in src/com/amazon/ion/impl/IonTokenReader.java [470:575]
private Type next(int c, boolean is_in_expression) throws IOException {
int c2;
t = Type.none;
isIncomplete = false;
switch (c) {
case -1:
return (t = Type.eof);
case '{':
c2 = read();
if (c2 == '{') {
return (t = Type.tOpenDoubleCurly);
}
unread(c2);
return (t = Type.tOpenCurly);
case '}':
return (t = Type.tCloseCurly);
case '[':
return (t = Type.tOpenSquare);
case ']':
return (t = Type.tCloseSquare);
case '(':
return (t = Type.tOpenParen);
case ')':
return (t = Type.tCloseParen);
case ',':
return (t = Type.tComma);
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
return readNumber(c);
case '\"':
inQuotedContent = true;
this.keyword = Type.none; // anything in quotes isn't a keyword
return scanString(c, _Private_IonConstants.lnIsVarLen - 1);
case '\'':
c2 = read();
if (c2 == '\'') {
c2 = read();
if (c2 == '\'') {
return scanLongString();
}
this.unread(c2);
c2 = '\''; // restore c2 for the next unread
}
this.unread(c2);
inQuotedContent = true;
return scanIdentifier(c);
case '+':
c2 = read();
if (c2 == 'i') {
c2 = read();
if (c2 == 'n') {
c2 = read();
if (c2 == 'f') {
return (t = Type.kwPosInf);
}
this.unread(c2);
c2 = 'n';
}
this.unread(c2);
c2 = 'i';
}
this.unread(c2);
if (is_in_expression) {
return scanOperator(c);
}
break; // break to error
case '-':
c2 = read();
if (c2 >= '0' && c2 <= '9') {
this.unread(c2);
return readNumber(c);
}
if (c2 == 'i') {
c2 = read();
if (c2 == 'n') {
c2 = read();
if (c2 == 'f') {
return (t = Type.kwNegInf);
}
this.unread(c2);
c2 = 'n';
}
this.unread(c2);
c2 = 'i';
}
this.unread(c2);
if (is_in_expression) {
return scanOperator(c);
}
break; // break to error
default:
if (IonTextUtils.isIdentifierStart(c)) {
return scanIdentifier(c);
}
if (is_in_expression && isOperatorPart(c)) {
return scanOperator(c);
}
}
String message =
"Unexpected character " + printCodePointAsString(c) +
" encountered at line " + this.getLineNumber() +
" column " + this.getColumn();
throw new IonException(message);
}