Skip to content

Commit

Permalink
Start work on #563
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 18, 2019
1 parent 1c852df commit ce70782
Showing 1 changed file with 13 additions and 9 deletions.
Expand Up @@ -636,11 +636,11 @@ private final JsonToken _startValue(int ch) throws IOException
return _startTrueToken();
case '[':
return _startArrayScope();
case ']':
case INT_RBRACKET:
return _closeArrayScope();
case '{':
return _startObjectScope();
case '}':
case INT_RCURLY:
return _closeObjectScope();
default:
}
Expand Down Expand Up @@ -676,6 +676,10 @@ private final JsonToken _startValueExpectComma(int ch) throws IOException
}
_reportUnexpectedChar(ch, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries");
}

// 17-Sep-2019, tatu: [core#563] Need to call this to update index within array
_parsingContext.expectComma();

int ptr = _inputPtr;
if (ptr >= _inputEnd) {
_minorState = MINOR_VALUE_WS_AFTER_COMMA;
Expand Down Expand Up @@ -722,15 +726,15 @@ private final JsonToken _startValueExpectComma(int ch) throws IOException
return _startTrueToken();
case '[':
return _startArrayScope();
case ']':
case INT_RBRACKET:
// Was that a trailing comma?
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
return _closeArrayScope();
}
break;
case '{':
return _startObjectScope();
case '}':
case INT_RCURLY:
// Was that a trailing comma?
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
return _closeObjectScope();
Expand Down Expand Up @@ -866,15 +870,15 @@ private final JsonToken _startValueAfterComma(int ch) throws IOException
return _startTrueToken();
case '[':
return _startArrayScope();
case ']':
case INT_RBRACKET:
// Was that a trailing comma?
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
return _closeArrayScope();
}
break;
case '{':
return _startObjectScope();
case '}':
case INT_RCURLY:
// Was that a trailing comma?
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
return _closeObjectScope();
Expand All @@ -888,7 +892,7 @@ private final JsonToken _startValueAfterComma(int ch) throws IOException
protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) throws IOException
{
switch (ch) {
case ']':
case INT_RBRACKET:
if (!_parsingContext.inArray()) {
break;
}
Expand All @@ -902,7 +906,7 @@ protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) throws I
return _valueComplete(JsonToken.VALUE_NULL);
}
// fall through
case '}':
case INT_RCURLY:
// Error: neither is valid at this point; valid closers have
// been handled earlier
break;
Expand Down Expand Up @@ -2071,7 +2075,7 @@ private JsonToken _handleOddName(int ch) throws IOException
return _finishAposName(0, 0, 0);
}
break;
case ']': // for better error reporting...
case INT_RBRACKET: // for better error reporting...
return _closeArrayScope();
}
// allow unquoted names if feature enabled:
Expand Down

0 comments on commit ce70782

Please sign in to comment.