Skip to content

Commit 6661f48

Browse files
author
Troy Melhase
committed
Initial support for 'continue' statement.
1 parent 3294b04 commit 6661f48

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

java2python/compiler/visitor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ def acceptCatch(self, node, memo):
390390
self.expr.right = self.factory.expr(fs=FS.l+' as '+FS.r, left=cname, right=cvar)
391391
self.walk(block, memo)
392392

393+
394+
def acceptContinue(self, node, memo):
395+
""" Accept and process a continue statement. """
396+
contStat = self.factory.statement('continue', fs=FS.lsr, parent=self)
397+
393398
def acceptDo(self, node, memo):
394399
""" Accept and process a do-while block. """
395400
# DO - BLOCK_SCOPE - PARENTESIZED_EXPR

test/Continue1.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Continue1 {
2+
public static void main(String[] args) {
3+
int x = 0;
4+
while (x < 10) {
5+
System.out.println(x);
6+
if (x==6) {
7+
break ;
8+
} else {
9+
x+=2;
10+
continue ;
11+
}
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)