Changes in src/Parser/parser.yy [321f55d:2f22cc4]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r321f55d r2f22cc4 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 23:03:05201613 // Update Count : 184 612 // Last Modified On : Wed Aug 10 13:09:53 2016 13 // Update Count : 1844 14 14 // 15 15 … … 723 723 IF '(' comma_expression ')' statement %prec THEN 724 724 // explicitly deal with the shift/reduce conflict on if/else 725 //{ $$ = new StatementNode( StatementNode::If, $3, $5 ); } 725 726 { $$ = new StatementNode2( build_if( $3, $5, nullptr ) ); } 726 727 | IF '(' comma_expression ')' statement ELSE statement 728 //{ $$ = new StatementNode( StatementNode::If, $3, (StatementNode *)mkList((*$5, *$7 )) ); } 727 729 { $$ = new StatementNode2( build_if( $3, $5, $7 ) ); } 728 730 | SWITCH '(' comma_expression ')' case_clause // CFA 731 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); } 729 732 { $$ = new StatementNode2( build_switch( $3, $5 ) ); } 730 733 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA … … 739 742 } 740 743 | CHOOSE '(' comma_expression ')' case_clause // CFA 744 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); } 741 745 { $$ = new StatementNode2( build_switch( $3, $5 ) ); } 742 746 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA 743 747 { 748 //StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 ); 744 749 StatementNode *sw = new StatementNode2( build_switch( $3, $8 ) ); 745 750 $$ = $7 != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( $7 ))->set_link( sw )) ) : sw; … … 839 844 jump_statement: 840 845 GOTO IDENTIFIER ';' 841 //{ $$ = new StatementNode( StatementNode::Goto, $2 ); } 842 { $$ = new StatementNode2( build_branch( *$2, BranchStmt::Goto ) ); } 846 { $$ = new StatementNode( StatementNode::Goto, $2 ); } 843 847 | GOTO '*' comma_expression ';' // GCC, computed goto 844 848 // The syntax for the GCC computed goto violates normal expression precedence, e.g., goto *i+3; => goto *(i+3); … … 847 851 | CONTINUE ';' 848 852 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 849 //{ $$ = new StatementNode( StatementNode::Continue ); } 850 { $$ = new StatementNode2( build_branch( "", BranchStmt::Continue ) ); } 853 { $$ = new StatementNode( StatementNode::Continue ); } 851 854 | CONTINUE IDENTIFIER ';' // CFA, multi-level continue 852 855 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and 853 856 // the target of the transfer appears only at the start of an iteration statement. 854 //{ $$ = new StatementNode( StatementNode::Continue, $2 ); } 855 { $$ = new StatementNode2( build_branch( *$2, BranchStmt::Continue ) ); delete $2; } 857 { $$ = new StatementNode( StatementNode::Continue, $2 ); } 856 858 | BREAK ';' 857 859 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 858 //{ $$ = new StatementNode( StatementNode::Break ); } 859 { $$ = new StatementNode2( build_branch( "", BranchStmt::Break ) ); } 860 { $$ = new StatementNode( StatementNode::Break ); } 860 861 | BREAK IDENTIFIER ';' // CFA, multi-level exit 861 862 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and 862 863 // the target of the transfer appears only at the start of an iteration statement. 863 //{ $$ = new StatementNode( StatementNode::Break, $2 ); } 864 { $$ = new StatementNode2( build_branch( *$2, BranchStmt::Break ) ); delete $2; } 864 { $$ = new StatementNode( StatementNode::Break, $2 ); } 865 865 | RETURN comma_expression_opt ';' 866 866 { $$ = new StatementNode( StatementNode::Return, $2, 0 ); }
Note:
See TracChangeset
for help on using the changeset viewer.