class SimpleTokenManager extends Object implements TokenManager, Cloneable
Modifier and Type | Field and Description |
---|---|
protected Tool |
antlrTool |
protected int |
maxToken |
protected String |
name |
protected boolean |
readOnly |
protected Vector |
vocabulary |
Constructor and Description |
---|
SimpleTokenManager(String name_,
Tool tool_) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
void |
define(TokenSymbol ts)
define a token
|
String |
getName()
Simple token manager doesn't have a name -- must be set externally
|
String |
getTokenStringAt(int idx)
Get a token symbol by index
|
TokenSymbol |
getTokenSymbol(String sym)
Get the TokenSymbol for a string
|
TokenSymbol |
getTokenSymbolAt(int idx)
Get a token symbol by index
|
Enumeration |
getTokenSymbolElements()
Get an enumerator over the symbol table
|
Enumeration |
getTokenSymbolKeys() |
Vector |
getVocabulary()
Get the token vocabulary (read-only).
|
boolean |
isReadOnly()
Simple token manager is not read-only
|
void |
mapToTokenSymbol(String name,
TokenSymbol sym)
Map a label or string to an existing token symbol
|
int |
maxTokenType()
Get the highest token type in use
|
int |
nextTokenType()
Get the next unused token type
|
void |
setName(String name_)
Set the name of the token manager
|
void |
setReadOnly(boolean ro) |
boolean |
tokenDefined(String symbol)
Is a token symbol defined?
|
protected int maxToken
protected Vector vocabulary
protected Tool antlrTool
protected String name
protected boolean readOnly
public Object clone()
clone
in interface TokenManager
clone
in class Object
public void define(TokenSymbol ts)
define
in interface TokenManager
public String getName()
getName
in interface TokenManager
public String getTokenStringAt(int idx)
getTokenStringAt
in interface TokenManager
public TokenSymbol getTokenSymbol(String sym)
getTokenSymbol
in interface TokenManager
public TokenSymbol getTokenSymbolAt(int idx)
getTokenSymbolAt
in interface TokenManager
public Enumeration getTokenSymbolElements()
getTokenSymbolElements
in interface TokenManager
public Enumeration getTokenSymbolKeys()
getTokenSymbolKeys
in interface TokenManager
public Vector getVocabulary()
getVocabulary
in interface TokenManager
public boolean isReadOnly()
isReadOnly
in interface TokenManager
public void mapToTokenSymbol(String name, TokenSymbol sym)
mapToTokenSymbol
in interface TokenManager
public int maxTokenType()
maxTokenType
in interface TokenManager
public int nextTokenType()
nextTokenType
in interface TokenManager
public void setName(String name_)
setName
in interface TokenManager
public void setReadOnly(boolean ro)
setReadOnly
in interface TokenManager
public boolean tokenDefined(String symbol)
tokenDefined
in interface TokenManager