fixed string definition
This commit is contained in:
parent
1f381d496d
commit
2b4e461702
3 changed files with 8 additions and 21 deletions
23
src/json.hpp
23
src/json.hpp
|
@ -3630,8 +3630,8 @@ class basic_json
|
||||||
unsigned int yyaccept = 0;
|
unsigned int yyaccept = 0;
|
||||||
static const unsigned char yybm[] =
|
static const unsigned char yybm[] =
|
||||||
{
|
{
|
||||||
0, 64, 64, 64, 64, 64, 64, 64,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
64, 32, 32, 64, 64, 32, 64, 64,
|
0, 32, 32, 0, 0, 32, 0, 0,
|
||||||
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,
|
||||||
96, 64, 0, 64, 64, 64, 64, 64,
|
96, 64, 0, 64, 64, 64, 64, 64,
|
||||||
|
@ -3914,26 +3914,11 @@ basic_json_parser_25:
|
||||||
basic_json_parser_26:
|
basic_json_parser_26:
|
||||||
yyaccept = 0;
|
yyaccept = 0;
|
||||||
yych = *(m_marker = ++m_cursor);
|
yych = *(m_marker = ++m_cursor);
|
||||||
if (yych <= '\n')
|
if (yych <= 0x0F)
|
||||||
{
|
|
||||||
if (yych <= 0x00)
|
|
||||||
{
|
|
||||||
goto basic_json_parser_19;
|
|
||||||
}
|
|
||||||
if (yych <= 0x08)
|
|
||||||
{
|
|
||||||
goto basic_json_parser_31;
|
|
||||||
}
|
|
||||||
goto basic_json_parser_19;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (yych == '\r')
|
|
||||||
{
|
{
|
||||||
goto basic_json_parser_19;
|
goto basic_json_parser_19;
|
||||||
}
|
}
|
||||||
goto basic_json_parser_31;
|
goto basic_json_parser_31;
|
||||||
}
|
|
||||||
basic_json_parser_27:
|
basic_json_parser_27:
|
||||||
++m_cursor;
|
++m_cursor;
|
||||||
{
|
{
|
||||||
|
@ -3954,7 +3939,7 @@ basic_json_parser_31:
|
||||||
{
|
{
|
||||||
goto basic_json_parser_30;
|
goto basic_json_parser_30;
|
||||||
}
|
}
|
||||||
if (yych <= '\r')
|
if (yych <= 0x0F)
|
||||||
{
|
{
|
||||||
goto basic_json_parser_32;
|
goto basic_json_parser_32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3669,7 +3669,7 @@ class basic_json
|
||||||
// string
|
// string
|
||||||
quotation_mark = [\"];
|
quotation_mark = [\"];
|
||||||
escape = [\\];
|
escape = [\\];
|
||||||
unescaped = [^\"\\\000\t\n\r];
|
unescaped = [^\"\\\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F];
|
||||||
single_escaped = [\"\\/bfnrt];
|
single_escaped = [\"\\/bfnrt];
|
||||||
unicode_escaped = [u][0-9a-fA-F]{4};
|
unicode_escaped = [u][0-9a-fA-F]{4};
|
||||||
escaped = escape (single_escaped | unicode_escaped);
|
escaped = escape (single_escaped | unicode_escaped);
|
||||||
|
|
|
@ -7384,6 +7384,8 @@ TEST_CASE("parser class")
|
||||||
// error: newline in string
|
// error: newline in string
|
||||||
CHECK_THROWS_AS(json::parser("\"\n\"").parse(), std::invalid_argument);
|
CHECK_THROWS_AS(json::parser("\"\n\"").parse(), std::invalid_argument);
|
||||||
CHECK_THROWS_AS(json::parser("\"\r\"").parse(), std::invalid_argument);
|
CHECK_THROWS_AS(json::parser("\"\r\"").parse(), std::invalid_argument);
|
||||||
|
// error: backspace in string
|
||||||
|
CHECK_THROWS_AS(json::parser("\"\b\"").parse(), std::invalid_argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("escaped")
|
SECTION("escaped")
|
||||||
|
|
Loading…
Reference in a new issue