Package antlr
Class SimpleTokenManager
java.lang.Object
antlr.SimpleTokenManager
- All Implemented Interfaces:
TokenManager
,Cloneable
- Direct Known Subclasses:
ImportVocabTokenManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
void
define
(TokenSymbol ts) define a tokengetName()
Simple token manager doesn't have a name -- must be set externallygetTokenStringAt
(int idx) Get a token symbol by indexgetTokenSymbol
(String sym) Get the TokenSymbol for a stringgetTokenSymbolAt
(int idx) Get a token symbol by indexGet an enumerator over the symbol tableGet the token vocabulary (read-only).boolean
Simple token manager is not read-onlyvoid
mapToTokenSymbol
(String name, TokenSymbol sym) Map a label or string to an existing token symbolint
Get the highest token type in useint
Get the next unused token typevoid
Set the name of the token managervoid
setReadOnly
(boolean ro) boolean
tokenDefined
(String symbol) Is a token symbol defined?
-
Field Details
-
maxToken
protected int maxToken -
vocabulary
-
antlrTool
-
name
-
readOnly
protected boolean readOnly
-
-
Constructor Details
-
SimpleTokenManager
-
-
Method Details
-
clone
- Specified by:
clone
in interfaceTokenManager
- Overrides:
clone
in classObject
-
define
define a token- Specified by:
define
in interfaceTokenManager
-
getName
Simple token manager doesn't have a name -- must be set externally- Specified by:
getName
in interfaceTokenManager
-
getTokenStringAt
Get a token symbol by index- Specified by:
getTokenStringAt
in interfaceTokenManager
-
getTokenSymbol
Get the TokenSymbol for a string- Specified by:
getTokenSymbol
in interfaceTokenManager
-
getTokenSymbolAt
Get a token symbol by index- Specified by:
getTokenSymbolAt
in interfaceTokenManager
-
getTokenSymbolElements
Get an enumerator over the symbol table- Specified by:
getTokenSymbolElements
in interfaceTokenManager
-
getTokenSymbolKeys
- Specified by:
getTokenSymbolKeys
in interfaceTokenManager
-
getVocabulary
Get the token vocabulary (read-only).- Specified by:
getVocabulary
in interfaceTokenManager
- Returns:
- A Vector of TokenSymbol
-
isReadOnly
public boolean isReadOnly()Simple token manager is not read-only- Specified by:
isReadOnly
in interfaceTokenManager
-
mapToTokenSymbol
Map a label or string to an existing token symbol- Specified by:
mapToTokenSymbol
in interfaceTokenManager
-
maxTokenType
public int maxTokenType()Get the highest token type in use- Specified by:
maxTokenType
in interfaceTokenManager
-
nextTokenType
public int nextTokenType()Get the next unused token type- Specified by:
nextTokenType
in interfaceTokenManager
-
setName
Set the name of the token manager- Specified by:
setName
in interfaceTokenManager
-
setReadOnly
public void setReadOnly(boolean ro) - Specified by:
setReadOnly
in interfaceTokenManager
-
tokenDefined
Is a token symbol defined?- Specified by:
tokenDefined
in interfaceTokenManager
-