equal
deleted
inserted
replaced
1 "{ Package: 'stx:goodies/petitparser' }" |
1 "{ Package: 'stx:goodies/petitparser' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
2 |
4 |
3 PPListParser subclass:#PPSequenceParser |
5 PPListParser subclass:#PPSequenceParser |
4 instanceVariableNames:'' |
6 instanceVariableNames:'' |
5 classVariableNames:'' |
7 classVariableNames:'' |
6 poolDictionaries:'' |
8 poolDictionaries:'' |
7 category:'PetitParser-Parsers' |
9 category:'PetitParser-Parsers' |
8 ! |
10 ! |
9 |
11 |
10 |
12 |
11 |
13 |
|
14 !PPSequenceParser methodsFor:'*petitcompiler'! |
|
15 |
|
16 map: aBlock |
|
17 ^ aBlock numArgs = self children size |
|
18 ifTrue: [ self ==> [ :nodes | aBlock valueWithArguments: nodes ] ] |
|
19 ifFalse: [ self error: aBlock numArgs asString , ' arguments expected.' ] |
|
20 ! ! |
12 |
21 |
13 |
22 |
14 !PPSequenceParser methodsFor:'operations'! |
23 !PPSequenceParser methodsFor:'operations'! |
15 |
24 |
16 , aRule |
25 , aRule |
22 |
31 |
23 anArrayOfIntegers do: [ :index | |
32 anArrayOfIntegers do: [ :index | |
24 (index isInteger and: [ index between: 1 and: parsers size ]) |
33 (index isInteger and: [ index between: 1 and: parsers size ]) |
25 ifFalse: [ self error: 'Invalid permutation index: ' , index printString ] ]. |
34 ifFalse: [ self error: 'Invalid permutation index: ' , index printString ] ]. |
26 ^ self ==> [ :nodes | anArrayOfIntegers collect: [ :index | nodes at: index ] ] |
35 ^ self ==> [ :nodes | anArrayOfIntegers collect: [ :index | nodes at: index ] ] |
27 ! ! |
|
28 |
|
29 !PPSequenceParser methodsFor:'operators-mapping'! |
|
30 |
|
31 map: aBlock |
|
32 ^ aBlock numArgs = self children size |
|
33 ifTrue: [ self ==> [ :nodes | aBlock valueWithArguments: nodes ] ] |
|
34 ifFalse: [ self error: aBlock numArgs asString , ' arguments expected.' ] |
|
35 ! ! |
36 ! ! |
36 |
37 |
37 !PPSequenceParser methodsFor:'parsing'! |
38 !PPSequenceParser methodsFor:'parsing'! |
38 |
39 |
39 parseOn: aPPContext |
40 parseOn: aPPContext |