diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-07-02 11:55:17 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-07-02 11:55:17 -0700 |
| commit | 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 (patch) | |
| tree | ed97e39ec77c5231ffd2c394493e68d00ddac5a4 /Homework/cs5300/compiler/submit/ast/CompoundStatement.java | |
| download | misc-undergrad-main.tar.gz misc-undergrad-main.zip | |
Diffstat (limited to 'Homework/cs5300/compiler/submit/ast/CompoundStatement.java')
| -rw-r--r-- | Homework/cs5300/compiler/submit/ast/CompoundStatement.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Homework/cs5300/compiler/submit/ast/CompoundStatement.java b/Homework/cs5300/compiler/submit/ast/CompoundStatement.java new file mode 100644 index 0000000..f745a26 --- /dev/null +++ b/Homework/cs5300/compiler/submit/ast/CompoundStatement.java @@ -0,0 +1,30 @@ +/* + * Code formatter project + * CS 4481 + */ +package submit.ast; + +import java.util.List; + +/** + * + * @author edwajohn + */ +public class CompoundStatement implements Statement { + + private final List<Statement> statements; + + public CompoundStatement(List<Statement> statements) { + this.statements = statements; + } + + @Override + public void toCminus(StringBuilder builder, String prefix) { + builder.append(prefix).append("{\n"); + for (Statement s : statements) { + s.toCminus(builder, prefix + " "); + } + builder.append(prefix).append("}\n"); + } + +} |
