cminus/submit/ast/Mutable.java

32 lines
550 B
Java
Raw Normal View History

2023-04-10 11:17:11 -04:00
/*
* Code formatter project
* CS 4481
*/
package submit.ast;
/**
*
* @author edwajohn
*/
public class Mutable extends AbstractNode implements Expression {
private final String id;
private final Expression index;
public Mutable(String id, Expression index) {
this.id = id;
this.index = index;
}
@Override
public void toCminus(StringBuilder builder, String prefix) {
builder.append(id);
if (index != null) {
builder.append("[");
index.toCminus(builder, prefix);
builder.append("]");
}
}
}