summaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-06-27 20:27:43 +0100
committerMichael Williamson <mike@zwobble.org>2026-06-27 20:33:00 +0100
commit773c3febb37536f77eb4ccb7c7457775ce0c7e0f (patch)
tree9e98501e69cfdc17af5ba26f046c9651d617d2d3 /src/main/java/org/zwobble
parent465ed2b7568fbabfbcde0868d253dd10d5a6a23c (diff)
Add skeleton for Rust types generator
Diffstat (limited to 'src/main/java/org/zwobble')
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/config/ProjectConfig.java4
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java35
2 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/config/ProjectConfig.java b/src/main/java/org/zwobble/hobgoblin/compiler/config/ProjectConfig.java
index fda2e15..132a89d 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/config/ProjectConfig.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/config/ProjectConfig.java
@@ -4,6 +4,7 @@ import org.zwobble.hobgoblin.compiler.output.generators.Generator;
import org.zwobble.hobgoblin.compiler.output.generators.errors.UnknownGeneratorError;
import org.zwobble.hobgoblin.compiler.output.generators.javapreciselymatchers.JavaPreciselyMatchersGenerator;
import org.zwobble.hobgoblin.compiler.output.generators.javatypes.JavaTypesGenerator;
+import org.zwobble.hobgoblin.compiler.output.generators.rusttypes.RustTypesGenerator;
import org.zwobble.hobgoblin.compiler.sources.FileFragmentSource;
import org.zwobble.json5.reader.Json5ObjectReader;
import org.zwobble.sourcetext.SourceText;
@@ -42,6 +43,9 @@ public record ProjectConfig(
case JavaPreciselyMatchersGenerator.NAME ->
JavaPreciselyMatchersGenerator.parseOutputConfig(projectRoot, outputJson);
+ case RustTypesGenerator.NAME ->
+ RustTypesGenerator.parseOutputConfig(projectRoot, outputJson);
+
default ->
throw new UnknownGeneratorError(
generatorName.value(),
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java
new file mode 100644
index 0000000..c93be76
--- /dev/null
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java
@@ -0,0 +1,35 @@
+package org.zwobble.hobgoblin.compiler.output.generators.rusttypes;
+
+import org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceNode;
+import org.zwobble.hobgoblin.compiler.config.OutputConfig;
+import org.zwobble.hobgoblin.compiler.output.generators.Generator;
+import org.zwobble.hobgoblin.compiler.typechecker.TypesInfo;
+import org.zwobble.json5.reader.Json5ObjectReader;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.List;
+
+public class RustTypesGenerator implements Generator {
+ public static final String NAME = "rust-types";
+
+ public static OutputConfig parseOutputConfig(Path projectRoot, Json5ObjectReader output) {
+ return () -> {
+ var relativeOutputPath = output.getString("path").value();
+ var outputPath = projectRoot.resolve(relativeOutputPath);
+
+ return new RustTypesGenerator(outputPath);
+ };
+ }
+
+ private final Path outputPath;
+
+ private RustTypesGenerator(Path outputPath) {
+ this.outputPath = outputPath;
+ }
+
+ @Override
+ public void generate(List<TypedNamespaceNode> namespaces, TypesInfo typesInfo) throws IOException {
+
+ }
+}