equal
deleted
inserted
replaced
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 PPCActionNode subclass:#PPCTokenActionNode |
|
6 instanceVariableNames:'' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'PetitCompiler-Nodes' |
|
10 ! |
|
11 |
|
12 !PPCTokenActionNode methodsFor:'as yet unclassified'! |
|
13 |
|
14 asFast |
|
15 ^ self |
|
16 ! |
|
17 |
|
18 compileWith: compiler effect: effect id: id |
|
19 | | |
|
20 compiler addConstant: block as: id. |
|
21 |
|
22 " |
|
23 Actually, do nothing, we are in Token mode and the |
|
24 child does not return any result and token takes only |
|
25 the input value. |
|
26 " |
|
27 compiler startMethod: id. |
|
28 compiler add: '^ '. |
|
29 compiler callOnLine: (child compileWith: compiler). |
|
30 ^ compiler stopMethod. |
|
31 ! |
|
32 |
|
33 rewrite: changeStatus |
|
34 (self hasProperty: #trimmingToken) ifTrue: [ |
|
35 | retval | |
|
36 changeStatus change. |
|
37 "Get rid of action and sequence with whitespace" |
|
38 retval := child children second child. "JK: oups, what a chain!!" |
|
39 retval name ifNil: [ retval name: self name ]. |
|
40 ^ retval |
|
41 ]. |
|
42 |
|
43 child name ifNil: [ |
|
44 changeStatus change. |
|
45 child name: self name. |
|
46 ^ child |
|
47 ]. |
|
48 |
|
49 (child name = self name) ifTrue: [ |
|
50 changeStatus change. |
|
51 ^ child |
|
52 ] |
|
53 ! |
|
54 |
|
55 suffix |
|
56 ^ '_fast' |
|
57 ! ! |
|
58 |
|