compiler/PPCNode.st
changeset 414 0eaf09920532
parent 392 9b297f0d949c
child 421 7e08b31e0dae
--- a/compiler/PPCNode.st	Wed Nov 05 21:40:01 2014 +0000
+++ b/compiler/PPCNode.st	Wed Nov 05 23:05:19 2014 +0000
@@ -1,12 +1,18 @@
 "{ Package: 'stx:goodies/petitparser/compiler' }"
 
 Object subclass:#PPCNode
-	instanceVariableNames:'contextFree name'
+	instanceVariableNames:'contextFree name firstSet firstCharSet'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'PetitCompiler-Nodes'
 !
 
+!PPCNode class methodsFor:'as yet unclassified'!
+
+new
+	^ self basicNew initialize
+! !
+
 !PPCNode methodsFor:'accessing'!
 
 children
@@ -69,6 +75,13 @@
 	^ nil
 !
 
+firstCharSetCached
+	firstCharSet ifNil: [ 
+ 		firstCharSet := self firstCharSet.
+	].
+	^ firstCharSet
+!
+
 firstSetSuchThat: block
 	^ self firstSetSuchThat: block into: (OrderedCollection new) openSet: IdentitySet new.
 !
@@ -113,7 +126,10 @@
 !PPCNode methodsFor:'as yet unclassified'!
 
 firstSet
-	^ self firstSetSuchThat: [ :e | e isFirstSetTerminal ]
+	firstSet ifNil: [ 
+		firstSet := self firstSetSuchThat: [ :e | e isFirstSetTerminal ].
+	].
+	^ firstSet
 !
 
 name