org.tromer.jie.visitor
Class PiggybackTreeDumper
java.lang.Object
|
+--org.tromer.jie.visitor.PiggybackDepthFirst
|
+--org.tromer.jie.visitor.PiggybackTreeDumper
- Direct Known Subclasses:
- InstrumentedTreeDumper
- public class PiggybackTreeDumper
- extends PiggybackDepthFirst
The PiggybackTreeDumper class is similar to TreeDumper
but adds piggyback support.
Autogenerated from TreeDumper.java by makeVisitors.pl. Original description:
Dumps the syntax tree to a Writer using the location information in
each NodeToken.
Method Summary |
void |
flushWriter()
Flushes the OutputStream or Writer that this PiggybackTreeDumper is using. |
protected static int |
lastIndexOfNewline(java.lang.String s,
int end)
Similar to s.lastIndexOf('\n', int) , but handles all
possible newlines combinations (CR, LF, CRLF). |
void |
printSpecials(boolean b)
Allows you to specify whether or not to print special tokens. |
protected void |
printToken(java.lang.String s)
|
void |
resetPosition()
Resets the position of the output "cursor" to the first line and
column. |
void |
startAtNextToken()
Starts the tree dumper on the line containing the next token
visited. |
void |
visit(NodeToken n)
Dumps the current NodeToken to the output stream being used. |
Methods inherited from class org.tromer.jie.visitor.PiggybackDepthFirst |
processPostpiggy,
processPrepiggy,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit,
visit |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
out
protected java.io.PrintWriter out
curLine
protected int curLine
curColumn
protected int curColumn
startAtNextToken
protected boolean startAtNextToken
printSpecials
protected boolean printSpecials
PiggybackTreeDumper
public PiggybackTreeDumper()
- The default constructor uses System.out as its output location.
You may specify your own Writer or OutputStream using one of the
other constructors.
PiggybackTreeDumper
public PiggybackTreeDumper(java.io.Writer o)
PiggybackTreeDumper
public PiggybackTreeDumper(java.io.OutputStream o)
flushWriter
public void flushWriter()
- Flushes the OutputStream or Writer that this PiggybackTreeDumper is using.
printSpecials
public void printSpecials(boolean b)
- Allows you to specify whether or not to print special tokens.
startAtNextToken
public void startAtNextToken()
- Starts the tree dumper on the line containing the next token
visited. For example, if the next token begins on line 50 and the
dumper is currently on line 1 of the file, it will set its current
line to 50 and continue printing from there, as opposed to
printing 49 blank lines and then printing the token.
resetPosition
public void resetPosition()
- Resets the position of the output "cursor" to the first line and
column. When using a dumper on a syntax tree more than once, you
either need to call this method or startAtNextToken() between each
dump.
visit
public void visit(NodeToken n)
- Dumps the current NodeToken to the output stream being used.
- Overrides:
- visit in class PiggybackDepthFirst
- Throws:
- IllegalStateException - if the token position is invalid
relative to the current position, i.e. its location places it
before the previous token.
printToken
protected void printToken(java.lang.String s)
lastIndexOfNewline
protected static int lastIndexOfNewline(java.lang.String s,
int end)
- Similar to
s.lastIndexOf('\n', int)
, but handles all
possible newlines combinations (CR, LF, CRLF).