01: package persistence.antlr.collections;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.jGuru.com
05: * Software rights: http://www.antlr.org/license.html
06: *
07: */
08:
09: import persistence.antlr.Token;
10:
11: /** Minimal AST node interface used by ANTLR AST generation
12: * and tree-walker.
13: */
14: public interface AST {
15: /** Add a (rightmost) child to this node */
16: public void addChild(AST c);
17:
18: public boolean equals(AST t);
19:
20: public boolean equalsList(AST t);
21:
22: public boolean equalsListPartial(AST t);
23:
24: public boolean equalsTree(AST t);
25:
26: public boolean equalsTreePartial(AST t);
27:
28: public ASTEnumeration findAll(AST tree);
29:
30: public ASTEnumeration findAllPartial(AST subtree);
31:
32: /** Get the first child of this node; null if no children */
33: public AST getFirstChild();
34:
35: /** Get the next sibling in line after this one */
36: public AST getNextSibling();
37:
38: /** Get the token text for this node */
39: public String getText();
40:
41: /** Get the token type for this node */
42: public int getType();
43:
44: /** @since 2.7.3 Need for error handling */
45: public int getLine();
46:
47: /** @since 2.7.3 Need for error handling */
48: public int getColumn();
49:
50: /** Get number of children of this node; if leaf, returns 0 */
51: public int getNumberOfChildren();
52:
53: public void initialize(int t, String txt);
54:
55: public void initialize(AST t);
56:
57: public void initialize(Token t);
58:
59: /** Set the first child of a node. */
60: public void setFirstChild(AST c);
61:
62: /** Set the next sibling after this one. */
63: public void setNextSibling(AST n);
64:
65: /** Set the token text for this node */
66: public void setText(String text);
67:
68: /** Set the token type for this node */
69: public void setType(int ttype);
70:
71: public String toString();
72:
73: public String toStringList();
74:
75: public String toStringTree();
76: }
|