Commit 116f6599 authored by StilesCrisis's avatar StilesCrisis

Improve coverage and performance

Further improvement to perftest and hoping to make coveralls happy.
parent 5de72584
...@@ -537,19 +537,18 @@ public: ...@@ -537,19 +537,18 @@ 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 we've finished or hit an error...
if (IsIterativeParsingCompleteState(d)) {
// Report errors.
if (d == IterativeParsingErrorState) { if (d == IterativeParsingErrorState) {
HandleError(state_, is); HandleError(state_, is);
return false; return false;
} }
// Transition to the finish state.
RAPIDJSON_ASSERT(d == IterativeParsingFinishState);
state_ = d; 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;
// If StopWhenDone is not set... // If StopWhenDone is not set...
if (!(parseFlags & kParseStopWhenDoneFlag)) { if (!(parseFlags & kParseStopWhenDoneFlag)) {
// ... and extra non-whitespace data is found... // ... and extra non-whitespace data is found...
...@@ -561,11 +560,14 @@ public: ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment