public void nextToken ( ) { byte ct [ ] = ctype ; int c ; int lctype ; sval = null ; isQuoted = false ; do { c = read ( ) ; if ( c < 0 ) { return ; } lctype = ( c < 256 ) ? ct [ c ] : unicode2ctype ( c ) ; } while ( lctype == CT_WHITESPACE ) ; if ( lctype == CT_ALPHA ) { int i = 0 ; do { if ( i >= buf . length ) { buf = Arrays . copyOf ( buf , buf . length * 2 ) ; } buf [ i ++ ] = ( char ) c ; c = read ( ) ; lctype = c < 0 ? CT_WHITESPACE : ( c < 256 ) ? ct [ c ] : unicode2ctype ( c ) ; } while ( lctype == CT_ALPHA ) ; if ( c >= 0 ) -- next ; // push last back sval = String . copyValueOf ( buf , 0 , i ) ; return ; } if ( lctype == CT_QUOTE ) { int quote = c ; int i = 0 ; /* Invariants (because \Octal needs a lookahead): * (i) c contains char value * (ii) d contains the lookahead */ int d = read ( ) ; while ( d >= 0 && d != quote ) { if ( d == ' ' ) { c = read ( ) ; int first = c ; /* To allow \377, but not \477 */ if ( c >= ' ' && c <= ' ' ) { c = c - ' ' ; int c2 = read ( ) ; if ( ' ' <= c2 && c2 <= ' ' ) { c = ( c << 3 ) + ( c2 - ' ' ) ; c2 = read ( ) ; if ( ' ' <= c2 && c2 <= ' ' && first <= ' ' ) { c = ( c << 3 ) + ( c2 - ' ' ) ; d = read ( ) ; } else d = c2 ; } else d = c2 ; } else { switch ( c ) { case ' ' : c = 0x7 ; break ; case ' ' : c = ' ' ; break ; case ' ' : c = 0xC ; break ; case ' ' : c = ' ' ; break ; case ' ' : c = ' ' ; break ; case ' ' : c = ' ' ; break ; case ' ' : c = 0xB ; break ; } d = read ( ) ; } } else { c = d ; d = read ( ) ; } if ( i >= buf . length ) { buf = Arrays . copyOf ( buf , buf . length * 2 ) ; } buf [ i ++ ] = ( char ) c ; } if ( d == quote ) { isQuoted = true ; } sval = String . copyValueOf ( buf , 0 , i ) ; } }
Parses the next token of this tokenizer .