private CallExpr ParseCall(Expr target) { Eat(TokenType.LeftParenthesis); List<Arg> args = new List<Arg>(); if (!MaybeEat(TokenType.RightParenthesis)) { do { args.Add(ParseArg()); } while (MaybeEat(TokenType.Comma)); Eat(TokenType.RightParenthesis); } var ret = new CallExpr(target, args.ToArray()); ret.SetLoc(_globalParent, target.StartIndex, GetEnd()); return ret; }
private Expr ParseCallExpr() { Expr ret = ParseMemberExpr(); if (ret == null) return null; var start = ret.StartIndex; while (MaybeEat(TokenType.LeftParenthesis)) { List<Arg> args = new List<Arg>(); if (!MaybeEat(TokenType.RightParenthesis)) { do { args.Add(ParseArg()); } while (MaybeEat(TokenType.Comma)); Eat(TokenType.RightParenthesis); } ret = new CallExpr(ret, args.ToArray()); ret.SetLoc(_globalParent, start, GetEnd()); } return ret; }