Exemple #1
0
        private Stmt ExpressionStatement()
        {
            Stmt ret = null;

            Expr expr = Expression();

            if (repl)
            {
                if (Check(TokenType.Semicolon))
                {
                    Consume(TokenType.Semicolon, "Expect ';' after value.");
                    ret = new Stmt.Expression(expr);
                }
                else
                {
                    ret = new Stmt.Print(expr);
                }
            }
            else
            {
                Consume(TokenType.Semicolon, "Expect ';' after value.");
                ret = new Stmt.Expression(expr);
            }

            return(ret);
        }
Exemple #2
0
 public void Visit(Stmt.Expression stmt)
 {
     Evaluate(stmt.expression);
 }
Exemple #3
0
 public void Visit(Stmt.Expression expression)
 {
     // do nothing
 }
Exemple #4
0
 public void Visit(Stmt.Expression stmt)
 {
     Resolve(stmt.expression);
 }