Changes in src/Parser/parser.yy [2f22cc4:d1625f8]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r2f22cc4 rd1625f8 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 10 13:09:53201613 // Update Count : 18 4412 // Last Modified On : Tue Aug 9 12:59:11 2016 13 // Update Count : 1821 14 14 // 15 15 … … 122 122 StatementNode *sn; 123 123 ConstantExpr *constant; 124 ForCtl *fctl;125 124 LabelNode *label; 126 125 InitializerNode *in; … … 143 142 %type<en> constant_expression assignment_expression assignment_expression_opt 144 143 %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 148 145 %type<en> subrange 149 146 %type<en> asm_operands_opt asm_operands_list asm_operand … … 723 720 IF '(' comma_expression ')' statement %prec THEN 724 721 // 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 ); } 727 723 | 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 )) ); } 730 725 | 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 ); } 733 727 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA 734 728 { 735 StatementNode *sw = new StatementNode 2( build_switch( $3, $8 ));729 StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 ); 736 730 // The semantics of the declaration list is changed to include associated initialization, which is performed 737 731 // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound … … 742 736 } 743 737 | 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 ); } 746 739 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA 747 740 { 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 ); 750 742 $$ = $7 != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( $7 ))->set_link( sw )) ) : sw; 751 743 } … … 828 820 iteration_statement: 829 821 WHILE '(' comma_expression ')' statement 830 { $$ = new StatementNode 2( build_while( $3, $5 )); }822 { $$ = new StatementNode( StatementNode::While, $3, $5 ); } 831 823 | DO statement WHILE '(' comma_expression ')' ';' 832 { $$ = new StatementNode 2( build_while( $5, $2 )); }824 { $$ = new StatementNode( StatementNode::Do, $5, $2 ); } 833 825 | FOR '(' push for_control_expression ')' statement 834 { $$ = new StatementNode 2( build_for( $4, $6 )); }826 { $$ = new StatementNode( StatementNode::For, $4, $6 ); } 835 827 ; 836 828 837 829 for_control_expression: 838 830 comma_expression_opt pop ';' comma_expression_opt ';' comma_expression_opt 839 { $$ = new ForCtl ( $1, $4, $6 ); }831 { $$ = new ForCtlExprNode( $1, $4, $6 ); } 840 832 | declaration comma_expression_opt ';' comma_expression_opt // C99 841 { $$ = new ForCtl ( $1, $2, $4 ); }833 { $$ = new ForCtlExprNode( $1, $2, $4 ); } 842 834 ; 843 835 … … 954 946 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $4, $6, $8, $10 ); } 955 947 | 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 ); } 957 949 ; 958 950
Note:
See TracChangeset
for help on using the changeset viewer.