@zenstackhq/language 2.16.0 → 3.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # ZenStack ZModel language compiler
2
-
3
- This package provides the AST of ZModel - ZenStack's modeling language.
4
-
5
- Visit [Homepage](https://zenstack.dev) for more details.
package/ast.d.ts DELETED
@@ -1,55 +0,0 @@
1
- import { AstNode } from 'langium';
2
- import { AbstractDeclaration, BinaryExpr, DataModel, ExpressionType } from './generated/ast';
3
- export { AstNode, Reference } from 'langium';
4
- export * from './generated/ast';
5
- /**
6
- * Shape of type resolution result: an expression type or reference to a declaration
7
- */
8
- export type ResolvedShape = ExpressionType | AbstractDeclaration;
9
- /**
10
- * Resolved type information (attached to expressions by linker)
11
- */
12
- export type ResolvedType = {
13
- decl?: ResolvedShape;
14
- array?: boolean;
15
- nullable?: boolean;
16
- };
17
- export declare const BinaryExprOperatorPriority: Record<BinaryExpr['operator'], number>;
18
- declare module './generated/ast' {
19
- interface AttributeArg {
20
- /**
21
- * Resolved attribute param declaration
22
- */
23
- $resolvedParam?: AttributeParam;
24
- }
25
- interface DataModelField {
26
- $inheritedFrom?: DataModel;
27
- }
28
- interface DataModelAttribute {
29
- $inheritedFrom?: DataModel;
30
- }
31
- interface DataModel {
32
- /**
33
- * Indicates whether the model is already merged with the base types
34
- */
35
- $baseMerged?: boolean;
36
- /**
37
- * All fields including those marked with `@ignore`
38
- */
39
- $allFields?: DataModelField[];
40
- }
41
- }
42
- export interface InheritableNode extends AstNode {
43
- $inheritedFrom?: DataModel;
44
- }
45
- export interface InheritableNode extends AstNode {
46
- $inheritedFrom?: DataModel;
47
- }
48
- declare module 'langium' {
49
- interface AstNode {
50
- /**
51
- * Resolved type information attached to expressions
52
- */
53
- $resolvedType?: ResolvedType;
54
- }
55
- }
package/ast.js DELETED
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.BinaryExprOperatorPriority = void 0;
18
- __exportStar(require("./generated/ast"), exports);
19
- exports.BinaryExprOperatorPriority = {
20
- //LogicalExpr
21
- '||': 1,
22
- '&&': 1,
23
- //EqualityExpr
24
- '==': 2,
25
- '!=': 2,
26
- //ComparisonExpr
27
- '>': 3,
28
- '<': 3,
29
- '>=': 3,
30
- '<=': 3,
31
- in: 4,
32
- //CollectionPredicateExpr
33
- '^': 5,
34
- '?': 5,
35
- '!': 5,
36
- };
37
- //# sourceMappingURL=ast.js.map
package/ast.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ast.js","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,kDAAgC;AAgBnB,QAAA,0BAA0B,GAA2C;IAC9E,aAAa;IACb,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,cAAc;IACd,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,gBAAgB;IAChB,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,CAAC;IACL,yBAAyB;IACzB,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;CACT,CAAC"}
@@ -1,485 +0,0 @@
1
- /******************************************************************************
2
- * This file was generated by langium-cli 1.3.1.
3
- * DO NOT EDIT MANUALLY!
4
- ******************************************************************************/
5
- import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
6
- import { AbstractAstReflection } from 'langium';
7
- export declare const ZModelTerminals: {
8
- WS: RegExp;
9
- INTERNAL_ATTRIBUTE_NAME: RegExp;
10
- MODEL_ATTRIBUTE_NAME: RegExp;
11
- FIELD_ATTRIBUTE_NAME: RegExp;
12
- ID: RegExp;
13
- STRING: RegExp;
14
- NUMBER: RegExp;
15
- TRIPLE_SLASH_COMMENT: RegExp;
16
- ML_COMMENT: RegExp;
17
- SL_COMMENT: RegExp;
18
- };
19
- export type AbstractDeclaration = Attribute | DataModel | DataSource | Enum | FunctionDecl | GeneratorDecl | Plugin | TypeDef;
20
- export declare const AbstractDeclaration = "AbstractDeclaration";
21
- export declare function isAbstractDeclaration(item: unknown): item is AbstractDeclaration;
22
- export type Boolean = boolean;
23
- export declare function isBoolean(item: unknown): item is Boolean;
24
- export type BuiltinType = 'BigInt' | 'Boolean' | 'Bytes' | 'DateTime' | 'Decimal' | 'Float' | 'Int' | 'Json' | 'String';
25
- export declare function isBuiltinType(item: unknown): item is BuiltinType;
26
- export type ConfigExpr = ConfigArrayExpr | InvocationExpr | LiteralExpr;
27
- export declare const ConfigExpr = "ConfigExpr";
28
- export declare function isConfigExpr(item: unknown): item is ConfigExpr;
29
- export type Expression = ArrayExpr | BinaryExpr | InvocationExpr | LiteralExpr | MemberAccessExpr | NullExpr | ObjectExpr | ReferenceExpr | ThisExpr | UnaryExpr;
30
- export declare const Expression = "Expression";
31
- export declare function isExpression(item: unknown): item is Expression;
32
- export type ExpressionType = 'Any' | 'Boolean' | 'DateTime' | 'Float' | 'Int' | 'Null' | 'Object' | 'String' | 'Unsupported';
33
- export declare function isExpressionType(item: unknown): item is ExpressionType;
34
- export type LiteralExpr = BooleanLiteral | NumberLiteral | StringLiteral;
35
- export declare const LiteralExpr = "LiteralExpr";
36
- export declare function isLiteralExpr(item: unknown): item is LiteralExpr;
37
- export type MemberAccessTarget = DataModelField | TypeDefField;
38
- export declare const MemberAccessTarget = "MemberAccessTarget";
39
- export declare function isMemberAccessTarget(item: unknown): item is MemberAccessTarget;
40
- export type ReferenceTarget = DataModelField | EnumField | FunctionParam | TypeDefField;
41
- export declare const ReferenceTarget = "ReferenceTarget";
42
- export declare function isReferenceTarget(item: unknown): item is ReferenceTarget;
43
- export type RegularID = 'abstract' | 'attribute' | 'datasource' | 'enum' | 'import' | 'in' | 'model' | 'plugin' | 'type' | 'view' | string;
44
- export declare function isRegularID(item: unknown): item is RegularID;
45
- export type RegularIDWithTypeNames = 'Any' | 'BigInt' | 'Boolean' | 'Bytes' | 'DateTime' | 'Decimal' | 'Float' | 'Int' | 'Json' | 'Null' | 'Object' | 'String' | 'Unsupported' | RegularID;
46
- export declare function isRegularIDWithTypeNames(item: unknown): item is RegularIDWithTypeNames;
47
- export type TypeDeclaration = DataModel | Enum | TypeDef;
48
- export declare const TypeDeclaration = "TypeDeclaration";
49
- export declare function isTypeDeclaration(item: unknown): item is TypeDeclaration;
50
- export type TypeDefFieldTypes = Enum | TypeDef;
51
- export declare const TypeDefFieldTypes = "TypeDefFieldTypes";
52
- export declare function isTypeDefFieldTypes(item: unknown): item is TypeDefFieldTypes;
53
- export interface Argument extends AstNode {
54
- readonly $container: InvocationExpr;
55
- readonly $type: 'Argument';
56
- value: Expression;
57
- }
58
- export declare const Argument = "Argument";
59
- export declare function isArgument(item: unknown): item is Argument;
60
- export interface ArrayExpr extends AstNode {
61
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
62
- readonly $type: 'ArrayExpr';
63
- items: Array<Expression>;
64
- }
65
- export declare const ArrayExpr = "ArrayExpr";
66
- export declare function isArrayExpr(item: unknown): item is ArrayExpr;
67
- export interface Attribute extends AstNode {
68
- readonly $container: Model;
69
- readonly $type: 'Attribute';
70
- attributes: Array<InternalAttribute>;
71
- comments: Array<string>;
72
- name: string;
73
- params: Array<AttributeParam>;
74
- }
75
- export declare const Attribute = "Attribute";
76
- export declare function isAttribute(item: unknown): item is Attribute;
77
- export interface AttributeArg extends AstNode {
78
- readonly $container: DataModelAttribute | DataModelFieldAttribute | InternalAttribute;
79
- readonly $type: 'AttributeArg';
80
- name?: RegularID;
81
- value: Expression;
82
- }
83
- export declare const AttributeArg = "AttributeArg";
84
- export declare function isAttributeArg(item: unknown): item is AttributeArg;
85
- export interface AttributeParam extends AstNode {
86
- readonly $container: Attribute;
87
- readonly $type: 'AttributeParam';
88
- attributes: Array<InternalAttribute>;
89
- comments: Array<string>;
90
- default: boolean;
91
- name: RegularID;
92
- type: AttributeParamType;
93
- }
94
- export declare const AttributeParam = "AttributeParam";
95
- export declare function isAttributeParam(item: unknown): item is AttributeParam;
96
- export interface AttributeParamType extends AstNode {
97
- readonly $container: AttributeParam;
98
- readonly $type: 'AttributeParamType';
99
- array: boolean;
100
- optional: boolean;
101
- reference?: Reference<TypeDeclaration>;
102
- type?: 'ContextType' | 'FieldReference' | 'TransitiveFieldReference' | ExpressionType;
103
- }
104
- export declare const AttributeParamType = "AttributeParamType";
105
- export declare function isAttributeParamType(item: unknown): item is AttributeParamType;
106
- export interface BinaryExpr extends AstNode {
107
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
108
- readonly $type: 'BinaryExpr';
109
- left: Expression;
110
- operator: '!' | '!=' | '&&' | '<' | '<=' | '==' | '>' | '>=' | '?' | '^' | 'in' | '||';
111
- right: Expression;
112
- }
113
- export declare const BinaryExpr = "BinaryExpr";
114
- export declare function isBinaryExpr(item: unknown): item is BinaryExpr;
115
- export interface BooleanLiteral extends AstNode {
116
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
117
- readonly $type: 'BooleanLiteral';
118
- value: Boolean;
119
- }
120
- export declare const BooleanLiteral = "BooleanLiteral";
121
- export declare function isBooleanLiteral(item: unknown): item is BooleanLiteral;
122
- export interface ConfigArrayExpr extends AstNode {
123
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
124
- readonly $type: 'ConfigArrayExpr';
125
- items: Array<ConfigInvocationExpr | LiteralExpr>;
126
- }
127
- export declare const ConfigArrayExpr = "ConfigArrayExpr";
128
- export declare function isConfigArrayExpr(item: unknown): item is ConfigArrayExpr;
129
- export interface ConfigField extends AstNode {
130
- readonly $container: DataSource | GeneratorDecl;
131
- readonly $type: 'ConfigField';
132
- name: RegularID;
133
- value: ConfigExpr;
134
- }
135
- export declare const ConfigField = "ConfigField";
136
- export declare function isConfigField(item: unknown): item is ConfigField;
137
- export interface ConfigInvocationArg extends AstNode {
138
- readonly $container: ConfigInvocationExpr;
139
- readonly $type: 'ConfigInvocationArg';
140
- name: string;
141
- value: LiteralExpr;
142
- }
143
- export declare const ConfigInvocationArg = "ConfigInvocationArg";
144
- export declare function isConfigInvocationArg(item: unknown): item is ConfigInvocationArg;
145
- export interface ConfigInvocationExpr extends AstNode {
146
- readonly $container: ConfigArrayExpr;
147
- readonly $type: 'ConfigInvocationExpr';
148
- args: Array<ConfigInvocationArg>;
149
- name: string;
150
- }
151
- export declare const ConfigInvocationExpr = "ConfigInvocationExpr";
152
- export declare function isConfigInvocationExpr(item: unknown): item is ConfigInvocationExpr;
153
- export interface DataModel extends AstNode {
154
- readonly $container: Model;
155
- readonly $type: 'DataModel';
156
- attributes: Array<DataModelAttribute>;
157
- comments: Array<string>;
158
- fields: Array<DataModelField>;
159
- isAbstract: boolean;
160
- isView: boolean;
161
- name: RegularID;
162
- superTypes: Array<Reference<DataModel>>;
163
- }
164
- export declare const DataModel = "DataModel";
165
- export declare function isDataModel(item: unknown): item is DataModel;
166
- export interface DataModelAttribute extends AstNode {
167
- readonly $container: DataModel | Enum | TypeDef;
168
- readonly $type: 'DataModelAttribute';
169
- args: Array<AttributeArg>;
170
- decl: Reference<Attribute>;
171
- }
172
- export declare const DataModelAttribute = "DataModelAttribute";
173
- export declare function isDataModelAttribute(item: unknown): item is DataModelAttribute;
174
- export interface DataModelField extends AstNode {
175
- readonly $container: DataModel | Enum | FunctionDecl | TypeDef;
176
- readonly $type: 'DataModelField';
177
- attributes: Array<DataModelFieldAttribute>;
178
- comments: Array<string>;
179
- name: RegularIDWithTypeNames;
180
- type: DataModelFieldType;
181
- }
182
- export declare const DataModelField = "DataModelField";
183
- export declare function isDataModelField(item: unknown): item is DataModelField;
184
- export interface DataModelFieldAttribute extends AstNode {
185
- readonly $container: DataModelField | EnumField | TypeDefField;
186
- readonly $type: 'DataModelFieldAttribute';
187
- args: Array<AttributeArg>;
188
- decl: Reference<Attribute>;
189
- }
190
- export declare const DataModelFieldAttribute = "DataModelFieldAttribute";
191
- export declare function isDataModelFieldAttribute(item: unknown): item is DataModelFieldAttribute;
192
- export interface DataModelFieldType extends AstNode {
193
- readonly $container: DataModelField;
194
- readonly $type: 'DataModelFieldType';
195
- array: boolean;
196
- optional: boolean;
197
- reference?: Reference<TypeDeclaration>;
198
- type?: BuiltinType;
199
- unsupported?: UnsupportedFieldType;
200
- }
201
- export declare const DataModelFieldType = "DataModelFieldType";
202
- export declare function isDataModelFieldType(item: unknown): item is DataModelFieldType;
203
- export interface DataSource extends AstNode {
204
- readonly $container: Model;
205
- readonly $type: 'DataSource';
206
- fields: Array<ConfigField>;
207
- name: RegularID;
208
- }
209
- export declare const DataSource = "DataSource";
210
- export declare function isDataSource(item: unknown): item is DataSource;
211
- export interface Enum extends AstNode {
212
- readonly $container: Model;
213
- readonly $type: 'Enum';
214
- attributes: Array<DataModelAttribute>;
215
- comments: Array<string>;
216
- fields: Array<EnumField>;
217
- name: RegularID;
218
- }
219
- export declare const Enum = "Enum";
220
- export declare function isEnum(item: unknown): item is Enum;
221
- export interface EnumField extends AstNode {
222
- readonly $container: DataModel | Enum | FunctionDecl | TypeDef;
223
- readonly $type: 'EnumField';
224
- attributes: Array<DataModelFieldAttribute>;
225
- comments: Array<string>;
226
- name: RegularIDWithTypeNames;
227
- }
228
- export declare const EnumField = "EnumField";
229
- export declare function isEnumField(item: unknown): item is EnumField;
230
- export interface FieldInitializer extends AstNode {
231
- readonly $container: ObjectExpr;
232
- readonly $type: 'FieldInitializer';
233
- name: RegularID | string;
234
- value: Expression;
235
- }
236
- export declare const FieldInitializer = "FieldInitializer";
237
- export declare function isFieldInitializer(item: unknown): item is FieldInitializer;
238
- export interface FunctionDecl extends AstNode {
239
- readonly $container: Model;
240
- readonly $type: 'FunctionDecl';
241
- attributes: Array<InternalAttribute>;
242
- expression?: Expression;
243
- name: RegularID;
244
- params: Array<FunctionParam>;
245
- returnType: FunctionParamType;
246
- }
247
- export declare const FunctionDecl = "FunctionDecl";
248
- export declare function isFunctionDecl(item: unknown): item is FunctionDecl;
249
- export interface FunctionParam extends AstNode {
250
- readonly $container: DataModel | Enum | FunctionDecl | TypeDef;
251
- readonly $type: 'FunctionParam';
252
- name: RegularID;
253
- optional: boolean;
254
- type: FunctionParamType;
255
- }
256
- export declare const FunctionParam = "FunctionParam";
257
- export declare function isFunctionParam(item: unknown): item is FunctionParam;
258
- export interface FunctionParamType extends AstNode {
259
- readonly $container: FunctionDecl | FunctionParam;
260
- readonly $type: 'FunctionParamType';
261
- array: boolean;
262
- reference?: Reference<TypeDeclaration>;
263
- type?: ExpressionType;
264
- }
265
- export declare const FunctionParamType = "FunctionParamType";
266
- export declare function isFunctionParamType(item: unknown): item is FunctionParamType;
267
- export interface GeneratorDecl extends AstNode {
268
- readonly $container: Model;
269
- readonly $type: 'GeneratorDecl';
270
- fields: Array<ConfigField>;
271
- name: RegularID;
272
- }
273
- export declare const GeneratorDecl = "GeneratorDecl";
274
- export declare function isGeneratorDecl(item: unknown): item is GeneratorDecl;
275
- export interface InternalAttribute extends AstNode {
276
- readonly $container: Attribute | AttributeParam | FunctionDecl;
277
- readonly $type: 'InternalAttribute';
278
- args: Array<AttributeArg>;
279
- decl: Reference<Attribute>;
280
- }
281
- export declare const InternalAttribute = "InternalAttribute";
282
- export declare function isInternalAttribute(item: unknown): item is InternalAttribute;
283
- export interface InvocationExpr extends AstNode {
284
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
285
- readonly $type: 'InvocationExpr';
286
- args: Array<Argument>;
287
- function: Reference<FunctionDecl>;
288
- }
289
- export declare const InvocationExpr = "InvocationExpr";
290
- export declare function isInvocationExpr(item: unknown): item is InvocationExpr;
291
- export interface MemberAccessExpr extends AstNode {
292
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
293
- readonly $type: 'MemberAccessExpr';
294
- member: Reference<MemberAccessTarget>;
295
- operand: Expression;
296
- }
297
- export declare const MemberAccessExpr = "MemberAccessExpr";
298
- export declare function isMemberAccessExpr(item: unknown): item is MemberAccessExpr;
299
- export interface Model extends AstNode {
300
- readonly $type: 'Model';
301
- declarations: Array<AbstractDeclaration>;
302
- imports: Array<ModelImport>;
303
- }
304
- export declare const Model = "Model";
305
- export declare function isModel(item: unknown): item is Model;
306
- export interface ModelImport extends AstNode {
307
- readonly $container: Model;
308
- readonly $type: 'ModelImport';
309
- path: string;
310
- }
311
- export declare const ModelImport = "ModelImport";
312
- export declare function isModelImport(item: unknown): item is ModelImport;
313
- export interface NullExpr extends AstNode {
314
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
315
- readonly $type: 'NullExpr';
316
- value: 'null';
317
- }
318
- export declare const NullExpr = "NullExpr";
319
- export declare function isNullExpr(item: unknown): item is NullExpr;
320
- export interface NumberLiteral extends AstNode {
321
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
322
- readonly $type: 'NumberLiteral';
323
- value: string;
324
- }
325
- export declare const NumberLiteral = "NumberLiteral";
326
- export declare function isNumberLiteral(item: unknown): item is NumberLiteral;
327
- export interface ObjectExpr extends AstNode {
328
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
329
- readonly $type: 'ObjectExpr';
330
- fields: Array<FieldInitializer>;
331
- }
332
- export declare const ObjectExpr = "ObjectExpr";
333
- export declare function isObjectExpr(item: unknown): item is ObjectExpr;
334
- export interface Plugin extends AstNode {
335
- readonly $container: Model;
336
- readonly $type: 'Plugin';
337
- fields: Array<PluginField>;
338
- name: RegularID;
339
- }
340
- export declare const Plugin = "Plugin";
341
- export declare function isPlugin(item: unknown): item is Plugin;
342
- export interface PluginField extends AstNode {
343
- readonly $container: Plugin;
344
- readonly $type: 'PluginField';
345
- name: RegularID;
346
- value: ArrayExpr | LiteralExpr | ObjectExpr;
347
- }
348
- export declare const PluginField = "PluginField";
349
- export declare function isPluginField(item: unknown): item is PluginField;
350
- export interface ReferenceArg extends AstNode {
351
- readonly $container: ReferenceExpr;
352
- readonly $type: 'ReferenceArg';
353
- name: string;
354
- value: Expression;
355
- }
356
- export declare const ReferenceArg = "ReferenceArg";
357
- export declare function isReferenceArg(item: unknown): item is ReferenceArg;
358
- export interface ReferenceExpr extends AstNode {
359
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
360
- readonly $type: 'ReferenceExpr';
361
- args: Array<ReferenceArg>;
362
- target: Reference<ReferenceTarget>;
363
- }
364
- export declare const ReferenceExpr = "ReferenceExpr";
365
- export declare function isReferenceExpr(item: unknown): item is ReferenceExpr;
366
- export interface StringLiteral extends AstNode {
367
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
368
- readonly $type: 'StringLiteral';
369
- value: string;
370
- }
371
- export declare const StringLiteral = "StringLiteral";
372
- export declare function isStringLiteral(item: unknown): item is StringLiteral;
373
- export interface ThisExpr extends AstNode {
374
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
375
- readonly $type: 'ThisExpr';
376
- value: 'this';
377
- }
378
- export declare const ThisExpr = "ThisExpr";
379
- export declare function isThisExpr(item: unknown): item is ThisExpr;
380
- export interface TypeDef extends AstNode {
381
- readonly $container: Model;
382
- readonly $type: 'TypeDef';
383
- attributes: Array<DataModelAttribute>;
384
- comments: Array<string>;
385
- fields: Array<TypeDefField>;
386
- name: RegularID;
387
- }
388
- export declare const TypeDef = "TypeDef";
389
- export declare function isTypeDef(item: unknown): item is TypeDef;
390
- export interface TypeDefField extends AstNode {
391
- readonly $container: DataModel | Enum | FunctionDecl | TypeDef;
392
- readonly $type: 'TypeDefField';
393
- attributes: Array<DataModelFieldAttribute>;
394
- comments: Array<string>;
395
- name: RegularIDWithTypeNames;
396
- type: TypeDefFieldType;
397
- }
398
- export declare const TypeDefField = "TypeDefField";
399
- export declare function isTypeDefField(item: unknown): item is TypeDefField;
400
- export interface TypeDefFieldType extends AstNode {
401
- readonly $container: TypeDefField;
402
- readonly $type: 'TypeDefFieldType';
403
- array: boolean;
404
- optional: boolean;
405
- reference?: Reference<TypeDefFieldTypes>;
406
- type?: BuiltinType;
407
- }
408
- export declare const TypeDefFieldType = "TypeDefFieldType";
409
- export declare function isTypeDefFieldType(item: unknown): item is TypeDefFieldType;
410
- export interface UnaryExpr extends AstNode {
411
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | ReferenceArg | UnaryExpr | UnsupportedFieldType;
412
- readonly $type: 'UnaryExpr';
413
- operand: Expression;
414
- operator: '!';
415
- }
416
- export declare const UnaryExpr = "UnaryExpr";
417
- export declare function isUnaryExpr(item: unknown): item is UnaryExpr;
418
- export interface UnsupportedFieldType extends AstNode {
419
- readonly $container: DataModelFieldType;
420
- readonly $type: 'UnsupportedFieldType';
421
- value: LiteralExpr;
422
- }
423
- export declare const UnsupportedFieldType = "UnsupportedFieldType";
424
- export declare function isUnsupportedFieldType(item: unknown): item is UnsupportedFieldType;
425
- export type ZModelAstType = {
426
- AbstractDeclaration: AbstractDeclaration;
427
- Argument: Argument;
428
- ArrayExpr: ArrayExpr;
429
- Attribute: Attribute;
430
- AttributeArg: AttributeArg;
431
- AttributeParam: AttributeParam;
432
- AttributeParamType: AttributeParamType;
433
- BinaryExpr: BinaryExpr;
434
- BooleanLiteral: BooleanLiteral;
435
- ConfigArrayExpr: ConfigArrayExpr;
436
- ConfigExpr: ConfigExpr;
437
- ConfigField: ConfigField;
438
- ConfigInvocationArg: ConfigInvocationArg;
439
- ConfigInvocationExpr: ConfigInvocationExpr;
440
- DataModel: DataModel;
441
- DataModelAttribute: DataModelAttribute;
442
- DataModelField: DataModelField;
443
- DataModelFieldAttribute: DataModelFieldAttribute;
444
- DataModelFieldType: DataModelFieldType;
445
- DataSource: DataSource;
446
- Enum: Enum;
447
- EnumField: EnumField;
448
- Expression: Expression;
449
- FieldInitializer: FieldInitializer;
450
- FunctionDecl: FunctionDecl;
451
- FunctionParam: FunctionParam;
452
- FunctionParamType: FunctionParamType;
453
- GeneratorDecl: GeneratorDecl;
454
- InternalAttribute: InternalAttribute;
455
- InvocationExpr: InvocationExpr;
456
- LiteralExpr: LiteralExpr;
457
- MemberAccessExpr: MemberAccessExpr;
458
- MemberAccessTarget: MemberAccessTarget;
459
- Model: Model;
460
- ModelImport: ModelImport;
461
- NullExpr: NullExpr;
462
- NumberLiteral: NumberLiteral;
463
- ObjectExpr: ObjectExpr;
464
- Plugin: Plugin;
465
- PluginField: PluginField;
466
- ReferenceArg: ReferenceArg;
467
- ReferenceExpr: ReferenceExpr;
468
- ReferenceTarget: ReferenceTarget;
469
- StringLiteral: StringLiteral;
470
- ThisExpr: ThisExpr;
471
- TypeDeclaration: TypeDeclaration;
472
- TypeDef: TypeDef;
473
- TypeDefField: TypeDefField;
474
- TypeDefFieldType: TypeDefFieldType;
475
- TypeDefFieldTypes: TypeDefFieldTypes;
476
- UnaryExpr: UnaryExpr;
477
- UnsupportedFieldType: UnsupportedFieldType;
478
- };
479
- export declare class ZModelAstReflection extends AbstractAstReflection {
480
- getAllTypes(): string[];
481
- protected computeIsSubtype(subtype: string, supertype: string): boolean;
482
- getReferenceType(refInfo: ReferenceInfo): string;
483
- getTypeMetaData(type: string): TypeMetaData;
484
- }
485
- export declare const reflection: ZModelAstReflection;