File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -393,8 +393,16 @@ statement [block]
393393 }
394394
395395
396- | # ("do" statement[block] do_exp = expression[block])
397- { raise NotImplementedError(" do statement" )}
396+ | {
397+ while_stat = block.newStatement(" while" )
398+ while_stat.setExpression(" True" )
399+ }
400+ # ("do" statement[while_stat] do_exp = expression[block, False])
401+ {
402+ if_stat = while_stat.newStatement(" if" )
403+ if_stat.setExpression((" not %s " , do_exp))
404+ if_stat.newStatement(" break" )
405+ }
398406
399407
400408 | {
Original file line number Diff line number Diff line change @@ -8,6 +8,16 @@ public static void main(String[] args) {
88 for (int b = 0 ; b < 20 ; b +=2 ) {
99 }
1010
11+ doWhile ();
12+ }
13+
14+ public static int doWhile () {
15+ int x = 0 ;
16+ do {
17+ System .out .println (x );
18+ x += 1 ;
19+ } while (x <= 10 );
20+ return x ;
1121 }
1222}
1323
You can’t perform that action at this time.
0 commit comments