yukigo-ast 0.1.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/CHANGELOG.md +19 -0
- package/dist/globals/generics.d.ts +740 -0
- package/dist/globals/generics.js +1128 -0
- package/dist/globals/helpers.d.ts +4 -0
- package/dist/globals/helpers.js +76 -0
- package/dist/globals/operators.d.ts +251 -0
- package/dist/globals/operators.js +336 -0
- package/dist/globals/patterns.d.ts +170 -0
- package/dist/globals/patterns.js +261 -0
- package/dist/globals/runtime.d.ts +22 -0
- package/dist/globals/runtime.js +6 -0
- package/dist/globals/types.d.ts +185 -0
- package/dist/globals/types.js +329 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/paradigms/data.d.ts +246 -0
- package/dist/paradigms/data.js +348 -0
- package/dist/paradigms/functional.d.ts +59 -0
- package/dist/paradigms/functional.js +103 -0
- package/dist/paradigms/imperative.d.ts +124 -0
- package/dist/paradigms/imperative.js +188 -0
- package/dist/paradigms/logic.d.ts +163 -0
- package/dist/paradigms/logic.js +240 -0
- package/dist/paradigms/object.d.ts +201 -0
- package/dist/paradigms/object.js +308 -0
- package/dist/visitor.d.ts +254 -0
- package/dist/visitor.js +426 -0
- package/package.json +25 -0
- package/src/globals/generics.ts +1421 -0
- package/src/globals/helpers.ts +107 -0
- package/src/globals/operators.ts +515 -0
- package/src/globals/patterns.ts +321 -0
- package/src/globals/runtime.ts +33 -0
- package/src/globals/types.ts +375 -0
- package/src/index.ts +12 -0
- package/src/paradigms/data.ts +393 -0
- package/src/paradigms/functional.ts +129 -0
- package/src/paradigms/imperative.ts +232 -0
- package/src/paradigms/logic.ts +314 -0
- package/src/paradigms/object.ts +366 -0
- package/src/visitor.ts +692 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { ASTNode, } from "./generics.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a basic named type (e.g., Int, Bool).
|
|
4
|
+
* @category Types
|
|
5
|
+
*/
|
|
6
|
+
export class SimpleType extends ASTNode {
|
|
7
|
+
/** @hidden */
|
|
8
|
+
constraints;
|
|
9
|
+
/** @hidden */
|
|
10
|
+
value;
|
|
11
|
+
constructor(value, constraints, loc) {
|
|
12
|
+
super(loc);
|
|
13
|
+
this.value = value;
|
|
14
|
+
this.constraints = constraints;
|
|
15
|
+
}
|
|
16
|
+
accept(visitor) {
|
|
17
|
+
return visitor.visitSimpleType?.(this);
|
|
18
|
+
}
|
|
19
|
+
toString() {
|
|
20
|
+
return this.value;
|
|
21
|
+
}
|
|
22
|
+
toJSON() {
|
|
23
|
+
return {
|
|
24
|
+
type: "SimpleType",
|
|
25
|
+
value: this.value,
|
|
26
|
+
constraints: this.constraints.map((c) => c.toJSON()),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a type variable (e.g., 'a), used in polymorphic types.
|
|
32
|
+
* @category Types
|
|
33
|
+
*/
|
|
34
|
+
export class TypeVar extends ASTNode {
|
|
35
|
+
/** @hidden */
|
|
36
|
+
constraints;
|
|
37
|
+
/** @hidden */
|
|
38
|
+
value;
|
|
39
|
+
constructor(value, constraints, loc) {
|
|
40
|
+
super(loc);
|
|
41
|
+
this.value = value;
|
|
42
|
+
this.constraints = constraints;
|
|
43
|
+
}
|
|
44
|
+
accept(visitor) {
|
|
45
|
+
return visitor.visitTypeVar?.(this);
|
|
46
|
+
}
|
|
47
|
+
toString() {
|
|
48
|
+
return this.value;
|
|
49
|
+
}
|
|
50
|
+
toJSON() {
|
|
51
|
+
return {
|
|
52
|
+
type: "TypeVar",
|
|
53
|
+
value: this.value,
|
|
54
|
+
constraints: this.constraints.map((c) => c.toJSON()),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Represents the application of a type constructor to arguments (e.g., List Int).
|
|
60
|
+
* @category Types
|
|
61
|
+
*/
|
|
62
|
+
export class TypeApplication extends ASTNode {
|
|
63
|
+
/** @hidden */
|
|
64
|
+
argument;
|
|
65
|
+
/** @hidden */
|
|
66
|
+
functionType;
|
|
67
|
+
constructor(functionType, argument, loc) {
|
|
68
|
+
super(loc);
|
|
69
|
+
this.functionType = functionType;
|
|
70
|
+
this.argument = argument;
|
|
71
|
+
}
|
|
72
|
+
accept(visitor) {
|
|
73
|
+
return visitor.visitTypeApplication?.(this);
|
|
74
|
+
}
|
|
75
|
+
toString() {
|
|
76
|
+
const func = this.functionType.toString();
|
|
77
|
+
let arg = this.argument.toString();
|
|
78
|
+
if (this.argument instanceof TypeApplication ||
|
|
79
|
+
this.argument instanceof ParameterizedType) {
|
|
80
|
+
arg = `(${arg})`;
|
|
81
|
+
}
|
|
82
|
+
return `${func} ${arg}`;
|
|
83
|
+
}
|
|
84
|
+
toJSON() {
|
|
85
|
+
return {
|
|
86
|
+
type: "TypeApplication",
|
|
87
|
+
function: this.functionType.toJSON(),
|
|
88
|
+
argument: this.argument.toJSON(),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Represents a list type (e.g., [Int]).
|
|
94
|
+
* @category Types
|
|
95
|
+
*/
|
|
96
|
+
export class ListType extends ASTNode {
|
|
97
|
+
/** @hidden */
|
|
98
|
+
constraints;
|
|
99
|
+
/** @hidden */
|
|
100
|
+
values;
|
|
101
|
+
constructor(values, constraints, loc) {
|
|
102
|
+
super(loc);
|
|
103
|
+
this.values = values;
|
|
104
|
+
this.constraints = constraints;
|
|
105
|
+
}
|
|
106
|
+
accept(visitor) {
|
|
107
|
+
return visitor.visitListType?.(this);
|
|
108
|
+
}
|
|
109
|
+
toString() {
|
|
110
|
+
return `[${this.values.toString()}]`;
|
|
111
|
+
}
|
|
112
|
+
toJSON() {
|
|
113
|
+
return {
|
|
114
|
+
type: "ListType",
|
|
115
|
+
values: this.values.toJSON(),
|
|
116
|
+
constraints: this.constraints.map((c) => c.toJSON()),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Represents a tuple type (e.g., (Int, Bool)).
|
|
122
|
+
* @category Types
|
|
123
|
+
*/
|
|
124
|
+
export class TupleType extends ASTNode {
|
|
125
|
+
/** @hidden */
|
|
126
|
+
constraints;
|
|
127
|
+
/** @hidden */
|
|
128
|
+
values;
|
|
129
|
+
constructor(values, constraints, loc) {
|
|
130
|
+
super(loc);
|
|
131
|
+
this.values = values;
|
|
132
|
+
this.constraints = constraints;
|
|
133
|
+
}
|
|
134
|
+
accept(visitor) {
|
|
135
|
+
return visitor.visitTupleType?.(this);
|
|
136
|
+
}
|
|
137
|
+
toString() {
|
|
138
|
+
return `(${this.values.map((t) => t.toString()).join(", ")})`;
|
|
139
|
+
}
|
|
140
|
+
toJSON() {
|
|
141
|
+
return {
|
|
142
|
+
type: "TupleType",
|
|
143
|
+
values: this.values.map((val) => val.toJSON()),
|
|
144
|
+
constraints: this.constraints.map((c) => c.toJSON()),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Represents a type constraint or class constraint (e.g., Eq a).
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* (Eq a) => a -> a -> Bool
|
|
153
|
+
* @category Types
|
|
154
|
+
*/
|
|
155
|
+
export class Constraint extends ASTNode {
|
|
156
|
+
/** @hidden */
|
|
157
|
+
parameters;
|
|
158
|
+
/** @hidden */
|
|
159
|
+
name;
|
|
160
|
+
constructor(name, parameters, loc) {
|
|
161
|
+
super(loc);
|
|
162
|
+
this.name = name;
|
|
163
|
+
this.parameters = parameters;
|
|
164
|
+
}
|
|
165
|
+
accept(visitor) {
|
|
166
|
+
return visitor.visitConstraint?.(this);
|
|
167
|
+
}
|
|
168
|
+
toJSON() {
|
|
169
|
+
return {
|
|
170
|
+
type: "Constraint",
|
|
171
|
+
name: this.name,
|
|
172
|
+
parameters: this.parameters.map((p) => p.toJSON()),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Represents a type that accepts type parameters.
|
|
178
|
+
* @category Types
|
|
179
|
+
*/
|
|
180
|
+
export class ParameterizedType extends ASTNode {
|
|
181
|
+
/** @hidden */
|
|
182
|
+
constraints;
|
|
183
|
+
/** @hidden */
|
|
184
|
+
returnType;
|
|
185
|
+
/** @hidden */
|
|
186
|
+
inputs;
|
|
187
|
+
constructor(inputs, returnType, constraints, loc) {
|
|
188
|
+
super(loc);
|
|
189
|
+
this.inputs = inputs;
|
|
190
|
+
this.returnType = returnType;
|
|
191
|
+
this.constraints = constraints;
|
|
192
|
+
}
|
|
193
|
+
accept(visitor) {
|
|
194
|
+
return visitor.visitParameterizedType?.(this);
|
|
195
|
+
}
|
|
196
|
+
toString() {
|
|
197
|
+
const inputs = this.inputs.map((t) => {
|
|
198
|
+
const str = t.toString();
|
|
199
|
+
return t instanceof ParameterizedType ? `(${str})` : str;
|
|
200
|
+
});
|
|
201
|
+
const ret = this.returnType.toString();
|
|
202
|
+
const signature = [...inputs, ret].join(" -> ");
|
|
203
|
+
if (this.constraints.length > 0) {
|
|
204
|
+
const constraints = this.constraints
|
|
205
|
+
.map((c) => {
|
|
206
|
+
const params = c.parameters.map((p) => p.toString()).join(" ");
|
|
207
|
+
return params ? `${c.name} ${params}` : c.name;
|
|
208
|
+
})
|
|
209
|
+
.join(", ");
|
|
210
|
+
const context = this.constraints.length > 1 ? `(${constraints})` : constraints;
|
|
211
|
+
return `${context} => ${signature}`;
|
|
212
|
+
}
|
|
213
|
+
return signature;
|
|
214
|
+
}
|
|
215
|
+
toJSON() {
|
|
216
|
+
return {
|
|
217
|
+
type: "ParameterizedType",
|
|
218
|
+
inputs: this.inputs.map((p) => p.toJSON()),
|
|
219
|
+
return: this.returnType.toJSON(),
|
|
220
|
+
constraints: this.constraints.map((p) => p.toJSON()),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Represents a type qualified by a context of constraints.
|
|
226
|
+
* @category Types
|
|
227
|
+
*/
|
|
228
|
+
export class ConstrainedType extends ASTNode {
|
|
229
|
+
/** @hidden */
|
|
230
|
+
constraints;
|
|
231
|
+
constructor(constraints, loc) {
|
|
232
|
+
super(loc);
|
|
233
|
+
this.constraints = constraints;
|
|
234
|
+
}
|
|
235
|
+
accept(visitor) {
|
|
236
|
+
return visitor.visitConstrainedType?.(this);
|
|
237
|
+
}
|
|
238
|
+
toJSON() {
|
|
239
|
+
return {
|
|
240
|
+
type: "ConstrainedType",
|
|
241
|
+
constraints: this.constraints.map((p) => p.toJSON()),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Represents a type alias definition, giving a new name to an existing type.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* type String = [Char]
|
|
250
|
+
* @category Types
|
|
251
|
+
*/
|
|
252
|
+
export class TypeAlias extends ASTNode {
|
|
253
|
+
/** @hidden */
|
|
254
|
+
value;
|
|
255
|
+
/** @hidden */
|
|
256
|
+
variables;
|
|
257
|
+
/** @hidden */
|
|
258
|
+
identifier;
|
|
259
|
+
constructor(identifier, variables, value, loc) {
|
|
260
|
+
super(loc);
|
|
261
|
+
this.identifier = identifier;
|
|
262
|
+
this.variables = variables;
|
|
263
|
+
this.value = value;
|
|
264
|
+
}
|
|
265
|
+
accept(visitor) {
|
|
266
|
+
return visitor.visitTypeAlias?.(this);
|
|
267
|
+
}
|
|
268
|
+
toJSON() {
|
|
269
|
+
return {
|
|
270
|
+
type: "TypeAlias",
|
|
271
|
+
identifier: this.identifier.toJSON(),
|
|
272
|
+
variables: this.variables,
|
|
273
|
+
value: this.value.toJSON(),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Represents an explicit type signature declaration for a function or variable.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* add :: Int -> Int -> Int
|
|
282
|
+
* @category Types
|
|
283
|
+
*/
|
|
284
|
+
export class TypeSignature extends ASTNode {
|
|
285
|
+
/** @hidden */
|
|
286
|
+
body;
|
|
287
|
+
/** @hidden */
|
|
288
|
+
identifier;
|
|
289
|
+
constructor(identifier, body, loc) {
|
|
290
|
+
super(loc);
|
|
291
|
+
this.identifier = identifier;
|
|
292
|
+
this.body = body;
|
|
293
|
+
}
|
|
294
|
+
accept(visitor) {
|
|
295
|
+
return visitor.visitTypeSignature?.(this);
|
|
296
|
+
}
|
|
297
|
+
toJSON() {
|
|
298
|
+
return {
|
|
299
|
+
type: "TypeSignature",
|
|
300
|
+
identifier: this.identifier.toJSON(),
|
|
301
|
+
body: this.body.toJSON(),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Represents an explicit type casting or annotation expression.
|
|
307
|
+
* @category Types
|
|
308
|
+
*/
|
|
309
|
+
export class TypeCast extends ASTNode {
|
|
310
|
+
/** @hidden */
|
|
311
|
+
body;
|
|
312
|
+
/** @hidden */
|
|
313
|
+
expression;
|
|
314
|
+
constructor(expression, body, loc) {
|
|
315
|
+
super(loc);
|
|
316
|
+
this.expression = expression;
|
|
317
|
+
this.body = body;
|
|
318
|
+
}
|
|
319
|
+
accept(visitor) {
|
|
320
|
+
return visitor.visitTypeCast?.(this);
|
|
321
|
+
}
|
|
322
|
+
toJSON() {
|
|
323
|
+
return {
|
|
324
|
+
type: "TypeCast",
|
|
325
|
+
expression: this.expression.toJSON(),
|
|
326
|
+
body: this.body.toJSON(),
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./visitor.js";
|
|
2
|
+
export * from "./globals/helpers.js";
|
|
3
|
+
export * from "./globals/generics.js";
|
|
4
|
+
export * from "./globals/operators.js";
|
|
5
|
+
export * from "./globals/patterns.js";
|
|
6
|
+
export * from "./globals/types.js";
|
|
7
|
+
export * from "./globals/runtime.js";
|
|
8
|
+
export * from "./paradigms/functional.js";
|
|
9
|
+
export * from "./paradigms/object.js";
|
|
10
|
+
export * from "./paradigms/imperative.js";
|
|
11
|
+
export * from "./paradigms/logic.js";
|
|
12
|
+
export * from "./paradigms/data.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./visitor.js";
|
|
2
|
+
export * from "./globals/helpers.js";
|
|
3
|
+
export * from "./globals/generics.js";
|
|
4
|
+
export * from "./globals/operators.js";
|
|
5
|
+
export * from "./globals/patterns.js";
|
|
6
|
+
export * from "./globals/types.js";
|
|
7
|
+
export * from "./globals/runtime.js";
|
|
8
|
+
export * from "./paradigms/functional.js";
|
|
9
|
+
export * from "./paradigms/object.js";
|
|
10
|
+
export * from "./paradigms/imperative.js";
|
|
11
|
+
export * from "./paradigms/logic.js";
|
|
12
|
+
export * from "./paradigms/data.js";
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { ASTNode, Expression, SourceLocation, SymbolPrimitive } from "../globals/generics.js";
|
|
2
|
+
import { Visitor } from "../visitor.js";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a query to retrieve data from a database table.
|
|
5
|
+
* @category SQL
|
|
6
|
+
* @example
|
|
7
|
+
* SELECT * FROM users WHERE age > 18
|
|
8
|
+
*/
|
|
9
|
+
export declare class Select extends ASTNode {
|
|
10
|
+
/** @hidden */
|
|
11
|
+
columns: Expression[];
|
|
12
|
+
/** @hidden */
|
|
13
|
+
from: string;
|
|
14
|
+
/** @hidden */
|
|
15
|
+
where?: Expression;
|
|
16
|
+
constructor(columns: Expression[], from: string, where?: Expression, loc?: SourceLocation);
|
|
17
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
18
|
+
toJSON(): {
|
|
19
|
+
type: string;
|
|
20
|
+
columns: any[];
|
|
21
|
+
from: string;
|
|
22
|
+
where: any;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents a command to modify existing records in a database table.
|
|
27
|
+
* @category SQL
|
|
28
|
+
* @example
|
|
29
|
+
* UPDATE products SET price = 10 WHERE id = 1
|
|
30
|
+
*/
|
|
31
|
+
export declare class Update extends ASTNode {
|
|
32
|
+
/** @hidden */
|
|
33
|
+
table: string;
|
|
34
|
+
/** @hidden */
|
|
35
|
+
assignments: Expression[];
|
|
36
|
+
/** @hidden */
|
|
37
|
+
where?: Expression;
|
|
38
|
+
constructor(table: string, assignments: Expression[], where?: Expression, loc?: SourceLocation);
|
|
39
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
40
|
+
toJSON(): {
|
|
41
|
+
type: string;
|
|
42
|
+
table: string;
|
|
43
|
+
assignments: any[];
|
|
44
|
+
where: any;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents a command to remove records from a database table.
|
|
49
|
+
* @category SQL
|
|
50
|
+
* @example
|
|
51
|
+
* DELETE FROM sessions WHERE last_active < '2023-01-01'
|
|
52
|
+
*/
|
|
53
|
+
export declare class Delete extends ASTNode {
|
|
54
|
+
/** @hidden */
|
|
55
|
+
table: string;
|
|
56
|
+
/** @hidden */
|
|
57
|
+
where?: Expression;
|
|
58
|
+
constructor(table: string, where?: Expression, loc?: SourceLocation);
|
|
59
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
60
|
+
toJSON(): {
|
|
61
|
+
type: string;
|
|
62
|
+
table: string;
|
|
63
|
+
where: any;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Represents a command to insert new records into a database table.
|
|
68
|
+
* @category SQL
|
|
69
|
+
* @example
|
|
70
|
+
* INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com')
|
|
71
|
+
*/
|
|
72
|
+
export declare class InsertInto extends ASTNode {
|
|
73
|
+
/** @hidden */
|
|
74
|
+
table: string;
|
|
75
|
+
/** @hidden */
|
|
76
|
+
columns: string[];
|
|
77
|
+
/** @hidden */
|
|
78
|
+
values: Expression[][];
|
|
79
|
+
constructor(table: string, columns: string[], values: Expression[][], loc?: SourceLocation);
|
|
80
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
81
|
+
toJSON(): {
|
|
82
|
+
type: string;
|
|
83
|
+
table: string;
|
|
84
|
+
columns: string[];
|
|
85
|
+
values: any[][];
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Represents a command to create a new database container.
|
|
90
|
+
* @category SQL
|
|
91
|
+
* @example
|
|
92
|
+
* CREATE DATABASE production_db
|
|
93
|
+
*/
|
|
94
|
+
export declare class CreateDatabase extends ASTNode {
|
|
95
|
+
/** @hidden */
|
|
96
|
+
name: string;
|
|
97
|
+
constructor(name: string, loc?: SourceLocation);
|
|
98
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
99
|
+
toJSON(): {
|
|
100
|
+
type: string;
|
|
101
|
+
name: string;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Represents a command to modify the properties of an existing database.
|
|
106
|
+
* @category SQL
|
|
107
|
+
* @example
|
|
108
|
+
* ALTER DATABASE production_db SET READ_ONLY = OFF
|
|
109
|
+
*/
|
|
110
|
+
export declare class AlterDatabase extends ASTNode {
|
|
111
|
+
/** @hidden */
|
|
112
|
+
name: string;
|
|
113
|
+
/** @hidden */
|
|
114
|
+
action: string;
|
|
115
|
+
constructor(name: string, action: string, loc?: SourceLocation);
|
|
116
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
117
|
+
toJSON(): {
|
|
118
|
+
type: string;
|
|
119
|
+
name: string;
|
|
120
|
+
action: string;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Represents a command to define a new table and its schema.
|
|
125
|
+
* @category SQL
|
|
126
|
+
* @example
|
|
127
|
+
* CREATE TABLE employees (id INT, name VARCHAR(100))
|
|
128
|
+
*/
|
|
129
|
+
export declare class CreateTable extends ASTNode {
|
|
130
|
+
/** @hidden */
|
|
131
|
+
name: string;
|
|
132
|
+
/** @hidden */
|
|
133
|
+
columns: Expression[];
|
|
134
|
+
constructor(name: string, columns: Expression[], loc?: SourceLocation);
|
|
135
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
136
|
+
toJSON(): {
|
|
137
|
+
type: string;
|
|
138
|
+
name: string;
|
|
139
|
+
columns: any[];
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Represents a command to modify an existing table structure (e.g., adding columns).
|
|
144
|
+
* @category SQL
|
|
145
|
+
* @example
|
|
146
|
+
* ALTER TABLE employees ADD COLUMN email VARCHAR(255)
|
|
147
|
+
*/
|
|
148
|
+
export declare class AlterTable extends ASTNode {
|
|
149
|
+
/** @hidden */
|
|
150
|
+
name: string;
|
|
151
|
+
/** @hidden */
|
|
152
|
+
action: Expression;
|
|
153
|
+
constructor(name: string, action: Expression, loc?: SourceLocation);
|
|
154
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
155
|
+
toJSON(): {
|
|
156
|
+
type: string;
|
|
157
|
+
name: string;
|
|
158
|
+
action: any;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Represents a command to delete a table and all its data permanently.
|
|
163
|
+
* @category SQL
|
|
164
|
+
* @example
|
|
165
|
+
* DROP TABLE old_logs
|
|
166
|
+
*/
|
|
167
|
+
export declare class DropTable extends ASTNode {
|
|
168
|
+
/** @hidden */
|
|
169
|
+
name: string;
|
|
170
|
+
constructor(name: string, loc?: SourceLocation);
|
|
171
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
172
|
+
toJSON(): {
|
|
173
|
+
type: string;
|
|
174
|
+
name: string;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Represents a command to create a search index on table columns to improve query performance.
|
|
179
|
+
* @category SQL
|
|
180
|
+
* @example
|
|
181
|
+
* CREATE INDEX idx_lastname ON employees (lastname)
|
|
182
|
+
*/
|
|
183
|
+
export declare class CreateIndex extends ASTNode {
|
|
184
|
+
/** @hidden */
|
|
185
|
+
name: string;
|
|
186
|
+
/** @hidden */
|
|
187
|
+
table: string;
|
|
188
|
+
/** @hidden */
|
|
189
|
+
columns: string[];
|
|
190
|
+
constructor(name: string, table: string, columns: string[], loc?: SourceLocation);
|
|
191
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
192
|
+
toJSON(): {
|
|
193
|
+
type: string;
|
|
194
|
+
name: string;
|
|
195
|
+
table: string;
|
|
196
|
+
columns: string[];
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Represents a command to remove an existing search index.
|
|
201
|
+
* @category SQL
|
|
202
|
+
* @example
|
|
203
|
+
* DROP INDEX idx_lastname
|
|
204
|
+
*/
|
|
205
|
+
export declare class DropIndex extends ASTNode {
|
|
206
|
+
/** @hidden */
|
|
207
|
+
name: string;
|
|
208
|
+
constructor(name: string, loc?: SourceLocation);
|
|
209
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
210
|
+
toJSON(): {
|
|
211
|
+
type: string;
|
|
212
|
+
name: string;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Represents a command to save changes made in a transaction.
|
|
217
|
+
* @category SQL
|
|
218
|
+
* @example
|
|
219
|
+
* COMMIT TRAN transaction_name
|
|
220
|
+
*/
|
|
221
|
+
export declare class Commit extends ASTNode {
|
|
222
|
+
/** @hidden */
|
|
223
|
+
name: SymbolPrimitive;
|
|
224
|
+
constructor(name: SymbolPrimitive, loc?: SourceLocation);
|
|
225
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
226
|
+
toJSON(): {
|
|
227
|
+
type: string;
|
|
228
|
+
name: SymbolPrimitive;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Represents a command to undo changes made in a transaction.
|
|
233
|
+
* @category SQL
|
|
234
|
+
* @example
|
|
235
|
+
* ROLLBACK TRAN transaction_name
|
|
236
|
+
*/
|
|
237
|
+
export declare class Rollback extends ASTNode {
|
|
238
|
+
/** @hidden */
|
|
239
|
+
name: SymbolPrimitive;
|
|
240
|
+
constructor(name: SymbolPrimitive, loc?: SourceLocation);
|
|
241
|
+
accept<R>(visitor: Visitor<R>): R;
|
|
242
|
+
toJSON(): {
|
|
243
|
+
type: string;
|
|
244
|
+
name: SymbolPrimitive;
|
|
245
|
+
};
|
|
246
|
+
}
|