Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
bf19c1a0
Commit
bf19c1a0
authored
Mar 13, 2017
by
John Stiles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove switch
GCC and Clang cannot agree on what constitutes a good switch statement.
parent
e7fd7076
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
39 deletions
+22
-39
lookaheadparser.cpp
example/lookaheadparser/lookaheadparser.cpp
+22
-39
No files found.
example/lookaheadparser/lookaheadparser.cpp
View file @
bf19c1a0
...
...
@@ -139,50 +139,33 @@ bool LookaheadParser::EnterArray() {
}
const
char
*
LookaheadParser
::
NextObjectKey
()
{
switch
(
st_
)
{
case
kHasKey
:
{
const
char
*
result
=
v_
.
GetString
();
ParseNext
();
return
result
;
}
case
kExitingObject
:
ParseNext
();
return
0
;
case
kError
:
case
kHasNull
:
case
kHasBool
:
case
kHasNumber
:
case
kHasString
:
case
kEnteringObject
:
case
kEnteringArray
:
case
kExitingArray
:
st_
=
kError
;
return
0
;
if
(
st_
==
kHasKey
)
{
const
char
*
result
=
v_
.
GetString
();
ParseNext
();
return
result
;
}
if
(
st_
==
kExitingObject
)
{
ParseNext
();
return
0
;
}
st_
=
kError
;
return
0
;
}
bool
LookaheadParser
::
NextArrayValue
()
{
switch
(
st_
)
{
case
kExitingArray
:
ParseNext
();
return
false
;
case
kError
:
case
kExitingObject
:
case
kHasKey
:
st_
=
kError
;
return
false
;
case
kHasNull
:
case
kHasBool
:
case
kHasNumber
:
case
kHasString
:
case
kEnteringObject
:
case
kEnteringArray
:
return
true
;
if
(
st_
==
kExitingArray
)
{
ParseNext
();
return
false
;
}
if
(
st_
==
kError
||
st_
==
kExitingObject
||
st_
==
kHasKey
)
{
st_
=
kError
;
return
false
;
}
return
true
;
}
int
LookaheadParser
::
GetInt
()
{
...
...
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