Interface TokenStream

All Known Implementing Classes:
TokenStreamImpl

public interface TokenStream
An interface that allows for peeking and consuming a stream of Tokens.
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    boolean
    peek(String suspected)
     
    int
    peek(String... suspected)
    Checks whether the value of the next token equals any of the suspected; does not consume the next token.
    boolean
    peek(TokenType suspected)
     
    int
    peek(TokenType... suspected)
    Checks whether the type of the next token is any of the suspected; does not consume the next token.
     
    boolean
     
    boolean
    peekRead(String suspected)
    Checks whether the value of the next token equals the suspected; if so, consumes the token.
    int
    peekRead(String... suspected)
    Checks whether the value of the next token is one of the suspected; if so, consumes the token.
    peekRead(TokenType suspected)
    Checks whether the type of the next token is the suspected; if so, consumes the token.
    int
    peekRead(TokenType... suspected)
    Checks whether the type of the next token is one of the suspected; if so, consumes the token.
     
    void
    read(String expected)
    Verifies that the value of the next token equals expected, and consumes the token.
    int
    read(String... expected)
    Verifies that the value of the next token equals one of the expected, and consumes the token.
    read(TokenType expected)
    Verifies that the type of the next token is the expected, and consumes the token.
    int
    read(TokenType... expected)
    Verifies that the type of the next token is one of the expected, and consumes the token.
    void
    By default, warnings are discarded, but an application my install a WarningHandler.