--- a/compiler/PPCNode.st Fri Jul 31 14:07:31 2015 +0100
+++ b/compiler/PPCNode.st Mon Aug 17 12:56:02 2015 +0100
@@ -34,6 +34,10 @@
^ #()
!
+defaultName
+ ^ 'node'
+!
+
firstFollowCache
^ self propertyAt: #firstFollowCache ifAbsentPut: [ IdentityDictionary new ]
!
@@ -61,10 +65,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 ]
!
@@ -74,11 +82,11 @@
!
prefix
- ^ 'node'
+ ^ nil
!
suffix
- ^ self isMarkedForInline ifTrue: [ '_inlined' ] ifFalse: [ '' ]
+ ^ self isMarkedForInline ifTrue: [ 'inlined' ] ifFalse: [ nil ]
!
unmarkForGuard
@@ -242,12 +250,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
@@ -529,6 +537,10 @@
^ true
!
+hasName
+ ^ (name == nil) not
+!
+
isMarkedForInline
^ self propertyAt: #inlined ifAbsent: [ false ].
@@ -558,7 +570,10 @@
asFsa
| visitor |
visitor := PEGFsaGenerator new.
- ^ visitor visit: self
+ ^ (visitor visit: self)
+ name: self name;
+ yourself
+
!
replace: node with: anotherNode