equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 PPCNode subclass:#PPCStarCharSetPredicateNode |
|
4 instanceVariableNames:'predicate' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'PetitCompiler-Nodes' |
|
8 ! |
|
9 |
|
10 PPCStarCharSetPredicateNode comment:'' |
|
11 ! |
|
12 |
|
13 !PPCStarCharSetPredicateNode methodsFor:'accessing'! |
|
14 |
|
15 acceptsEpsilon |
|
16 ^ true |
|
17 ! |
|
18 |
|
19 compileWith: compiler effect: effect id: id |
|
20 | classification classificationId | |
|
21 |
|
22 compiler startMethod: id. |
|
23 classification := self extendClassification: predicate classification. |
|
24 classificationId := compiler idFor: classification prefixed: #classification. |
|
25 compiler addConstant: classification as: classificationId. |
|
26 |
|
27 compiler addVariable: 'retval'. |
|
28 compiler add: 'retval := OrderedCollection new.'. |
|
29 compiler add: '[ ', classificationId, ' at: context peek asInteger ] whileTrue: ['. |
|
30 compiler indent. |
|
31 compiler add: ' retval add: context next.'. |
|
32 compiler dedent. |
|
33 compiler add: '].'. |
|
34 compiler add: '^ retval asArray'. |
|
35 ^ compiler stopMethod. |
|
36 ! |
|
37 |
|
38 extendClassification: classification |
|
39 ^ (classification asOrderedCollection addLast: false; yourself) asArray |
|
40 ! |
|
41 |
|
42 firstCharParser |
|
43 ^ PPPredicateObjectParser on: predicate message: 'predicate expected'. |
|
44 ! |
|
45 |
|
46 predicate |
|
47 |
|
48 ^ predicate |
|
49 ! |
|
50 |
|
51 predicate: anObject |
|
52 |
|
53 predicate := anObject |
|
54 ! |
|
55 |
|
56 prefix |
|
57 ^ #starPredicate |
|
58 ! ! |
|
59 |