|
1 "{ Package: 'stx:goodies/petitparser/parsers/java' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 Object subclass:#PJASTNodeVisitor |
|
6 instanceVariableNames:'' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'PetitJava-AST-Visitors' |
|
10 ! |
|
11 |
|
12 PJASTNodeVisitor comment:'Abstract visitor with all methods needed to visit a PetitJava AST' |
|
13 ! |
|
14 |
|
15 !PJASTNodeVisitor methodsFor:'as yet unclassified'! |
|
16 |
|
17 visitEndOfLineCommentsNode: anEndOfLineCommentNode |
|
18 self visitNode: anEndOfLineCommentNode expression |
|
19 ! |
|
20 |
|
21 visitTraditionalCommentsNode: aCommentNode |
|
22 self visitNode: aCommentNode expression |
|
23 ! ! |
|
24 |
|
25 !PJASTNodeVisitor methodsFor:'visiting'! |
|
26 |
|
27 visitNode: aNode |
|
28 |
|
29 ^aNode acceptVisitor: self |
|
30 ! ! |
|
31 |
|
32 !PJASTNodeVisitor methodsFor:'visitor-doubleDispatching'! |
|
33 |
|
34 visitBlockNode: aBodyNode |
|
35 self visitNodes: aBodyNode statements |
|
36 ! |
|
37 |
|
38 visitBooleanLiteralNode: aBooleanLiteralNode |
|
39 self subclassResponsibility |
|
40 ! |
|
41 |
|
42 visitCharacterLiteralNode: aCharacterLiteralNode |
|
43 self subclassResponsibility |
|
44 ! |
|
45 |
|
46 visitCommentsNode: aCommentNode |
|
47 self visitNode: aCommentNode expression |
|
48 ! |
|
49 |
|
50 visitCompilationUnitNode: aCompilationUnitNode |
|
51 |
|
52 self flag: 'TODO' |
|
53 ! |
|
54 |
|
55 visitExpressionStatementNode: anExpressionStatementNode |
|
56 self visitNode: anExpressionStatementNode expression |
|
57 ! |
|
58 |
|
59 visitFloatLiteralNode: aIntegerLiteralNode |
|
60 self subclassResponsibility |
|
61 ! |
|
62 |
|
63 visitIdentifierNode: anIdentifierNode |
|
64 self subclassResponsibility |
|
65 ! |
|
66 |
|
67 visitIfStatementNode: anIfStatementNode |
|
68 |
|
69 self visitNode: anIfStatementNode condition. |
|
70 self visitNode: anIfStatementNode thenPart. |
|
71 self visitNode: anIfStatementNode elsePart |
|
72 ! |
|
73 |
|
74 visitImportDeclarationNode: anImportDeclarationNode |
|
75 |
|
76 self visitNode: anImportDeclarationNode nameNode |
|
77 ! |
|
78 |
|
79 visitInfixOperationNode: anInfixOperationNode |
|
80 self visitNode: anInfixOperationNode left. |
|
81 self visitNode: anInfixOperationNode right |
|
82 ! |
|
83 |
|
84 visitIntegerLiteralNode: aIntegerLiteralNode |
|
85 self subclassResponsibility |
|
86 ! |
|
87 |
|
88 visitLocalVariableDeclarationStatementNode: aLocalVariableDeclarationStatementNode |
|
89 self visitNode: aLocalVariableDeclarationStatementNode type. |
|
90 self visitNodes: aLocalVariableDeclarationStatementNode modifiers. |
|
91 self visitNode: aLocalVariableDeclarationStatementNode declarators |
|
92 ! |
|
93 |
|
94 visitMethodDeclarationNode: aMethodDeclarationNode |
|
95 self visitNode: aMethodDeclarationNode returnType. |
|
96 self visitNode: aMethodDeclarationNode simpleName. |
|
97 self visitNode: aMethodDeclarationNode block |
|
98 ! |
|
99 |
|
100 visitNameNode: aNameNode |
|
101 "this is a leaf, so no further traversing" |
|
102 ! |
|
103 |
|
104 visitNodes: aCollection |
|
105 aCollection do: [:each | each acceptVisitor: self] |
|
106 ! |
|
107 |
|
108 visitNullLiteralNode: aNullLiteralNode |
|
109 self subclassResponsibility |
|
110 ! |
|
111 |
|
112 visitPackageDeclarationNode: aPackageDeclarationNode |
|
113 |
|
114 self visitNode: aPackageDeclarationNode nameNode |
|
115 ! |
|
116 |
|
117 visitParameterDeclaratorNode: aParameterDeclaratorNode |
|
118 self visitNode: aParameterDeclaratorNode identifier. |
|
119 self visitNodes: aParameterDeclaratorNode modifiers |
|
120 ! |
|
121 |
|
122 visitReturnStatementNode: aReturnStatementNode |
|
123 self visitNode: aReturnStatementNode expression |
|
124 ! |
|
125 |
|
126 visitSeparatorNode: aSeparatorNode |
|
127 self subclassResponsibility |
|
128 ! |
|
129 |
|
130 visitStringLiteralNode: aStringLiteralNode |
|
131 self subclassResponsibility |
|
132 ! |
|
133 |
|
134 visitVariableDeclaratorNode: aVariableDeclaratorNode |
|
135 self visitNode: aVariableDeclaratorNode variable. |
|
136 self visitNode: aVariableDeclaratorNode initializer |
|
137 ! |
|
138 |
|
139 visitWhileStatementNode: aWhileStatementNode |
|
140 |
|
141 self visitNode: aWhileStatementNode expression. |
|
142 self visitNode: aWhileStatementNode statement |
|
143 ! ! |
|
144 |