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
ba6edd56
Unverified
Commit
ba6edd56
authored
Mar 30, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
cleanup
parent
850671b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
36 deletions
+14
-36
include/nlohmann/detail/input/parser.hpp
include/nlohmann/detail/input/parser.hpp
+7
-18
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+7
-18
No files found.
include/nlohmann/detail/input/parser.hpp
View file @
ba6edd56
...
@@ -182,11 +182,8 @@ class parser
...
@@ -182,11 +182,8 @@ class parser
return
false
;
return
false
;
}
}
// read next token
get_token
();
// closing } -> we are done
// closing } -> we are done
if
(
last_token
==
token_type
::
end_object
)
if
(
get_token
()
==
token_type
::
end_object
)
{
{
if
(
JSON_UNLIKELY
(
not
sax
->
end_object
()))
if
(
JSON_UNLIKELY
(
not
sax
->
end_object
()))
{
{
...
@@ -211,8 +208,7 @@ class parser
...
@@ -211,8 +208,7 @@ class parser
}
}
// parse separator (:)
// parse separator (:)
get_token
();
if
(
JSON_UNLIKELY
(
get_token
()
!=
token_type
::
name_separator
))
if
(
JSON_UNLIKELY
(
last_token
!=
token_type
::
name_separator
))
{
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
m_lexer
.
get_token_string
(),
...
@@ -234,11 +230,8 @@ class parser
...
@@ -234,11 +230,8 @@ class parser
return
false
;
return
false
;
}
}
// read next token
get_token
();
// closing ] -> we are done
// closing ] -> we are done
if
(
last_token
==
token_type
::
end_array
)
if
(
get_token
()
==
token_type
::
end_array
)
{
{
if
(
JSON_UNLIKELY
(
not
sax
->
end_array
()))
if
(
JSON_UNLIKELY
(
not
sax
->
end_array
()))
{
{
...
@@ -357,11 +350,10 @@ class parser
...
@@ -357,11 +350,10 @@ class parser
}
}
else
else
{
{
get_token
();
if
(
states
.
back
())
// array
if
(
states
.
back
())
// array
{
{
// comma -> next value
// comma -> next value
if
(
last_token
==
token_type
::
value_separator
)
if
(
get_token
()
==
token_type
::
value_separator
)
{
{
// parse a new value
// parse a new value
get_token
();
get_token
();
...
@@ -395,12 +387,10 @@ class parser
...
@@ -395,12 +387,10 @@ class parser
else
// object
else
// object
{
{
// comma -> next value
// comma -> next value
if
(
last_token
==
token_type
::
value_separator
)
if
(
get_token
()
==
token_type
::
value_separator
)
{
{
get_token
();
// parse key
// parse key
if
(
JSON_UNLIKELY
(
last_token
!=
token_type
::
value_string
))
if
(
JSON_UNLIKELY
(
get_token
()
!=
token_type
::
value_string
))
{
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
m_lexer
.
get_token_string
(),
...
@@ -415,8 +405,7 @@ class parser
...
@@ -415,8 +405,7 @@ class parser
}
}
// parse separator (:)
// parse separator (:)
get_token
();
if
(
JSON_UNLIKELY
(
get_token
()
!=
token_type
::
name_separator
))
if
(
JSON_UNLIKELY
(
last_token
!=
token_type
::
name_separator
))
{
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
m_lexer
.
get_token_string
(),
...
...
single_include/nlohmann/json.hpp
View file @
ba6edd56
...
@@ -3975,11 +3975,8 @@ class parser
...
@@ -3975,11 +3975,8 @@ class parser
return
false
;
return
false
;
}
}
// read next token
get_token
();
// closing } -> we are done
// closing } -> we are done
if
(
last_token
==
token_type
::
end_object
)
if
(
get_token
()
==
token_type
::
end_object
)
{
{
if
(
JSON_UNLIKELY
(
not
sax
->
end_object
()))
if
(
JSON_UNLIKELY
(
not
sax
->
end_object
()))
{
{
...
@@ -4004,8 +4001,7 @@ class parser
...
@@ -4004,8 +4001,7 @@ class parser
}
}
// parse separator (:)
// parse separator (:)
get_token
();
if
(
JSON_UNLIKELY
(
get_token
()
!=
token_type
::
name_separator
))
if
(
JSON_UNLIKELY
(
last_token
!=
token_type
::
name_separator
))
{
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
m_lexer
.
get_token_string
(),
...
@@ -4027,11 +4023,8 @@ class parser
...
@@ -4027,11 +4023,8 @@ class parser
return
false
;
return
false
;
}
}
// read next token
get_token
();
// closing ] -> we are done
// closing ] -> we are done
if
(
last_token
==
token_type
::
end_array
)
if
(
get_token
()
==
token_type
::
end_array
)
{
{
if
(
JSON_UNLIKELY
(
not
sax
->
end_array
()))
if
(
JSON_UNLIKELY
(
not
sax
->
end_array
()))
{
{
...
@@ -4150,11 +4143,10 @@ class parser
...
@@ -4150,11 +4143,10 @@ class parser
}
}
else
else
{
{
get_token
();
if
(
states
.
back
())
// array
if
(
states
.
back
())
// array
{
{
// comma -> next value
// comma -> next value
if
(
last_token
==
token_type
::
value_separator
)
if
(
get_token
()
==
token_type
::
value_separator
)
{
{
// parse a new value
// parse a new value
get_token
();
get_token
();
...
@@ -4188,12 +4180,10 @@ class parser
...
@@ -4188,12 +4180,10 @@ class parser
else
// object
else
// object
{
{
// comma -> next value
// comma -> next value
if
(
last_token
==
token_type
::
value_separator
)
if
(
get_token
()
==
token_type
::
value_separator
)
{
{
get_token
();
// parse key
// parse key
if
(
JSON_UNLIKELY
(
last_token
!=
token_type
::
value_string
))
if
(
JSON_UNLIKELY
(
get_token
()
!=
token_type
::
value_string
))
{
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
m_lexer
.
get_token_string
(),
...
@@ -4208,8 +4198,7 @@ class parser
...
@@ -4208,8 +4198,7 @@ class parser
}
}
// parse separator (:)
// parse separator (:)
get_token
();
if
(
JSON_UNLIKELY
(
get_token
()
!=
token_type
::
name_separator
))
if
(
JSON_UNLIKELY
(
last_token
!=
token_type
::
name_separator
))
{
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
m_lexer
.
get_token_string
(),
...
...
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