@@ -606,7 +606,7 @@ class GenericReader {
606
606
parseResult_.Clear ();
607
607
state_ = IterativeParsingStartState;
608
608
}
609
-
609
+
610
610
// ! Parse one token from JSON text
611
611
/* ! \tparam InputStream Type of input stream, implementing Stream concept
612
612
\tparam Handler Type of handler, implementing Handler concept.
@@ -618,23 +618,23 @@ class GenericReader {
618
618
bool IterativeParseNext (InputStream& is, Handler& handler) {
619
619
while (RAPIDJSON_LIKELY (is.Peek () != ' \0 ' )) {
620
620
SkipWhitespaceAndComments<parseFlags>(is);
621
-
621
+
622
622
Token t = Tokenize (is.Peek ());
623
623
IterativeParsingState n = Predict (state_, t);
624
624
IterativeParsingState d = Transit<parseFlags>(state_, t, n, is, handler);
625
-
625
+
626
626
// If we've finished or hit an error...
627
627
if (RAPIDJSON_UNLIKELY (IsIterativeParsingCompleteState (d))) {
628
628
// Report errors.
629
629
if (d == IterativeParsingErrorState) {
630
630
HandleError (state_, is);
631
631
return false ;
632
632
}
633
-
633
+
634
634
// Transition to the finish state.
635
635
RAPIDJSON_ASSERT (d == IterativeParsingFinishState);
636
636
state_ = d;
637
-
637
+
638
638
// If StopWhenDone is not set...
639
639
if (!(parseFlags & kParseStopWhenDoneFlag )) {
640
640
// ... and extra non-whitespace data is found...
@@ -645,30 +645,30 @@ class GenericReader {
645
645
return false ;
646
646
}
647
647
}
648
-
648
+
649
649
// Success! We are done!
650
650
return true ;
651
651
}
652
-
652
+
653
653
// Transition to the new state.
654
654
state_ = d;
655
655
656
656
// If we parsed anything other than a delimiter, we invoked the handler, so we can return true now.
657
657
if (!IsIterativeParsingDelimiterState (n))
658
658
return true ;
659
659
}
660
-
660
+
661
661
// We reached the end of file.
662
662
stack_.Clear ();
663
663
664
664
if (state_ != IterativeParsingFinishState) {
665
665
HandleError (state_, is);
666
666
return false ;
667
667
}
668
-
668
+
669
669
return true ;
670
670
}
671
-
671
+
672
672
// ! Check if token-by-token parsing JSON text is complete
673
673
/* ! \return Whether the JSON has been fully decoded.
674
674
*/
@@ -1523,7 +1523,7 @@ class GenericReader {
1523
1523
}
1524
1524
}
1525
1525
}
1526
-
1526
+
1527
1527
if (RAPIDJSON_UNLIKELY (!useNanOrInf)) {
1528
1528
RAPIDJSON_PARSE_ERROR (kParseErrorValueInvalid , s.Tell ());
1529
1529
}
@@ -1701,7 +1701,7 @@ class GenericReader {
1701
1701
d = internal::StrtodNormalPrecision (d, p);
1702
1702
1703
1703
// Use > max, instead of == inf, to fix bogus warning -Wfloat-equal
1704
- if (d > std::numeric_limits<double >::max ()) {
1704
+ if (d > ( std::numeric_limits<double >::max) ()) {
1705
1705
// Overflow
1706
1706
// TODO: internal::StrtodX should report overflow (or underflow)
1707
1707
RAPIDJSON_PARSE_ERROR (kParseErrorNumberTooBig , startOffset);
@@ -1769,12 +1769,12 @@ class GenericReader {
1769
1769
1770
1770
// Single value state
1771
1771
IterativeParsingValueState,
1772
-
1772
+
1773
1773
// Delimiter states (at bottom)
1774
1774
IterativeParsingElementDelimiterState,
1775
1775
IterativeParsingMemberDelimiterState,
1776
1776
IterativeParsingKeyValueDelimiterState,
1777
-
1777
+
1778
1778
cIterativeParsingStateCount
1779
1779
};
1780
1780
@@ -2167,43 +2167,43 @@ class GenericReader {
2167
2167
RAPIDJSON_FORCEINLINE bool IsIterativeParsingDelimiterState (IterativeParsingState s) const {
2168
2168
return s >= IterativeParsingElementDelimiterState;
2169
2169
}
2170
-
2170
+
2171
2171
RAPIDJSON_FORCEINLINE bool IsIterativeParsingCompleteState (IterativeParsingState s) const {
2172
2172
return s <= IterativeParsingErrorState;
2173
2173
}
2174
-
2174
+
2175
2175
template <unsigned parseFlags, typename InputStream, typename Handler>
2176
2176
ParseResult IterativeParse (InputStream& is, Handler& handler) {
2177
2177
parseResult_.Clear ();
2178
2178
ClearStackOnExit scope (*this );
2179
2179
IterativeParsingState state = IterativeParsingStartState;
2180
-
2180
+
2181
2181
SkipWhitespaceAndComments<parseFlags>(is);
2182
2182
RAPIDJSON_PARSE_ERROR_EARLY_RETURN (parseResult_);
2183
2183
while (is.Peek () != ' \0 ' ) {
2184
2184
Token t = Tokenize (is.Peek ());
2185
2185
IterativeParsingState n = Predict (state, t);
2186
2186
IterativeParsingState d = Transit<parseFlags>(state, t, n, is, handler);
2187
-
2187
+
2188
2188
if (d == IterativeParsingErrorState) {
2189
2189
HandleError (state, is);
2190
2190
break ;
2191
2191
}
2192
-
2192
+
2193
2193
state = d;
2194
-
2194
+
2195
2195
// Do not further consume streams if a root JSON has been parsed.
2196
2196
if ((parseFlags & kParseStopWhenDoneFlag ) && state == IterativeParsingFinishState)
2197
2197
break ;
2198
-
2198
+
2199
2199
SkipWhitespaceAndComments<parseFlags>(is);
2200
2200
RAPIDJSON_PARSE_ERROR_EARLY_RETURN (parseResult_);
2201
2201
}
2202
-
2202
+
2203
2203
// Handle the end of file.
2204
2204
if (state != IterativeParsingFinishState)
2205
2205
HandleError (state, is);
2206
-
2206
+
2207
2207
return parseResult_;
2208
2208
}
2209
2209
0 commit comments