77 compiler add: 'context atEnd ifTrue: [ ^ self error ].'. |
77 compiler add: 'context atEnd ifTrue: [ ^ self error ].'. |
78 guard id: id, '_guard'. |
78 guard id: id, '_guard'. |
79 guard compileGuard: compiler. |
79 guard compileGuard: compiler. |
80 compiler addOnLine: 'ifFalse: [ ^ self error ].' |
80 compiler addOnLine: 'ifFalse: [ ^ self error ].' |
81 ]. |
81 ]. |
82 ! |
|
83 |
|
84 compileWith: compiler effect: effect id: id |
|
85 compiler startMethod: id. |
|
86 compiler addVariable: 'retval'. |
|
87 compiler addVariable: 'element'. |
|
88 compiler addVariable: 'memento'. |
|
89 compiler add: (compiler smartRemember: self). |
|
90 compiler add: 'retval := Array new: ', children size asString, '.'. |
|
91 self addGuard: compiler id: id. |
|
92 |
|
93 " Halt if: [ self name = #qualifiedName ]." |
|
94 |
|
95 (1 to: children size) do: [ :idx | |child| |
|
96 child := children at: idx. |
|
97 compiler add: 'element := '. |
|
98 compiler callOnLine: (child compileWith: compiler). |
|
99 |
|
100 compiler add: 'error ifTrue: [ ', (compiler smartRestore: self) ,' ^ failure ].'. |
|
101 compiler add: 'retval at: ', idx asString, ' put: element.'. |
|
102 ]. |
|
103 compiler add: '^ retval'. |
|
104 ^ compiler stopMethod. |
|
105 ! ! |
82 ! ! |
106 |
83 |
107 !PPCSequenceNode methodsFor:'first follow next'! |
84 !PPCSequenceNode methodsFor:'first follow next'! |
108 |
85 |
109 followSets: aFollowDictionary firstSets: aFirstDictionary into: aSet suchThat: aBlock |
86 followSets: aFollowDictionary firstSets: aFirstDictionary into: aSet suchThat: aBlock |
122 ifTrue: [ follow addAll: aSet ]. |
99 ifTrue: [ follow addAll: aSet ]. |
123 follow addAll: (first |
100 follow addAll: (first |
124 reject: [ :each | each isNullable ]) ] ] |
101 reject: [ :each | each isNullable ]) ] ] |
125 ! ! |
102 ! ! |
126 |
103 |
127 !PPCSequenceNode methodsFor:'optimizing'! |
104 !PPCSequenceNode methodsFor:'visiting'! |
128 |
105 |
129 asFast |
106 accept: visitor |
130 ^ PPCTokenSequenceNode new |
107 ^ visitor visitSequenceNode: self |
131 children: children; |
|
132 name: self name; |
|
133 properties: properties; |
|
134 yourself |
|
135 ! ! |
108 ! ! |
136 |
109 |