Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    ra16764a6 r6a276a0  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 22 17:48:54 2018
    13 // Update Count     : 3028
     12// Last Modified On : Fri Mar  9 11:37:35 2018
     13// Update Count     : 3075
    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                      choose_clause_list_opt          choose_clause_list
     256%type<sn> switch_clause_list_opt                switch_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
    260259%type<sn> iteration_statement                   jump_statement
    261260%type<sn> expression_statement                  asm_statement
     
    917916                { $$ = new StatementNode( build_if( $4, $6, $8 ) ); }
    918917        | SWITCH '(' comma_expression ')' case_clause
    919                 { $$ = new StatementNode( build_switch( $3, $5 ) ); }
     918                { $$ = new StatementNode( build_switch( true, $3, $5 ) ); }
    920919        | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
    921920                {
    922                         StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
     921                        StatementNode *sw = new StatementNode( build_switch( true, $3, $8 ) );
    923922                        // The semantics of the declaration list is changed to include associated initialization, which is performed
    924923                        // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound
     
    929928                }
    930929        | CHOOSE '(' comma_expression ')' case_clause           // CFA
    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 ) );
     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 ) );
    935934                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    936935                }
     
    970969        ;
    971970
     971//label_list_opt:
     972//      // empty
     973//      | identifier_or_type_name ':'
     974//      | label_list_opt identifier_or_type_name ':'
     975//      ;
     976
    972977case_label_list:                                                                                // CFA
    973978        case_label
     
    990995        | switch_clause_list case_label_list statement_list_nodecl
    991996                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); }
    992         ;
    993 
    994 choose_clause_list_opt:                                                                 // CFA
    995         // empty
    996                 { $$ = nullptr; }
    997         | choose_clause_list
    998         ;
    999 
    1000 choose_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 
    1011 fall_through_opt:                                                                               // CFA
    1012         // empty
    1013                 { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); } // insert implicit break
    1014         | fall_through
    1015         ;
    1016 
    1017 fall_through_name:                                                                              // CFA
    1018         FALLTHRU
    1019         | FALLTHROUGH
    1020         ;
    1021 
    1022 fall_through:                                                                                   // CFA
    1023         fall_through_name
    1024                 { $$ = nullptr; }
    1025         | fall_through_name ';'
    1026                 { $$ = nullptr; }
    1027997        ;
    1028998
     
    10501020                // whereas normal operator precedence yields goto (*i)+3;
    10511021                { $$ = 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 ) ); }
    10521029        | CONTINUE ';'
    10531030                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
     
    10761053        ;
    10771054
     1055fall_through_name:                                                                              // CFA
     1056        FALLTHRU
     1057        | FALLTHROUGH
     1058        ;
     1059
    10781060with_statement:
    10791061        WITH '(' tuple_expression_list ')' statement
     
    10901072
    10911073when_clause:
    1092         WHEN '(' comma_expression ')'
    1093                 { $$ = $3; }
     1074        WHEN '(' comma_expression ')'                           { $$ = $3; }
    10941075        ;
    10951076
     
    11151096
    11161097timeout:
    1117         TIMEOUT '(' comma_expression ')'
    1118                 { $$ = $3; }
     1098        TIMEOUT '(' comma_expression ')'                        { $$ = $3; }
    11191099        ;
    11201100
     
    11591139        //empty
    11601140                { $$ = nullptr; }
    1161         | ';' conditional_expression
    1162                 { $$ = $2; }
     1141        | ';' conditional_expression                            { $$ = $2; }
    11631142        ;
    11641143
    11651144handler_key:
    1166         CATCH
    1167                 { $$ = CatchStmt::Terminate; }
    1168         | CATCHRESUME
    1169                 { $$ = CatchStmt::Resume; }
     1145        CATCH                                                                           { $$ = CatchStmt::Terminate; }
     1146        | CATCHRESUME                                                           { $$ = CatchStmt::Resume; }
    11701147        ;
    11711148
    11721149finally_clause:
    1173         FINALLY compound_statement
    1174                 {
    1175                         $$ = new StatementNode( build_finally( $2 ) );
    1176                 }
     1150        FINALLY compound_statement                                      { $$ = new StatementNode( build_finally( $2 ) ); }
    11771151        ;
    11781152
     
    24132387                        $$ = $2;
    24142388                }
    2415         | forall '{' external_definition_list '}'                       // CFA, namespace
     2389        | type_qualifier_list '{' external_definition_list '}'                  // CFA, namespace
    24162390        ;
    24172391
Note: See TracChangeset for help on using the changeset viewer.