"{ Package: 'stx:goodies/petitparser/compiler' }"
"{ NameSpace: Smalltalk }"
PPCAbstractActionNode subclass:#PPCActionNode
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Nodes'
!
!PPCActionNode methodsFor:'as yet unclassified'!
asFast
^ PPCTokenActionNode new
child: child;
properties: properties;
name: self name;
yourself
!
compileWith: compiler effect: effect id: id
| |
compiler addConstant: block as: id.
compiler startMethod: id.
compiler addVariable: 'element'.
compiler add: 'element := '.
compiler callOnLine: (child compileWith: compiler).
compiler add: 'error ifFalse: [ ^ ', id, ' value: element ].'.
compiler add: '^ failure'.
^ compiler stopMethod.
!
rewrite: changeStatus
(self hasProperty: #trimmingToken) ifTrue: [
changeStatus change.
^ PPCTrimmingTokenNode new
name: name;
child: child children second child; "Oups, what a chain"
tokenClass: child children second tokenClass;
whitespace: child children first;
yourself
].
block isSymbol ifTrue: [
changeStatus change.
^ PPCSymbolActionNode new
block: block;
name: name;
child: child;
yourself
]
! !