diff -r b2f2f15cef26 -r 7e08b31e0dae compiler/PPCTokenActionNode.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compiler/PPCTokenActionNode.st Mon Nov 24 00:09:23 2014 +0000 @@ -0,0 +1,56 @@ +"{ Package: 'stx:goodies/petitparser/compiler' }" + +PPCActionNode subclass:#PPCTokenActionNode + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + category:'PetitCompiler-Nodes' +! + +!PPCTokenActionNode methodsFor:'as yet unclassified'! + +asFast + ^ self +! + +compileWith: compiler effect: effect id: id + | | + compiler addConstant: block as: id. + + " + Actually, do nothing, we are in Token mode and the + child does not return any result and token takes only + the input value. + " + compiler startMethod: id. + compiler add: '^ '. + compiler callOnLine: (child compileWith: compiler). + ^ compiler stopMethod. +! + +rewrite: changeStatus + (self hasProperty: #trimmingToken) ifTrue: [ + | retval | + changeStatus change. + "Get rid of action and sequence with whitespace" + retval := child children second child. "JK: oups, what a chain!!" + retval name ifNil: [ retval name: self name ]. + ^ retval + ]. + + child name ifNil: [ + changeStatus change. + child name: self name. + ^ child + ]. + + (child name = self name) ifTrue: [ + changeStatus change. + ^ child + ] +! + +suffix + ^ '_fast' +! ! +