4
|
1 |
"{ Package: 'stx:goodies/petitparser' }"
|
0
|
2 |
|
|
3 |
PPParser subclass:#PPListParser
|
|
4 |
instanceVariableNames:'parsers'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Parsers'
|
|
8 |
!
|
|
9 |
|
|
10 |
PPListParser comment:'Abstract parser that parses a list of things in some way (to be specified by the subclasses).
|
|
11 |
Instance Variables:
|
4
|
12 |
parsers <SequenceableCollection of: PPParser> A sequence of other parsers to delegate to.'
|
0
|
13 |
!
|
|
14 |
|
|
15 |
|
|
16 |
!PPListParser class methodsFor:'instance creation'!
|
|
17 |
|
|
18 |
with: aParser
|
|
19 |
^ self withAll: (Array with: aParser)
|
|
20 |
!
|
|
21 |
|
|
22 |
with: aFirstParser with: aSecondParser
|
|
23 |
^ self withAll: (Array with: aFirstParser with: aSecondParser)
|
|
24 |
!
|
|
25 |
|
|
26 |
withAll: aCollection
|
|
27 |
^ self basicNew setParsers: aCollection
|
|
28 |
! !
|
|
29 |
|
|
30 |
!PPListParser methodsFor:'accessing'!
|
|
31 |
|
|
32 |
children
|
|
33 |
^ parsers
|
|
34 |
! !
|
|
35 |
|
|
36 |
!PPListParser methodsFor:'copying'!
|
|
37 |
|
|
38 |
copyWith: aParser
|
|
39 |
^ self species withAll: (parsers copyWith: aParser)
|
|
40 |
!
|
|
41 |
|
|
42 |
postCopy
|
|
43 |
super postCopy.
|
|
44 |
parsers := parsers copy
|
|
45 |
! !
|
|
46 |
|
|
47 |
!PPListParser methodsFor:'initialization'!
|
|
48 |
|
|
49 |
initialize
|
|
50 |
super initialize.
|
|
51 |
self setParsers: #()
|
|
52 |
!
|
|
53 |
|
|
54 |
setParsers: aCollection
|
|
55 |
parsers := aCollection asArray
|
|
56 |
! !
|
|
57 |
|
|
58 |
!PPListParser class methodsFor:'documentation'!
|
|
59 |
|
|
60 |
version_SVN
|
4
|
61 |
^ '$Id: PPListParser.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
|
0
|
62 |
! !
|