use of com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint in project ion-java by amzn.
the class IonReaderTextRawTokensX method skip_to_end.
private final int skip_to_end(SavePoint sp) throws IOException {
int c;
switch(_token) {
case IonTokenConstsX.TOKEN_UNKNOWN_NUMERIC:
c = skip_over_number(sp);
break;
case IonTokenConstsX.TOKEN_INT:
c = skip_over_int(sp);
break;
case IonTokenConstsX.TOKEN_HEX:
c = skipOverRadix(sp, Radix.HEX);
break;
case IonTokenConstsX.TOKEN_BINARY:
c = skipOverRadix(sp, Radix.BINARY);
break;
case IonTokenConstsX.TOKEN_DECIMAL:
c = skip_over_decimal(sp);
break;
case IonTokenConstsX.TOKEN_FLOAT:
c = skip_over_float(sp);
break;
case IonTokenConstsX.TOKEN_TIMESTAMP:
c = skip_over_timestamp(sp);
break;
case IonTokenConstsX.TOKEN_SYMBOL_IDENTIFIER:
c = skip_over_symbol_identifier(sp);
break;
case IonTokenConstsX.TOKEN_SYMBOL_QUOTED:
// Initial single-quote has been consumed!
assert (!is_2_single_quotes_helper());
c = skip_single_quoted_string(sp);
break;
case IonTokenConstsX.TOKEN_SYMBOL_OPERATOR:
// Initial operator char has NOT been consumed
c = skip_over_symbol_operator(sp);
break;
case IonTokenConstsX.TOKEN_STRING_DOUBLE_QUOTE:
// FIXME Why no sp here?
skip_double_quoted_string_helper();
c = skip_over_whitespace();
break;
case IonTokenConstsX.TOKEN_STRING_TRIPLE_QUOTE:
skip_triple_quoted_string(sp);
c = skip_over_whitespace();
break;
case IonTokenConstsX.TOKEN_OPEN_DOUBLE_BRACE:
// works just like a pair of nested structs
// since "skip_over" doesn't care about formal
// syntax (like requiring field names);
skip_over_blob(sp);
c = read_char();
break;
case IonTokenConstsX.TOKEN_OPEN_BRACE:
// you can't save point a scanned struct (right now anyway)
assert (sp == null);
skip_over_struct();
c = read_char();
break;
case IonTokenConstsX.TOKEN_OPEN_PAREN:
// you can't save point a scanned sexp (right now anyway)
skip_over_sexp();
c = read_char();
break;
case IonTokenConstsX.TOKEN_OPEN_SQUARE:
// you can't save point a scanned list (right now anyway)
skip_over_list();
c = read_char();
break;
case IonTokenConstsX.TOKEN_DOT:
case IonTokenConstsX.TOKEN_COMMA:
case IonTokenConstsX.TOKEN_COLON:
case IonTokenConstsX.TOKEN_DOUBLE_COLON:
case IonTokenConstsX.TOKEN_CLOSE_PAREN:
case IonTokenConstsX.TOKEN_CLOSE_BRACE:
case IonTokenConstsX.TOKEN_CLOSE_SQUARE:
case IonTokenConstsX.TOKEN_CLOSE_DOUBLE_BRACE:
case IonTokenConstsX.TOKEN_ERROR:
case IonTokenConstsX.TOKEN_EOF:
default:
// makes eclipse happy
c = -1;
error("token " + IonTokenConstsX.getTokenName(_token) + " unexpectedly encounterd as \"unfinished\"");
break;
}
if (IonTokenConstsX.isWhitespace(c)) {
c = skip_over_whitespace();
}
_unfinished_token = false;
return c;
}
use of com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint in project ion-java by amzn.
the class IonReaderTextRawTokensX method skip_over_int.
private int skip_over_int(SavePoint sp) throws IOException {
int c = read_char();
if (c == '-') {
c = read_char();
}
c = skip_over_digits(c);
if (!is_value_terminating_character(c)) {
bad_token(c);
}
if (sp != null) {
sp.markEnd(-1);
}
return c;
}
use of com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint in project ion-java by amzn.
the class IonReaderTextRawTokensX method finish_token.
protected final void finish_token(SavePoint sp) throws IOException {
if (_unfinished_token) {
int c = skip_to_end(sp);
unread_char(c);
_unfinished_token = false;
}
}
use of com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint in project ion-java by amzn.
the class IonReaderTextRawTokensX method skip_triple_quoted_string.
private void skip_triple_quoted_string(SavePoint sp, CommentStrategy commentStrategy) throws IOException {
// starts AFTER the 3 quotes have been consumed
int c;
for (; ; ) {
c = read_char();
switch(c) {
case -1:
unexpected_eof();
case '\'':
c = read_char();
if (c == '\'') {
// 2nd quote
// possibly the 3rd
c = read_char();
if (sp != null) {
sp.markEnd(-3);
}
if (c == '\'') {
// it is the 3rd quote - end of this segment
c = skip_over_whitespace(commentStrategy);
if (c == '\'' && is_2_single_quotes_helper()) {
// there's another segment so read the next segment as well
break;
}
// end of last segment
unread_char(c);
return;
}
}
break;
case '\\':
c = read_char();
break;
}
}
}
use of com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint in project ion-java by amzn.
the class IonReaderTextRawTokensX method skip_over_number.
private int skip_over_number(SavePoint sp) throws IOException {
int c = read_char();
// first consume any leading 0 to get it out of the way
if (c == '-') {
c = read_char();
}
// could be a long int, a decimal, a float
// it cannot be a hex or a valid timestamp
// so scan digits - if decimal can more digits
// if d or e eat possible sign
// scan to end of digits
c = skip_over_digits(c);
if (c == '.') {
c = read_char();
c = skip_over_digits(c);
}
if (c == 'd' || c == 'D' || c == 'e' || c == 'E') {
c = read_char();
if (c == '-' || c == '+') {
c = read_char();
}
c = skip_over_digits(c);
}
if (!is_value_terminating_character(c)) {
bad_token(c);
}
if (sp != null) {
sp.markEnd(-1);
}
return c;
}
Aggregations