Package uk.co.cogitolearning.cogpar
Class Token
- java.lang.Object
-
- uk.co.cogitolearning.cogpar.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 intCLOSE_BRACKETToken id for closing bracketsstatic intEPSILONToken id for the epsilon terminalstatic intFUNCTIONToken id for function namesstatic intMULTDIVToken id for multiplication or divisionstatic intNUMBERToken id for numbersstatic intOPEN_BRACKETToken id for opening bracketsstatic intPLUSMINUSToken id for plus or minusintposthe position of the token in the input stringstatic intRAISEDToken id for the exponentiation symbolStringsequencethe string that the token was created frominttokenthe token identifierstatic intVARIABLEToken id for variable names
-
-
-
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
-
FUNCTION
public static final int FUNCTION
Token id for function names- 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
-
NUMBER
public static final int NUMBER
Token id for numbers- See Also:
- Constant Field Values
-
VARIABLE
public static final int VARIABLE
Token id for variable names- 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 identifiersequence- the string that the token was created frompos- the position of the token in the input string
-
-