KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > antlr > TokenManager


1 package antlr;
2
3 /* ANTLR Translator Generator
4  * Project led by Terence Parr at http://www.jGuru.com
5  * Software rights: http://www.antlr.org/RIGHTS.html
6  *
7  * $Id: //depot/code/org.antlr/main/main/antlr/TokenManager.java#4 $
8  */

9
10 import java.util.Hashtable JavaDoc;
11 import java.util.Enumeration JavaDoc;
12
13 import antlr.collections.impl.Vector;
14
15 /** Interface that describes the set of defined tokens */
16 interface TokenManager {
17     public Object JavaDoc clone();
18
19     /** define a token symbol */
20     public void define(TokenSymbol ts);
21
22     /** Get the name of the token manager */
23     public String JavaDoc getName();
24
25     /** Get a token string by index */
26     public String JavaDoc getTokenStringAt(int idx);
27
28     /** Get the TokenSymbol for a string */
29     public TokenSymbol getTokenSymbol(String JavaDoc sym);
30
31     public TokenSymbol getTokenSymbolAt(int idx);
32
33     /** Get an enumerator over the symbol table */
34     public Enumeration JavaDoc getTokenSymbolElements();
35
36     public Enumeration JavaDoc getTokenSymbolKeys();
37
38     /** Get the token vocabulary (read-only).
39      * @return A Vector of Strings indexed by token type */

40     public Vector getVocabulary();
41
42     /** Is this token manager read-only? */
43     public boolean isReadOnly();
44
45     public void mapToTokenSymbol(String JavaDoc name, TokenSymbol sym);
46
47     /** Get the highest token type in use */
48     public int maxTokenType();
49
50     /** Get the next unused token type */
51     public int nextTokenType();
52
53     public void setName(String JavaDoc n);
54
55     public void setReadOnly(boolean ro);
56
57     /** Is a token symbol defined? */
58     public boolean tokenDefined(String JavaDoc symbol);
59 }
60
Popular Tags