From 692904b77b94c41ffc65406d42822a642cf20ef7 Mon Sep 17 00:00:00 2001 From: thebusytypist Date: Thu, 10 Jul 2014 19:49:43 +0800 Subject: [PATCH] Handle all unspecific parsing errors. --- include/rapidjson/error/en.h | 2 ++ include/rapidjson/reader.h | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/rapidjson/error/en.h b/include/rapidjson/error/en.h index 81637ee..c96fa53 100644 --- a/include/rapidjson/error/en.h +++ b/include/rapidjson/error/en.h @@ -38,6 +38,8 @@ inline const RAPIDJSON_ERROR_CHARTYPE* GetParseError_En(ParseErrorCode parseErro case kParseErrorNumberMissFraction: return RAPIDJSON_ERROR_STRING("Miss fraction part in number."); case kParseErrorNumberMissExponent: return RAPIDJSON_ERROR_STRING("Miss exponent in number."); + case kParseErrorUnspecificSyntaxError: return RAPIDJSON_ERROR_STRING("Unspecific syntax error."); + default: return RAPIDJSON_ERROR_STRING("Unknown error."); } diff --git a/include/rapidjson/reader.h b/include/rapidjson/reader.h index 815fbba..372016f 100644 --- a/include/rapidjson/reader.h +++ b/include/rapidjson/reader.h @@ -74,7 +74,9 @@ enum ParseErrorCode { kParseErrorNumberTooBig, //!< Number too big to be stored in double. kParseErrorNumberMissFraction, //!< Miss fraction part in number. - kParseErrorNumberMissExponent //!< Miss exponent in number. + kParseErrorNumberMissExponent, //!< Miss exponent in number. + + kParseErrorUnspecificSyntaxError //!< General syntax error. }; /////////////////////////////////////////////////////////////////////////////// @@ -1114,6 +1116,9 @@ private: else if (src == IterativeParsingElementState) RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); + + else + RAPIDJSON_PARSE_ERROR(kParseErrorUnspecificSyntaxError, is.Tell()); } template