Changeset 321f55d for src/Parser/parser.yy
- Timestamp:
- Aug 10, 2016, 11:31:15 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 27fefeb6
- Parents:
- 2f22cc4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r2f22cc4 r321f55d 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 : 184 412 // Last Modified On : Wed Aug 10 23:03:05 2016 13 // Update Count : 1846 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 ); }726 725 { $$ = new StatementNode2( build_if( $3, $5, nullptr ) ); } 727 726 | IF '(' comma_expression ')' statement ELSE statement 728 //{ $$ = new StatementNode( StatementNode::If, $3, (StatementNode *)mkList((*$5, *$7 )) ); }729 727 { $$ = new StatementNode2( build_if( $3, $5, $7 ) ); } 730 728 | SWITCH '(' comma_expression ')' case_clause // CFA 731 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); }732 729 { $$ = new StatementNode2( build_switch( $3, $5 ) ); } 733 730 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA … … 742 739 } 743 740 | CHOOSE '(' comma_expression ')' case_clause // CFA 744 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); }745 741 { $$ = new StatementNode2( build_switch( $3, $5 ) ); } 746 742 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA 747 743 { 748 //StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 );749 744 StatementNode *sw = new StatementNode2( build_switch( $3, $8 ) ); 750 745 $$ = $7 != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( $7 ))->set_link( sw )) ) : sw; … … 844 839 jump_statement: 845 840 GOTO IDENTIFIER ';' 846 { $$ = new StatementNode( StatementNode::Goto, $2 ); } 841 //{ $$ = new StatementNode( StatementNode::Goto, $2 ); } 842 { $$ = new StatementNode2( build_branch( *$2, BranchStmt::Goto ) ); } 847 843 | GOTO '*' comma_expression ';' // GCC, computed goto 848 844 // The syntax for the GCC computed goto violates normal expression precedence, e.g., goto *i+3; => goto *(i+3); … … 851 847 | CONTINUE ';' 852 848 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 853 { $$ = new StatementNode( StatementNode::Continue ); } 849 //{ $$ = new StatementNode( StatementNode::Continue ); } 850 { $$ = new StatementNode2( build_branch( "", BranchStmt::Continue ) ); } 854 851 | CONTINUE IDENTIFIER ';' // CFA, multi-level continue 855 852 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and 856 853 // the target of the transfer appears only at the start of an iteration statement. 857 { $$ = new StatementNode( StatementNode::Continue, $2 ); } 854 //{ $$ = new StatementNode( StatementNode::Continue, $2 ); } 855 { $$ = new StatementNode2( build_branch( *$2, BranchStmt::Continue ) ); delete $2; } 858 856 | BREAK ';' 859 857 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 860 { $$ = new StatementNode( StatementNode::Break ); } 858 //{ $$ = new StatementNode( StatementNode::Break ); } 859 { $$ = new StatementNode2( build_branch( "", BranchStmt::Break ) ); } 861 860 | BREAK IDENTIFIER ';' // CFA, multi-level exit 862 861 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and 863 862 // the target of the transfer appears only at the start of an iteration statement. 864 { $$ = new StatementNode( StatementNode::Break, $2 ); } 863 //{ $$ = new StatementNode( StatementNode::Break, $2 ); } 864 { $$ = new StatementNode2( build_branch( *$2, BranchStmt::Break ) ); delete $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.