compiler/PPCForwardNode.st
changeset 391 553a5456963b
child 392 9b297f0d949c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCForwardNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,43 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCForwardNode
+	instanceVariableNames:'block'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCForwardNode comment:''
+!
+
+!PPCForwardNode methodsFor:'compiling'!
+
+check
+	^ (child name = self name and: [child suffix = self suffix]) ifTrue: [ 'referring to itself!!' ]
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler add: '^ '.
+	"child name = 'keyword' ifTrue: [ self halt ]."
+	compiler callOnLine: (child compileWith: compiler).
+ ^ compiler stopMethod.	
+!
+
+prefix
+	^ #fw
+!
+
+rewrite: changeStatus
+	child name ifNil: [  
+		changeStatus change.
+		child name: self name.
+		^ child
+	].
+
+	(child name = self name) ifTrue: [ 
+		changeStatus change.
+		^ child
+	]
+! !
+