compiler/PPMappedActionParser.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 18 Jun 2015 21:20:15 +0100
changeset 496 0433a9d7fbcd
parent 481 34ee0d3c72e7
child 501 e29bd90f388e
permissions -rw-r--r--
Reverted fc3dbe5654c5: sending #copy should be OK (copy set's parent properly)

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

"{ NameSpace: Smalltalk }"

PPActionParser subclass:#PPMappedActionParser
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'PetitParser-Parsers'
!

!PPMappedActionParser methodsFor:'*petitcompiler'!

asCompilerNode
    ^ PPCMappedActionNode new
        name: self name;
        block: block;
        child: parser;
        properties: properties;
        parser: self;
        yourself

    "Created: / 02-06-2015 / 17:27:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PPMappedActionParser methodsFor:'parsing'!

parseOn: aPPContext
    | element |
    ^ (element := parser parseOn: aPPContext) isPetitFailure
            ifFalse: [ block valueWithArguments: element ]
            ifTrue: [ element ]

    "Created: / 02-06-2015 / 17:15:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !