Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r2f22cc4 rd1625f8  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 10 13:09:53 2016
    13 // Update Count     : 1844
     12// Last Modified On : Tue Aug  9 12:59:11 2016
     13// Update Count     : 1821
    1414//
    1515
     
    122122        StatementNode *sn;
    123123        ConstantExpr *constant;
    124         ForCtl *fctl;
    125124        LabelNode *label;
    126125        InitializerNode *in;
     
    143142%type<en> constant_expression                   assignment_expression           assignment_expression_opt
    144143%type<en> comma_expression                              comma_expression_opt
    145 //%type<en> argument_expression_list            argument_expression                     for_control_expression          assignment_opt
    146 %type<en> argument_expression_list              argument_expression                     assignment_opt
    147 %type<fctl> for_control_expression
     144%type<en> argument_expression_list              argument_expression                     for_control_expression          assignment_opt
    148145%type<en> subrange
    149146%type<en> asm_operands_opt asm_operands_list asm_operand
     
    723720        IF '(' comma_expression ')' statement                           %prec THEN
    724721                // explicitly deal with the shift/reduce conflict on if/else
    725                 //{ $$ = new StatementNode( StatementNode::If, $3, $5 ); }
    726                 { $$ = new StatementNode2( build_if( $3, $5, nullptr ) ); }
     722                { $$ = new StatementNode( StatementNode::If, $3, $5 ); }
    727723        | IF '(' comma_expression ')' statement ELSE statement
    728                 //{ $$ = new StatementNode( StatementNode::If, $3, (StatementNode *)mkList((*$5, *$7 )) ); }
    729                 { $$ = new StatementNode2( build_if( $3, $5, $7 ) ); }
     724                { $$ = new StatementNode( StatementNode::If, $3, (StatementNode *)mkList((*$5, *$7 )) ); }
    730725        | SWITCH '(' comma_expression ')' case_clause           // CFA
    731                 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); }
    732                 { $$ = new StatementNode2( build_switch( $3, $5 ) ); }
     726                { $$ = new StatementNode( StatementNode::Switch, $3, $5 ); }
    733727        | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
    734728                {
    735                         StatementNode *sw = new StatementNode2( build_switch( $3, $8 ) );
     729                        StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 );
    736730                        // The semantics of the declaration list is changed to include associated initialization, which is performed
    737731                        // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound
     
    742736                }
    743737        | CHOOSE '(' comma_expression ')' case_clause           // CFA
    744                 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); }
    745                 { $$ = new StatementNode2( build_switch( $3, $5 ) ); }
     738                { $$ = new StatementNode( StatementNode::Switch, $3, $5 ); }
    746739        | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA
    747740                {
    748                         //StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 );
    749                         StatementNode *sw = new StatementNode2( build_switch( $3, $8 ) );
     741                        StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 );
    750742                        $$ = $7 != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( $7 ))->set_link( sw )) ) : sw;
    751743                }
     
    828820iteration_statement:
    829821        WHILE '(' comma_expression ')' statement
    830                 { $$ = new StatementNode2( build_while( $3, $5 ) ); }
     822                { $$ = new StatementNode( StatementNode::While, $3, $5 ); }
    831823        | DO statement WHILE '(' comma_expression ')' ';'
    832                 { $$ = new StatementNode2( build_while( $5, $2 ) ); }
     824                { $$ = new StatementNode( StatementNode::Do, $5, $2 ); }
    833825        | FOR '(' push for_control_expression ')' statement
    834                 { $$ = new StatementNode2( build_for( $4, $6 ) ); }
     826                { $$ = new StatementNode( StatementNode::For, $4, $6 ); }
    835827        ;
    836828
    837829for_control_expression:
    838830        comma_expression_opt pop ';' comma_expression_opt ';' comma_expression_opt
    839                 { $$ = new ForCtl( $1, $4, $6 ); }
     831                { $$ = new ForCtlExprNode( $1, $4, $6 ); }
    840832        | declaration comma_expression_opt ';' comma_expression_opt // C99
    841                 { $$ = new ForCtl( $1, $2, $4 ); }
     833                { $$ = new ForCtlExprNode( $1, $2, $4 ); }
    842834        ;
    843835
     
    954946                { $$ = new AsmStmtNode( StatementNode::Asm, $2, $4, $6, $8, $10 ); }
    955947        | ASM asm_volatile_opt GOTO '(' string_literal_list ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';'
    956                 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $5, 0, $8, $10, $12 ); }
     948        { $$ = new AsmStmtNode( StatementNode::Asm, $2, $5, 0, $8, $10, $12 ); }
    957949        ;
    958950
Note: See TracChangeset for help on using the changeset viewer.