From d669d1f0b4ab34aec751d27812a558783bbbf4f1 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 15 Oct 2026 21:29:01 +0100 Subject: Type check table definitions --- hobgoblin/src/ast/typed.hob | 20 ++++++++++++++++++++ hobgoblin/src/types.hob | 3 +++ 2 files changed, 23 insertions(+) (limited to 'hobgoblin/src') diff --git a/hobgoblin/src/ast/typed.hob b/hobgoblin/src/ast/typed.hob index 5581940..b65ecdd 100644 --- a/hobgoblin/src/ast/typed.hob +++ b/hobgoblin/src/ast/typed.hob @@ -5,17 +5,22 @@ import { NamespaceName, SimpleNativeType, SimpleStructType, + StructType, SumType, Type, TypeOrConstructor, } from types; +// == Namespaces == + struct TypedNamespaceNode { field namespaceName: NamespaceName; field body: List[TypedNamespaceStatementNode]; field source: Source; } +// == Namespace statements == + sum TypedNamespaceStatementNode { variant TypedDatabaseSchemaDefinitionNode; variant TypedEnumDefinitionNode; @@ -26,6 +31,7 @@ sum TypedNamespaceStatementNode { struct TypedDatabaseSchemaDefinitionNode { field name: String; + field body: List[TypedDatabaseSchemaStatementNode]; field docComment: DocComment; field source: Source; } @@ -73,3 +79,17 @@ struct TypedSumVariantDefinitionNode { field type: Type; field source: Source; } + +// == Database schema statements == + +sum TypedDatabaseSchemaStatementNode { + variant TypedTableDefinitionNode; +} + +struct TypedTableDefinitionNode { + field name: String; + field rowType: StructType; + field primaryKey: String; + field docComment: DocComment; + field source: Source; +} diff --git a/hobgoblin/src/types.hob b/hobgoblin/src/types.hob index 4e3a971..5e96164 100644 --- a/hobgoblin/src/types.hob +++ b/hobgoblin/src/types.hob @@ -13,6 +13,9 @@ native SimpleNativeType { native SimpleStructType { } +native StructType { +} + native SumType { } -- cgit v1.2.3