compiler/PPCTokenSequenceNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 26 Oct 2014 01:28:07 +0000
changeset 392 9b297f0d949c
parent 391 553a5456963b
child 422 116d2b2af905
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' }"

PPCSequenceNode subclass:#PPCTokenSequenceNode
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Nodes'
!


!PPCTokenSequenceNode methodsFor:'as yet unclassified'!

asFast
	^ self
!

compileWith: compiler effect: effect id: id

	compiler startMethod: id.
	compiler addVariable: 'memento'.			
	compiler add: (compiler smartRemember: self).

"	self addGuard: compiler."

	compiler call: ((children at: 1) compileWith: compiler).
	compiler add: 'error ifTrue: [ ^ failure ].'.

	(2 to: children size) do: [ :idx  | |child|
		child := children at: idx.
		compiler call: (child compileWith: compiler).
		compiler add: 'error ifTrue: [ ', (compiler smartRestore: self) ,' ^ failure ].'.
	].
 ^ compiler stopMethod.
!

suffix
	^ #'_fast'
! !

!PPCTokenSequenceNode class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !