Changeset a73c16e
- Timestamp:
- Oct 11, 2021, 11:10:33 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- efc8f3e
- Parents:
- d4d4ac8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rd4d4ac8 ra73c16e 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 8 06:57:16202113 // Update Count : 5 08612 // Last Modified On : Mon Oct 11 16:14:04 2021 13 // Update Count : 5131 14 14 // 15 15 … … 346 346 %type<en> case_value 347 347 %type<sn> case_clause case_value_list case_label case_label_list 348 %type<sn> iteration_statement jump_statement348 %type<sn> iteration_statement loop_default_opt jump_statement 349 349 %type<sn> expression_statement asm_statement 350 350 %type<sn> with_statement … … 1192 1192 1193 1193 iteration_statement: 1194 WHILE '(' push if_control_expression ')' statement pop1195 { $$ = new StatementNode( build_while( $4, maybe_build_compound( $ 6) ) ); }1194 WHILE '(' push if_control_expression ')' loop_default_opt statement pop 1195 { $$ = new StatementNode( build_while( $4, maybe_build_compound( $7 ) ) ); } 1196 1196 | WHILE '(' ')' statement // CFA => while ( 1 ) 1197 1197 { $$ = new StatementNode( build_while( new IfCtrl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); } 1198 | DO statement WHILE '(' comma_expression ')' ';'1198 | DO statement WHILE '(' comma_expression ')' loop_default_opt ';' 1199 1199 { $$ = new StatementNode( build_do_while( $5, maybe_build_compound( $2 ) ) ); } 1200 1200 | DO statement WHILE '(' ')' ';' // CFA => do while( 1 ) 1201 1201 { $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), maybe_build_compound( $2 ) ) ); } 1202 | FOR '(' push for_control_expression_list ')' statement pop1203 { $$ = new StatementNode( build_for( $4, maybe_build_compound( $6) ) ); }1202 | FOR '(' push for_control_expression_list ')' loop_default_opt statement pop 1203 { $$ = new StatementNode( build_for( $4, maybe_build_compound( $7 ) ) ); } 1204 1204 | FOR '(' ')' statement // CFA => for ( ;; ) 1205 1205 { $$ = new StatementNode( build_for( new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ), maybe_build_compound( $4 ) ) ); } 1206 ; 1207 1208 loop_default_opt: 1209 // empty 1210 { $$ = nullptr; } 1211 | DEFAULT statement ELSE 1212 { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 1213 // { $$ = $2; } 1206 1214 ; 1207 1215
Note: See TracChangeset
for help on using the changeset viewer.