compiler/PPCStarMessagePredicateNode.st
changeset 452 9f4558b3be66
parent 438 20598d7ce9fa
child 464 f6d77fee9811
--- a/compiler/PPCStarMessagePredicateNode.st	Thu Apr 30 23:43:14 2015 +0200
+++ b/compiler/PPCStarMessagePredicateNode.st	Sun May 10 06:28:36 2015 +0100
@@ -12,41 +12,59 @@
 !PPCStarMessagePredicateNode methodsFor:'accessing'!
 
 children
-	^ #()
+    ^ #()
 !
 
 firstCharSet
-	^ PPCharSetPredicate on: [:char | char perform: message ] 	
+    ^ PPCharSetPredicate on: [:char | char perform: message ] 	
 !
 
 message
-	
-	^ message
+    
+    ^ message
 !
 
 message: anObject
-	
-	message := anObject
+    
+    message := anObject
 !
 
 prefix
-	^ #starPredicate
+    ^ #starPredicate
+! !
+
+!PPCStarMessagePredicateNode methodsFor:'analysis'!
+
+firstSets: aFirstDictionary into: aSet suchThat: aBlock
+    "
+        First and follow should be performed on the non-specialized tree, i.e. on a tree
+        with star -> messageNode. Not on myself.
+        
+        The reason for that is, that:
+        - I am terminal
+        - I am nullable
+        
+        This means, I look like epsilon node for the first follow analysis. And epsilons 
+        are ignored in sequences, thus sequence of StarMessagePredicate, Literal
+        leads to { Literal } as firstSet and not expected { MessagePredicate, Literal }
+    "
+    ^ self error: 'Cannot perform first/follow analysis on myself, sorry for that :('
 ! !
 
 !PPCStarMessagePredicateNode methodsFor:'comparing'!
 
 = anotherNode
-	super = anotherNode ifFalse: [ ^ false ].
-	^ message = anotherNode message.
+    super = anotherNode ifFalse: [ ^ false ].
+    ^ message = anotherNode message.
 !
 
 hash
-	^ super hash bitXor: message hash
+    ^ super hash bitXor: message hash
 ! !
 
 !PPCStarMessagePredicateNode methodsFor:'visiting'!
 
 accept: visitor
-	^ visitor visitStarMessagePredicateNode: self
+    ^ visitor visitStarMessagePredicateNode: self
 ! !