Ignore:
Timestamp:
Aug 9, 2017, 2:08:14 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
65cdc1e
Parents:
e195093
Message:

Structure based exception handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    re195093 rcbce272  
    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 : Mon Jul 31 14:54:32 2017
    13 // Update Count     : 2474
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  4 13:33:00 2017
     13// Update Count     : 2475
    1414//
    1515
     
    182182%type<en> asm_clobbers_list_opt
    183183%type<flag> asm_volatile_opt
     184%type<en> handler_predicate_opt
    184185
    185186// statements
     
    968969
    969970handler_clause:
    970         // TEMPORARY, TEST EXCEPTIONS
    971         handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
    972                 { $$ = new StatementNode( build_catch( $1, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); }
    973         | handler_clause handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
    974                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
    975 
    976         | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    977                 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); }
     971        handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     972                { $$ = new StatementNode( build_catch( $1, $5, $7, $9 ) ); }
    978973        | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    979                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); }
     974                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, $8, $10 ) ) ); }
    980975        ;
    981976
    982977handler_predicate_opt:
    983978        //empty
     979                { $$ = nullptr; }
    984980        | ';' conditional_expression
     981                { $$ = $2; }
    985982        ;
    986983
     
    16741671        | aggregate_key attribute_list_opt typegen_name         // CFA
    16751672                { $$ = $3->addQualifiers( $2 ); }
    1676 
    1677 // Temp, testing TreeStruct
    1678     | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name
    1679         {
    1680             typedefTable.makeTypedef( *$4 );            // create typedef
    1681             if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
    1682             forall = false;                             // reset
    1683         }
    1684       '{' field_declaration_list '}'
    1685         {
    1686             $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
    1687                 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );
    1688         }
    1689     | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname
    1690         {
    1691             typedefTable.makeTypedef( *$4 );            // create typedef
    1692             if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
    1693             forall = false;                             // reset
    1694         }
    1695       '{' field_declaration_list '}'
    1696         {
    1697             $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
    1698                 $4, $5, nullptr, $8, true )->addQualifiers( $3 );
    1699         }
    17001673        ;
    17011674
Note: See TracChangeset for help on using the changeset viewer.