"{ Package: 'stx:goodies/petitparser' }"
PPParser subclass:#PPPluggableParser
instanceVariableNames:'block'
classVariableNames:''
poolDictionaries:''
category:'PetitParser-Parsers'
!
PPPluggableParser comment:'A pluggable parser that passes the parser stream into a block. This enables users to perform manual parsing or to embed other parser frameworks into PetitParser.
Instance Variables:
block <BlockClosure> The pluggable one-argument block.
'
!
!PPPluggableParser class methodsFor:'instance creation'!
on: aBlock
^ self new initializeOn: aBlock
! !
!PPPluggableParser methodsFor:'accessing'!
block
"Answer the pluggable block."
^ block
! !
!PPPluggableParser methodsFor:'initialization'!
initializeOn: aBlock
block := aBlock
! !
!PPPluggableParser methodsFor:'parsing'!
parseOn: aStream
| position result |
position := aStream position.
result := block value: aStream.
result isPetitFailure
ifTrue: [ aStream position: position ].
^ result
! !
!PPPluggableParser class methodsFor:'documentation'!
version_SVN
^ '$Id: PPPluggableParser.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
! !