From e6a7f569f03cdb25afe762a1d9ed1447e53226d7 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 12 Jun 2026 20:02:34 +0100 Subject: Restructure hobgoblin files to match Java source layout --- hobgoblin/hobgoblin.json5 | 30 +++++------------ hobgoblin/src/ast/untyped.hob | 67 +++++++++++++++++++++++++++++++++++++ hobgoblin/src/hobgoblin/untyped.hob | 67 ------------------------------------- 3 files changed, 76 insertions(+), 88 deletions(-) create mode 100644 hobgoblin/src/ast/untyped.hob delete mode 100644 hobgoblin/src/hobgoblin/untyped.hob diff --git a/hobgoblin/hobgoblin.json5 b/hobgoblin/hobgoblin.json5 index 9b5a557..12c4ecc 100644 --- a/hobgoblin/hobgoblin.json5 +++ b/hobgoblin/hobgoblin.json5 @@ -3,24 +3,18 @@ { generator: "java-types", path: "../src/main/java", - packageName: "org.zwobble.hobgoblin.compiler.ast.untyped", - namespaces: [ - { - hobgoblin: "hobgoblin/untyped", - java: "org.zwobble.hobgoblin.compiler.ast.untyped", - }, - ], + packageName: "org.zwobble.hobgoblin.compiler", nativeTypes: [ { - hobgoblin: "hobgoblin/untyped.Source", + hobgoblin: "ast/untyped.Source", java: "org.zwobble.hobgoblin.compiler.sources.Source", }, { - hobgoblin: "hobgoblin/untyped.NamespaceName", + hobgoblin: "ast/untyped.NamespaceName", java: "org.zwobble.hobgoblin.compiler.types.NamespaceName", }, { - hobgoblin: "hobgoblin/untyped.DocComment", + hobgoblin: "ast/untyped.DocComment", java: "org.zwobble.hobgoblin.compiler.ast.DocComment", } ], @@ -28,27 +22,21 @@ { generator: "java-precisely-matchers", path: "../src/test/java", - packageName: "org.zwobble.hobgoblin.compiler.ast.untyped", - namespaces: [ - { - hobgoblin: "hobgoblin/untyped", - java: "org.zwobble.hobgoblin.compiler.ast.untyped", - }, - ], + packageName: "org.zwobble.hobgoblin.compiler", nativeTypes: [ { - hobgoblin: "hobgoblin/untyped.Source", + hobgoblin: "ast/untyped.Source", java: "org.zwobble.hobgoblin.compiler.sources.Source", }, { - hobgoblin: "hobgoblin/untyped.NamespaceName", + hobgoblin: "ast/untyped.NamespaceName", java: "org.zwobble.hobgoblin.compiler.types.NamespaceName", }, { - hobgoblin: "hobgoblin/untyped.DocComment", + hobgoblin: "ast/untyped.DocComment", java: "org.zwobble.hobgoblin.compiler.ast.DocComment", } - ], + ] } ], } diff --git a/hobgoblin/src/ast/untyped.hob b/hobgoblin/src/ast/untyped.hob new file mode 100644 index 0000000..31ba4f2 --- /dev/null +++ b/hobgoblin/src/ast/untyped.hob @@ -0,0 +1,67 @@ +native Source { +} + +native NamespaceName { +} + +native DocComment { +} + +struct UntypedNamespaceNode { + field namespaceName: NamespaceName; + field body: List[UntypedNamespaceStatementNode]; + field source: Source; +} + +sum UntypedNamespaceStatementNode { + variant UntypedNativeTypeDefinitionNode; + variant UntypedStructDefinitionNode; + variant UntypedSumDefinitionNode; +} + +struct UntypedNativeTypeDefinitionNode { + field name: String; + field docComment: DocComment; + field source: Source; +} + +struct UntypedStructDefinitionNode { + field name: String; + field fields: List[UntypedStructFieldDefinitionNode]; + field docComment: DocComment; + field source: Source; +} + +struct UntypedStructFieldDefinitionNode { + field name: String; + field type: UntypedTypeLevelExpressionNode; + field source: Source; +} + +struct UntypedSumDefinitionNode { + field name: String; + field variants: List[UntypedSumVariantDefinitionNode]; + field docComment: DocComment; + field source: Source; +} + +struct UntypedSumVariantDefinitionNode { + field type: UntypedTypeLevelExpressionNode; + field source: Source; +} + +sum UntypedTypeLevelExpressionNode { + variant UntypedConstructedTypeNode; + variant UntypedTypeLevelReferenceNode; +} + +struct UntypedConstructedTypeNode { + field receiver: UntypedTypeLevelExpressionNode; + field args: List[UntypedTypeLevelExpressionNode]; + field source: Source; +} + +struct UntypedTypeLevelReferenceNode { + field name: String; + field source: Source; +} diff --git a/hobgoblin/src/hobgoblin/untyped.hob b/hobgoblin/src/hobgoblin/untyped.hob deleted file mode 100644 index 31ba4f2..0000000 --- a/hobgoblin/src/hobgoblin/untyped.hob +++ /dev/null @@ -1,67 +0,0 @@ -native Source { -} - -native NamespaceName { -} - -native DocComment { -} - -struct UntypedNamespaceNode { - field namespaceName: NamespaceName; - field body: List[UntypedNamespaceStatementNode]; - field source: Source; -} - -sum UntypedNamespaceStatementNode { - variant UntypedNativeTypeDefinitionNode; - variant UntypedStructDefinitionNode; - variant UntypedSumDefinitionNode; -} - -struct UntypedNativeTypeDefinitionNode { - field name: String; - field docComment: DocComment; - field source: Source; -} - -struct UntypedStructDefinitionNode { - field name: String; - field fields: List[UntypedStructFieldDefinitionNode]; - field docComment: DocComment; - field source: Source; -} - -struct UntypedStructFieldDefinitionNode { - field name: String; - field type: UntypedTypeLevelExpressionNode; - field source: Source; -} - -struct UntypedSumDefinitionNode { - field name: String; - field variants: List[UntypedSumVariantDefinitionNode]; - field docComment: DocComment; - field source: Source; -} - -struct UntypedSumVariantDefinitionNode { - field type: UntypedTypeLevelExpressionNode; - field source: Source; -} - -sum UntypedTypeLevelExpressionNode { - variant UntypedConstructedTypeNode; - variant UntypedTypeLevelReferenceNode; -} - -struct UntypedConstructedTypeNode { - field receiver: UntypedTypeLevelExpressionNode; - field args: List[UntypedTypeLevelExpressionNode]; - field source: Source; -} - -struct UntypedTypeLevelReferenceNode { - field name: String; - field source: Source; -} -- cgit v1.2.3