Package antlr
Class SimpleTokenManager
- java.lang.Object
-
- antlr.SimpleTokenManager
-
- All Implemented Interfaces:
TokenManager,Cloneable
- Direct Known Subclasses:
ImportVocabTokenManager
class SimpleTokenManager extends Object implements TokenManager, Cloneable
-
-
Constructor Summary
Constructors Constructor Description SimpleTokenManager(String name_, Tool tool_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()voiddefine(TokenSymbol ts)define a tokenStringgetName()Simple token manager doesn't have a name -- must be set externallyStringgetTokenStringAt(int idx)Get a token symbol by indexTokenSymbolgetTokenSymbol(String sym)Get the TokenSymbol for a stringTokenSymbolgetTokenSymbolAt(int idx)Get a token symbol by indexEnumerationgetTokenSymbolElements()Get an enumerator over the symbol tableEnumerationgetTokenSymbolKeys()VectorgetVocabulary()Get the token vocabulary (read-only).booleanisReadOnly()Simple token manager is not read-onlyvoidmapToTokenSymbol(String name, TokenSymbol sym)Map a label or string to an existing token symbolintmaxTokenType()Get the highest token type in useintnextTokenType()Get the next unused token typevoidsetName(String name_)Set the name of the token managervoidsetReadOnly(boolean ro)booleantokenDefined(String symbol)Is a token symbol defined?
-
-
-
Method Detail
-
clone
public Object clone()
- Specified by:
clonein interfaceTokenManager- Overrides:
clonein classObject
-
define
public void define(TokenSymbol ts)
define a token- Specified by:
definein interfaceTokenManager
-
getName
public String getName()
Simple token manager doesn't have a name -- must be set externally- Specified by:
getNamein interfaceTokenManager
-
getTokenStringAt
public String getTokenStringAt(int idx)
Get a token symbol by index- Specified by:
getTokenStringAtin interfaceTokenManager
-
getTokenSymbol
public TokenSymbol getTokenSymbol(String sym)
Get the TokenSymbol for a string- Specified by:
getTokenSymbolin interfaceTokenManager
-
getTokenSymbolAt
public TokenSymbol getTokenSymbolAt(int idx)
Get a token symbol by index- Specified by:
getTokenSymbolAtin interfaceTokenManager
-
getTokenSymbolElements
public Enumeration getTokenSymbolElements()
Get an enumerator over the symbol table- Specified by:
getTokenSymbolElementsin interfaceTokenManager
-
getTokenSymbolKeys
public Enumeration getTokenSymbolKeys()
- Specified by:
getTokenSymbolKeysin interfaceTokenManager
-
getVocabulary
public Vector getVocabulary()
Get the token vocabulary (read-only).- Specified by:
getVocabularyin interfaceTokenManager- Returns:
- A Vector of TokenSymbol
-
isReadOnly
public boolean isReadOnly()
Simple token manager is not read-only- Specified by:
isReadOnlyin interfaceTokenManager
-
mapToTokenSymbol
public void mapToTokenSymbol(String name, TokenSymbol sym)
Map a label or string to an existing token symbol- Specified by:
mapToTokenSymbolin interfaceTokenManager
-
maxTokenType
public int maxTokenType()
Get the highest token type in use- Specified by:
maxTokenTypein interfaceTokenManager
-
nextTokenType
public int nextTokenType()
Get the next unused token type- Specified by:
nextTokenTypein interfaceTokenManager
-
setName
public void setName(String name_)
Set the name of the token manager- Specified by:
setNamein interfaceTokenManager
-
setReadOnly
public void setReadOnly(boolean ro)
- Specified by:
setReadOnlyin interfaceTokenManager
-
tokenDefined
public boolean tokenDefined(String symbol)
Is a token symbol defined?- Specified by:
tokenDefinedin interfaceTokenManager
-
-