Commit c9f27151 authored by Philipp A. Hartmann's avatar Philipp A. Hartmann

Reader: drop object/array root restrction from iterative parser

parent edccda00
...@@ -903,6 +903,9 @@ private: ...@@ -903,6 +903,9 @@ private:
IterativeParsingElementDelimiterState, IterativeParsingElementDelimiterState,
IterativeParsingArrayFinishState, IterativeParsingArrayFinishState,
// Single value state
IterativeParsingValueState,
cIterativeParsingStateCount cIterativeParsingStateCount
}; };
...@@ -961,11 +964,11 @@ private: ...@@ -961,11 +964,11 @@ private:
IterativeParsingErrorState, // Right curly bracket IterativeParsingErrorState, // Right curly bracket
IterativeParsingErrorState, // Comma IterativeParsingErrorState, // Comma
IterativeParsingErrorState, // Colon IterativeParsingErrorState, // Colon
IterativeParsingErrorState, // String IterativeParsingValueState, // String
IterativeParsingErrorState, // False IterativeParsingValueState, // False
IterativeParsingErrorState, // True IterativeParsingValueState, // True
IterativeParsingErrorState, // Null IterativeParsingValueState, // Null
IterativeParsingErrorState // Number IterativeParsingValueState // Number
}, },
// Finish(sink state) // Finish(sink state)
{ {
...@@ -1102,6 +1105,12 @@ private: ...@@ -1102,6 +1105,12 @@ private:
IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState,
IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState,
IterativeParsingErrorState IterativeParsingErrorState
},
// Single Value (sink state)
{
IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState,
IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState,
IterativeParsingErrorState
} }
}; // End of G }; // End of G
...@@ -1238,6 +1247,14 @@ private: ...@@ -1238,6 +1247,14 @@ private:
} }
} }
case IterativeParsingValueState:
// Must be non-compound value. Or it would be ObjectInitial or ArrayInitial state.
ParseValue<parseFlags>(is, handler);
if (HasParseError()) {
return IterativeParsingErrorState;
}
return IterativeParsingFinishState;
default: default:
RAPIDJSON_ASSERT(false); RAPIDJSON_ASSERT(false);
return IterativeParsingErrorState; return IterativeParsingErrorState;
...@@ -1252,7 +1269,7 @@ private: ...@@ -1252,7 +1269,7 @@ private:
} }
switch (src) { switch (src) {
case IterativeParsingStartState: RAPIDJSON_PARSE_ERROR(is.Peek() == '\0' ? kParseErrorDocumentEmpty : kParseErrorDocumentRootNotObjectOrArray, is.Tell()); case IterativeParsingStartState: RAPIDJSON_PARSE_ERROR(kParseErrorDocumentEmpty, is.Tell());
case IterativeParsingFinishState: RAPIDJSON_PARSE_ERROR(kParseErrorDocumentRootNotSingular, is.Tell()); case IterativeParsingFinishState: RAPIDJSON_PARSE_ERROR(kParseErrorDocumentRootNotSingular, is.Tell());
case IterativeParsingObjectInitialState: case IterativeParsingObjectInitialState:
case IterativeParsingMemberDelimiterState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissName, is.Tell()); case IterativeParsingMemberDelimiterState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissName, is.Tell());
......
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