PPActionParser.st
author Claus Gittinger <cg@exept.de>
Thu, 18 Aug 2011 20:56:17 +0200
changeset 0 739fe9b7253e
child 4 90de244a7fa2
permissions -rw-r--r--
*** empty log message ***

"{ Package: 'squeak: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.1 2011-08-18 18:56:17 cg Exp $'
! !