Merge pull request #3776 from ncpenke/fix-bug-skipping-unknown-fields
Fix bug skipping unknown fields
This commit is contained in:
commit
959866b848
|
@ -1557,8 +1557,12 @@ CheckedError Parser::SkipJsonObject() {
|
|||
for (;;) {
|
||||
if ((!opts.strict_json || !fieldn) && Is('}')) break;
|
||||
|
||||
if (!Is(kTokenStringConstant))
|
||||
if (!Is(kTokenStringConstant)) {
|
||||
EXPECT(opts.strict_json ? kTokenStringConstant : kTokenIdentifier);
|
||||
}
|
||||
else {
|
||||
NEXT();
|
||||
}
|
||||
|
||||
EXPECT(':');
|
||||
ECHECK(SkipAnyJsonValue());
|
||||
|
|
|
@ -830,10 +830,13 @@ void UnknownFieldsTest() {
|
|||
TEST_EQ(parser.Parse("table T { str:string; i:int;}"
|
||||
"root_type T;"
|
||||
"{ str:\"test\","
|
||||
"unknown_string:\"test\","
|
||||
"\"unknown_string\":\"test\","
|
||||
"unknown_int:10,"
|
||||
"unknown_float:1.0,"
|
||||
"unknown_array: [ 1, 2, 3, 4],"
|
||||
"unknown_object: { i: 10 },"
|
||||
"\"unknown_object\": { \"i\": 10 },"
|
||||
"i:10}"), true);
|
||||
|
||||
std::string jsongen;
|
||||
|
|
Loading…
Reference in New Issue