compiler/PPCDelegateNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 15 Apr 2015 11:28:09 +0100
changeset 422 116d2b2af905
parent 392 9b297f0d949c
child 438 20598d7ce9fa
permissions -rw-r--r--
To fold

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

"{ NameSpace: Smalltalk }"

PPCNode subclass:#PPCDelegateNode
	instanceVariableNames:'child'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Nodes'
!


!PPCDelegateNode methodsFor:'accessing'!

child
	^ child
!

child: whatever
	child := whatever 
!

children
	^ { child }
! !

!PPCDelegateNode methodsFor:'analysis'!

acceptsEpsilon
	^ child acceptsEpsilonOpenSet: (IdentitySet with: self).
!

acceptsEpsilonOpenSet: set
	(set includes: child) ifFalse: [ 
		set add: child.
		^ child acceptsEpsilonOpenSet: set 
	].
	^ false
! !

!PPCDelegateNode methodsFor:'optimizing'!

inline: changeStatus	
	| inlinedNode |
	inlinedNode := child asInlined.
	(inlinedNode ~= child) ifTrue: [ 
		changeStatus change.
		self replace: child with: inlinedNode.
	]
! !

!PPCDelegateNode methodsFor:'transformation'!

replace: node with: anotherNode
	child == node ifTrue: [ child := anotherNode ]
! !

!PPCDelegateNode class methodsFor:'documentation'!

version_HG

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