|
Generic Interpreter 0.9 Private API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gi.Grammar.ParseTree
This class implements a
constructed by interpreting a source stream.ParseTree
Field Summary | |
Object |
attribute
The attribute at the root of this ParseTree . |
Grammar.ParseTree[] |
phrase
The subtrees of the root of this ParseTree . |
Object |
symbol
The symbol at the root of this ParseTree . |
private static StringBuffer |
tree
The last string representation of a ParseTree returned. |
Constructor Summary | |
(package private) |
Grammar.ParseTree(Object symbol,
Object attribute,
Grammar.ParseTree[] phrase)
Constructs a ParseTree with a root and its subtrees. |
Method Summary | |
String |
toString()
Returns a string representation of this ParseTree . |
private void |
toString(int depth)
Returns a string representation of this ParseTree . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Field Detail |
public Object attribute
The attribute at the root of this ParseTree
. If symbol
is a terminal, attribute
is initially the source word symbol
matches; otherwise, attribute
is initially null
. attribute
may be modified when interpreting by evaluation of embedded Semantics
.
public Grammar.ParseTree[] phrase
The subtrees of the root of this ParseTree
. If symbol
is a nonterminal, phrase
is the array of subtrees produced by symbol
; otherwise, phrase
is null
.
public Object symbol
The symbol at the root of this ParseTree
. symbol
can be a nonterminal, a terminal or Semantics
.
private static StringBuffer tree
The last string representation of a ParseTree
returned.
Constructor Detail |
Grammar.ParseTree(Object symbol, Object attribute, Grammar.ParseTree[] phrase)
Constructs a ParseTree
with a root and its subtrees.
symbol
- the symbol at the root.phrase
- the array of subtrees produced by symbol
.Method Detail |
public String toString()
Returns a string representation of this ParseTree
. The symbols in the ParseTree
are shown in outline form, with children below their parent indented two columns. Each symbol is followed by its attribute value, if it is not null
and differs from the symbol.
toString
in class Object
ParseTree
.private void toString(int depth)
Returns a string representation of this ParseTree
.
ParseTree
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |