compiler/PPCCharSetPredicateNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 01 Nov 2014 00:30:28 +0000
changeset 403 7063d523b064
parent 392 9b297f0d949c
child 422 116d2b2af905
permissions -rw-r--r--
Removed autoload attribut for tests. As all classes are in a test package, when package is loaded likely tests are required, so load them right away.

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

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

!PPCCharSetPredicateNode methodsFor:'as yet unclassified'!

asInlined
	^ PPCInlineCharSetPredicateNode new
		predicate: predicate;
		name: name;
		yourself
!

bodyOfPredicate: compiler
	| classification classificationId |
	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: 'ifFalse: [ self error: ''predicate not found'' ]'.
	compiler add: 'ifTrue: [ context next ].'.
	compiler dedent.
!

start: compiler id: id
	compiler startMethod: id
!

stop: compiler
	^ compiler stopMethod
! !