Changeset 936e9f4 for src/Parser/parser.yy
- Timestamp:
- Aug 16, 2017, 6:31:41 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 21f0aa8, 6d49ea3
- Parents:
- fcc88a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rfcc88a4 r936e9f4 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Aug 4 13:33:00201713 // Update Count : 24 7511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 16 18:09:14 2017 13 // Update Count : 2485 14 14 // 15 15 … … 98 98 StatementNode * sn; 99 99 ConstantExpr * constant; 100 IfCtl * ifctl; 100 101 ForCtl * fctl; 101 102 LabelNode * label; … … 175 176 %type<en> comma_expression comma_expression_opt 176 177 %type<en> argument_expression_list argument_expression default_initialize_opt 178 %type<ifctl> if_control_expression 177 179 %type<fctl> for_control_expression 178 180 %type<en> subrange … … 794 796 795 797 selection_statement: 796 IF '(' comma_expression ')' statement %prec THEN798 IF '(' if_control_expression ')' statement %prec THEN 797 799 // explicitly deal with the shift/reduce conflict on if/else 798 800 { $$ = new StatementNode( build_if( $3, $5, nullptr ) ); } 799 | IF '(' comma_expression ')' statement ELSE statement801 | IF '(' if_control_expression ')' statement ELSE statement 800 802 { $$ = new StatementNode( build_if( $3, $5, $7 ) ); } 801 803 | SWITCH '(' comma_expression ')' case_clause // CFA … … 819 821 } 820 822 ; 823 824 if_control_expression: 825 comma_expression 826 { $$ = new IfCtl( nullptr, $1 ); } 827 | c_declaration // no semi-coln 828 { $$ = new IfCtl( $1, nullptr ); } 829 | cfa_declaration // no semi-colon 830 { $$ = new IfCtl( $1, nullptr ); } 831 | declaration comma_expression 832 { $$ = new IfCtl( $1, $2 ); } 833 ; 821 834 822 835 // CASE and DEFAULT clauses are only allowed in the SWITCH statement, precluding Duff's device. In addition, a case … … 1097 1110 1098 1111 KR_declaration_list: 1099 c_declaration 1100 | KR_declaration_list push c_declaration 1112 c_declaration ';' 1113 | KR_declaration_list push c_declaration ';' 1101 1114 { $$ = $1->appendList( $3 ); } 1102 1115 ; … … 1117 1130 ; 1118 1131 1119 declaration: // CFA, new & oldstyle declarations1120 c fa_declaration1121 | c _declaration1132 declaration: // old & new style declarations 1133 c_declaration ';' 1134 | cfa_declaration ';' // CFA 1122 1135 ; 1123 1136 … … 1134 1147 1135 1148 cfa_declaration: // CFA 1136 cfa_variable_declaration pop ';'1137 | cfa_typedef_declaration pop ';'1138 | cfa_function_declaration pop ';'1139 | type_declaring_list pop ';'1140 | trait_specifier pop ';'1149 cfa_variable_declaration pop 1150 | cfa_typedef_declaration pop 1151 | cfa_function_declaration pop 1152 | type_declaring_list pop 1153 | trait_specifier pop 1141 1154 ; 1142 1155 … … 1338 1351 1339 1352 c_declaration: 1340 declaration_specifier declaring_list pop ';'1353 declaration_specifier declaring_list pop 1341 1354 { 1342 1355 $$ = distAttr( $1, $2 ); 1343 1356 } 1344 | typedef_declaration pop ';'1345 | typedef_expression pop ';'// GCC, naming expression type1346 | sue_declaration_specifier pop ';'1357 | typedef_declaration pop 1358 | typedef_expression pop // GCC, naming expression type 1359 | sue_declaration_specifier pop 1347 1360 ; 1348 1361
Note: See TracChangeset
for help on using the changeset viewer.