Class Token


  • public class Token
    extends Object
    A token that is produced by Tokenizer and fed into Parser.parse A token consists of a token identifier, a string that the token was created from and the position in the input string that the token was found. The token id must be one of a number of pre-defined values
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CLOSE_BRACKET
      Token id for closing brackets
      static int EPSILON
      Token id for the epsilon terminal
      static int FUNCTION
      Token id for function names
      static int MULTDIV
      Token id for multiplication or division
      static int NUMBER
      Token id for numbers
      static int OPEN_BRACKET
      Token id for opening brackets
      static int PLUSMINUS
      Token id for plus or minus
      int pos
      the position of the token in the input string
      static int RAISED
      Token id for the exponentiation symbol
      String sequence
      the string that the token was created from
      int token
      the token identifier
      static int VARIABLE
      Token id for variable names
    • Constructor Summary

      Constructors 
      Constructor Description
      Token​(int token, String sequence, int pos)
      Construct the token with its values
    • Field Detail

      • EPSILON

        public static final int EPSILON
        Token id for the epsilon terminal
        See Also:
        Constant Field Values
      • PLUSMINUS

        public static final int PLUSMINUS
        Token id for plus or minus
        See Also:
        Constant Field Values
      • MULTDIV

        public static final int MULTDIV
        Token id for multiplication or division
        See Also:
        Constant Field Values
      • RAISED

        public static final int RAISED
        Token id for the exponentiation symbol
        See Also:
        Constant Field Values
      • OPEN_BRACKET

        public static final int OPEN_BRACKET
        Token id for opening brackets
        See Also:
        Constant Field Values
      • CLOSE_BRACKET

        public static final int CLOSE_BRACKET
        Token id for closing brackets
        See Also:
        Constant Field Values
      • token

        public final int token
        the token identifier
      • sequence

        public final String sequence
        the string that the token was created from
      • pos

        public final int pos
        the position of the token in the input string
    • Constructor Detail

      • Token

        public Token​(int token,
                     String sequence,
                     int pos)
        Construct the token with its values
        Parameters:
        token - the token identifier
        sequence - the string that the token was created from
        pos - the position of the token in the input string