java.lang.Object
studio.magemonkey.codex.util.eval.javaluator.Token

public class Token extends Object
A token.
When evaluating an expression, it is first split into tokens. These tokens can be operators, constants, etc ...
Author:
Jean-Marc Astesana
See Also:
  • Constructor Details

  • Method Details

    • buildLiteral

      public static Token buildLiteral(String literal)
    • buildOperator

      public static Token buildOperator(Operator ope)
    • buildFunction

      public static Token buildFunction(Function function)
    • buildOpenToken

      public static Token buildOpenToken(BracketPair pair)
    • buildCloseToken

      public static Token buildCloseToken(BracketPair pair)
    • buildArgumentSeparator

      public static Token buildArgumentSeparator(String strToken)
    • appendTokenInfo

      public String appendTokenInfo(String msg)
    • setLineInfo

      public Token setLineInfo(String line, int lineNum, int startPosition, int endPosition)
    • getBrackets

      public BracketPair getBrackets()
    • getOperator

      public Operator getOperator()
    • getFunction

      public Function getFunction()
    • getKind

      public Token.Kind getKind()
    • getString

      public String getString()
    • isOperator

      public boolean isOperator()
      Tests whether the token is an operator.
      Returns:
      true if the token is an operator
    • isFunction

      public boolean isFunction()
      Tests whether the token is a function.
      Returns:
      true if the token is a function
    • isOpenBracket

      public boolean isOpenBracket()
      Tests whether the token is an open bracket.
      Returns:
      true if the token is an open bracket
    • isCloseBracket

      public boolean isCloseBracket()
      Tests whether the token is a close bracket.
      Returns:
      true if the token is a close bracket
    • isFunctionArgumentSeparator

      public boolean isFunctionArgumentSeparator()
      Tests whether the token is a function argument separator.
      Returns:
      true if the token is a function argument separator
    • isLiteral

      public boolean isLiteral()
      Tests whether the token is a literal or a constant or a variable name.
      Returns:
      true if the token is a literal, a constant or a variable name
    • getAssociativity

      public Operator.Associativity getAssociativity()
    • getPrecedence

      public int getPrecedence()
    • getLiteral

      public String getLiteral()
    • toString

      public String toString()
      Overrides:
      toString in class Object