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 |
|
|
19 |
parseOn: aStream
|
|
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)
|
|
25 |
parseOn: aStream.
|
|
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 |
! !
|