Interface TokenStream

  • All Known Implementing Classes:
    TokenStreamImpl

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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Location location()  
      Token peek()  
      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.
      Token peekNextButOne()  
      boolean peekNextButOne​(String suspected)  
      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.
      String 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.
      Token read()  
      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.
      String 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 setWarningHandler​(WarningHandler warningHandler)
      By default, warnings are discarded, but an application my install a WarningHandler.