@Test public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray() { makeCaseInsensitive(); tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"}); assertThat(tokens.canConsume("SELECT"), is(false)); assertThat(tokens.canConsume(TokenStream.ANY_VALUE), is(false)); assertThat(tokens.canConsume(BasicTokenizer.SYMBOL), is(false)); }
public boolean canConsume( String expected ) throws IllegalStateException { if (!matches(expected)) return false; moveToNextToken(); return true; }
TokenStream { public boolean canConsume( String expected ) throws IllegalStateException { if (!matches(expected)) return false; moveToNextToken(); return true; } }
TokenStream { public boolean canConsume( String expected ) throws IllegalStateException { if (!matches(expected)) return false; moveToNextToken(); return true; } TokenStream( String content,
                        Tokenizer tokenizer,
                        boolean caseSensitive ); }
TokenStream { public boolean canConsume( String expected ) throws IllegalStateException { if (!matches(expected)) return false; moveToNextToken(); return true; } TokenStream( String content,
                        Tokenizer tokenizer,
                        boolean caseSensitive ); TokenStream start(); void rewind(); Position previousPosition(); Position nextPosition(); int consumeInteger(); long consumeLong(); boolean consumeBoolean(); String consume(); void consume( String expected ); void consume( char expected ); void consume( int expectedType ); void consume( String expected,
                         String... expectedForNextTokens ); void consume( String[] nextTokens ); void consume( Iterable<String> nextTokens ); boolean canConsume( String expected ); boolean canConsume( char expected ); boolean canConsume( int expectedType ); boolean canConsume( String currentExpected,
                               String... expectedForNextTokens ); boolean canConsume( String[] nextTokens ); boolean canConsume( Iterable<String> nextTokens ); boolean canConsumeAnyOf( String firstOption,
                                    String... additionalOptions ); boolean canConsumeAnyOf( String[] options ); boolean canConsumeAnyOf( Iterable<String> options ); boolean canConsumeAnyOf( int firstTypeOption,
                                    int... additionalTypeOptions ); boolean canConsumeAnyOf( int[] typeOptions ); boolean matches( String expected ); boolean matches( char expected ); boolean matches( int expectedType ); boolean matches( String currentExpected,
                            String... expectedForNextTokens ); boolean matches( String[] nextTokens ); boolean matches( Iterable<String> nextTokens ); boolean matches( int currentExpectedType,
                            int... expectedTypeForNextTokens ); boolean matches( int[] typesForNextTokens ); boolean matchesAnyOf( String firstOption,
                                 String... additionalOptions ); boolean matchesAnyOf( String[] options ); boolean matchesAnyOf( Iterable<String> options ); boolean matchesAnyOf( int firstTypeOption,
                                 int... additionalTypeOptions ); boolean matchesAnyOf( int[] typeOptions ); boolean hasNext(); @Override String toString(); String getContentBetween( Position starting,
                                     Position end ); static BasicTokenizer basicTokenizer( boolean includeComments ); }
TokenStream { public boolean canConsume( String expected ) throws IllegalStateException { if (!matches(expected)) return false; moveToNextToken(); return true; } TokenStream( String content,
                        Tokenizer tokenizer,
                        boolean caseSensitive ); TokenStream start(); void rewind(); Position previousPosition(); Position nextPosition(); int consumeInteger(); long consumeLong(); boolean consumeBoolean(); String consume(); void consume( String expected ); void consume( char expected ); void consume( int expectedType ); void consume( String expected,
                         String... expectedForNextTokens ); void consume( String[] nextTokens ); void consume( Iterable<String> nextTokens ); boolean canConsume( String expected ); boolean canConsume( char expected ); boolean canConsume( int expectedType ); boolean canConsume( String currentExpected,
                               String... expectedForNextTokens ); boolean canConsume( String[] nextTokens ); boolean canConsume( Iterable<String> nextTokens ); boolean canConsumeAnyOf( String firstOption,
                                    String... additionalOptions ); boolean canConsumeAnyOf( String[] options ); boolean canConsumeAnyOf( Iterable<String> options ); boolean canConsumeAnyOf( int firstTypeOption,
                                    int... additionalTypeOptions ); boolean canConsumeAnyOf( int[] typeOptions ); boolean matches( String expected ); boolean matches( char expected ); boolean matches( int expectedType ); boolean matches( String currentExpected,
                            String... expectedForNextTokens ); boolean matches( String[] nextTokens ); boolean matches( Iterable<String> nextTokens ); boolean matches( int currentExpectedType,
                            int... expectedTypeForNextTokens ); boolean matches( int[] typesForNextTokens ); boolean matchesAnyOf( String firstOption,
                                 String... additionalOptions ); boolean matchesAnyOf( String[] options ); boolean matchesAnyOf( Iterable<String> options ); boolean matchesAnyOf( int firstTypeOption,
                                 int... additionalTypeOptions ); boolean matchesAnyOf( int[] typeOptions ); boolean hasNext(); @Override String toString(); String getContentBetween( Position starting,
                                     Position end ); static BasicTokenizer basicTokenizer( boolean includeComments ); static final String ANY_VALUE; static final int ANY_TYPE; }