"{ Package: 'stx:goodies/petitparser' }"
PPDelegateParser subclass:#PPActionParser
instanceVariableNames:'block'
classVariableNames:''
poolDictionaries:''
category:'PetitParser-Parsers'
!
PPActionParser comment:'A parser that performs an action block with the successful parse result of the delegate.
Instance Variables:
block <BlockClosure> The action block to be executed.
'
!
!PPActionParser class methodsFor:'instance creation'!
on: aParser block: aBlock
^ (self on: aParser) setBlock: aBlock
! !
!PPActionParser methodsFor:'accessing'!
block
"Answer the action block of the receiver."
^ block
! !
!PPActionParser methodsFor:'initialization'!
setBlock: aBlock
block := aBlock
! !
!PPActionParser methodsFor:'parsing'!
parseOn: aStream
| element |
^ (element := parser parseOn: aStream) isPetitFailure
ifFalse: [ block value: element ]
ifTrue: [ element ]
! !
!PPActionParser class methodsFor:'documentation'!
version_SVN
^ '$Id: PPActionParser.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
! !