@@ -57,43 +57,6 @@ makeCodeSequence(e:ParseTree,separator:Word):CodeSequence := (
5757 v := new CodeSequence len CodeSequenceLength(e,separator) do provide dummyCode;
5858 fillCodeSequence(e,v,length(v),separator);
5959 v);
60- SymbolSequenceLength(e:ParseTree):int := (
61- i := 0;
62- while true do (
63- when e
64- is p:Parentheses do e = p.contents
65- is b:Binary do (
66- i = i+1;
67- e = b.lhs;
68- )
69- else ( -- should be the first token
70- i = i+1;
71- return i;
72- )
73- )
74- );
75- makeSymbolSequence(e:ParseTree):SymbolSequence := ( -- but replace local symbols by dummySymbol
76- m := SymbolSequenceLength(e);
77- v := new SymbolSequence len m do provide dummySymbol;
78- while true do (
79- when e
80- is p:Parentheses do e = p.contents
81- is b:Binary do (
82- when b.rhs is t:Token do (
83- m = m-1;
84- v.m = t.entry;
85- )
86- else nothing; -- shouldn' t happen
87- e = b.lhs;
88- )
89- is t:Token do (
90- m = m- 1 ;
91- v.m = t.entry;
92- break ;
93- )
94- else break ; -- shouldn' t happen
95- );
96- v);
9760
9861nestingDepth(frameID:int,d:Dictionary):int := (
9962 if frameID == 0 then return -1;
@@ -138,15 +101,11 @@ convertTokenAssignment(token:Token, rhs:ParseTree):Code := (
138101 nestingDepth(sym.frameID, token.dictionary), sym.frameindex, val, pos))
139102 );
140103
141- convertParallelAssignment(par:Parentheses,rhs:ParseTree,d:Dictionary ):Code := (
142- syms := makeSymbolSequence(ParseTree( par)); -- silly -- rethink
104+ convertParallelAssignment(colon:bool, par:Parentheses, rhs:ParseTree):Code := (
105+ lhs := makeCodeSequence( par.contents, CommaW);
143106 vals := convert(rhs);
144107 pos := combinePositionR(par.left.position, treePosition(rhs));
145- n := length(syms);
146- nd := new array(int) len n do foreach x in syms do provide nestingDepth(x.frameID, d); -- rethink dictionary
147- fr := new array(int) len n do foreach x in syms do provide x.frameindex;
148- foreach x in syms do if x.frameID != 0 then x = dummySymbol;
149- Code(parallelAssignmentCode(nd, fr, syms, vals, pos))
108+ Code(parallelAssignmentCode(colon, lhs, vals, pos))
150109 );
151110
152111export convertGlobalOperator(oper:Token):Code := Code(globalSymbolClosureCode(oper.entry, oper.position));
@@ -207,7 +166,7 @@ export convert0(e:ParseTree):Code := (
207166 -- e.g. x = ...
208167 is t:Token do convertTokenAssignment(t, b.rhs)
209168 -- e.g. (x,y,z) = (...)
210- is p:Parentheses do convertParallelAssignment(p, b.rhs , b.Operator.dictionary )
169+ is p:Parentheses do convertParallelAssignment(false, p , b.rhs )
211170 -- Note: usable, but not used anywhere yet
212171 is u:Unary do convertUnaryInstallCode(UnaryInstallValueFun,
213172 convertGlobalOperator(u.Operator), convert(u.rhs), convert(b.rhs), pos)
@@ -243,7 +202,7 @@ export convert0(e:ParseTree):Code := (
243202 -- e.g. x := ...
244203 is t:Token do convertTokenAssignment(t, b.rhs)
245204 -- e.g. (x,y,z) := (...)
246- is p:Parentheses do convertParallelAssignment(p, b.rhs , b.Operator.dictionary )
205+ is p:Parentheses do convertParallelAssignment(true, p , b.rhs )
247206 -- e.g. - Matrix := ...
248207 -- TODO: can #T be implemented here?
249208 is u:Unary do convertUnaryInstallCode(UnaryInstallMethodFun,
0 commit comments