PPPluggableParser.st
author sr
Wed, 04 Jul 2018 15:23:44 +0200
changeset 604 afe646509162
parent 174 e8984d5abf0f
child 377 6112a403a52d
permissions -rw-r--r--
build order was wrong

"{ Package: 'stx:goodies/petitparser' }"

PPParser subclass:#PPPluggableParser
	instanceVariableNames:'block'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitParser-Parsers'
!


!PPPluggableParser class methodsFor:'instance creation'!

on: aBlock
	^ self new initializeOn: aBlock
! !

!PPPluggableParser methodsFor:'*petitanalyzer-matching'!

match: aParser inContext: aDictionary seen: anIdentitySet
	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self block = aParser block ]
! !

!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
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPluggableParser.st,v 1.4 2014-03-04 14:33:12 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPluggableParser.st,v 1.4 2014-03-04 14:33:12 cg Exp $'
!

version_SVN
    ^ '$Id: PPPluggableParser.st,v 1.4 2014-03-04 14:33:12 cg Exp $'
! !