PPPluggableParser.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 04 Oct 2014 21:26:15 +0100
changeset 381 0bbbcf5da2d4
parent 377 6112a403a52d
child 421 7e08b31e0dae
permissions -rw-r--r--
`PPParser>>allParsers`, `allParsersDo:(seen:)` moved to base PetitParser package. The method #allParsersDo: is actually used used by PPContext>>initializeFor: therefore it has to be in the package stx:goodies/petitparser (MC package PetitParser) and _NOT_ in stx:goodies/petitparser/analyzer (MC package PetitAnalyzer)

"{ 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:'accessing'!

block
	"Answer the pluggable block."

	^ block
! !

!PPPluggableParser methodsFor:'initialization'!

initializeOn: aBlock
	block := aBlock
! !

!PPPluggableParser methodsFor:'parsing'!

parseOn: aPPContext
	| memento result |
	memento := aPPContext remember.
	result := block value: aPPContext.
	result isPetitFailure
		ifTrue: [ aPPContext restore: memento ].
	^ 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_HG

    ^ '$Changeset: <not expanded> $'
!

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