Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
7b7a54ac
Commit
7b7a54ac
authored
Feb 11, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a bug
parent
032bcf64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
21 deletions
+28
-21
src/json.hpp
src/json.hpp
+9
-1
src/json.hpp.re2c
src/json.hpp.re2c
+1
-1
test/unit.cpp
test/unit.cpp
+18
-19
No files found.
src/json.hpp
View file @
7b7a54ac
...
...
@@ -2476,7 +2476,7 @@ class basic_json
unsigned
int
yyaccept
=
0
;
static
const
unsigned
char
yybm
[]
=
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
0
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
192
,
192
,
64
,
64
,
192
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
...
...
@@ -2650,6 +2650,10 @@ json_parser_7:
json_parser_8:
yyaccept
=
0
;
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
<=
0x00
)
{
goto
json_parser_6
;
}
goto
json_parser_53
;
json_parser_9:
++
m_cursor
;
...
...
@@ -2955,6 +2959,10 @@ json_parser_53:
{
goto
json_parser_52
;
}
if
(
yych
<=
0x00
)
{
goto
json_parser_29
;
}
if
(
yych
<=
'"'
)
{
goto
json_parser_55
;
...
...
src/json.hpp.re2c
View file @
7b7a54ac
...
...
@@ -2514,7 +2514,7 @@ class basic_json
// string
quotation_mark = [\"];
escape = [\\];
unescaped = [^\"\\];
unescaped = [^\"\\
\000
];
escaped = escape ([\"\\/bfnrt] | [u][0-9a-fA-F]{4});
char = unescaped | escaped;
string = quotation_mark char* quotation_mark;
...
...
test/unit.cpp
View file @
7b7a54ac
...
...
@@ -4044,7 +4044,7 @@ TEST_CASE("lexer class")
switch
(
c
)
{
//
characters that are prefixes of reasonable json
//
single characters that are valid tokens
case
(
'['
):
case
(
']'
):
case
(
'{'
):
...
...
@@ -4066,12 +4066,6 @@ TEST_CASE("lexer class")
break
;
}
case
(
'"'
):
{
// no idea what to do here
break
;
}
// whitespace
case
(
' '
):
case
(
'\t'
):
...
...
@@ -4199,32 +4193,37 @@ TEST_CASE("parser class")
SECTION
(
"parse errors"
)
{
// unexpected end of number
CHECK_THROWS_AS
(
json
::
parser
(
"0.A"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"-,"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"-A"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"0."
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"-"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"--"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"-0."
).
parse
(),
std
::
invalid_argument
);
// unexpected end of null
CHECK_THROWS_AS
(
json
::
parser
(
"n"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"n
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"nu
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"nul
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"n"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"nu"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"nul"
).
parse
(),
std
::
invalid_argument
);
// unexpected end of true
CHECK_THROWS_AS
(
json
::
parser
(
"t"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"t
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"tr
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"tru
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"t"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"tr"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"tru"
).
parse
(),
std
::
invalid_argument
);
// unexpected end of false
CHECK_THROWS_AS
(
json
::
parser
(
"f"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"fa
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"fal
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"fals
A
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"fa"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"fal"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"fals"
).
parse
(),
std
::
invalid_argument
);
// unexpected end of array
CHECK_THROWS_AS
(
json
::
parser
(
"[1,"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"[1,]"
).
parse
(),
std
::
invalid_argument
);
// unexpected end of object
CHECK_THROWS_AS
(
json
::
parser
(
"{"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"{
\"
foo
\"
"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"{
\"
foo
\"
:"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"{
\"
foo
\"
:}"
).
parse
(),
std
::
invalid_argument
);
CHECK_THROWS_AS
(
json
::
parser
(
"{
\"
foo
\"
:1,}"
).
parse
(),
std
::
invalid_argument
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment