1 | using System; |
---|
2 | using IEnumerator = System.Collections.IEnumerator; |
---|
3 | |
---|
4 | using IToken = antlr.IToken; |
---|
5 | |
---|
6 | namespace antlr.collections |
---|
7 | { |
---|
8 | /*ANTLR Translator Generator |
---|
9 | * Project led by Terence Parr at http://www.jGuru.com |
---|
10 | * Software rights: http://www.antlr.org/license.html |
---|
11 | * |
---|
12 | * $Id:$ |
---|
13 | */ |
---|
14 | |
---|
15 | // |
---|
16 | // ANTLR C# Code Generator by Micheal Jordan |
---|
17 | // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com |
---|
18 | // Anthony Oguntimehin |
---|
19 | // |
---|
20 | // With many thanks to Eric V. Smith from the ANTLR list. |
---|
21 | // |
---|
22 | |
---|
23 | /// <summary> |
---|
24 | /// Minimal AST node interface used by ANTLR AST generation and tree-walker. |
---|
25 | /// </summary> |
---|
26 | public interface AST : ICloneable |
---|
27 | { |
---|
28 | /// <summary> |
---|
29 | /// Add a (rightmost) child to this node |
---|
30 | /// </summary> |
---|
31 | /// <param name="c"></param> |
---|
32 | void addChild(AST c); |
---|
33 | bool Equals(AST t); |
---|
34 | bool EqualsList(AST t); |
---|
35 | bool EqualsListPartial(AST t); |
---|
36 | bool EqualsTree(AST t); |
---|
37 | bool EqualsTreePartial(AST t); |
---|
38 | IEnumerator findAll(AST tree); |
---|
39 | IEnumerator findAllPartial(AST subtree); |
---|
40 | /// <summary> |
---|
41 | /// Get the first child of this node; null if no children |
---|
42 | /// </summary> |
---|
43 | AST getFirstChild(); |
---|
44 | /// <summary> |
---|
45 | /// Get the next sibling in line after this one |
---|
46 | /// </summary> |
---|
47 | AST getNextSibling(); |
---|
48 | /// <summary> |
---|
49 | /// Get the token text for this node |
---|
50 | /// </summary> |
---|
51 | /// <returns></returns> |
---|
52 | string getText(); |
---|
53 | /// <summary> |
---|
54 | /// Get the token type for this node |
---|
55 | /// </summary> |
---|
56 | int Type { get; set;} |
---|
57 | /// <summary> |
---|
58 | /// Get number of children of this node; if leaf, returns 0 |
---|
59 | /// </summary> |
---|
60 | /// <returns>Number of children</returns> |
---|
61 | int getNumberOfChildren(); |
---|
62 | void initialize(int t, string txt); |
---|
63 | void initialize(AST t); |
---|
64 | void initialize(IToken t); |
---|
65 | /// <summary> |
---|
66 | /// Set the first child of a node. |
---|
67 | /// </summary> |
---|
68 | /// <param name="c"></param> |
---|
69 | void setFirstChild(AST c); |
---|
70 | /// <summary> |
---|
71 | /// Set the next sibling after this one. |
---|
72 | /// </summary> |
---|
73 | /// <param name="n"></param> |
---|
74 | void setNextSibling(AST n); |
---|
75 | /// <summary> |
---|
76 | /// Set the token text for this node |
---|
77 | /// </summary> |
---|
78 | /// <param name="text"></param> |
---|
79 | void setText(string text); |
---|
80 | /// <summary> |
---|
81 | /// Set the token type for this node |
---|
82 | /// </summary> |
---|
83 | /// <param name="ttype"></param> |
---|
84 | void setType(int ttype); |
---|
85 | string ToString(); |
---|
86 | string ToStringList(); |
---|
87 | string ToStringTree(); |
---|
88 | } |
---|
89 | } |
---|