예제 #1
0
        private AST_statement Parse_statement(TokenKind followSet)
        {
            IncrementDepth();
            DebugPrint("stmt");

            AST_statement statement;
            Token         t = LookAheadToken();

            switch (t.Kind)
            {
            case var_Keyword:
                statement = Parse_variable_declaration();
                break;

            case Identifier:
                statement = Parse_assignment(followSet);
                break;

            case for_Keyword:
                statement = Parse_for_statement();
                break;

            case read_Keyword:
                statement = Parse_read_statement();
                break;

            case print_Keyword:
                statement = Parse_print_statement();
                break;

            case assert_Keyword:
                statement = Parse_assert_statement(followSet);
                break;

            default:
                Error("Statement expected. '" + t.ToString() + "' does not start a statement.", t);
                SkipUntilFollow(followSet);
                statement = new ASTDummy_statement();
                break;
            }
            if (statement != null)
            {
                statement.Row    = t.Row;
                statement.Column = t.Column;
            }

            DecrementDepth();

            return(statement);
        }
예제 #2
0
 public virtual void Visit(ASTDummy_statement dummy_statement)
 {
 }