cleanup after PR #189

This commit is contained in:
Niels 2016-01-24 11:00:54 +01:00
parent 21a44da89d
commit 600ad330c5
4 changed files with 755 additions and 351 deletions

View file

@ -388,6 +388,7 @@ I deeply appreciate the help of the following people.
- [406345](https://github.com/406345) fixed two small warnings. - [406345](https://github.com/406345) fixed two small warnings.
- [Glen Fernandes](https://github.com/glenfe) noted a potential portability problem in the `has_mapped_type` function. - [Glen Fernandes](https://github.com/glenfe) noted a potential portability problem in the `has_mapped_type` function.
- [Corbin Hughes](https://github.com/nibroc) fixed some typos in the contribution guidelines. - [Corbin Hughes](https://github.com/nibroc) fixed some typos in the contribution guidelines.
- [twelsby](https://github.com/twelsby) fixed the array subscript operator.
Thanks a lot for helping out! Thanks a lot for helping out!
@ -404,7 +405,7 @@ $ make
$ ./json_unit "*" $ ./json_unit "*"
=============================================================================== ===============================================================================
All tests passed (3343239 assertions in 28 test cases) All tests passed (3343318 assertions in 29 test cases)
``` ```
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml). For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).

View file

@ -2671,14 +2671,14 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
template<typename ValueType, typename template < typename ValueType, typename
std::enable_if< std::enable_if <
not std::is_pointer<ValueType>::value not std::is_pointer<ValueType>::value
and not std::is_same<ValueType, typename string_t::value_type>::value and not std::is_same<ValueType, typename string_t::value_type>::value
#ifndef _MSC_VER // Fix for issue #167 operator<< abiguity under VS2015 #ifndef _MSC_VER // Fix for issue #167 operator<< abiguity under VS2015
and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
#endif #endif
, int>::type = 0> , int >::type = 0 >
operator ValueType() const operator ValueType() const
{ {
// delegate the call to get<>() const // delegate the call to get<>() const
@ -3081,7 +3081,7 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
template<typename T, std::size_t n> template<typename T, std::size_t n>
reference operator[](T* (&key)[n]) reference operator[](T * (&key)[n])
{ {
return operator[](static_cast<const T>(key)); return operator[](static_cast<const T>(key));
} }
@ -3116,7 +3116,7 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
template<typename T, std::size_t n> template<typename T, std::size_t n>
const_reference operator[](T* (&key)[n]) const const_reference operator[](T * (&key)[n]) const
{ {
return operator[](static_cast<const T>(key)); return operator[](static_cast<const T>(key));
} }
@ -6815,7 +6815,8 @@ class basic_json
{ {
lexer_char_t yych; lexer_char_t yych;
unsigned int yyaccept = 0; unsigned int yyaccept = 0;
static const unsigned char yybm[] = { static const unsigned char yybm[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 32, 32, 0, 0, 32, 0, 0, 0, 32, 32, 0, 0, 32, 0, 0,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@ -6849,56 +6850,140 @@ class basic_json
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
}; };
if ((m_limit - m_cursor) < 5) yyfill(); // LCOV_EXCL_LINE; if ((m_limit - m_cursor) < 5)
yych = *m_cursor; {
if (yych <= ':') { yyfill(); // LCOV_EXCL_LINE;
if (yych <= ' ') {
if (yych <= '\n') {
if (yych <= 0x00) goto basic_json_parser_28;
if (yych <= 0x08) goto basic_json_parser_30;
if (yych >= '\n') goto basic_json_parser_4;
} else {
if (yych == '\r') goto basic_json_parser_2;
if (yych <= 0x1F) goto basic_json_parser_30;
} }
} else { yych = *m_cursor;
if (yych <= ',') { if (yych <= ':')
if (yych == '"') goto basic_json_parser_27; {
if (yych <= '+') goto basic_json_parser_30; if (yych <= ' ')
goto basic_json_parser_16; {
} else { if (yych <= '\n')
if (yych <= '/') { {
if (yych <= '-') goto basic_json_parser_23; if (yych <= 0x00)
{
goto basic_json_parser_28;
}
if (yych <= 0x08)
{
goto basic_json_parser_30; goto basic_json_parser_30;
} else { }
if (yych <= '0') goto basic_json_parser_24; if (yych >= '\n')
if (yych <= '9') goto basic_json_parser_26; {
goto basic_json_parser_4;
}
}
else
{
if (yych == '\r')
{
goto basic_json_parser_2;
}
if (yych <= 0x1F)
{
goto basic_json_parser_30;
}
}
}
else
{
if (yych <= ',')
{
if (yych == '"')
{
goto basic_json_parser_27;
}
if (yych <= '+')
{
goto basic_json_parser_30;
}
goto basic_json_parser_16;
}
else
{
if (yych <= '/')
{
if (yych <= '-')
{
goto basic_json_parser_23;
}
goto basic_json_parser_30;
}
else
{
if (yych <= '0')
{
goto basic_json_parser_24;
}
if (yych <= '9')
{
goto basic_json_parser_26;
}
goto basic_json_parser_18; goto basic_json_parser_18;
} }
} }
} }
} else { }
if (yych <= 'n') { else
if (yych <= ']') { {
if (yych == '[') goto basic_json_parser_8; if (yych <= 'n')
if (yych <= '\\') goto basic_json_parser_30; {
if (yych <= ']')
{
if (yych == '[')
{
goto basic_json_parser_8;
}
if (yych <= '\\')
{
goto basic_json_parser_30;
}
goto basic_json_parser_10; goto basic_json_parser_10;
} else { }
if (yych == 'f') goto basic_json_parser_22; else
if (yych <= 'm') goto basic_json_parser_30; {
if (yych == 'f')
{
goto basic_json_parser_22;
}
if (yych <= 'm')
{
goto basic_json_parser_30;
}
goto basic_json_parser_20; goto basic_json_parser_20;
} }
} else { }
if (yych <= '{') { else
if (yych == 't') goto basic_json_parser_21; {
if (yych <= 'z') goto basic_json_parser_30; if (yych <= '{')
{
if (yych == 't')
{
goto basic_json_parser_21;
}
if (yych <= 'z')
{
goto basic_json_parser_30;
}
goto basic_json_parser_12; goto basic_json_parser_12;
} else { }
if (yych <= '}') { else
if (yych <= '|') goto basic_json_parser_30; {
if (yych <= '}')
{
if (yych <= '|')
{
goto basic_json_parser_30;
}
goto basic_json_parser_14; goto basic_json_parser_14;
} else { }
if (yych == 0xEF) goto basic_json_parser_6; else
{
if (yych == 0xEF)
{
goto basic_json_parser_6;
}
goto basic_json_parser_30; goto basic_json_parser_30;
} }
} }
@ -6909,72 +6994,127 @@ basic_json_parser_2:
yych = *m_cursor; yych = *m_cursor;
goto basic_json_parser_5; goto basic_json_parser_5;
basic_json_parser_3: basic_json_parser_3:
{ return scan(); } {
return scan();
}
basic_json_parser_4: basic_json_parser_4:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
basic_json_parser_5: basic_json_parser_5:
if (yybm[0+yych] & 32) { if (yybm[0 + yych] & 32)
{
goto basic_json_parser_4; goto basic_json_parser_4;
} }
goto basic_json_parser_3; goto basic_json_parser_3;
basic_json_parser_6: basic_json_parser_6:
yyaccept = 0; yyaccept = 0;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
if (yych == 0xBB) goto basic_json_parser_64; if (yych == 0xBB)
{
goto basic_json_parser_64;
}
basic_json_parser_7: basic_json_parser_7:
{ return token_type::parse_error; } {
return token_type::parse_error;
}
basic_json_parser_8: basic_json_parser_8:
++m_cursor; ++m_cursor;
{ return token_type::begin_array; } {
return token_type::begin_array;
}
basic_json_parser_10: basic_json_parser_10:
++m_cursor; ++m_cursor;
{ return token_type::end_array; } {
return token_type::end_array;
}
basic_json_parser_12: basic_json_parser_12:
++m_cursor; ++m_cursor;
{ return token_type::begin_object; } {
return token_type::begin_object;
}
basic_json_parser_14: basic_json_parser_14:
++m_cursor; ++m_cursor;
{ return token_type::end_object; } {
return token_type::end_object;
}
basic_json_parser_16: basic_json_parser_16:
++m_cursor; ++m_cursor;
{ return token_type::value_separator; } {
return token_type::value_separator;
}
basic_json_parser_18: basic_json_parser_18:
++m_cursor; ++m_cursor;
{ return token_type::name_separator; } {
return token_type::name_separator;
}
basic_json_parser_20: basic_json_parser_20:
yyaccept = 0; yyaccept = 0;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
if (yych == 'u') goto basic_json_parser_60; if (yych == 'u')
{
goto basic_json_parser_60;
}
goto basic_json_parser_7; goto basic_json_parser_7;
basic_json_parser_21: basic_json_parser_21:
yyaccept = 0; yyaccept = 0;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
if (yych == 'r') goto basic_json_parser_56; if (yych == 'r')
{
goto basic_json_parser_56;
}
goto basic_json_parser_7; goto basic_json_parser_7;
basic_json_parser_22: basic_json_parser_22:
yyaccept = 0; yyaccept = 0;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
if (yych == 'a') goto basic_json_parser_51; if (yych == 'a')
{
goto basic_json_parser_51;
}
goto basic_json_parser_7; goto basic_json_parser_7;
basic_json_parser_23: basic_json_parser_23:
yych = *++m_cursor; yych = *++m_cursor;
if (yych <= '/') goto basic_json_parser_7; if (yych <= '/')
if (yych <= '0') goto basic_json_parser_50; {
if (yych <= '9') goto basic_json_parser_41; goto basic_json_parser_7;
}
if (yych <= '0')
{
goto basic_json_parser_50;
}
if (yych <= '9')
{
goto basic_json_parser_41;
}
goto basic_json_parser_7; goto basic_json_parser_7;
basic_json_parser_24: basic_json_parser_24:
yyaccept = 1; yyaccept = 1;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
if (yych <= 'D') { if (yych <= 'D')
if (yych == '.') goto basic_json_parser_43; {
} else { if (yych == '.')
if (yych <= 'E') goto basic_json_parser_44; {
if (yych == 'e') goto basic_json_parser_44; goto basic_json_parser_43;
}
}
else
{
if (yych <= 'E')
{
goto basic_json_parser_44;
}
if (yych == 'e')
{
goto basic_json_parser_44;
}
} }
basic_json_parser_25: basic_json_parser_25:
{ return token_type::value_number; } {
return token_type::value_number;
}
basic_json_parser_26: basic_json_parser_26:
yyaccept = 1; yyaccept = 1;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
@ -6982,214 +7122,477 @@ basic_json_parser_26:
basic_json_parser_27: basic_json_parser_27:
yyaccept = 0; yyaccept = 0;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
if (yych <= 0x0F) goto basic_json_parser_7; if (yych <= 0x0F)
{
goto basic_json_parser_7;
}
goto basic_json_parser_32; goto basic_json_parser_32;
basic_json_parser_28: basic_json_parser_28:
++m_cursor; ++m_cursor;
{ return token_type::end_of_input; } {
return token_type::end_of_input;
}
basic_json_parser_30: basic_json_parser_30:
yych = *++m_cursor; yych = *++m_cursor;
goto basic_json_parser_7; goto basic_json_parser_7;
basic_json_parser_31: basic_json_parser_31:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
basic_json_parser_32: basic_json_parser_32:
if (yybm[0+yych] & 64) { if (yybm[0 + yych] & 64)
{
goto basic_json_parser_31; goto basic_json_parser_31;
} }
if (yych <= 0x0F) goto basic_json_parser_33; if (yych <= 0x0F)
if (yych <= '"') goto basic_json_parser_35; {
goto basic_json_parser_33;
}
if (yych <= '"')
{
goto basic_json_parser_35;
}
goto basic_json_parser_34; goto basic_json_parser_34;
basic_json_parser_33: basic_json_parser_33:
m_cursor = m_marker; m_cursor = m_marker;
if (yyaccept == 0) { if (yyaccept == 0)
{
goto basic_json_parser_7; goto basic_json_parser_7;
} else { }
else
{
goto basic_json_parser_25; goto basic_json_parser_25;
} }
basic_json_parser_34: basic_json_parser_34:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
if (yych <= 'e') { if (yych <= 'e')
if (yych <= '/') { {
if (yych == '"') goto basic_json_parser_31; if (yych <= '/')
if (yych <= '.') goto basic_json_parser_33; {
if (yych == '"')
{
goto basic_json_parser_31; goto basic_json_parser_31;
} else { }
if (yych <= '\\') { if (yych <= '.')
if (yych <= '[') goto basic_json_parser_33; {
goto basic_json_parser_33;
}
goto basic_json_parser_31; goto basic_json_parser_31;
} else { }
if (yych == 'b') goto basic_json_parser_31; else
{
if (yych <= '\\')
{
if (yych <= '[')
{
goto basic_json_parser_33;
}
goto basic_json_parser_31;
}
else
{
if (yych == 'b')
{
goto basic_json_parser_31;
}
goto basic_json_parser_33; goto basic_json_parser_33;
} }
} }
} else { }
if (yych <= 'q') { else
if (yych <= 'f') goto basic_json_parser_31; {
if (yych == 'n') goto basic_json_parser_31; if (yych <= 'q')
{
if (yych <= 'f')
{
goto basic_json_parser_31;
}
if (yych == 'n')
{
goto basic_json_parser_31;
}
goto basic_json_parser_33; goto basic_json_parser_33;
} else { }
if (yych <= 's') { else
if (yych <= 'r') goto basic_json_parser_31; {
if (yych <= 's')
{
if (yych <= 'r')
{
goto basic_json_parser_31;
}
goto basic_json_parser_33; goto basic_json_parser_33;
} else { }
if (yych <= 't') goto basic_json_parser_31; else
if (yych <= 'u') goto basic_json_parser_37; {
if (yych <= 't')
{
goto basic_json_parser_31;
}
if (yych <= 'u')
{
goto basic_json_parser_37;
}
goto basic_json_parser_33; goto basic_json_parser_33;
} }
} }
} }
basic_json_parser_35: basic_json_parser_35:
++m_cursor; ++m_cursor;
{ return token_type::value_string; } {
return token_type::value_string;
}
basic_json_parser_37: basic_json_parser_37:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
if (yych <= '@') { if (yych <= '@')
if (yych <= '/') goto basic_json_parser_33; {
if (yych >= ':') goto basic_json_parser_33; if (yych <= '/')
} else { {
if (yych <= 'F') goto basic_json_parser_38; goto basic_json_parser_33;
if (yych <= '`') goto basic_json_parser_33; }
if (yych >= 'g') goto basic_json_parser_33; if (yych >= ':')
{
goto basic_json_parser_33;
}
}
else
{
if (yych <= 'F')
{
goto basic_json_parser_38;
}
if (yych <= '`')
{
goto basic_json_parser_33;
}
if (yych >= 'g')
{
goto basic_json_parser_33;
}
} }
basic_json_parser_38: basic_json_parser_38:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
if (yych <= '@') { if (yych <= '@')
if (yych <= '/') goto basic_json_parser_33; {
if (yych >= ':') goto basic_json_parser_33; if (yych <= '/')
} else { {
if (yych <= 'F') goto basic_json_parser_39; goto basic_json_parser_33;
if (yych <= '`') goto basic_json_parser_33; }
if (yych >= 'g') goto basic_json_parser_33; if (yych >= ':')
{
goto basic_json_parser_33;
}
}
else
{
if (yych <= 'F')
{
goto basic_json_parser_39;
}
if (yych <= '`')
{
goto basic_json_parser_33;
}
if (yych >= 'g')
{
goto basic_json_parser_33;
}
} }
basic_json_parser_39: basic_json_parser_39:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
if (yych <= '@') { if (yych <= '@')
if (yych <= '/') goto basic_json_parser_33; {
if (yych >= ':') goto basic_json_parser_33; if (yych <= '/')
} else { {
if (yych <= 'F') goto basic_json_parser_40; goto basic_json_parser_33;
if (yych <= '`') goto basic_json_parser_33; }
if (yych >= 'g') goto basic_json_parser_33; if (yych >= ':')
{
goto basic_json_parser_33;
}
}
else
{
if (yych <= 'F')
{
goto basic_json_parser_40;
}
if (yych <= '`')
{
goto basic_json_parser_33;
}
if (yych >= 'g')
{
goto basic_json_parser_33;
}
} }
basic_json_parser_40: basic_json_parser_40:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
if (yych <= '@') { if (yych <= '@')
if (yych <= '/') goto basic_json_parser_33; {
if (yych <= '9') goto basic_json_parser_31; if (yych <= '/')
{
goto basic_json_parser_33; goto basic_json_parser_33;
} else { }
if (yych <= 'F') goto basic_json_parser_31; if (yych <= '9')
if (yych <= '`') goto basic_json_parser_33; {
if (yych <= 'f') goto basic_json_parser_31; goto basic_json_parser_31;
}
goto basic_json_parser_33;
}
else
{
if (yych <= 'F')
{
goto basic_json_parser_31;
}
if (yych <= '`')
{
goto basic_json_parser_33;
}
if (yych <= 'f')
{
goto basic_json_parser_31;
}
goto basic_json_parser_33; goto basic_json_parser_33;
} }
basic_json_parser_41: basic_json_parser_41:
yyaccept = 1; yyaccept = 1;
m_marker = ++m_cursor; m_marker = ++m_cursor;
if ((m_limit - m_cursor) < 3) yyfill(); // LCOV_EXCL_LINE; if ((m_limit - m_cursor) < 3)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
basic_json_parser_42: basic_json_parser_42:
if (yybm[0+yych] & 128) { if (yybm[0 + yych] & 128)
{
goto basic_json_parser_41; goto basic_json_parser_41;
} }
if (yych <= 'D') { if (yych <= 'D')
if (yych != '.') goto basic_json_parser_25; {
} else { if (yych != '.')
if (yych <= 'E') goto basic_json_parser_44; {
if (yych == 'e') goto basic_json_parser_44; goto basic_json_parser_25;
}
}
else
{
if (yych <= 'E')
{
goto basic_json_parser_44;
}
if (yych == 'e')
{
goto basic_json_parser_44;
}
goto basic_json_parser_25; goto basic_json_parser_25;
} }
basic_json_parser_43: basic_json_parser_43:
yych = *++m_cursor; yych = *++m_cursor;
if (yych <= '/') goto basic_json_parser_33; if (yych <= '/')
if (yych <= '9') goto basic_json_parser_48; {
goto basic_json_parser_33;
}
if (yych <= '9')
{
goto basic_json_parser_48;
}
goto basic_json_parser_33; goto basic_json_parser_33;
basic_json_parser_44: basic_json_parser_44:
yych = *++m_cursor; yych = *++m_cursor;
if (yych <= ',') { if (yych <= ',')
if (yych != '+') goto basic_json_parser_33; {
} else { if (yych != '+')
if (yych <= '-') goto basic_json_parser_45; {
if (yych <= '/') goto basic_json_parser_33; goto basic_json_parser_33;
if (yych <= '9') goto basic_json_parser_46; }
}
else
{
if (yych <= '-')
{
goto basic_json_parser_45;
}
if (yych <= '/')
{
goto basic_json_parser_33;
}
if (yych <= '9')
{
goto basic_json_parser_46;
}
goto basic_json_parser_33; goto basic_json_parser_33;
} }
basic_json_parser_45: basic_json_parser_45:
yych = *++m_cursor; yych = *++m_cursor;
if (yych <= '/') goto basic_json_parser_33; if (yych <= '/')
if (yych >= ':') goto basic_json_parser_33; {
goto basic_json_parser_33;
}
if (yych >= ':')
{
goto basic_json_parser_33;
}
basic_json_parser_46: basic_json_parser_46:
++m_cursor; ++m_cursor;
if (m_limit <= m_cursor) yyfill(); // LCOV_EXCL_LINE; if (m_limit <= m_cursor)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
if (yych <= '/') goto basic_json_parser_25; if (yych <= '/')
if (yych <= '9') goto basic_json_parser_46; {
goto basic_json_parser_25;
}
if (yych <= '9')
{
goto basic_json_parser_46;
}
goto basic_json_parser_25; goto basic_json_parser_25;
basic_json_parser_48: basic_json_parser_48:
yyaccept = 1; yyaccept = 1;
m_marker = ++m_cursor; m_marker = ++m_cursor;
if ((m_limit - m_cursor) < 3) yyfill(); // LCOV_EXCL_LINE; if ((m_limit - m_cursor) < 3)
{
yyfill(); // LCOV_EXCL_LINE;
}
yych = *m_cursor; yych = *m_cursor;
if (yych <= 'D') { if (yych <= 'D')
if (yych <= '/') goto basic_json_parser_25; {
if (yych <= '9') goto basic_json_parser_48; if (yych <= '/')
{
goto basic_json_parser_25; goto basic_json_parser_25;
} else { }
if (yych <= 'E') goto basic_json_parser_44; if (yych <= '9')
if (yych == 'e') goto basic_json_parser_44; {
goto basic_json_parser_48;
}
goto basic_json_parser_25;
}
else
{
if (yych <= 'E')
{
goto basic_json_parser_44;
}
if (yych == 'e')
{
goto basic_json_parser_44;
}
goto basic_json_parser_25; goto basic_json_parser_25;
} }
basic_json_parser_50: basic_json_parser_50:
yyaccept = 1; yyaccept = 1;
yych = *(m_marker = ++m_cursor); yych = *(m_marker = ++m_cursor);
if (yych <= 'D') { if (yych <= 'D')
if (yych == '.') goto basic_json_parser_43; {
if (yych == '.')
{
goto basic_json_parser_43;
}
goto basic_json_parser_25; goto basic_json_parser_25;
} else { }
if (yych <= 'E') goto basic_json_parser_44; else
if (yych == 'e') goto basic_json_parser_44; {
if (yych <= 'E')
{
goto basic_json_parser_44;
}
if (yych == 'e')
{
goto basic_json_parser_44;
}
goto basic_json_parser_25; goto basic_json_parser_25;
} }
basic_json_parser_51: basic_json_parser_51:
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 'l') goto basic_json_parser_33; if (yych != 'l')
{
goto basic_json_parser_33;
}
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 's') goto basic_json_parser_33; if (yych != 's')
{
goto basic_json_parser_33;
}
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 'e') goto basic_json_parser_33; if (yych != 'e')
{
goto basic_json_parser_33;
}
++m_cursor; ++m_cursor;
{ return token_type::literal_false; } {
return token_type::literal_false;
}
basic_json_parser_56: basic_json_parser_56:
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 'u') goto basic_json_parser_33; if (yych != 'u')
{
goto basic_json_parser_33;
}
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 'e') goto basic_json_parser_33; if (yych != 'e')
{
goto basic_json_parser_33;
}
++m_cursor; ++m_cursor;
{ return token_type::literal_true; } {
return token_type::literal_true;
}
basic_json_parser_60: basic_json_parser_60:
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 'l') goto basic_json_parser_33; if (yych != 'l')
{
goto basic_json_parser_33;
}
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 'l') goto basic_json_parser_33; if (yych != 'l')
{
goto basic_json_parser_33;
}
++m_cursor; ++m_cursor;
{ return token_type::literal_null; } {
return token_type::literal_null;
}
basic_json_parser_64: basic_json_parser_64:
yych = *++m_cursor; yych = *++m_cursor;
if (yych != 0xBF) goto basic_json_parser_33; if (yych != 0xBF)
{
goto basic_json_parser_33;
}
++m_cursor; ++m_cursor;
{ return scan(); } {
return scan();
}
} }

View file

@ -2671,14 +2671,14 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
template<typename ValueType, typename template < typename ValueType, typename
std::enable_if< std::enable_if <
not std::is_pointer<ValueType>::value not std::is_pointer<ValueType>::value
and not std::is_same<ValueType, typename string_t::value_type>::value and not std::is_same<ValueType, typename string_t::value_type>::value
#ifndef _MSC_VER // Fix for issue #167 operator<< abiguity under VS2015 #ifndef _MSC_VER // Fix for issue #167 operator<< abiguity under VS2015
and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
#endif #endif
, int>::type = 0> , int >::type = 0 >
operator ValueType() const operator ValueType() const
{ {
// delegate the call to get<>() const // delegate the call to get<>() const
@ -3081,7 +3081,7 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
template<typename T, std::size_t n> template<typename T, std::size_t n>
reference operator[](T* (&key)[n]) reference operator[](T * (&key)[n])
{ {
return operator[](static_cast<const T>(key)); return operator[](static_cast<const T>(key));
} }
@ -3116,7 +3116,7 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
template<typename T, std::size_t n> template<typename T, std::size_t n>
const_reference operator[](T* (&key)[n]) const const_reference operator[](T * (&key)[n]) const
{ {
return operator[](static_cast<const T>(key)); return operator[](static_cast<const T>(key));
} }

View file

@ -11500,12 +11500,12 @@ TEST_CASE("regression tests")
CHECK(s2 == "value"); CHECK(s2 == "value");
} }
SECTION("character following a surrogate pair is skipped") SECTION("issue #146 - character following a surrogate pair is skipped")
{ {
CHECK(json::parse("\"\\ud80c\\udc60abc\"").get<json::string_t>() == u8"\U00013060abc"); CHECK(json::parse("\"\\ud80c\\udc60abc\"").get<json::string_t>() == u8"\U00013060abc");
} }
SECTION("issue #144 - Cannot index by key of type static constexpr const char*") SECTION("issue #171 - Cannot index by key of type static constexpr const char*")
{ {
json j; json j;
@ -11521,12 +11521,12 @@ TEST_CASE("regression tests")
// Non-const access with key as "char *" // Non-const access with key as "char *"
char _ptr_key[] = "Key3"; char _ptr_key[] = "Key3";
char * ptr_key = &_ptr_key[0]; char* ptr_key = &_ptr_key[0];
CHECK_NOTHROW(j[ptr_key] = 3); CHECK_NOTHROW(j[ptr_key] = 3);
CHECK(j[ptr_key] == json(3)); CHECK(j[ptr_key] == json(3));
// Non-const access with key as "const char *" // Non-const access with key as "const char *"
const char * const_ptr_key = "Key4"; const char* const_ptr_key = "Key4";
CHECK_NOTHROW(j[const_ptr_key] = 4); CHECK_NOTHROW(j[const_ptr_key] = 4);
CHECK(j[const_ptr_key] == json(4)); CHECK(j[const_ptr_key] == json(4));