|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xrel.parser.SimpleNode
Field Summary | |
protected Node[] |
children
|
protected Token |
first
Modified |
protected int |
id
|
protected Token |
last
Modified |
protected Node |
parent
|
protected XRelParser |
parser
|
protected java.util.HashSet |
Vars
variables annotated on the value. |
Constructor Summary | |
SimpleNode(int i)
The standard constructor. |
|
SimpleNode(XRelParser p,
int i)
This constructor lets you to specify the parser. |
Method Summary | |
void |
annotateValue(java.util.HashSet newSet)
Associate the node with the specified set of variables. |
void |
bindAll()
|
java.lang.Object |
childrenAccept(XRelParserVisitor visitor,
java.lang.Object data)
Accept the visitor. |
protected java.lang.Object |
clone()
Clones this node. |
void |
dumpIntFlat(java.io.PrintStream out)
Writes a tree in a internal flat representation. |
void |
dumpIntTree(java.io.PrintStream out,
java.lang.String prefix)
Writes out to the stream "out" the subtree of this node. |
void |
eraseAnnotations()
Cleans the current node and its subtree from variable annotations. |
void |
eraseSubtreeAnnotations()
Cleans the subtree of the current node from variable annotations. |
void |
exportExpression(java.lang.String filename,
SymTable st)
Exports to the stream "out" the subtree of this node in an XML format. |
Token |
getFirstToken()
Returns the first token associated to this node. |
Token |
getLastToken()
Returns the last token associated to this node. |
java.lang.String |
getPattern()
|
java.lang.Object |
jjtAccept(XRelParserVisitor visitor,
java.lang.Object data)
Accept the visitor. |
void |
jjtAddChild(Node n,
int i)
Adds n to the children list of the current node. |
void |
jjtClose()
This method is called after all the child nodes have been added. |
Node |
jjtGetChild(int i)
This method returns a child node. |
int |
jjtGetNumChildren()
Return the number of children the node has. |
Node |
jjtGetParent()
This method is used to get the parent of the node. |
void |
jjtmAddChildExt(Node n,
int i)
Calls jjtAddChild and sets the parent pointer of the child. |
SimpleNode |
jjtmCloneSubtree()
Clones this node and the whole subtree (by converse clone() makes only a copy of the node itself). |
void |
jjtmMoveChildren(Node dst,
int from,
int upto)
Moves children subset [from,upto] from this node to dst. |
int |
jjtmSearchChild(SimpleNode node)
Searches a child. |
void |
jjtmSetTokens(Token frst,
Token lst)
Sets the first and the last token of the current node. |
void |
jjtOpen()
This method is called after the node has been made the current node. |
void |
jjtSetParent(Node n)
This method is used to set the parent of the node. |
Token |
searchTokenFrom(java.lang.String tk,
Token start)
Searches a token with name tk from the token start. |
void |
showAnnotations(java.io.PrintStream out,
java.lang.String prefix)
|
java.lang.String |
toString()
Returns a string representation of the node. |
java.lang.String |
toString(java.lang.String prefix)
Returns a string representation of the node. |
void |
writeExpression(java.io.PrintStream out,
java.lang.String prefix,
SymTable st)
Writes out to the stream "out" the subtree of this node in a human-readable structured format. |
void |
writePattern(java.io.PrintStream out)
Writes a tree in a compact human-readable form. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Node parent
protected Node[] children
protected int id
protected XRelParser parser
protected Token first
protected Token last
protected java.util.HashSet Vars
Constructor Detail |
public SimpleNode(int i)
i
- the constant that identifies the subclasspublic SimpleNode(XRelParser p, int i)
p
- the parseri
- the constant that identifies the subclassMethod Detail |
public void jjtSetParent(Node n)
Node
jjtSetParent
in interface Node
public Node jjtGetParent()
Node
jjtGetParent
in interface Node
public void jjtAddChild(Node n, int i)
jjtAddChild
in interface Node
n
- the node to become child of the current nodei
- the position in the children list where to put nNode.jjtAddChild(xrel.parser.Node, int)
public Node jjtGetChild(int i)
Node
jjtGetChild
in interface Node
public int jjtGetNumChildren()
Node
jjtGetNumChildren
in interface Node
public java.lang.Object jjtAccept(XRelParserVisitor visitor, java.lang.Object data)
jjtAccept
in interface Node
public java.lang.Object childrenAccept(XRelParserVisitor visitor, java.lang.Object data)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.String toString(java.lang.String prefix)
prefix
- a prefix for the stringpublic void jjtOpen()
Node
jjtOpen
in interface Node
public void jjtClose()
Node
jjtClose
in interface Node
public Token getFirstToken()
public Token getLastToken()
public void writeExpression(java.io.PrintStream out, java.lang.String prefix, SymTable st)
Writes out to the stream "out" the subtree of this node in a human-readable structured format. While dumpIntTree() is used to write the original syntax tree, this function is used to write XML values or output expressions.
N.B.:
out
- the stream where to dump outprefix
- a string of prefixdumpIntTree(PrintStream out, String prefix)
public void exportExpression(java.lang.String filename, SymTable st)
Exports to the stream "out" the subtree of this node in an XML format.
N.B.:
out
- the stream where to dump outprefix
- a string of prefixpublic void writePattern(java.io.PrintStream out)
Writes a tree in a compact human-readable form.
N.B.:
out
- the stream where to print outpublic java.lang.String getPattern()
public void dumpIntTree(java.io.PrintStream out, java.lang.String prefix)
out
- the stream where to dump outprefix
- a string of prefixpublic void dumpIntFlat(java.io.PrintStream out)
Writes a tree in a internal flat representation. Flat means that description stands in a single row. Internal means that the internal tree structure is shown istead of a more human-readable format.
For example "a[],b[] | c[]" is represented as
Par[ Comma[ Tag "a"[Empty], Tag "b"[Empty] ], Tag "c"[Empty] ]
N.B.:
out
- the stream where to print outpublic void annotateValue(java.util.HashSet newSet)
newSet
- public void eraseSubtreeAnnotations()
Cleans the subtree of the current node from variable annotations. Note that it doesn't clean the annotations on the current node, only on the nodes of the subtree.
eraseAnnotations()
public void eraseAnnotations()
Cleans the current node and its subtree from variable annotations. Note that it cleans the annotations both from the current node and from the nodes in the subtree.
eraseSubtreeAnnotations()
public void showAnnotations(java.io.PrintStream out, java.lang.String prefix)
public void bindAll()
public Token searchTokenFrom(java.lang.String tk, Token start)
N.B.: I've added this to search "as".
tk
- the name of the token to searchstart
- where to start to searchpublic SimpleNode jjtmCloneSubtree()
Clones this node and the whole subtree (by converse clone() makes only a copy of the node itself).
protected java.lang.Object clone()
clone
in class java.lang.Object
Object.clone()
public void jjtmAddChildExt(Node n, int i)
n
- the node that will be child of the current nodei
- the position inside the children list.public void jjtmMoveChildren(Node dst, int from, int upto)
dst
- node to which movefrom
- index of the first child to moveupto
- index of the last child to movepublic void jjtmSetTokens(Token frst, Token lst)
frst
- the first tokenlst
- the last tokenpublic int jjtmSearchChild(SimpleNode node)
node
- the node to find
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |