compiler/PPCSequenceNode.st
changeset 502 1e45d3c96ec5
parent 459 4751c407bb40
child 503 ff58cd9f1f3c
child 515 b5316ef15274
--- a/compiler/PPCSequenceNode.st	Thu May 21 14:12:22 2015 +0100
+++ b/compiler/PPCSequenceNode.st	Fri Jul 24 15:06:54 2015 +0100
@@ -11,8 +11,58 @@
 
 !PPCSequenceNode methodsFor:'accessing'!
 
+preferredChildrenVariableNames
+    "Return an array of preferred variable names of variables where to store
+     particular child's result value."
+
+    | names |
+
+    names := self propertyAt: #preferredChildrenVariableNames ifAbsent:[ nil ].
+    names notNil ifTrue:[ ^ names ].
+    names := OrderedCollection new.
+    self children do:[:child |  
+        | id |
+
+        id := child name notNil ifTrue:[ child name ] ifFalse:[ 'c' ].
+        (names includes: id) ifTrue:[ 
+            | i |
+
+            i := 1.
+            [ names includes: (id , '_' , i printString) ] whileTrue:[ 
+                i := i + 1.
+            ].
+            id := (id , '_' , i printString).
+        ].
+        names add: id.
+    ].                
+    self propertyAt: #preferredChildrenVariableNames put: names.
+    ^ names
+
+    "Created: / 04-06-2015 / 23:08:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+preferredChildrenVariableNames: aSequenceableCollection
+    "Sets an array of preferred variable names"
+
+    self propertyAt: #preferredChildrenVariableNames put: aSequenceableCollection
+
+    "Created: / 04-06-2015 / 23:09:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 prefix
     ^ #seq
+!
+
+returnParsedObjectsAsCollection
+    ^ self propertyAt: #returnParsedObjectsAsCollection ifAbsent:[ true ]
+
+    "Created: / 04-06-2015 / 23:43:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+returnParsedObjectsAsCollection: aBoolean
+    self propertyAt: #returnParsedObjectsAsCollection put: aBoolean
+
+    "Created: / 04-06-2015 / 23:43:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !PPCSequenceNode methodsFor:'analysis'!
@@ -121,6 +171,14 @@
                     reject: [ :each | each isNullable ]) ] ]
 ! !
 
+!PPCSequenceNode methodsFor:'testing'!
+
+isSequenceNode
+    ^ true
+
+    "Created: / 15-06-2015 / 18:29:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !PPCSequenceNode methodsFor:'visiting'!
 
 accept: visitor