Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zenstack-monorepo",
"version": "1.0.0-alpha.98",
"version": "1.0.0-alpha.99",
"description": "",
"scripts": {
"build": "pnpm -r build",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/language",
"version": "1.0.0-alpha.98",
"version": "1.0.0-alpha.99",
"displayName": "ZenStack modeling language compiler",
"description": "ZenStack modeling language compiler",
"homepage": "https://zenstack.dev",
Expand Down
36 changes: 19 additions & 17 deletions packages/language/src/generated/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export function isReferenceTarget(item: unknown): item is ReferenceTarget {
return reflection.isInstance(item, ReferenceTarget);
}

export type RegularID = 'in' | string;

export type TypeDeclaration = DataModel | Enum;

export const TypeDeclaration = 'TypeDeclaration';
Expand All @@ -55,7 +57,7 @@ export function isTypeDeclaration(item: unknown): item is TypeDeclaration {
export interface Argument extends AstNode {
readonly $container: InvocationExpr;
readonly $type: 'Argument';
name?: string
name?: RegularID
value: Expression
}

Expand Down Expand Up @@ -94,7 +96,7 @@ export function isAttribute(item: unknown): item is Attribute {
export interface AttributeArg extends AstNode {
readonly $container: AttributeAttribute | DataModelAttribute | DataModelFieldAttribute;
readonly $type: 'AttributeArg';
name?: string
name?: RegularID
value: Expression
}

Expand All @@ -121,7 +123,7 @@ export interface AttributeParam extends AstNode {
readonly $container: Attribute;
readonly $type: 'AttributeParam';
default: boolean
name: string
name: RegularID
type: AttributeParamType
}

Expand Down Expand Up @@ -166,7 +168,7 @@ export interface DataModel extends AstNode {
attributes: Array<DataModelAttribute>
comments: Array<string>
fields: Array<DataModelField>
name: string
name: RegularID
}

export const DataModel = 'DataModel';
Expand All @@ -193,7 +195,7 @@ export interface DataModelField extends AstNode {
readonly $type: 'DataModelField';
attributes: Array<DataModelFieldAttribute>
comments: Array<string>
name: string
name: RegularID
type: DataModelFieldType
}

Expand Down Expand Up @@ -235,7 +237,7 @@ export interface DataSource extends AstNode {
readonly $container: Model;
readonly $type: 'DataSource';
fields: Array<DataSourceField>
name: string
name: RegularID
}

export const DataSource = 'DataSource';
Expand All @@ -247,7 +249,7 @@ export function isDataSource(item: unknown): item is DataSource {
export interface DataSourceField extends AstNode {
readonly $container: DataSource;
readonly $type: 'DataSourceField';
name: string
name: RegularID
value: ArrayExpr | InvocationExpr | LiteralExpr
}

Expand All @@ -263,7 +265,7 @@ export interface Enum extends AstNode {
attributes: Array<DataModelAttribute>
comments: Array<string>
fields: Array<EnumField>
name: string
name: RegularID
}

export const Enum = 'Enum';
Expand All @@ -277,7 +279,7 @@ export interface EnumField extends AstNode {
readonly $type: 'EnumField';
attributes: Array<DataModelFieldAttribute>
comments: Array<string>
name: string
name: RegularID
}

export const EnumField = 'EnumField';
Expand All @@ -289,7 +291,7 @@ export function isEnumField(item: unknown): item is EnumField {
export interface FieldInitializer extends AstNode {
readonly $container: ObjectExpr;
readonly $type: 'FieldInitializer';
name: string
name: RegularID
value: Expression
}

Expand All @@ -303,7 +305,7 @@ export interface FunctionDecl extends AstNode {
readonly $container: Model;
readonly $type: 'FunctionDecl';
expression?: Expression
name: string
name: RegularID
params: Array<FunctionParam>
returnType: FunctionParamType
}
Expand All @@ -317,7 +319,7 @@ export function isFunctionDecl(item: unknown): item is FunctionDecl {
export interface FunctionParam extends AstNode {
readonly $container: DataModel | Enum | FunctionDecl;
readonly $type: 'FunctionParam';
name: string
name: RegularID
optional: boolean
type: FunctionParamType
}
Expand Down Expand Up @@ -346,7 +348,7 @@ export interface GeneratorDecl extends AstNode {
readonly $container: Model;
readonly $type: 'GeneratorDecl';
fields: Array<GeneratorField>
name: string
name: RegularID
}

export const GeneratorDecl = 'GeneratorDecl';
Expand All @@ -358,7 +360,7 @@ export function isGeneratorDecl(item: unknown): item is GeneratorDecl {
export interface GeneratorField extends AstNode {
readonly $container: GeneratorDecl;
readonly $type: 'GeneratorField';
name: string
name: RegularID
value: ArrayExpr | LiteralExpr
}

Expand Down Expand Up @@ -445,7 +447,7 @@ export interface Plugin extends AstNode {
readonly $container: Model;
readonly $type: 'Plugin';
fields: Array<PluginField>
name: string
name: RegularID
}

export const Plugin = 'Plugin';
Expand All @@ -457,8 +459,8 @@ export function isPlugin(item: unknown): item is Plugin {
export interface PluginField extends AstNode {
readonly $container: Plugin;
readonly $type: 'PluginField';
name: string
value: ArrayExpr | LiteralExpr
name: RegularID
value: ArrayExpr | LiteralExpr | ObjectExpr
}

export const PluginField = 'PluginField';
Expand Down
Loading