From 188b99b471446675e022eb79d08076233d127e0e Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Thu, 26 Jun 2014 23:14:05 +0800 Subject: [PATCH] Clear the stack after parsing and fixes indentation. --- include/rapidjson/reader.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/rapidjson/reader.h b/include/rapidjson/reader.h index df4b60e..43e13e4 100644 --- a/include/rapidjson/reader.h +++ b/include/rapidjson/reader.h @@ -240,9 +240,9 @@ public: RAPIDJSON_PARSE_ERROR_NORETURN("Text only contains white space(s)", is.Tell()); else { switch (is.Peek()) { - case '{': ParseObject(is, handler); break; - case '[': ParseArray(is, handler); break; - default: RAPIDJSON_PARSE_ERROR_NORETURN("Expect either an object or array at root", is.Tell()); + case '{': ParseObject(is, handler); break; + case '[': ParseArray(is, handler); break; + default: RAPIDJSON_PARSE_ERROR_NORETURN("Expect either an object or array at root", is.Tell()); } SkipWhitespace(is); @@ -250,6 +250,7 @@ public: RAPIDJSON_PARSE_ERROR_NORETURN("Nothing should follow the root object or array.", is.Tell()); } + stack_.Clear(); return !HasParseError(); }