summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriter.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriter.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriter.java
index 77ed461..514e3f5 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriter.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriter.java
@@ -37,13 +37,7 @@ public class RustWriter implements AutoCloseable {
this.writer.close();
}
- private void writeDocComment(DocComment docComment) throws IOException {
- for (var line : docComment.lines()) {
- this.writer.write("/// ");
- this.writer.write(line);
- this.writer.write("\n");
- }
- }
+ // == Modules ==
public void writeModule(RustModule module) throws IOException {
writeWithSeparator(
@@ -58,10 +52,7 @@ public class RustWriter implements AutoCloseable {
this.writer.newLine();
}
- void writeIdentifier(RustIdentifier identifier) throws IOException {
- // TODO: handle keywords
- this.writer.write(identifier.value());
- }
+ // == Items ==
void writeItem(RustItem item) throws IOException {
switch (item) {
@@ -96,6 +87,8 @@ public class RustWriter implements AutoCloseable {
this.writer.write("}");
}
+ // == Types ==
+
void writeType(RustType type) throws IOException {
switch (type) {
case RustTypePath typePath -> {
@@ -133,4 +126,21 @@ public class RustWriter implements AutoCloseable {
}
}
}
+
+ // == Identifiers ==
+
+ void writeIdentifier(RustIdentifier identifier) throws IOException {
+ // TODO: handle keywords
+ this.writer.write(identifier.value());
+ }
+
+ // == Doc comments ==
+
+ private void writeDocComment(DocComment docComment) throws IOException {
+ for (var line : docComment.lines()) {
+ this.writer.write("/// ");
+ this.writer.write(line);
+ this.writer.write("\n");
+ }
+ }
}