equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 PPCAbstractActionNode subclass:#PPCActionNode |
|
4 instanceVariableNames:'' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'PetitCompiler-Nodes' |
|
8 ! |
|
9 |
|
10 PPCActionNode comment:'' |
|
11 ! |
|
12 |
|
13 !PPCActionNode methodsFor:'as yet unclassified'! |
|
14 |
|
15 compileWith: compiler effect: effect id: id |
|
16 compiler addConstant: block as: id. |
|
17 |
|
18 compiler startMethod: id. |
|
19 compiler addVariable: 'element'. |
|
20 compiler add: 'element := '. |
|
21 compiler callOnLine: (child compileWith: compiler). |
|
22 compiler add: 'error ifFalse: [ ^ ', id, ' value: element ].'. |
|
23 compiler add: '^ failure'. |
|
24 ^ compiler stopMethod. |
|
25 ! |
|
26 |
|
27 rewrite: changeStatus |
|
28 "TODO JK: Find another way how to recognize the trimming token!!" |
|
29 (name = 'trimmingToken') ifTrue: [ |
|
30 changeStatus change. |
|
31 ^ PPCTrimmingTokenNode new |
|
32 "name: name" |
|
33 "JK: I am sorry" |
|
34 child: child children second child; |
|
35 tokenClass: child children second tokenClass; |
|
36 whitespace: child children first; |
|
37 yourself |
|
38 ]. |
|
39 |
|
40 block isSymbol ifTrue: [ |
|
41 changeStatus change. |
|
42 ^ PPCSymbolActionNode new |
|
43 block: block; |
|
44 name: name; |
|
45 child: child; |
|
46 yourself |
|
47 ] |
|
48 ! ! |
|
49 |