Improve coverage and performance

Further improvement to perftest and hoping to make coveralls happy.
This commit is contained in:
StilesCrisis 2017-02-03 18:58:37 -08:00
parent 5de7258478
commit 116f65994b

View File

@ -537,18 +537,17 @@ public:
IterativeParsingState n = Predict(state_, t); IterativeParsingState n = Predict(state_, t);
IterativeParsingState d = Transit<parseFlags>(state_, t, n, is, handler); IterativeParsingState d = Transit<parseFlags>(state_, t, n, is, handler);
if (d == IterativeParsingErrorState) { // If we've finished or hit an error...
HandleError(state_, is); if (IsIterativeParsingCompleteState(d)) {
return false; // Report errors.
} if (d == IterativeParsingErrorState) {
HandleError(state_, is);
state_ = d;
// Do not further consume streams if we've parsed a complete object or hit an error.
if (IsIterativeParsingCompleteState(state_)) {
// If we hit an error, we are done.
if (HasParseError())
return false; return false;
}
// Transition to the finish state.
RAPIDJSON_ASSERT(d == IterativeParsingFinishState);
state_ = d;
// If StopWhenDone is not set... // If StopWhenDone is not set...
if (!(parseFlags & kParseStopWhenDoneFlag)) { if (!(parseFlags & kParseStopWhenDoneFlag)) {
@ -561,11 +560,14 @@ public:
} }
} }
// We are done! // Success! We are done!
return true; return true;
} }
// If we found anything other than a delimiter, we invoked the handler, so we can return true now. // Transition to the new state.
state_ = d;
// If we parsed anything other than a delimiter, we invoked the handler, so we can return true now.
if (!IsIterativeParsingDelimiterState(n)) if (!IsIterativeParsingDelimiterState(n))
return true; return true;
} }