Changeset efc8f3e
- Timestamp:
- Oct 15, 2021, 9:25:30 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 55cbff8
- Parents:
- a73c16e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
ra73c16e refc8f3e 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Oct 11 16:14:04202113 // Update Count : 51 3112 // Last Modified On : Fri Oct 15 09:20:17 2021 13 // Update Count : 5163 14 14 // 15 15 … … 69 69 // 2. String encodings are transformed into canonical form (one encoding at start) so the encoding can be found 70 70 // without searching the string, e.g.: "abc" L"def" L"ghi" => L"abc" "def" "ghi". Multiple encodings must match, 71 // i.e., u"a" U"b" L"c" is disallowed.71 // e.g., u"a" U"b" L"c" is disallowed. 72 72 73 73 if ( from[0] != '"' ) { // encoding ? … … 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 loop_default_optjump_statement348 %type<sn> iteration_statement 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 ')' loop_default_opt statement pop 1195 { $$ = new StatementNode( build_while( $4, maybe_build_compound( $7 ) ) ); } 1196 | WHILE '(' ')' statement // CFA => while ( 1 ) 1194 WHILE '(' ')' statement // CFA => while ( 1 ) 1197 1195 { $$ = new StatementNode( build_while( new IfCtrl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); } 1198 | DO statement WHILE '(' comma_expression ')' loop_default_opt ';' 1199 { $$ = new StatementNode( build_do_while( $5, maybe_build_compound( $2 ) ) ); } 1196 | WHILE '(' if_control_expression ')' statement %prec THEN 1197 { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ) ) ); } 1198 | WHILE '(' if_control_expression ')' statement ELSE statement // CFA 1199 { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 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 ')' loop_default_opt statement pop 1203 { $$ = new StatementNode( build_for( $4, maybe_build_compound( $7 ) ) ); } 1202 | DO statement WHILE '(' comma_expression ')' ';' %prec THEN 1203 { $$ = new StatementNode( build_do_while( $5, maybe_build_compound( $2 ) ) ); } 1204 | DO statement WHILE '(' comma_expression ')' ELSE statement // CFA 1205 { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 1204 1206 | FOR '(' ')' statement // CFA => for ( ;; ) 1205 1207 { $$ = 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 1208 | FOR '(' for_control_expression_list ')' statement %prec THEN 1209 { $$ = new StatementNode( build_for( $3, maybe_build_compound( $5 ) ) ); } 1210 | FOR '(' for_control_expression_list ')' statement ELSE statement // CFA 1212 1211 { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 1213 // { $$ = $2; }1214 1212 ; 1215 1213
Note: See TracChangeset
for help on using the changeset viewer.