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 Summary
Constructors Constructor Description TokenTable()
Construct a new OPToken.TokenTable(String sIdentifierASTName, String sLiteralASTName)
Construct a new TokenTable with the given parameters to set the ast names for identifiers and literals.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OPToken
addToken(OPToken token)
Add a token t under the id stored in the tokenOPToken
addToken(OPToken token, String sASTName)
Add a token t with given ast nameOPToken
addToken(String sName, OPToken token)
Add a token t under the given nameOPToken
addToken(String sName, OPToken token, String sASTName)
Add a token t under the given name with given ast nameOPToken
addToken(String sName, OPToken token, String sLedName, String sNudName)
Add a token t under the given name with given led and nud namesvoid
alias(String sName, String sInstalled)
Add a token alias under the given name for a token already installedvoid
disable(String sName)
Disable an installed token stored under the given namevoid
enable(String sName)
Enable an installed token stored under the given nameboolean
isIgnoringCase()
Answer wheather the receiver is ignoringCaseOPToken
lookup(String sName)
Lookup an OPToken by nameOPToken
newIdentifier(String sValue)
Construct a new identifier OPToken instance with the given id.OPToken
newLiteral(String sValue, int nTypeCode)
Construct a new literal OPToken instance with the given parameters.void
setIgnoreCase(boolean fIgnore)
Use given boolean to decide whether to ignore case for keyword operations
-
-
-
Method Detail
-
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 tokentoken
- 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 tokentoken
- the token to addsASTName
- 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 tokentoken
- the token to addsLedName
- the token's led symbolsNudName
- 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 addsASTName
- 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 aliassInstalled
- 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 literalnTypeCode
- the type code for this literal token- Returns:
- the token of some appropriate class
-
-