private boolean isLiteral(char c) throws IOException { switch (c) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': return false; default: return true; } }
private void skipUnquotedValue() throws IOException { do { int i = 0; for (; pos + i < limit; i++) { switch (buffer[pos + i]) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': pos += i; return; } } pos += i; } while (fillBuffer(1)); }
case '#': case '=': checkLenient(); // fall-through case '{': case '}':
return peeked = PEEKED_END_ARRAY; case ';': checkLenient(); // fall-through case ',': break; return peeked = PEEKED_END_OBJECT; case ';': checkLenient(); // fall-through case ',': break; return peeked = PEEKED_DOUBLE_QUOTED_NAME; case '\'': checkLenient(); return peeked = PEEKED_SINGLE_QUOTED_NAME; case '}': checkLenient(); break; case '=': checkLenient(); if ((pos < limit || fillBuffer(1)) && buffer[pos] == '>') { pos++; return peeked = PEEKED_EOF; } else { checkLenient();
checkLenient(); char peek = buffer[pos]; switch (peek) { checkLenient(); skipToEndOfLine(); p = pos;
private boolean isLiteral(char c) throws IOException { switch (c) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': return false; default: return true; } }
private boolean isLiteral(char c) throws IOException { switch (c) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': return false; default: return true; } }
private boolean isLiteral(char c) throws IOException { switch (c) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': return false; default: return true; } }
private boolean isLiteral(char c) throws IOException { switch (c) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': return false; default: return true; } }
private boolean isLiteral(char c) throws IOException { switch (c) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': return false; default: return true; } }
/** * Assigns {@code nextToken} based on the value of {@code nextValue}. */ private void decodeLiteral() throws IOException { if (value.equalsIgnoreCase("null")) { token = JsonToken.NULL; } else if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) { token = JsonToken.BOOLEAN; } else { try { Double.parseDouble(value); // this work could potentially be cached token = JsonToken.NUMBER; } catch (NumberFormatException ignored) { // this must be an unquoted string checkLenient(); token = JsonToken.STRING; } } }
private void skipUnquotedValue() throws IOException { do { int i = 0; for (; pos + i < limit; i++) { switch (buffer[pos + i]) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': pos += i; return; } } pos += i; } while (fillBuffer(1)); }
private void skipUnquotedValue() throws IOException { do { int i = 0; for (; pos + i < limit; i++) { switch (buffer[pos + i]) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': pos += i; return; } } pos += i; } while (fillBuffer(1)); }
private void skipUnquotedValue() throws IOException { do { int i = 0; for (; pos + i < limit; i++) { switch (buffer[pos + i]) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': pos += i; return; } } pos += i; } while (fillBuffer(1)); }
private void skipUnquotedValue() throws IOException { do { int i = 0; for (; pos + i < limit; i++) { switch (buffer[pos + i]) { case '/': case '\\': case ';': case '#': case '=': checkLenient(); // fall-through case '{': case '}': case '[': case ']': case ':': case ',': case ' ': case '\t': case '\f': case '\r': case '\n': pos += i; return; } } pos += i; } while (fillBuffer(1)); }
/** * Reads a null, boolean, numeric or unquoted string literal value. */ private JsonToken readLiteral() throws IOException { value = nextLiteral(true); if (valueLength == 0) { throw syntaxError("Expected literal value"); } token = decodeLiteral(); if (token == JsonToken.STRING) { checkLenient(); } return token; }
@SuppressWarnings("fallthrough") private JsonToken nextValue() throws IOException { int c = nextNonWhitespace(true); switch (c) { case '{': push(JsonScope.EMPTY_OBJECT); return token = JsonToken.BEGIN_OBJECT; case '[': push(JsonScope.EMPTY_ARRAY); return token = JsonToken.BEGIN_ARRAY; case '\'': checkLenient(); // fall-through case '"': value = nextString((char) c); return token = JsonToken.STRING; default: pos--; return readLiteral(); } }
@SuppressWarnings("fallthrough") private JsonToken nextValue() throws IOException { int c = nextNonWhitespace(); switch (c) { case '{': push(JsonScope.EMPTY_OBJECT); hasToken = true; return token = JsonToken.BEGIN_OBJECT; case '[': push(JsonScope.EMPTY_ARRAY); hasToken = true; return token = JsonToken.BEGIN_ARRAY; case '\'': checkLenient(); // fall-through case '"': value = nextString((char) c); hasToken = true; return token = JsonToken.STRING; default: pos--; return readLiteral(); } }
private JsonToken objectValue() throws IOException { /* * Read the name/value separator. Usually a colon ':'. In lenient mode * we also accept an equals sign '=', or an arrow "=>". */ switch (nextNonWhitespace(true)) { case ':': break; case '=': checkLenient(); if ((pos < limit || fillBuffer(1)) && buffer[pos] == '>') { pos++; } break; default: throw syntaxError("Expected ':'"); } stack[stackSize - 1] = JsonScope.NONEMPTY_OBJECT; return nextValue(); }
private JsonToken objectValue() throws IOException { /* * Read the name/value separator. Usually a colon ':'. In lenient mode * we also accept an equals sign '=', or an arrow "=>". */ switch (nextNonWhitespace()) { case ':': break; case '=': checkLenient(); if ((pos < limit || fillBuffer(1)) && buffer[pos] == '>') { pos++; } break; default: throw syntaxError("Expected ':'"); } replaceTop(JsonScope.NONEMPTY_OBJECT); return nextValue(); }