protected void _matchToken ( String matchStr , int i ) throws IOException , JsonParseException { final int len = matchStr . length ( ) ; do { if ( _inputPtr >= _inputEnd ) { if ( ! loadMore ( ) ) { _reportInvalidEOFInValue ( ) ; } } if ( _inputBuffer [ _inputPtr ] != matchStr . charAt ( i ) ) { _reportInvalidToken ( matchStr . substring ( 0 , i ) , "'null', 'true', 'false' or NaN" ) ; } ++ _inputPtr ; } while ( ++ i < len ) ; // but let's also ensure we either get EOF, or non-alphanum char... if ( _inputPtr >= _inputEnd ) { if ( ! loadMore ( ) ) { return ; } } char c = _inputBuffer [ _inputPtr ] ; if ( c < ' ' || c == ' ' ) { // expected/allowed chars return ; } // if letter, it's a problem tho if ( IdentifierUtils . isIdCharLenient ( c ) ) { _reportInvalidToken ( matchStr . substring ( 0 , i ) , "'null', 'true', 'false' or NaN" ) ; } }
Helper method for checking whether input matches expected token