|
@@ -1764,7 +1764,8 @@ PRODUCTIONS
|
|
|
isOpen: BOOLEAN;
|
|
isOpen: BOOLEAN;
|
|
|
qb, cv: QbeGen.QVal;
|
|
qb, cv: QbeGen.QVal;
|
|
|
fid, fref, slot: INTEGER;
|
|
fid, fref, slot: INTEGER;
|
|
|
- r: BOOLEAN; .)
|
|
|
|
|
|
|
+ r: BOOLEAN;
|
|
|
|
|
+ astDes, astSel: AST.Node; .)
|
|
|
= GetIdent<n> (. methCls := SymTab.InvalidType;
|
|
= GetIdent<n> (. methCls := SymTab.InvalidType;
|
|
|
QbeGen.CopyOp(n, qn);
|
|
QbeGen.CopyOp(n, qn);
|
|
|
sfx := FALSE;
|
|
sfx := FALSE;
|
|
@@ -1933,8 +1934,11 @@ PRODUCTIONS
|
|
|
END
|
|
END
|
|
|
END
|
|
END
|
|
|
END; .)
|
|
END; .)
|
|
|
|
|
+ (. astDes := AST.MakeNode(AST.NkDesignator);
|
|
|
|
|
+ AST.SetChild(astDes, AST.NChild(astDes), AST.MakeLeaf(AST.NkIdent, n)); .)
|
|
|
{ "[" Expr<it, iq>
|
|
{ "[" Expr<it, iq>
|
|
|
- (. IF t = SymTab.InvalidType THEN
|
|
|
|
|
|
|
+ (. AST.SetChild(astDes, AST.NChild(astDes),
|
|
|
|
|
+ AST.MakeUn(AST.NkSelector, AST.SelIndex, astCur)); IF t = SymTab.InvalidType THEN
|
|
|
ELSIF SymTab.ClassOf(t) #
|
|
ELSIF SymTab.ClassOf(t) #
|
|
|
SymTab.ClArray THEN
|
|
SymTab.ClArray THEN
|
|
|
SemError(217);
|
|
SemError(217);
|
|
@@ -1980,7 +1984,8 @@ PRODUCTIONS
|
|
|
t := eT; sfx := TRUE
|
|
t := eT; sfx := TRUE
|
|
|
END; .)
|
|
END; .)
|
|
|
{ "," Expr<it, iq>
|
|
{ "," Expr<it, iq>
|
|
|
- (. IF t = SymTab.InvalidType THEN
|
|
|
|
|
|
|
+ (. AST.SetChild(astDes, AST.NChild(astDes),
|
|
|
|
|
+ AST.MakeUn(AST.NkSelector, AST.SelIndex, astCur)); IF t = SymTab.InvalidType THEN
|
|
|
ELSIF SymTab.ClassOf(t) #
|
|
ELSIF SymTab.ClassOf(t) #
|
|
|
SymTab.ClArray THEN
|
|
SymTab.ClArray THEN
|
|
|
SemError(217);
|
|
SemError(217);
|
|
@@ -2027,7 +2032,10 @@ PRODUCTIONS
|
|
|
END; .) }
|
|
END; .) }
|
|
|
"]"
|
|
"]"
|
|
|
| "." GetIdent<fn>
|
|
| "." GetIdent<fn>
|
|
|
- (. IF k = SymTab.KindModule THEN
|
|
|
|
|
|
|
+ (. astSel := AST.MakeNode(AST.NkSelector);
|
|
|
|
|
+ AST.SetOp(astSel, AST.SelField);
|
|
|
|
|
+ AST.SetChild(astSel, 0, AST.MakeLeaf(AST.NkIdent, fn));
|
|
|
|
|
+ AST.SetChild(astDes, AST.NChild(astDes), astSel); IF k = SymTab.KindModule THEN
|
|
|
(* qualified L.x: materialize
|
|
(* qualified L.x: materialize
|
|
|
the export, then load it *)
|
|
the export, then load it *)
|
|
|
IF NOT SymTab.MaterializeAlias(n,
|
|
IF NOT SymTab.MaterializeAlias(n,
|
|
@@ -2087,7 +2095,9 @@ PRODUCTIONS
|
|
|
sfx := TRUE
|
|
sfx := TRUE
|
|
|
END; .)
|
|
END; .)
|
|
|
| "^"
|
|
| "^"
|
|
|
- (. IF t = SymTab.InvalidType THEN
|
|
|
|
|
|
|
+ (. astSel := AST.MakeNode(AST.NkSelector);
|
|
|
|
|
+ AST.SetOp(astSel, AST.SelDeref);
|
|
|
|
|
+ AST.SetChild(astDes, AST.NChild(astDes), astSel); IF t = SymTab.InvalidType THEN
|
|
|
ELSIF SymTab.ClassOf(t) #
|
|
ELSIF SymTab.ClassOf(t) #
|
|
|
SymTab.ClPtr THEN
|
|
SymTab.ClPtr THEN
|
|
|
SemError(219);
|
|
SemError(219);
|
|
@@ -2110,7 +2120,7 @@ PRODUCTIONS
|
|
|
note is q itself. *)
|
|
note is q itself. *)
|
|
|
sfx := TRUE
|
|
sfx := TRUE
|
|
|
END
|
|
END
|
|
|
- END; .) } .
|
|
|
|
|
|
|
+ END; .) } (. astCur := astDes; .) .
|
|
|
(* Result suffix (ISO component after a function call): `F()^`,
|
|
(* Result suffix (ISO component after a function call): `F()^`,
|
|
|
`F()[i]`, `F().field`. The call result is in t/q with sfx FALSE
|
|
`F()[i]`, `F().field`. The call result is in t/q with sfx FALSE
|
|
|
(a value, or a descriptor address for aggregates); each component
|
|
(a value, or a descriptor address for aggregates); each component
|
|
@@ -2598,7 +2608,9 @@ PRODUCTIONS
|
|
|
isMax: BOOLEAN;
|
|
isMax: BOOLEAN;
|
|
|
called, isHigh, sfx, isCh,
|
|
called, isHigh, sfx, isCh,
|
|
|
isU, uok, isStr: BOOLEAN;
|
|
isU, uok, isStr: BOOLEAN;
|
|
|
- ucp: INTEGER; astIsLit: BOOLEAN; .)
|
|
|
|
|
|
|
+ ucp: INTEGER; astIsLit: BOOLEAN;
|
|
|
|
|
+ astD: AST.Node;
|
|
|
|
|
+ astCall: BOOLEAN; .)
|
|
|
= (. astIsLit := FALSE; .)
|
|
= (. astIsLit := FALSE; .)
|
|
|
( integer (. LexString(s);
|
|
( integer (. LexString(s);
|
|
|
QbeGen.NormInt(s, q); IF twoPhase THEN astIsLit := TRUE; astCur := AST.MakeLeaf(AST.NkIntLit, s) END;
|
|
QbeGen.NormInt(s, q); IF twoPhase THEN astIsLit := TRUE; astCur := AST.MakeLeaf(AST.NkIntLit, s) END;
|
|
@@ -2653,7 +2665,7 @@ PRODUCTIONS
|
|
|
t := SymTab.NewUStr();
|
|
t := SymTab.NewUStr();
|
|
|
QbeGen.NoteAddr(q, q)
|
|
QbeGen.NoteAddr(q, q)
|
|
|
END; .)
|
|
END; .)
|
|
|
- | Design<dt, dk, qd, qn, sfx> (. called := FALSE;
|
|
|
|
|
|
|
+ | Design<dt, dk, qd, qn, sfx> (. astD := astCur; astCall := FALSE; called := FALSE;
|
|
|
t := dt;
|
|
t := dt;
|
|
|
IF sfx THEN
|
|
IF sfx THEN
|
|
|
IF dt =
|
|
IF dt =
|
|
@@ -2694,9 +2706,9 @@ PRODUCTIONS
|
|
|
SymTab.ClRecord)) THEN
|
|
SymTab.ClRecord)) THEN
|
|
|
QbeGen.NoteAddr(qd, qd)
|
|
QbeGen.NoteAddr(qd, qd)
|
|
|
END; .)
|
|
END; .)
|
|
|
- [ TypedBraceLit<dt, q> (. t := dt; .) ]
|
|
|
|
|
|
|
+ [ TypedBraceLit<dt, q> (. t := dt; astCall := TRUE; .) ]
|
|
|
[ ArgList<qn, dt, qd, TRUE, FALSE, methCls, ct2, q2, called>
|
|
[ ArgList<qn, dt, qd, TRUE, FALSE, methCls, ct2, q2, called>
|
|
|
- (. t := ct2;
|
|
|
|
|
|
|
+ (. astCall := TRUE; t := ct2;
|
|
|
QbeGen.CopyOp(q2, q);
|
|
QbeGen.CopyOp(q2, q);
|
|
|
sfx := FALSE; .)
|
|
sfx := FALSE; .)
|
|
|
{ ResultComp<t, q, sfx> }
|
|
{ ResultComp<t, q, sfx> }
|
|
@@ -2712,7 +2724,9 @@ PRODUCTIONS
|
|
|
QbeGen.CopyOp(q2, q)
|
|
QbeGen.CopyOp(q2, q)
|
|
|
END
|
|
END
|
|
|
END; .) ]
|
|
END; .) ]
|
|
|
- (. IF NOT called
|
|
|
|
|
|
|
+ (. IF astCall THEN astCur := AST.NoNode ELSE astCur := astD END;
|
|
|
|
|
+ astIsLit := TRUE;
|
|
|
|
|
+ IF NOT called
|
|
|
AND (dk = SymTab.KindProc) THEN
|
|
AND (dk = SymTab.KindProc) THEN
|
|
|
(* bare zero-arg function
|
|
(* bare zero-arg function
|
|
|
call (parentheses may be
|
|
call (parentheses may be
|