compiler/PPCPluggableNode.st
changeset 391 553a5456963b
child 392 9b297f0d949c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCPluggableNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,59 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCPluggableNode
+	instanceVariableNames:'block'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCPluggableNode comment:''
+!
+
+!PPCPluggableNode methodsFor:'accessing'!
+
+block
+	
+	^ block
+!
+
+block: anObject
+	
+	block := anObject
+! !
+
+!PPCPluggableNode methodsFor:'as yet unclassified'!
+
+acceptsEpsilon
+	^ true
+!
+
+acceptsEpsilonOpenSet: set
+	^ true
+!
+
+asInlined
+	^ PPCInlinePluggableNode new
+		name: name;
+		block: block;
+		yourself
+!
+
+compileWith: compiler effect: effect id: id
+	| blockId |
+	blockId := compiler idFor: block prefixed: #block.
+	
+	compiler startMethod: id.
+	compiler addConstant: block as: blockId.
+	compiler add: '^ ', blockId, ' value: context.'.
+ ^ compiler stopMethod.
+!
+
+firstCharParser
+	^  block asParser
+!
+
+prefix
+	^ #plug
+! !
+