Changeset 376c632a for src/Parser/parser.yy
- Timestamp:
- Feb 1, 2022, 10:10:46 AM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 7b2c8c3c
- Parents:
- f681823 (diff), 89a5a1f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rf681823 r376c632a 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Oct 15 09:20:17 202113 // Update Count : 516 312 // Last Modified On : Sun Jan 30 09:41:13 2022 13 // Update Count : 5165 14 14 // 15 15 … … 238 238 WaitForStmt * wfs; 239 239 Expression * constant; 240 IfCtrl * ifctl;240 CondCtl * ifctl; 241 241 ForCtrl * fctl; 242 242 enum OperKinds compop; … … 327 327 %type<en> comma_expression comma_expression_opt 328 328 %type<en> argument_expression_list_opt argument_expression_list argument_expression default_initializer_opt 329 %type<ifctl> if_control_expression329 %type<ifctl> conditional_declaration 330 330 %type<fctl> for_control_expression for_control_expression_list 331 331 %type<compop> inclexcl … … 1123 1123 1124 1124 if_statement: 1125 IF '(' if_control_expression ')' statement%prec THEN1125 IF '(' conditional_declaration ')' statement %prec THEN 1126 1126 // explicitly deal with the shift/reduce conflict on if/else 1127 1127 { $$ = new StatementNode( build_if( $3, maybe_build_compound( $5 ), nullptr ) ); } 1128 | IF '(' if_control_expression ')' statement ELSE statement1128 | IF '(' conditional_declaration ')' statement ELSE statement 1129 1129 { $$ = new StatementNode( build_if( $3, maybe_build_compound( $5 ), maybe_build_compound( $7 ) ) ); } 1130 1130 ; 1131 1131 1132 if_control_expression:1132 conditional_declaration: 1133 1133 comma_expression 1134 { $$ = new IfCtrl( nullptr, $1 ); }1134 { $$ = new CondCtl( nullptr, $1 ); } 1135 1135 | c_declaration // no semi-colon 1136 { $$ = new IfCtrl( $1, nullptr ); }1136 { $$ = new CondCtl( $1, nullptr ); } 1137 1137 | cfa_declaration // no semi-colon 1138 { $$ = new IfCtrl( $1, nullptr ); }1138 { $$ = new CondCtl( $1, nullptr ); } 1139 1139 | declaration comma_expression // semi-colon separated 1140 { $$ = new IfCtrl( $1, $2 ); }1140 { $$ = new CondCtl( $1, $2 ); } 1141 1141 ; 1142 1142 … … 1193 1193 iteration_statement: 1194 1194 WHILE '(' ')' statement // CFA => while ( 1 ) 1195 { $$ = new StatementNode( build_while( new IfCtrl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); }1196 | WHILE '(' if_control_expression ')' statement%prec THEN1195 { $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); } 1196 | WHILE '(' conditional_declaration ')' statement %prec THEN 1197 1197 { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ) ) ); } 1198 | WHILE '(' if_control_expression ')' statement ELSE statement // CFA1198 | WHILE '(' conditional_declaration ')' statement ELSE statement // CFA 1199 1199 { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 1200 1200 | DO statement WHILE '(' ')' ';' // CFA => do while( 1 )
Note: See TracChangeset
for help on using the changeset viewer.