compiler/PPCNotCharSetPredicateNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 26 Oct 2014 01:28:07 +0000
changeset 392 9b297f0d949c
parent 391 553a5456963b
child 396 ec569977267a
permissions -rw-r--r--
Fixed PPCNode>>doOptmizationLoop:status: Must report status to changeStatus as caller is checking its value. Also, added PPCOptimizationResult class>>new as Smaltalk/X (actually, most Smalltalks) does not call #initialize by default.

"{ Package: 'stx:goodies/petitparser/compiler' }"

PPCAbstractPredicateNode subclass:#PPCNotCharSetPredicateNode
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Nodes'
!

!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.
! !