Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r936e9f4 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 : Wed Aug 16 18:09:14 2017
    13 // Update Count     : 2485
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  4 13:33:00 2017
     13// Update Count     : 2475
    1414//
    1515
     
    9898        StatementNode * sn;
    9999        ConstantExpr * constant;
    100         IfCtl * ifctl;
    101100        ForCtl * fctl;
    102101        LabelNode * label;
     
    176175%type<en> comma_expression                              comma_expression_opt
    177176%type<en> argument_expression_list              argument_expression                     default_initialize_opt
    178 %type<ifctl> if_control_expression
    179177%type<fctl> for_control_expression
    180178%type<en> subrange
     
    796794
    797795selection_statement:
    798         IF '(' if_control_expression ')' statement                              %prec THEN
     796        IF '(' comma_expression ')' statement                           %prec THEN
    799797                // explicitly deal with the shift/reduce conflict on if/else
    800798                { $$ = new StatementNode( build_if( $3, $5, nullptr ) ); }
    801         | IF '(' if_control_expression ')' statement ELSE statement
     799        | IF '(' comma_expression ')' statement ELSE statement
    802800                { $$ = new StatementNode( build_if( $3, $5, $7 ) ); }
    803801        | SWITCH '(' comma_expression ')' case_clause           // CFA
     
    821819                }
    822820        ;
    823 
    824 if_control_expression:
    825         comma_expression
    826                 { $$ = new IfCtl( nullptr, $1 ); }
    827         | c_declaration                                                                         // no semi-coln
    828                 { $$ = new IfCtl( $1, nullptr ); }
    829         | cfa_declaration                                                                       // no semi-colon
    830                 { $$ = new IfCtl( $1, nullptr ); }
    831         | declaration comma_expression
    832                 { $$ = new IfCtl( $1, $2 ); }
    833         ;
    834821
    835822// CASE and DEFAULT clauses are only allowed in the SWITCH statement, precluding Duff's device. In addition, a case
     
    11101097
    11111098KR_declaration_list:
    1112         c_declaration ';'
    1113         | KR_declaration_list push c_declaration ';'
     1099        c_declaration
     1100        | KR_declaration_list push c_declaration
    11141101                { $$ = $1->appendList( $3 ); }
    11151102        ;
     
    11301117        ;
    11311118
    1132 declaration:                                                                                    // old & new style declarations
    1133         c_declaration ';'
    1134         | cfa_declaration ';'                                                           // CFA
     1119declaration:                                                                                    // CFA, new & old style declarations
     1120        cfa_declaration
     1121        | c_declaration
    11351122        ;
    11361123
     
    11471134
    11481135cfa_declaration:                                                                                // CFA
    1149         cfa_variable_declaration pop
    1150         | cfa_typedef_declaration pop
    1151         | cfa_function_declaration pop
    1152         | type_declaring_list pop
    1153         | trait_specifier pop
     1136        cfa_variable_declaration pop ';'
     1137        | cfa_typedef_declaration pop ';'
     1138        | cfa_function_declaration pop ';'
     1139        | type_declaring_list pop ';'
     1140        | trait_specifier pop ';'
    11541141        ;
    11551142
     
    13511338
    13521339c_declaration:
    1353         declaration_specifier declaring_list pop
     1340        declaration_specifier declaring_list pop ';'
    13541341                {
    13551342                        $$ = distAttr( $1, $2 );
    13561343                }
    1357         | typedef_declaration pop
    1358         | typedef_expression pop                                                        // GCC, naming expression type
    1359         | sue_declaration_specifier pop
     1344        | typedef_declaration pop ';'
     1345        | typedef_expression pop ';'                                            // GCC, naming expression type
     1346        | sue_declaration_specifier pop ';'
    13601347        ;
    13611348
Note: See TracChangeset for help on using the changeset viewer.