compiler/PPCNotCharSetPredicateNode.st
changeset 391 553a5456963b
child 392 9b297f0d949c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNotCharSetPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,38 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractPredicateNode subclass:#PPCNotCharSetPredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNotCharSetPredicateNode comment:''
+!
+
+!PPCNotCharSetPredicateNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ PPCInlineNotCharSetPredicateNode new
+		predicate: predicate;
+		name: name;
+		yourself
+!
+
+bodyOfPredicate: compiler
+	| classificationId  classification |
+	classification := self extendClassification: predicate classification.
+	classificationId := (compiler idFor: classification prefixed: #classification).
+	compiler  addConstant: classification as: classificationId.
+	
+	compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'.
+	compiler indent.
+	compiler add: ' ifTrue: [ self error: '' predicate not expected'' ]'.
+	compiler add: ' ifFalse: [ nil ].'.
+	compiler dedent.
+!
+
+firstCharParser
+	^ (PPPredicateObjectParser on: predicate message: 'predicate not expected') not.
+! !
+