Changeset 67fa9f9 for src/Parser


Ignore:
Timestamp:
Jul 5, 2017, 10:50:22 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0614d14
Parents:
11dbfe1 (diff), 307a732 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/InitializerNode.cc

    r11dbfe1 r67fa9f9  
    7474
    7575        InitializerNode *moreInit;
    76         if  ( get_next() != 0 && ((moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) != 0) )
     76        if ( (moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) ) {
    7777                moreInit->printOneLine( os );
     78        }
    7879}
    7980
    8081Initializer *InitializerNode::build() const {
    8182        if ( aggregate ) {
     83                // steal designators from children
     84                std::list< Designation * > designlist;
     85                InitializerNode * child = next_init();
     86                for ( ; child != nullptr; child = dynamic_cast< InitializerNode * >( child->get_next() ) ) {
     87                        std::list< Expression * > desList;
     88                        buildList< Expression, ExpressionNode >( child->designator, desList );
     89                        designlist.push_back( new Designation( desList ) );
     90                } // for
    8291                std::list< Initializer * > initlist;
    8392                buildList< Initializer, InitializerNode >( next_init(), initlist );
    84 
    85                 std::list< Expression * > designlist;
    86 
    87                 if ( designator != 0 ) {
    88                         buildList< Expression, ExpressionNode >( designator, designlist );
    89                 } // if
    90 
    9193                return new ListInit( initlist, designlist, maybeConstructed );
    9294        } else {
    93                 std::list< Expression * > designators;
    94 
    95                 if ( designator != 0 )
    96                         buildList< Expression, ExpressionNode >( designator, designators );
    97 
    98                 if ( get_expression() != 0)
    99                         return new SingleInit( maybeBuild< Expression >( get_expression() ), designators, maybeConstructed );
     95                if ( get_expression() != 0) {
     96                        return new SingleInit( maybeBuild< Expression >( get_expression() ), maybeConstructed );
     97                }
    10098        } // if
    101 
    10299        return 0;
    103100}
  • src/Parser/TypeData.cc

    r11dbfe1 r67fa9f9  
    760760                if ( cur->has_enumeratorValue() ) {
    761761                        ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members);
    762                         member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), list< Expression * >() ) );
     762                        member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ) ) );
    763763                } // if
    764764        } // for
     
    777777TupleType * buildTuple( const TypeData * td ) {
    778778        assert( td->kind == TypeData::Tuple );
    779         TupleType * ret = new TupleType( buildQualifiers( td ) );
    780         buildTypeList( td->tuple, ret->get_types() );
     779        std::list< Type * > types;
     780        buildTypeList( td->tuple, types );
     781        TupleType * ret = new TupleType( buildQualifiers( td ), types );
    781782        buildForall( td->forall, ret->get_forall() );
    782783        return ret;
  • src/Parser/parser.yy

    r11dbfe1 r67fa9f9  
    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.