01: package antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.cs.usfca.edu
05: * Software rights: http://www.antlr.org/license.html
06: */
07:
08: import java.util.Hashtable;
09: import java.util.Enumeration;
10:
11: import antlr.collections.impl.Vector;
12:
13: /** Interface that describes the set of defined tokens */
14: interface TokenManager {
15: public Object clone();
16:
17: /** define a token symbol */
18: public void define(TokenSymbol ts);
19:
20: /** Get the name of the token manager */
21: public String getName();
22:
23: /** Get a token string by index */
24: public String getTokenStringAt(int idx);
25:
26: /** Get the TokenSymbol for a string */
27: public TokenSymbol getTokenSymbol(String sym);
28:
29: public TokenSymbol getTokenSymbolAt(int idx);
30:
31: /** Get an enumerator over the symbol table */
32: public Enumeration getTokenSymbolElements();
33:
34: public Enumeration getTokenSymbolKeys();
35:
36: /** Get the token vocabulary (read-only).
37: * @return A Vector of Strings indexed by token type */
38: public Vector getVocabulary();
39:
40: /** Is this token manager read-only? */
41: public boolean isReadOnly();
42:
43: public void mapToTokenSymbol(String name, TokenSymbol sym);
44:
45: /** Get the highest token type in use */
46: public int maxTokenType();
47:
48: /** Get the next unused token type */
49: public int nextTokenType();
50:
51: public void setName(String n);
52:
53: public void setReadOnly(boolean ro);
54:
55: /** Is a token symbol defined? */
56: public boolean tokenDefined(String symbol);
57: }
|