implement else if nesting

This commit is contained in:
2019-11-11 22:27:27 +01:00
parent ea6bde3305
commit 38d34a7cbc
5 changed files with 32 additions and 8 deletions

View File

@@ -9,11 +9,25 @@ public class IfStatement extends Statement {
public Expression cond;
public Block then;
public Block alt;
public IfStatement elif;
public IfStatement(Expression cond, Block then, Block alt) {
public IfStatement(Expression cond, Block then, Block alt, IfStatement elif) {
this.cond = cond;
this.then = then;
this.alt = alt;
this.elif = elif;
}
public IfStatement(Expression cond, Block then, Block alt) {
this(cond, then, alt, null);
}
public IfStatement(Expression cond, Block then, IfStatement elif) {
this(cond, then, null, elif);
}
public IfStatement(Expression cond, Block then) {
this(cond, then, null, null);
}
@Override