Class TokenTable
java.lang.Object
com.tangosol.coherence.dsltools.precedence.TokenTable
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
ConstructorsConstructorDescriptionConstruct 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
Modifier and TypeMethodDescriptionAdd a token t under the id stored in the tokenAdd a token t with given ast nameAdd a token t under the given nameAdd a token t under the given name with given ast nameAdd a token t under the given name with given led and nud namesvoidAdd a token alias under the given name for a token already installedvoidDisable an installed token stored under the given namevoidEnable an installed token stored under the given namebooleanAnswer wheather the receiver is ignoringCaseLookup an OPToken by namenewIdentifier(String sValue) Construct a new identifier OPToken instance with the given id.newLiteral(String sValue, int nTypeCode) Construct a new literal OPToken instance with the given parameters.voidsetIgnoreCase(boolean fIgnore) Use given boolean to decide whether to ignore case for keyword operations
-
Constructor Details
-
TokenTable
public TokenTable()Construct a new OPToken. -
TokenTable
Construct a new TokenTable with the given parameters to set the ast names for identifiers and literals.- Parameters:
sIdentifierASTName- identifiers ast namessLiteralASTName- 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
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
Add a token t under the given name- Parameters:
sName- string identifier for this tokentoken- the token to add- Returns:
- the given token
-
addToken
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
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
Add a token t under the id stored in the token- Parameters:
token- the token to add- Returns:
- the given token
-
addToken
Add a token t with given ast name- Parameters:
token- the token to addsASTName- the token to add- Returns:
- the given token
-
alias
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
Disable an installed token stored under the given name- Parameters:
sName- string identifier for token to disable
-
enable
Enable an installed token stored under the given name- Parameters:
sName- string identifier for token to enable
-
newLiteral
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
-
newIdentifier
Construct a new identifier OPToken instance with the given id.- Parameters:
sValue- string representation of the literal- Returns:
- the token of some appropriate class
-