diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-06-06 16:52:34 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-06-08 23:40:56 +0100 |
| commit | 3e9126bc09bd31388a6683e7add2e614ba993bb8 (patch) | |
| tree | a8551459e1dee6a0c352679b6fddfa06bc853527 /src/main | |
| parent | 450fd165619e6c3f2822bbb0d906fd439b867071 (diff) | |
Add skeleton for java-precisely-matchers generator
Diffstat (limited to 'src/main')
2 files changed, 42 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 6f8eb4e..6126a0c 100644 --- a/src/main/java/org/zwobble/hobgoblin/compiler/config/ProjectConfig.java +++ b/src/main/java/org/zwobble/hobgoblin/compiler/config/ProjectConfig.java @@ -1,6 +1,7 @@ package org.zwobble.hobgoblin.compiler.config; import org.zwobble.hobgoblin.compiler.output.generators.Generator; +import org.zwobble.hobgoblin.compiler.output.generators.javapreciselymatchers.JavaPreciselyMatchersGenerator; import org.zwobble.hobgoblin.compiler.output.generators.javatypes.JavaTypesGenerator; import org.zwobble.json5.reader.Json5ObjectReader; import org.zwobble.sourcetext.SourceText; @@ -36,6 +37,9 @@ public record ProjectConfig( case JavaTypesGenerator.NAME -> JavaTypesGenerator.parseOutputConfig(projectRoot, outputJson); + case JavaPreciselyMatchersGenerator.NAME -> + JavaPreciselyMatchersGenerator.parseOutputConfig(projectRoot, outputJson); + default -> throw new UnsupportedOperationException("TODO"); }; diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java new file mode 100644 index 0000000..a528639 --- /dev/null +++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java @@ -0,0 +1,38 @@ +package org.zwobble.hobgoblin.compiler.output.generators.javapreciselymatchers; + +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 JavaPreciselyMatchersGenerator implements Generator { + public static final String NAME = "java-precisely-matchers"; + + public static OutputConfig parseOutputConfig(Path projectRoot, Json5ObjectReader output) { + return () -> { + var relativeOutputPath = output.getString("path").value(); + var outputPath = projectRoot.resolve(relativeOutputPath); + var packageName = output.getString("packageName").value(); + + return new JavaPreciselyMatchersGenerator(outputPath, packageName); + }; + } + + private final Path sourceRootDirectory; + private final List<String> packageName; + + public JavaPreciselyMatchersGenerator(Path sourceRootDirectory, String packageName) { + this.sourceRootDirectory = sourceRootDirectory; + this.packageName = List.of(packageName.split("\\."));; + } + + @Override + public void generate(List<TypedNamespaceNode> namespaces, TypesInfo typesInfo) throws IOException { + + } +} |
