blob: cd99d51f75417f77bdcadbc88c9f4ef3fb9aa37d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package submit.ast;
public class WhileStatement implements Statement {
Expression simpleExpression;
Statement statement;
public WhileStatement(Expression simpleExpression, Statement statement) {
this.simpleExpression = simpleExpression;
this.statement = statement;
}
public void toCminus(StringBuilder builder, String prefix) {
builder.append(prefix);
builder.append("while (");
simpleExpression.toCminus(builder, "");
builder.append(")\n");
boolean isBodyCompound = statement.getClass() == CompoundStatement.class;
statement.toCminus(builder, prefix + (isBodyCompound ? "" : "\t"));
}
}
|