Changeset 2f22cc4 for src/Parser/parser.yy
- Timestamp:
- Aug 10, 2016, 2:02:10 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:
- 321f55d, a563f01
- Parents:
- a6dd5b0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
ra6dd5b0 r2f22cc4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 9 12:59:11201613 // Update Count : 18 2112 // Last Modified On : Wed Aug 10 13:09:53 2016 13 // Update Count : 1844 14 14 // 15 15 … … 122 122 StatementNode *sn; 123 123 ConstantExpr *constant; 124 ForCtl *fctl; 124 125 LabelNode *label; 125 126 InitializerNode *in; … … 142 143 %type<en> constant_expression assignment_expression assignment_expression_opt 143 144 %type<en> comma_expression comma_expression_opt 144 %type<en> argument_expression_list argument_expression for_control_expression assignment_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 145 148 %type<en> subrange 146 149 %type<en> asm_operands_opt asm_operands_list asm_operand … … 720 723 IF '(' comma_expression ')' statement %prec THEN 721 724 // explicitly deal with the shift/reduce conflict on if/else 722 { $$ = new StatementNode( StatementNode::If, $3, $5 ); } 725 //{ $$ = new StatementNode( StatementNode::If, $3, $5 ); } 726 { $$ = new StatementNode2( build_if( $3, $5, nullptr ) ); } 723 727 | IF '(' comma_expression ')' statement ELSE statement 724 { $$ = new StatementNode( StatementNode::If, $3, (StatementNode *)mkList((*$5, *$7 )) ); } 728 //{ $$ = new StatementNode( StatementNode::If, $3, (StatementNode *)mkList((*$5, *$7 )) ); } 729 { $$ = new StatementNode2( build_if( $3, $5, $7 ) ); } 725 730 | SWITCH '(' comma_expression ')' case_clause // CFA 726 { $$ = new StatementNode( StatementNode::Switch, $3, $5 ); } 731 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); } 732 { $$ = new StatementNode2( build_switch( $3, $5 ) ); } 727 733 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA 728 734 { 729 StatementNode *sw = new StatementNode ( StatementNode::Switch, $3, $8);735 StatementNode *sw = new StatementNode2( build_switch( $3, $8 ) ); 730 736 // The semantics of the declaration list is changed to include associated initialization, which is performed 731 737 // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound … … 736 742 } 737 743 | CHOOSE '(' comma_expression ')' case_clause // CFA 738 { $$ = new StatementNode( StatementNode::Switch, $3, $5 ); } 744 //{ $$ = new StatementNode( StatementNode::Switch, $3, $5 ); } 745 { $$ = new StatementNode2( build_switch( $3, $5 ) ); } 739 746 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA 740 747 { 741 StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 ); 748 //StatementNode *sw = new StatementNode( StatementNode::Switch, $3, $8 ); 749 StatementNode *sw = new StatementNode2( build_switch( $3, $8 ) ); 742 750 $$ = $7 != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( $7 ))->set_link( sw )) ) : sw; 743 751 } … … 820 828 iteration_statement: 821 829 WHILE '(' comma_expression ')' statement 822 { $$ = new StatementNode ( StatementNode::While, $3, $5); }830 { $$ = new StatementNode2( build_while( $3, $5 ) ); } 823 831 | DO statement WHILE '(' comma_expression ')' ';' 824 { $$ = new StatementNode ( StatementNode::Do, $5, $2); }832 { $$ = new StatementNode2( build_while( $5, $2 ) ); } 825 833 | FOR '(' push for_control_expression ')' statement 826 { $$ = new StatementNode ( StatementNode::For, $4, $6); }834 { $$ = new StatementNode2( build_for( $4, $6 ) ); } 827 835 ; 828 836 829 837 for_control_expression: 830 838 comma_expression_opt pop ';' comma_expression_opt ';' comma_expression_opt 831 { $$ = new ForCtl ExprNode( $1, $4, $6 ); }839 { $$ = new ForCtl( $1, $4, $6 ); } 832 840 | declaration comma_expression_opt ';' comma_expression_opt // C99 833 { $$ = new ForCtl ExprNode( $1, $2, $4 ); }841 { $$ = new ForCtl( $1, $2, $4 ); } 834 842 ; 835 843 … … 946 954 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $4, $6, $8, $10 ); } 947 955 | ASM asm_volatile_opt GOTO '(' string_literal_list ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';' 948 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $5, 0, $8, $10, $12 ); }956 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $5, 0, $8, $10, $12 ); } 949 957 ; 950 958
Note: See TracChangeset
for help on using the changeset viewer.