Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9335ecc r307a732  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 22:11:22 2017
    13 // Update Count     : 2414
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jun 30 15:38:00 2017
     13// Update Count     : 2415
    1414//
    1515
     
    104104        std::string * str;
    105105        bool flag;
     106        CatchStmt::Kind catch_kind;
    106107}
    107108
     
    192193%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    193194%type<sn> /* handler_list */                    handler_clause                          finally_clause
     195%type<catch_kind> handler_key
    194196
    195197// declarations
     
    958960handler_clause:
    959961        // TEMPORARY, TEST EXCEPTIONS
    960         CATCH '(' push push INTEGERconstant pop ')' compound_statement pop
    961                 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); }
    962         | handler_clause CATCH '(' push push INTEGERconstant pop ')' compound_statement pop
    963                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
    964 
    965         | CATCH '(' push push exception_declaration pop ')' compound_statement pop
    966                 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, $5, nullptr, $8 ) ); }
    967         | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop
    968                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, $6, nullptr, $9 ) ) ); }
    969         | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    970                 { $$ = new StatementNode( build_catch( CatchStmt::Resume, $5, nullptr, $8 ) ); }
    971         | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    972                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Resume, $6, nullptr, $9 ) ) ); }
     962        handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
     963                { $$ = new StatementNode( build_catch( $1, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); }
     964        | handler_clause handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
     965                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
     966
     967        | handler_key '(' push push exception_declaration pop ')' compound_statement pop
     968                { $$ = new StatementNode( build_catch( $1, $5, nullptr, $8 ) ); }
     969        | handler_clause handler_key '(' push push exception_declaration pop ')' compound_statement pop
     970                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $9 ) ) ); }
     971        ;
     972
     973handler_key:
     974        CATCH
     975                { $$ = CatchStmt::Terminate; }
     976        | CATCHRESUME
     977                { $$ = CatchStmt::Resume; }
    973978        ;
    974979
Note: See TracChangeset for help on using the changeset viewer.