diff options
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 { + + } +} |
