diff options
Diffstat (limited to 'Homework/cs5300/p4-formatter/submit/ast/Mutable.java')
| -rw-r--r-- | Homework/cs5300/p4-formatter/submit/ast/Mutable.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Homework/cs5300/p4-formatter/submit/ast/Mutable.java b/Homework/cs5300/p4-formatter/submit/ast/Mutable.java new file mode 100644 index 0000000..c7ef089 --- /dev/null +++ b/Homework/cs5300/p4-formatter/submit/ast/Mutable.java @@ -0,0 +1,31 @@ +/* + * Code formatter project + * CS 4481 + */ +package submit.ast; + +/** + * + * @author edwajohn + */ +public class Mutable implements Expression, Node { + + 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("]"); + } + } + +} |
