equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 PPCNodeVisitor subclass:#PPCRewritingVisitor |
|
6 instanceVariableNames:'change' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'PetitCompiler-Visitors' |
|
10 ! |
|
11 |
|
12 !PPCRewritingVisitor methodsFor:'as yet unclassified'! |
|
13 |
|
14 change |
|
15 self flag: 'JK: Do we need this?'. |
|
16 change := true. |
|
17 ! |
|
18 |
|
19 visitChild: child of: node |
|
20 | newChild | |
|
21 |
|
22 (self isOpen: child) ifTrue: [ |
|
23 "already processing..." |
|
24 ^ nil |
|
25 ]. |
|
26 |
|
27 (self isCached: child) ifTrue: [ |
|
28 "Use Cached Value" |
|
29 node replace: child with: (self cachedValue: child). |
|
30 ^ nil |
|
31 ]. |
|
32 |
|
33 |
|
34 change := false. |
|
35 newChild := self visit: child. |
|
36 change ifTrue: [ |
|
37 node replace: child with: newChild. |
|
38 ]. |
|
39 ! |
|
40 |
|
41 visitChildren: node |
|
42 node children do: [ :child | |
|
43 self visitChild: child of: node |
|
44 ] |
|
45 ! ! |
|
46 |