Class TokenTable

java.lang.Object
com.tangosol.coherence.dsltools.precedence.TokenTable

public class TokenTable extends Object
TokenTable is a helper class used by Scanners to convert BaseTokens to to OPTokens. TokenTables have protocol to add tokens under a name, alias tokens, and control the enabeleded state of tokens.
Author:
djl 2009.03.14
  • Constructor Details

    • TokenTable

      public TokenTable()
      Construct a new OPToken.
    • TokenTable

      public TokenTable(String sIdentifierASTName, String sLiteralASTName)
      Construct a new TokenTable with the given parameters to set the ast names for identifiers and literals.
      Parameters:
      sIdentifierASTName - identifiers ast names
      sLiteralASTName - literals ast name
  • Method Details

    • setIgnoreCase

      public void setIgnoreCase(boolean fIgnore)
      Use given boolean to decide whether to ignore case for keyword operations
      Parameters:
      fIgnore - the boolean to use to control case interest
    • isIgnoringCase

      public boolean isIgnoringCase()
      Answer wheather the receiver is ignoringCase
      Returns:
      the ignoreCase flag
    • lookup

      public OPToken lookup(String sName)
      Lookup an OPToken by name
      Parameters:
      sName - the name of the token to lookup
      Returns:
      the token found under name or null if absent
    • addToken

      public OPToken addToken(String sName, OPToken token)
      Add a token t under the given name
      Parameters:
      sName - string identifier for this token
      token - the token to add
      Returns:
      the given token
    • addToken

      public OPToken addToken(String sName, OPToken token, String sASTName)
      Add a token t under the given name with given ast name
      Parameters:
      sName - string identifier for this token
      token - the token to add
      sASTName - the token's led symbol
      Returns:
      the given token
    • addToken

      public OPToken addToken(String sName, OPToken token, String sLedName, String sNudName)
      Add a token t under the given name with given led and nud names
      Parameters:
      sName - string identifier for this token
      token - the token to add
      sLedName - the token's led symbol
      sNudName - the token's nud symbol
      Returns:
      the given token
    • addToken

      public OPToken addToken(OPToken token)
      Add a token t under the id stored in the token
      Parameters:
      token - the token to add
      Returns:
      the given token
    • addToken

      public OPToken addToken(OPToken token, String sASTName)
      Add a token t with given ast name
      Parameters:
      token - the token to add
      sASTName - the token to add
      Returns:
      the given token
    • alias

      public void alias(String sName, String sInstalled)
      Add a token alias under the given name for a token already installed
      Parameters:
      sName - string identifier for token alias
      sInstalled - the name of a token already in the table
    • disable

      public void disable(String sName)
      Disable an installed token stored under the given name
      Parameters:
      sName - string identifier for token to disable
    • enable

      public void enable(String sName)
      Enable an installed token stored under the given name
      Parameters:
      sName - string identifier for token to enable
    • newLiteral

      public OPToken newLiteral(String sValue, int nTypeCode)
      Construct a new literal OPToken instance with the given parameters.
      Parameters:
      sValue - string representation of the literal
      nTypeCode - the type code for this literal token
      Returns:
      the token of some appropriate class
    • newIdentifier

      public OPToken newIdentifier(String sValue)
      Construct a new identifier OPToken instance with the given id.
      Parameters:
      sValue - string representation of the literal
      Returns:
      the token of some appropriate class