equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 PPCDelegateNode subclass:#PPCTrimNode |
|
4 instanceVariableNames:'' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'PetitCompiler-Nodes' |
|
8 ! |
|
9 |
|
10 PPCTrimNode comment:'' |
|
11 ! |
|
12 |
|
13 !PPCTrimNode methodsFor:'accessing'! |
|
14 |
|
15 prefix |
|
16 ^ #trim |
|
17 ! ! |
|
18 |
|
19 !PPCTrimNode methodsFor:'compiling'! |
|
20 |
|
21 compileWith: compiler effect: effect id: id |
|
22 "TODO: This ignores the TrimmingParser trimmer object!!" |
|
23 compiler startMethod: id. |
|
24 compiler addVariable: 'result'. |
|
25 |
|
26 compiler add: '[context atEnd not and: [ context uncheckedPeek isSeparator ]] whileTrue: ['. |
|
27 compiler indent. |
|
28 compiler add: 'context next'. |
|
29 compiler dedent. |
|
30 compiler add: '].'. |
|
31 |
|
32 compiler add: 'result := '. |
|
33 compiler callOnLine: (child compileWith: compiler). |
|
34 |
|
35 compiler add: '[context atEnd not and: [ context uncheckedPeek isSeparator ]] whileTrue: ['. |
|
36 compiler indent. |
|
37 compiler add: 'context next'. |
|
38 compiler dedent. |
|
39 compiler add: '].'. |
|
40 |
|
41 compiler add: '^ result'. |
|
42 compiler stopMethod. |
|
43 ^ compiler lastMethod |
|
44 ! ! |
|
45 |