antlr

Class SimpleTokenManager

class SimpleTokenManager extends Object implements TokenManager, Cloneable

Field Summary
protected ToolantlrTool
protected intmaxToken
protected Stringname
protected booleanreadOnly
protected Vectorvocabulary
Constructor Summary
SimpleTokenManager(String name_, Tool tool_)
Method Summary
Objectclone()
voiddefine(TokenSymbol ts)
define a token
StringgetName()
Simple token manager doesn't have a name -- must be set externally
StringgetTokenStringAt(int idx)
Get a token symbol by index
TokenSymbolgetTokenSymbol(String sym)
Get the TokenSymbol for a string
TokenSymbolgetTokenSymbolAt(int idx)
Get a token symbol by index
EnumerationgetTokenSymbolElements()
Get an enumerator over the symbol table
EnumerationgetTokenSymbolKeys()
VectorgetVocabulary()
Get the token vocabulary (read-only).
booleanisReadOnly()
Simple token manager is not read-only
voidmapToTokenSymbol(String name, TokenSymbol sym)
Map a label or string to an existing token symbol
intmaxTokenType()
Get the highest token type in use
intnextTokenType()
Get the next unused token type
voidsetName(String name_)
Set the name of the token manager
voidsetReadOnly(boolean ro)
booleantokenDefined(String symbol)
Is a token symbol defined?

Field Detail

antlrTool

protected Tool antlrTool

maxToken

protected int maxToken

name

protected String name

readOnly

protected boolean readOnly

vocabulary

protected Vector vocabulary

Constructor Detail

SimpleTokenManager

SimpleTokenManager(String name_, Tool tool_)

Method Detail

clone

public Object clone()

define

public void define(TokenSymbol ts)
define a token

getName

public String getName()
Simple token manager doesn't have a name -- must be set externally

getTokenStringAt

public String getTokenStringAt(int idx)
Get a token symbol by index

getTokenSymbol

public TokenSymbol getTokenSymbol(String sym)
Get the TokenSymbol for a string

getTokenSymbolAt

public TokenSymbol getTokenSymbolAt(int idx)
Get a token symbol by index

getTokenSymbolElements

public Enumeration getTokenSymbolElements()
Get an enumerator over the symbol table

getTokenSymbolKeys

public Enumeration getTokenSymbolKeys()

getVocabulary

public Vector getVocabulary()
Get the token vocabulary (read-only).

Returns: A Vector of TokenSymbol

isReadOnly

public boolean isReadOnly()
Simple token manager is not read-only

mapToTokenSymbol

public void mapToTokenSymbol(String name, TokenSymbol sym)
Map a label or string to an existing token symbol

maxTokenType

public int maxTokenType()
Get the highest token type in use

nextTokenType

public int nextTokenType()
Get the next unused token type

setName

public void setName(String name_)
Set the name of the token manager

setReadOnly

public void setReadOnly(boolean ro)

tokenDefined

public boolean tokenDefined(String symbol)
Is a token symbol defined?