|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttip.analysis.AnalysisAdapter
tip.analysis.DepthFirstAdapter
tip.display.ASTDisplay
public class ASTDisplay
Nested Class Summary | |
---|---|
static class |
ASTDisplay.Phase
Enum used for designating for which phases the AST should be displayed. |
Constructor Summary | |
---|---|
ASTDisplay(String title)
Creates a new ASTDisplay with the given dialog title. |
Method Summary | |
---|---|
static void |
addDisplayPhase(ASTDisplay.Phase phase)
Adds the given phase to the set of phases for which the AST is displayed. |
static void |
awaitDisplays()
Wait for all open displays to be closed before continuing. |
void |
caseEOF(EOF node)
Called by the EOF node from EOF#apply(Switch) . |
void |
caseStart(Start node)
Calls DepthFirstAdapter.inStart(Start) , traverses the children of Start in
the order they are defined in the grammar, and finally calls DepthFirstAdapter.outStart(Start) . |
static void |
clearDisplayPhases()
Clears the set of phases for which the AST is displayed. |
void |
defaultIn(Node node)
As we come across nonterminals, push them onto the stack |
void |
defaultOut(Node node)
As we leave a non terminal, it's parent is the node before it on the stack, so we pop it off and add it to that node |
void |
defaultToken(Token token)
Terminals - our parent is always on the top of the stack, so we add ourselves to it |
static void |
expandAll(JTree tree,
boolean expand)
If expand is true , expands all nodes in the tree. |
void |
outAProgram(AProgram node)
Called by DepthFirstAdapter.caseAProgram(AProgram) after traversing the children of AProgram . |
static void |
showPhaseDisplay(AProgram program,
ASTDisplay.Phase phase)
Shows the ASTDisplay for the given phase. |
Methods inherited from class tip.analysis.AnalysisAdapter |
---|
caseTAnd, caseTAssign, caseTComma, caseTCommentBlock, caseTCommentSingle, caseTDiv, caseTElse, caseTEq, caseTGt, caseTIdentifier, caseTIf, caseTInput, caseTIntegerConst, caseTLBrace, caseTLPar, caseTMalloc, caseTMinus, caseTNull, caseTOutput, caseTPlus, caseTRBrace, caseTReturn, caseTRPar, caseTSemicolon, caseTStar, caseTVar, caseTWhile, caseTWhiteSpace, defaultNode, getIn, getOut, setIn, setOut |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ASTDisplay(String title)
title
- the displayed dialog titleMethod Detail |
---|
public void outAProgram(AProgram node)
DepthFirstAdapter
DepthFirstAdapter.caseAProgram(AProgram)
after traversing the children of AProgram
.
outAProgram
in class DepthFirstAdapter
node
- the visited AProgram
nodepublic void defaultIn(Node node)
defaultIn
in class DepthFirstAdapter
node
- the handled nodepublic void defaultOut(Node node)
defaultOut
in class DepthFirstAdapter
node
- the visited Node
public void defaultToken(Token token)
defaultToken
in class AnalysisAdapter
token
- the added tokenpublic final void caseStart(Start node)
DepthFirstAdapter
DepthFirstAdapter.inStart(Start)
, traverses the children of Start
in
the order they are defined in the grammar, and finally calls DepthFirstAdapter.outStart(Start)
.
caseStart
in interface Analysis
caseStart
in class DepthFirstAdapter
node
- the visited Start
nodepublic final void caseEOF(EOF node)
AnalysisAdapter
EOF
node from EOF#apply(Switch)
.
caseEOF
in interface Analysis
caseEOF
in class AnalysisAdapter
node
- the calling EOF
tokenpublic static void addDisplayPhase(ASTDisplay.Phase phase)
phase
- the added phasepublic static void clearDisplayPhases()
public static void showPhaseDisplay(AProgram program, ASTDisplay.Phase phase)
program
- the program ASTphase
- the phase for which to display the ASTpublic static void awaitDisplays()
public static void expandAll(JTree tree, boolean expand)
true
, expands all nodes in the tree. Otherwise,
collapses all nodes in the tree.
tree
- the expanded/collapsed treeexpand
- expand/collapse switch
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |