compiler/PPCNode.st
changeset 515 b5316ef15274
parent 502 1e45d3c96ec5
child 516 3b81c9e53352
child 524 f6f68d32de73
--- a/compiler/PPCNode.st	Fri Jul 24 15:06:54 2015 +0100
+++ b/compiler/PPCNode.st	Mon Aug 17 12:13:16 2015 +0100
@@ -33,6 +33,10 @@
     ^ #()
 !
 
+defaultName
+    ^ 'node' 
+!
+
 firstFollowCache
     ^ self propertyAt: #firstFollowCache ifAbsentPut: [ IdentityDictionary new ]
 !
@@ -60,10 +64,14 @@
 !
 
 name: anObject
-    
+"	(anObject asString beginsWith: 'symbolLiteral') ifTrue: [ self halt. ]."
     name := anObject
 !
 
+nameOrEmptyString
+    ^ self hasName ifTrue: [ self name ] ifFalse: [ '' ]
+!
+
 parser
     ^ self propertyAt: #parser ifAbsent: [ nil ]
 !
@@ -73,11 +81,11 @@
 !
 
 prefix
-    ^ 'node' 
+    ^ nil
 !
 
 suffix
-    ^ self isMarkedForInline ifTrue: [ '_inlined' ] ifFalse: [ '' ]
+    ^ self isMarkedForInline ifTrue: [ 'inlined' ] ifFalse: [ nil ]
 !
 
 unmarkForGuard
@@ -241,12 +249,12 @@
         finite := self.
         infinite := anotherNode.
     ] ifFalse: [ 
- 								finite := anotherNode.
+ 		finite := anotherNode.
         infinite := self.	
     ].
         
     finite recognizedSentences do: [ :sentence |
-            (infinite parser matches: sentence) ifTrue: [ ^ true ].
+        (infinite parser matches: sentence) ifTrue: [ ^ true ].
     ].
     ^ false
     
@@ -502,6 +510,10 @@
     ^ true
 !
 
+hasName
+    ^ (name == nil) not
+!
+
 isMarkedForInline
     ^ self propertyAt: #inlined ifAbsent: [ false ].
 
@@ -531,7 +543,10 @@
 asFsa
     | visitor |
     visitor := PEGFsaGenerator new.
-    ^ visitor visit: self
+    ^ (visitor visit: self)
+        name: self name;
+        yourself
+    
 !
 
 replace: node with: anotherNode