Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r6a276a0 ra16764a6  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  9 11:37:35 2018
    13 // Update Count     : 3075
     12// Last Modified On : Thu Feb 22 17:48:54 2018
     13// Update Count     : 3028
    1414//
    1515
     
    254254%type<sn> statement_decl                                statement_decl_list                     statement_list_nodecl
    255255%type<sn> selection_statement
    256 %type<sn> switch_clause_list_opt                switch_clause_list
     256%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    257257%type<en> case_value
    258258%type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
     259%type<sn> fall_through                                  fall_through_opt
    259260%type<sn> iteration_statement                   jump_statement
    260261%type<sn> expression_statement                  asm_statement
     
    916917                { $$ = new StatementNode( build_if( $4, $6, $8 ) ); }
    917918        | SWITCH '(' comma_expression ')' case_clause
    918                 { $$ = new StatementNode( build_switch( true, $3, $5 ) ); }
     919                { $$ = new StatementNode( build_switch( $3, $5 ) ); }
    919920        | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
    920921                {
    921                         StatementNode *sw = new StatementNode( build_switch( true, $3, $8 ) );
     922                        StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
    922923                        // The semantics of the declaration list is changed to include associated initialization, which is performed
    923924                        // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound
     
    928929                }
    929930        | CHOOSE '(' comma_expression ')' case_clause           // CFA
    930                 { $$ = new StatementNode( build_switch( false, $3, $5 ) ); }
    931         | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
    932                 {
    933                         StatementNode *sw = new StatementNode( build_switch( false, $3, $8 ) );
     931                { $$ = new StatementNode( build_switch( $3, $5 ) ); }
     932        | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA
     933                {
     934                        StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
    934935                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    935936                }
     
    969970        ;
    970971
    971 //label_list_opt:
    972 //      // empty
    973 //      | identifier_or_type_name ':'
    974 //      | label_list_opt identifier_or_type_name ':'
    975 //      ;
    976 
    977972case_label_list:                                                                                // CFA
    978973        case_label
     
    995990        | switch_clause_list case_label_list statement_list_nodecl
    996991                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); }
     992        ;
     993
     994choose_clause_list_opt:                                                                 // CFA
     995        // empty
     996                { $$ = nullptr; }
     997        | choose_clause_list
     998        ;
     999
     1000choose_clause_list:                                                                             // CFA
     1001        case_label_list fall_through
     1002                { $$ = $1->append_last_case( $2 ); }
     1003        | case_label_list statement_list_nodecl fall_through_opt
     1004                { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); }
     1005        | choose_clause_list case_label_list fall_through
     1006                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); }
     1007        | choose_clause_list case_label_list statement_list_nodecl fall_through_opt
     1008                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); }
     1009        ;
     1010
     1011fall_through_opt:                                                                               // CFA
     1012        // empty
     1013                { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); } // insert implicit break
     1014        | fall_through
     1015        ;
     1016
     1017fall_through_name:                                                                              // CFA
     1018        FALLTHRU
     1019        | FALLTHROUGH
     1020        ;
     1021
     1022fall_through:                                                                                   // CFA
     1023        fall_through_name
     1024                { $$ = nullptr; }
     1025        | fall_through_name ';'
     1026                { $$ = nullptr; }
    9971027        ;
    9981028
     
    10201050                // whereas normal operator precedence yields goto (*i)+3;
    10211051                { $$ = new StatementNode( build_computedgoto( $3 ) ); }
    1022                 // A semantic check is required to ensure fallthru appears only in the body of a choose statement.
    1023     | fall_through_name ';'                                                             // CFA
    1024                 { $$ = new StatementNode( build_branch( BranchStmt::FallThrough ) ); }
    1025     | fall_through_name identifier_or_type_name ';'             // CFA
    1026                 { $$ = new StatementNode( build_branch( $2, BranchStmt::FallThrough ) ); }
    1027         | fall_through_name DEFAULT ';'                                         // CFA
    1028                 { $$ = new StatementNode( build_branch( BranchStmt::FallThroughDefault ) ); }
    10291052        | CONTINUE ';'
    10301053                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
     
    10531076        ;
    10541077
    1055 fall_through_name:                                                                              // CFA
    1056         FALLTHRU
    1057         | FALLTHROUGH
    1058         ;
    1059 
    10601078with_statement:
    10611079        WITH '(' tuple_expression_list ')' statement
     
    10721090
    10731091when_clause:
    1074         WHEN '(' comma_expression ')'                           { $$ = $3; }
     1092        WHEN '(' comma_expression ')'
     1093                { $$ = $3; }
    10751094        ;
    10761095
     
    10961115
    10971116timeout:
    1098         TIMEOUT '(' comma_expression ')'                        { $$ = $3; }
     1117        TIMEOUT '(' comma_expression ')'
     1118                { $$ = $3; }
    10991119        ;
    11001120
     
    11391159        //empty
    11401160                { $$ = nullptr; }
    1141         | ';' conditional_expression                            { $$ = $2; }
     1161        | ';' conditional_expression
     1162                { $$ = $2; }
    11421163        ;
    11431164
    11441165handler_key:
    1145         CATCH                                                                           { $$ = CatchStmt::Terminate; }
    1146         | CATCHRESUME                                                           { $$ = CatchStmt::Resume; }
     1166        CATCH
     1167                { $$ = CatchStmt::Terminate; }
     1168        | CATCHRESUME
     1169                { $$ = CatchStmt::Resume; }
    11471170        ;
    11481171
    11491172finally_clause:
    1150         FINALLY compound_statement                                      { $$ = new StatementNode( build_finally( $2 ) ); }
     1173        FINALLY compound_statement
     1174                {
     1175                        $$ = new StatementNode( build_finally( $2 ) );
     1176                }
    11511177        ;
    11521178
     
    23872413                        $$ = $2;
    23882414                }
    2389         | type_qualifier_list '{' external_definition_list '}'                  // CFA, namespace
     2415        | forall '{' external_definition_list '}'                       // CFA, namespace
    23902416        ;
    23912417
Note: See TracChangeset for help on using the changeset viewer.