Class Terminal

java.lang.Object
org.oristool.lello.parse.Terminal

public class Terminal extends Object
Represents a terminal symbol. A terminal symbol consists of a kind, which influences the behavior (precedence, associativity, etc...) of the parser when it encounters the symbol, and a string called token that specifies the exact form in which the token was written within the input file; the token influences evaluation and AST manipulation. In order to allow accurate error reporting every token stores the row and column number where it was located in the input file.
  • Constructor Details

    • Terminal

      public Terminal(TerminalKind kind, String token, int row, int col)
      Initializes a new terminal symbol.
      Parameters:
      kind - The kind of the terminal symbol.
      token - The token of the terminal symbol.
      row - The row number in the input file at which this terminal symbol was located.
      col - The column number in the input file at which this terminal symbol was located.
  • Method Details

    • getKind

      public TerminalKind getKind()
      Retrieves the kind of the terminal symbol.
      Returns:
      The kind of the terminal symbol.
    • getToken

      public String getToken()
      Retrieves the token of the terminal symbol.
      Returns:
      The token of the terminal symbol.
    • getRow

      public int getRow()
      Retrieves the row number in the input file at which this terminal symbol was located.
      Returns:
      Row number.
    • getCol

      public int getCol()
      Retrieves the column number in the input file at which this terminal symbol was located.
      Returns:
      Column number.