PPListParser.st
changeset 0 739fe9b7253e
child 4 90de244a7fa2
equal deleted inserted replaced
-1:000000000000 0:739fe9b7253e
       
     1 "{ Package: 'squeak:petitparser' }"
       
     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:
       
    12 	parsers	<SequenceableCollection of: PPParser>	A sequence of other parsers to delegate to.'
       
    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
       
    61     ^ '$Id: PPListParser.st,v 1.1 2011-08-18 18:56:17 cg Exp $'
       
    62 ! !