9 category:'PetitCompiler-Nodes' |
9 category:'PetitCompiler-Nodes' |
10 ! |
10 ! |
11 |
11 |
12 !PPCSequenceNode methodsFor:'accessing'! |
12 !PPCSequenceNode methodsFor:'accessing'! |
13 |
13 |
|
14 preferredChildrenVariableNames |
|
15 "Return an array of preferred variable names of variables where to store |
|
16 particular child's result value." |
|
17 |
|
18 | names | |
|
19 |
|
20 names := self propertyAt: #preferredChildrenVariableNames ifAbsent:[ nil ]. |
|
21 names notNil ifTrue:[ ^ names ]. |
|
22 names := OrderedCollection new. |
|
23 self children do:[:child | |
|
24 | id | |
|
25 |
|
26 id := child name notNil ifTrue:[ child name ] ifFalse:[ 'c' ]. |
|
27 (names includes: id) ifTrue:[ |
|
28 | i | |
|
29 |
|
30 i := 1. |
|
31 [ names includes: (id , '_' , i printString) ] whileTrue:[ |
|
32 i := i + 1. |
|
33 ]. |
|
34 id := (id , '_' , i printString). |
|
35 ]. |
|
36 names add: id. |
|
37 ]. |
|
38 self propertyAt: #preferredChildrenVariableNames put: names. |
|
39 ^ names |
|
40 |
|
41 "Created: / 04-06-2015 / 23:08:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
42 ! |
|
43 |
|
44 preferredChildrenVariableNames: aSequenceableCollection |
|
45 "Sets an array of preferred variable names" |
|
46 |
|
47 self propertyAt: #preferredChildrenVariableNames put: aSequenceableCollection |
|
48 |
|
49 "Created: / 04-06-2015 / 23:09:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
50 ! |
|
51 |
14 prefix |
52 prefix |
15 ^ #seq |
53 ^ #seq |
|
54 ! |
|
55 |
|
56 returnParsedObjectsAsCollection |
|
57 ^ self propertyAt: #returnParsedObjectsAsCollection ifAbsent:[ true ] |
|
58 |
|
59 "Created: / 04-06-2015 / 23:43:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
60 ! |
|
61 |
|
62 returnParsedObjectsAsCollection: aBoolean |
|
63 self propertyAt: #returnParsedObjectsAsCollection put: aBoolean |
|
64 |
|
65 "Created: / 04-06-2015 / 23:43:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
16 ! ! |
66 ! ! |
17 |
67 |
18 !PPCSequenceNode methodsFor:'analysis'! |
68 !PPCSequenceNode methodsFor:'analysis'! |
19 |
69 |
20 acceptsEpsilon |
70 acceptsEpsilon |
119 ifTrue: [ follow addAll: aSet ]. |
169 ifTrue: [ follow addAll: aSet ]. |
120 follow addAll: (first |
170 follow addAll: (first |
121 reject: [ :each | each isNullable ]) ] ] |
171 reject: [ :each | each isNullable ]) ] ] |
122 ! ! |
172 ! ! |
123 |
173 |
|
174 !PPCSequenceNode methodsFor:'testing'! |
|
175 |
|
176 isSequenceNode |
|
177 ^ true |
|
178 |
|
179 "Created: / 15-06-2015 / 18:29:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
180 ! ! |
|
181 |
124 !PPCSequenceNode methodsFor:'visiting'! |
182 !PPCSequenceNode methodsFor:'visiting'! |
125 |
183 |
126 accept: visitor |
184 accept: visitor |
127 ^ visitor visitSequenceNode: self |
185 ^ visitor visitSequenceNode: self |
128 ! ! |
186 ! ! |