Updated to PetitCompiler-JanKurs.118, PetitCompiler-Tests-JanKurs.46, PetitCompiler-Extras-Tests-JanKurs.11, and PetitCompiler-Benchmarks-JanKurs.11
Name: PetitCompiler-JanKurs.118
Author: JanKurs
Time: 13-05-2015, 03:59:01.292 PM
UUID: 4a8ccd94-3131-4cc7-9098-528f8e5ea0b5
Name: PetitCompiler-Tests-JanKurs.46
Author: JanKurs
Time: 04-05-2015, 04:25:06.162 PM
UUID: 9f4cf8b7-876e-4a13-9579-b833f016db66
Name: PetitCompiler-Extras-Tests-JanKurs.11
Author: JanKurs
Time: 13-05-2015, 04:27:27.940 PM
UUID: e9f30c31-fbd0-4e96-ad2a-868f88d20ea8
Name: PetitCompiler-Benchmarks-JanKurs.11
Author: JanKurs
Time: 13-05-2015, 02:21:49.932 PM
UUID: 6a23fd1e-a86f-46db-8221-cc41b778d32c
"{ Package: 'stx:goodies/petitparser' }"
PPListParser subclass:#PPSequenceParser
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'PetitParser-Parsers'
!
!PPSequenceParser methodsFor:'operations'!
, aRule
^ self copyWith: aRule
!
permutation: anArrayOfIntegers
"Answer a permutation of the receivers sequence."
anArrayOfIntegers do: [ :index |
(index isInteger and: [ index between: 1 and: parsers size ])
ifFalse: [ self error: 'Invalid permutation index: ' , index printString ] ].
^ self ==> [ :nodes | anArrayOfIntegers collect: [ :index | nodes at: index ] ]
! !
!PPSequenceParser methodsFor:'operators-mapping'!
map: aBlock
^ aBlock numArgs = self children size
ifTrue: [ self ==> [ :nodes | aBlock valueWithArguments: nodes ] ]
ifFalse: [ self error: aBlock numArgs asString , ' arguments expected.' ]
! !
!PPSequenceParser methodsFor:'parsing'!
parseOn: aPPContext
"This is optimized code that avoids unnecessary block activations, do not change."
| memento elements element |
memento := aPPContext remember.
elements := Array new: parsers size.
1 to: parsers size do: [ :index |
element := (parsers at: index)
parseOn: aPPContext.
element isPetitFailure ifTrue: [
aPPContext restore: memento.
^ element ].
elements at: index put: element ].
^ elements
! !
!PPSequenceParser class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPSequenceParser.st,v 1.4 2014-03-04 14:33:25 cg Exp $'
!
version_CVS
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPSequenceParser.st,v 1.4 2014-03-04 14:33:25 cg Exp $'
!
version_HG
^ '$Changeset: <not expanded> $'
!
version_SVN
^ '$Id: PPSequenceParser.st,v 1.4 2014-03-04 14:33:25 cg Exp $'
! !