author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 30 Oct 2014 11:35:27 +0000 | |
changeset 397 | 530d98b90b13 |
parent 377 | 6112a403a52d |
child 642 | 77d5fddb6462 |
permissions | -rw-r--r-- |
4 | 1 |
"{ Package: 'stx:goodies/petitparser' }" |
0 | 2 |
|
3 |
PPListParser subclass:#PPChoiceParser |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'PetitParser-Parsers' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!PPChoiceParser methodsFor:'operations'! |
|
12 |
||
36 | 13 |
/ aRule |
0 | 14 |
^ self copyWith: aRule |
15 |
! ! |
|
16 |
||
17 |
!PPChoiceParser methodsFor:'parsing'! |
|
18 |
||
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
19 |
parseOn: aPPContext |
0 | 20 |
"This is optimized code that avoids unnecessary block activations, do not change. When all choices fail, the last failure is answered." |
21 |
||
22 |
| element | |
|
23 |
1 to: parsers size do: [ :index | |
|
24 |
element := (parsers at: index) |
|
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
25 |
parseOn: aPPContext. |
0 | 26 |
element isPetitFailure |
27 |
ifFalse: [ ^ element ] ]. |
|
28 |
^ element |
|
29 |
! ! |
|
30 |
||
31 |
!PPChoiceParser class methodsFor:'documentation'! |
|
32 |
||
36 | 33 |
version |
34 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPChoiceParser.st,v 1.3 2012-05-04 22:05:05 vrany Exp $' |
|
35 |
! |
|
36 |
||
37 |
version_CVS |
|
38 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPChoiceParser.st,v 1.3 2012-05-04 22:05:05 vrany Exp $' |
|
39 |
! |
|
40 |
||
0 | 41 |
version_SVN |
36 | 42 |
^ '§Id: PPChoiceParser.st 2 2010-12-17 18:44:23Z vranyj1 §' |
0 | 43 |
! ! |
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
36
diff
changeset
|
44 |