Updated to latest version from Moose repository.
Name: PetitParser-JanKurs.250
Author: JanKurs
Time: 01-10-2014, 04:44:04 AM
UUID: c46eea20-51a0-4deb-8fd5-8cb99810a8b4
Repository: http://smalltalkhub.com/mc/Moose/PetitParser/main
Name: PetitTests-JanKurs.60
Author: JanKurs
Time: 29-09-2014, 11:48:10 AM
UUID: 28fd2e65-c287-4f73-b71e-5b6bb25bebaa
Repository: http://smalltalkhub.com/mc/Moose/PetitParser/main
"{ Package: 'stx:goodies/petitparser' }"
PPParser subclass:#PPListParser
instanceVariableNames:'parsers'
classVariableNames:''
poolDictionaries:''
category:'PetitParser-Parsers'
!
!PPListParser class methodsFor:'instance creation'!
with: aParser
^ self withAll: (Array with: aParser)
!
with: aFirstParser with: aSecondParser
^ self withAll: (Array with: aFirstParser with: aSecondParser)
!
withAll: aCollection
^ self basicNew setParsers: aCollection
! !
!PPListParser methodsFor:'*petitanalyzer-matching'!
copyInContext: aDictionary seen: aSeenDictionary
| copy copies |
aSeenDictionary at: self ifPresent: [ :value | ^ value ].
copy := aSeenDictionary at: self put: self copy.
copies := OrderedCollection new.
parsers do: [ :each |
| result |
result := each
copyInContext: aDictionary
seen: aSeenDictionary.
result isCollection
ifTrue: [ copies addAll: result ]
ifFalse: [ copies add: result ] ].
^ copy
setParsers: copies;
yourself
! !
!PPListParser methodsFor:'*petitanalyzer-transforming'!
replace: aParser with: anotherParser
super replace: aParser with: anotherParser.
parsers keysAndValuesDo: [ :index :parser |
parser == aParser
ifTrue: [ parsers at: index put: anotherParser ] ]
! !
!PPListParser methodsFor:'accessing'!
children
^ parsers
! !
!PPListParser methodsFor:'copying'!
copyWith: aParser
^ self species withAll: (parsers copyWith: aParser)
!
postCopy
super postCopy.
parsers := parsers copy
! !
!PPListParser methodsFor:'initialization'!
initialize
super initialize.
self setParsers: #()
!
setParsers: aCollection
parsers := aCollection asArray
! !
!PPListParser class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPListParser.st,v 1.4 2014-03-04 14:32:58 cg Exp $'
!
version_CVS
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPListParser.st,v 1.4 2014-03-04 14:32:58 cg Exp $'
!
version_SVN
^ '$Id: PPListParser.st,v 1.4 2014-03-04 14:32:58 cg Exp $'
! !