public void Visit(Stmts node)
 {
     VisitChildren (node);
 }
Example #2
0
        private Stmts Stmts()
        {
            Stmts statements = new Stmts ("stmts", currentToken.Row, currentToken.Column);

            if ((Token.Types)currentToken.Type == Token.Types.Var ||
                (Token.Types)currentToken.Type == Token.Types.Identifier ||
                (Token.Types)currentToken.Type == Token.Types.For ||
                (Token.Types)currentToken.Type == Token.Types.Read ||
                (Token.Types)currentToken.Type == Token.Types.Print ||
                (Token.Types)currentToken.Type == Token.Types.Assert) {
                try {
                    statements.AddChild (Stmt());
                    Match (Token.Types.Semicolon);
                    statements.AddChild (Stmts ());
                    return statements;
                } catch (Error e) {
                    Errors.Add (e);
                    SkipToNextStatement ();
                    return Stmts ();
                }
            } else if ((Token.Types)currentToken.Type == Token.Types.End ||
                       (Token.Types)currentToken.Type == Token.Types.EOS) {
                return statements;
            }

            throw new SyntaxError ("invalid start symbol for statement " + currentToken.Lexeme,
                currentToken.Row, currentToken.Column);
        }