From b31d224fd68de8c53bd8bce21a296c5916d2dbad Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sun, 8 Feb 2015 14:39:52 -0600 Subject: [PATCH] partially revert 'Added features that allow the reader to accept common non-standard JSON.' revert '642befc836ac5093b528e7d8b4fd66b66735a98c', but keep the *added* methods for `decodedNumber()` and `decodedDouble()`. --- include/json/features.h | 6 ------ src/lib_json/json_reader.cpp | 21 ++------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/include/json/features.h b/include/json/features.h index 1bb7bb614..781354783 100644 --- a/include/json/features.h +++ b/include/json/features.h @@ -44,12 +44,6 @@ class JSON_API Features { /// \c true if root must be either an array or an object value. Default: \c /// false. bool strictRoot_; - - /// \c true if dropped null placeholders are allowed. Default: \c false. - bool allowDroppedNullPlaceholders_; - - /// \c true if numeric object key are allowed. Default: \c false. - bool allowNumericKeys_; }; } // namespace Json diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp index 89052e69c..964e409dc 100644 --- a/src/lib_json/json_reader.cpp +++ b/src/lib_json/json_reader.cpp @@ -43,17 +43,14 @@ typedef std::auto_ptr CharReaderPtr; // //////////////////////////////// Features::Features() - : allowComments_(true), strictRoot_(false), - allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {} - + : allowComments_(true), strictRoot_(false) +{} Features Features::all() { return Features(); } Features Features::strictMode() { Features features; features.allowComments_ = false; features.strictRoot_ = true; - features.allowDroppedNullPlaceholders_ = false; - features.allowNumericKeys_ = false; return features; } @@ -191,15 +188,6 @@ bool Reader::readValue() { currentValue().swapPayload(v); } break; - case tokenArraySeparator: - if (features_.allowDroppedNullPlaceholders_) { - // "Un-read" the current token and mark the current value as a null - // token. - current_--; - Value v; - currentValue().swapPayload(v); - break; - } // Else, fall through... default: return addError("Syntax error: value, object or array expected.", token); @@ -446,11 +434,6 @@ bool Reader::readObject(Token& /*tokenStart*/) { if (tokenName.type_ == tokenString) { if (!decodeString(tokenName, name)) return recoverFromError(tokenObjectEnd); - } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { - Value numberName; - if (!decodeNumber(tokenName, numberName)) - return recoverFromError(tokenObjectEnd); - name = numberName.asString(); } else { break; }