|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object spiglet.visitor.DepthFirstVisitor spiglet.visitor.TreeFormatter spiglet.visitor.SpigletFormatter
public class SpigletFormatter
A pretty printer visitor designed to be used together with
TreeDumper
to generate a formatted string that is the Spiglet code.
Based on the
PigletFormatter, in the homework's website.
TreeDumper
Constructor Summary | |
---|---|
SpigletFormatter()
|
Method Summary | |
---|---|
protected void |
processList(NodeListInterface n)
Accepts a NodeListInterface object and performs an optional format command between each node in the list (but not after the last node). |
void |
visit(Call n)
nodeToken -> "CALL" simpleExp -> SimpleExp() nodeToken1 -> "(" nodeListOptional -> ( Temp() )* nodeToken2 -> ")" |
void |
visit(Goal n)
nodeToken -> "MAIN" stmtList -> StmtList() nodeToken1 -> "END" nodeListOptional -> ( Procedure() )* nodeToken2 -> <EOF> |
void |
visit(NodeToken n)
Executes the commands waiting in the command queue, then inserts the proper location information into the current NodeToken. |
void |
visit(Procedure n)
label -> Label() nodeToken -> "[" integerLiteral -> IntegerLiteral() nodeToken1 -> "]" stmtExp -> StmtExp() |
void |
visit(StmtExp n)
nodeToken -> "BEGIN" stmtList -> StmtList() nodeToken1 -> "RETURN" simpleExp -> SimpleExp() nodeToken2 -> "END" |
Methods inherited from class spiglet.visitor.TreeFormatter |
---|
add, force, force, indent, indent, outdent, outdent, processList, space, space, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class spiglet.visitor.DepthFirstVisitor |
---|
visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SpigletFormatter()
Method Detail |
---|
protected void processList(NodeListInterface n)
TreeFormatter
processList
in class TreeFormatter
public void visit(NodeToken n)
TreeFormatter
visit
in interface Visitor
visit
in class TreeFormatter
public void visit(Goal n)
TreeFormatter
nodeToken -> "MAIN" stmtList -> StmtList() nodeToken1 -> "END" nodeListOptional -> ( Procedure() )* nodeToken2 -> <EOF>
visit
in interface Visitor
visit
in class TreeFormatter
public void visit(Procedure n)
TreeFormatter
label -> Label() nodeToken -> "[" integerLiteral -> IntegerLiteral() nodeToken1 -> "]" stmtExp -> StmtExp()
visit
in interface Visitor
visit
in class TreeFormatter
public void visit(StmtExp n)
TreeFormatter
nodeToken -> "BEGIN" stmtList -> StmtList() nodeToken1 -> "RETURN" simpleExp -> SimpleExp() nodeToken2 -> "END"
visit
in interface Visitor
visit
in class TreeFormatter
public void visit(Call n)
TreeFormatter
nodeToken -> "CALL" simpleExp -> SimpleExp() nodeToken1 -> "(" nodeListOptional -> ( Temp() )* nodeToken2 -> ")"
visit
in interface Visitor
visit
in class TreeFormatter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |