private AstExpr ParseRef() { AstExpr varRef = new AstVarRef { StName = Expect(Ktoken.Id).St }; if (Accept(Ktoken.Lbracket)) { var astIndex = new AstIndex { exprLeft = varRef, exprRight = ParseExpr() }; Expect(Ktoken.Rbracket); return(astIndex); } if (Accept(Ktoken.Dot)) { var varRefRight = new AstVarRef { StName = Expect(Ktoken.Id).St }; varRef = new AstDot { varLeft = (AstVarRef)varRef, varRight = varRefRight }; } if (FCurrent(Ktoken.Lparen)) { return new AstCall { exprFunc = varRef, rgexprParam = ParseArgumentList().ToArray() } } ; return(varRef); }
private void CompileVarRef(AstVarRef node, Syt syt, StringBuilder sb) { var syte = syt.Lookup(node.StName); if (syte.Ksyte.FIn(Ksyte.Field, Ksyte.Arg, Ksyte.Var, Ksyte.Static)) { sb.AppendLine("push {0} {1}".StFormat(StSegment(syte.Ksyte), syte.Isyte)); } else { throw new Erparse(node, "not an rvalue"); } }