Пример #1
0
        private Expr Call()
        {
            var expr = Primary();

            while (true)
            {
                if (Match(LEFT_PAREN))
                {
                    expr = FinishCall(expr);
                }
                else if (Match(DOT))
                {
                    var name = Consume(IDENTIFIER, "Expect property name after '.'.");
                    expr = new Expr.GetExpr(expr, name);
                }
                else
                {
                    break;
                }
            }

            return(expr);
        }
Пример #2
0
 public string VisitGetExpr(Expr.GetExpr expr)
 {
     return(Parenthesize2(".", expr.Object, expr.Name.Lexeme));
 }
Пример #3
0
 public object VisitGetExpr(Expr.GetExpr expr)
 {
     Resolve(expr.Object);
     return(null);
 }