--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCAbstractPredicateNode.st Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,102 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCAbstractPredicateNode
+ instanceVariableNames:'predicate methodStrategy'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'PetitCompiler-Nodes'
+!
+
+PPCAbstractPredicateNode comment:''
+!
+
+!PPCAbstractPredicateNode methodsFor:'accessing'!
+
+methodStrategy
+
+ ^ methodStrategy
+!
+
+methodStrategy: anObject
+
+ methodStrategy := anObject
+!
+
+predicate
+
+ ^ predicate
+!
+
+predicate: anObject
+
+ predicate := anObject
+!
+
+prefix
+ ^ #predicate
+! !
+
+!PPCAbstractPredicateNode methodsFor:'analysis'!
+
+= anotherNode
+ (self == anotherNode) ifTrue: [ ^ true ].
+ (anotherNode class = self class) ifFalse: [ ^ false ].
+
+ (anotherNode name = name) ifFalse: [ ^ false ].
+ (anotherNode methodStrategy = methodStrategy) ifFalse: [ ^ false ].
+ ^ anotherNode children = self children.
+!
+
+acceptsEpsilon
+ ^ false
+!
+
+firstCharParser
+ ^ PPPredicateObjectParser on: predicate message: 'predicate expected'.
+! !
+
+!PPCAbstractPredicateNode methodsFor:'compiling'!
+
+bodyOfPredicate: compiler
+ self subclassResponsibility
+!
+
+compileWith: compiler effect: effect id: id
+ compiler startMethod: id.
+ compiler add: '^'.
+ self bodyOfPredicate: compiler.
+ ^ compiler stopMethod.
+!
+
+extendClassification: classification
+ ^ (classification asOrderedCollection addLast: false; yourself) asArray
+! !
+
+!PPCAbstractPredicateNode methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ methodStrategy := PPCMethodStrategy new
+! !
+
+!PPCAbstractPredicateNode methodsFor:'optimizing'!
+
+asInlined
+ ^ super asInlined
+" (methodStrategy == (PPCInlineStrategy instance)) ifFalse: [
+ ^ self copy
+ methodStrategy: PPCInlineStrategy instance;
+ yourself
+ ].
+ ^ self"
+!
+
+optimize: params status: changeStatus
+ | retval |
+ retval := self.
+ retval := retval rewrite: params status: changeStatus.
+ retval := retval inline: params status: changeStatus.
+
+ ^ retval
+! !
+