org.tromer.jie.visitor
Class PrePostTreeDumper
java.lang.Object
|
+--org.tromer.jie.visitor.PrePostDepthFirst
|
+--org.tromer.jie.visitor.PrePostTreeDumper
- Direct Known Subclasses:
- InstrumentedTreeDumper
- public class PrePostTreeDumper
- extends PrePostDepthFirst
The PrePostTreeDumper class is similar to TreeDumper
but adds node pre/post processing 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 PrePostTreeDumper 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.PrePostDepthFirst |
postprocess,
preprocess,
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,
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
PrePostTreeDumper
public PrePostTreeDumper()
- The default constructor uses System.out as its output location.
You may specify your own Writer or OutputStream using one of the
other constructors.
PrePostTreeDumper
public PrePostTreeDumper(java.io.Writer o)
PrePostTreeDumper
public PrePostTreeDumper(java.io.OutputStream o)
flushWriter
public void flushWriter()
throws java.io.IOException
- Flushes the OutputStream or Writer that this PrePostTreeDumper 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 PrePostDepthFirst
- 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).