diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-10-15 21:29:01 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-10-15 21:29:01 +0100 |
| commit | d669d1f0b4ab34aec751d27812a558783bbbf4f1 (patch) | |
| tree | 6425afe5ed62020225f2e15ebc8d5d3eea7d6a56 /hobgoblin/src | |
| parent | 3afb8859dabdaaa81a6bbbe530d75a4186cc039c (diff) | |
Type check table definitions
Diffstat (limited to 'hobgoblin/src')
| -rw-r--r-- | hobgoblin/src/ast/typed.hob | 20 | ||||
| -rw-r--r-- | hobgoblin/src/types.hob | 3 |
2 files changed, 23 insertions, 0 deletions
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 { } |
