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

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

"{ NameSpace: Smalltalk }"

PPCNode subclass:#PPCListNode
	instanceVariableNames:'children'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Nodes'
!


!PPCListNode class methodsFor:'as yet unclassified'!

withAll: aCollection
	^ self basicNew children: aCollection
! !

!PPCListNode methodsFor:'accessing'!

children
	^ children
!

children: anObject
	
	children := anObject
! !

!PPCListNode methodsFor:'analysis'!

acceptsEpsilon
	self subclassResponsibility
!

acceptsEpsilonOpenSet: set
	self subclassResponsibility
!

replace: node with: anotherNode
	children keysAndValuesDo: [ :index :child |
		child == node ifTrue: [ children at: index put: anotherNode ] 
	]
! !

!PPCListNode methodsFor:'copying'!

postCopy
	super postCopy.
	children := children copy
! !

!PPCListNode methodsFor:'optimizing'!

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

!PPCListNode class methodsFor:'documentation'!

version_HG

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