@junoscript/juno 0.0.0-stage → 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.
Files changed (57) hide show
  1. package/Modules/async.ts +81 -0
  2. package/Modules/juno-node-fs.ts +105 -0
  3. package/Modules/juno-test.jn +156 -0
  4. package/dist/CLI/build-juno.d.ts +5 -0
  5. package/dist/CLI/build-juno.js +58 -0
  6. package/dist/CLI/generate-juno-types.d.ts +1 -0
  7. package/dist/CLI/generate-juno-types.js +51 -0
  8. package/dist/CLI/junode.d.ts +2 -0
  9. package/dist/CLI/junode.js +32 -0
  10. package/dist/Lexer/lexer.d.ts +42 -0
  11. package/dist/Lexer/lexer.js +300 -0
  12. package/dist/Lexer/parser.d.ts +395 -0
  13. package/dist/Lexer/parser.js +1881 -0
  14. package/dist/Modules/async.d.ts +33 -0
  15. package/dist/Modules/async.js +76 -0
  16. package/dist/Modules/index.d.ts +195 -0
  17. package/dist/Modules/index.js +31 -0
  18. package/dist/Modules/juno-node-fs.d.ts +52 -0
  19. package/dist/Modules/juno-node-fs.js +129 -0
  20. package/dist/Modules/juno-node.d.ts +74 -0
  21. package/dist/Modules/juno-node.js +56 -0
  22. package/dist/Modules/juno-test.d.ts +141 -0
  23. package/dist/Modules/juno-test.js +134 -0
  24. package/dist/Modules/juno-types.d.ts +35 -0
  25. package/dist/Modules/juno-types.js +2 -0
  26. package/dist/Modules/juno.d.ts +21 -0
  27. package/dist/Modules/juno.js +76 -0
  28. package/dist/Modules/types.d.ts +56 -0
  29. package/dist/Modules/types.js +87 -0
  30. package/dist/Runtime/interpreter.d.ts +64 -0
  31. package/dist/Runtime/interpreter.js +2533 -0
  32. package/dist/Runtime/resolve-import.d.ts +2 -0
  33. package/dist/Runtime/resolve-import.js +30 -0
  34. package/dist/vscode-junoscript/src/language.d.ts +86 -0
  35. package/dist/vscode-junoscript/src/language.js +4206 -0
  36. package/package.json +19 -4
  37. package/types/array.jn +158 -0
  38. package/types/boolean.jn +18 -0
  39. package/types/error.jn +28 -0
  40. package/types/error.ts +9 -0
  41. package/types/index.jn +11 -0
  42. package/types/iterable.jn +211 -0
  43. package/types/map.jn +44 -0
  44. package/types/map.ts +132 -0
  45. package/types/number.ts +52 -0
  46. package/types/object.jn +94 -0
  47. package/types/object.ts +49 -0
  48. package/types/queue.jn +46 -0
  49. package/types/random.jn +25 -0
  50. package/types/random.ts +1 -0
  51. package/types/range.jn +27 -0
  52. package/types/set.jn +139 -0
  53. package/types/set.ts +209 -0
  54. package/types/string.jn +33 -0
  55. package/types/string.ts +1 -0
  56. package/types/tuple.jn +11 -0
  57. package/README.md +0 -3
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Lexer = Lexer;
4
+ const keywords = new Set([
5
+ 'let', 'const', 'fun', 'type', 'return', 'break', 'if', 'else', 'for', 'of',
6
+ 'while', 'match', 'case', 'when', 'true', 'false', 'null', 'readonly', 'sealed', 'static', 'as', 'in',
7
+ 'import', 'from', 'export', 'default', 'constructor', 'try', 'catch', 'finally', 'await'
8
+ ]);
9
+ function Lexer(source) {
10
+ return {
11
+ pos: 0,
12
+ source,
13
+ get current() {
14
+ return source[this.pos] ?? '';
15
+ },
16
+ get isAtEnd() {
17
+ return this.pos >= source.length;
18
+ },
19
+ tokenize() {
20
+ const tokens = [];
21
+ const indents = [0];
22
+ let line = 1;
23
+ let column = 1;
24
+ let lineStart = true;
25
+ let continuedLine = false;
26
+ const push = (type, value, l = line, c = column) => {
27
+ if (type === 'Number') {
28
+ tokens.push({ type, value: value, line: l, column: c });
29
+ }
30
+ else if (type === 'BigInt') {
31
+ tokens.push({ type, value: value, line: l, column: c });
32
+ }
33
+ else if (type === 'String') {
34
+ tokens.push({ type, value: value, line: l, column: c });
35
+ }
36
+ else if (type === 'RegEx') {
37
+ tokens.push({ type, value: value, line: l, column: c });
38
+ }
39
+ else if (type === 'Identifier' || type === 'Keyword') {
40
+ tokens.push({ type, value: String(value), line: l, column: c });
41
+ }
42
+ else {
43
+ tokens.push({ type, line: l, column: c });
44
+ }
45
+ };
46
+ const advance = () => {
47
+ const character = this.current;
48
+ this.pos++;
49
+ if (character === '\n') {
50
+ line++;
51
+ column = 1;
52
+ }
53
+ else {
54
+ column++;
55
+ }
56
+ return character;
57
+ };
58
+ while (!this.isAtEnd) {
59
+ if (lineStart) {
60
+ let width = 0;
61
+ while (this.current === ' ' || this.current === '\t') {
62
+ width += advance() === '\t' ? 4 : 1;
63
+ }
64
+ if (this.current === '\r')
65
+ advance();
66
+ if (this.current === '\n') {
67
+ advance();
68
+ push('Newline', undefined, line - 1, 1);
69
+ continue;
70
+ }
71
+ if (this.current === '#') {
72
+ while (!this.isAtEnd && source[this.pos] !== '\n')
73
+ advance();
74
+ continue;
75
+ }
76
+ if (continuedLine) {
77
+ continuedLine = false;
78
+ }
79
+ else {
80
+ const currentIndent = indents[indents.length - 1];
81
+ if (width > currentIndent) {
82
+ indents.push(width);
83
+ push('Indent');
84
+ }
85
+ else if (width < currentIndent) {
86
+ while (indents.length > 1 && width < indents[indents.length - 1]) {
87
+ indents.pop();
88
+ push('Dedent');
89
+ }
90
+ if (width !== indents[indents.length - 1]) {
91
+ throw new SyntaxError(`Inconsistent indentation at ${line}:${column}`);
92
+ }
93
+ }
94
+ }
95
+ lineStart = false;
96
+ }
97
+ const character = this.current;
98
+ const tokenLine = line;
99
+ const tokenColumn = column;
100
+ if (source.slice(this.pos, this.pos + 3) === '...') {
101
+ advance();
102
+ advance();
103
+ advance();
104
+ push('Ellipsis', undefined, tokenLine, tokenColumn);
105
+ continue;
106
+ }
107
+ if (character === ' ' || character === '\t' || character === '\r') {
108
+ advance();
109
+ continue;
110
+ }
111
+ if (character === '\n') {
112
+ advance();
113
+ push('Newline', undefined, tokenLine, tokenColumn);
114
+ lineStart = true;
115
+ continue;
116
+ }
117
+ // A trailing backslash joins the next physical line to the
118
+ // current expression. Keep indentation processing on the next
119
+ // line, but do not emit a statement-separating Newline token.
120
+ if (character === '\\' && (source[this.pos + 1] === '\n' || source[this.pos + 1] === '\r')) {
121
+ advance();
122
+ if (this.current === '\r')
123
+ advance();
124
+ if (this.current === '\n')
125
+ advance();
126
+ lineStart = true;
127
+ continuedLine = true;
128
+ continue;
129
+ }
130
+ if (character === '#') {
131
+ while (!this.isAtEnd && this.current !== '\n')
132
+ advance();
133
+ continue;
134
+ }
135
+ if (/[0-9]/.test(character)) {
136
+ let raw = '';
137
+ while (/[0-9]/.test(this.current))
138
+ raw += advance();
139
+ const isDecimal = this.current === '.' &&
140
+ /[0-9]/.test(source[this.pos + 1] ?? '');
141
+ if (isDecimal) {
142
+ raw += advance();
143
+ while (/[0-9]/.test(this.current))
144
+ raw += advance();
145
+ }
146
+ if (!isDecimal && this.current === 'n') {
147
+ advance();
148
+ push('BigInt', BigInt(raw), tokenLine, tokenColumn);
149
+ }
150
+ else {
151
+ push('Number', Number(raw), tokenLine, tokenColumn);
152
+ }
153
+ continue;
154
+ }
155
+ if (/[A-Za-z_$]/.test(character)) {
156
+ let value = '';
157
+ while (/[A-Za-z0-9_$]/.test(this.current))
158
+ value += advance();
159
+ push(keywords.has(value) ? 'Keyword' : 'Identifier', value, tokenLine, tokenColumn);
160
+ continue;
161
+ }
162
+ if (character === '"' || character === "'" || character === '`') {
163
+ const quote = advance();
164
+ let value = '';
165
+ let closed = false;
166
+ while (!this.isAtEnd) {
167
+ const current = advance();
168
+ if (current === '\n' && quote !== '`') {
169
+ throw new SyntaxError(`Unterminated string at ${tokenLine}:${tokenColumn}`);
170
+ }
171
+ if (current === quote) {
172
+ closed = true;
173
+ break;
174
+ }
175
+ if (current === '\\') {
176
+ if (this.isAtEnd)
177
+ break;
178
+ const escaped = advance();
179
+ value += escaped === '$' ? '\uE000' : ({ n: '\n', r: '\r', t: '\t', '0': '\0' }[escaped] ?? escaped);
180
+ }
181
+ else {
182
+ value += current;
183
+ }
184
+ }
185
+ if (!closed) {
186
+ throw new SyntaxError(`Unterminated string at ${tokenLine}:${tokenColumn}`);
187
+ }
188
+ push('String', value, tokenLine, tokenColumn);
189
+ continue;
190
+ }
191
+ // A slash starts a regular-expression literal only where an
192
+ // expression can begin; after a value it remains division.
193
+ if (character === '/') {
194
+ const previous = tokens[tokens.length - 1];
195
+ const endsExpression = previous && (['Number', 'BigInt', 'String', 'RegEx', 'Identifier', 'RightParen', 'RightBracket', 'RightBrace', 'Increment', 'Decrement'].includes(previous.type) ||
196
+ previous.type === 'Keyword' && ['true', 'false', 'null'].includes(previous.value));
197
+ if (!endsExpression && source[this.pos + 1] !== '=' && source[this.pos + 1] !== '/') {
198
+ advance();
199
+ let pattern = '';
200
+ let escaped = false;
201
+ let inClass = false;
202
+ let closed = false;
203
+ while (!this.isAtEnd) {
204
+ const current = advance();
205
+ if (current === '\n' || current === '\r')
206
+ throw new SyntaxError(`Unterminated regular expression at ${tokenLine}:${tokenColumn}`);
207
+ if (!escaped && current === '[')
208
+ inClass = true;
209
+ else if (!escaped && current === ']')
210
+ inClass = false;
211
+ else if (!escaped && current === '/' && !inClass) {
212
+ closed = true;
213
+ break;
214
+ }
215
+ pattern += current;
216
+ escaped = !escaped && current === '\\';
217
+ if (current !== '\\')
218
+ escaped = false;
219
+ }
220
+ if (!closed)
221
+ throw new SyntaxError(`Unterminated regular expression at ${tokenLine}:${tokenColumn}`);
222
+ let flags = '';
223
+ while (/[A-Za-z]/.test(this.current))
224
+ flags += advance();
225
+ try {
226
+ new RegExp(pattern, flags);
227
+ }
228
+ catch (error) {
229
+ throw new SyntaxError(`Invalid regular expression at ${tokenLine}:${tokenColumn}: ${error instanceof Error ? error.message : String(error)}`);
230
+ }
231
+ push('RegEx', { source: pattern, flags }, tokenLine, tokenColumn);
232
+ continue;
233
+ }
234
+ }
235
+ const pairs = {
236
+ '++': 'Increment',
237
+ '--': 'Decrement',
238
+ '+=': 'PlusEqual',
239
+ '-=': 'MinusEqual',
240
+ '*=': 'MultiplyEqual',
241
+ '/=': 'DivideEqual',
242
+ '%=': 'PercentEqual',
243
+ '|=': 'PipeEqual',
244
+ '&=': 'AmpersandEqual',
245
+ '==': 'EqualEqual',
246
+ '!=': 'NotEqual',
247
+ '<=': 'LessEqual',
248
+ '>=': 'GreaterEqual',
249
+ '??': 'Nullish',
250
+ '=>': 'FatArrow',
251
+ '->': 'Arrow'
252
+ };
253
+ const pair = character + (source[this.pos + 1] ?? '');
254
+ if (pairs[pair]) {
255
+ advance();
256
+ advance();
257
+ push(pairs[pair], undefined, tokenLine, tokenColumn);
258
+ continue;
259
+ }
260
+ const singles = {
261
+ '+': 'Plus',
262
+ '-': 'Minus',
263
+ '*': 'Multiply',
264
+ '/': 'Divide',
265
+ '%': 'Percent',
266
+ '=': 'Equal',
267
+ '<': 'Less',
268
+ '>': 'Greater',
269
+ ':': 'Colon',
270
+ ',': 'Comma',
271
+ '.': 'Dot',
272
+ '?': 'Question',
273
+ '|': 'Pipe',
274
+ '&': 'Ampersand',
275
+ '!': 'Bang',
276
+ '(': 'LeftParen',
277
+ ')': 'RightParen',
278
+ '[': 'LeftBracket',
279
+ ']': 'RightBracket',
280
+ '{': 'LeftBrace',
281
+ '}': 'RightBrace'
282
+ };
283
+ if (!singles[character]) {
284
+ throw new SyntaxError(`Unexpected character '${character}' at ${tokenLine}:${tokenColumn}`);
285
+ }
286
+ advance();
287
+ push(singles[character], undefined, tokenLine, tokenColumn);
288
+ }
289
+ if (source.length && !lineStart && tokens[tokens.length - 1]?.type !== 'Newline') {
290
+ push('Newline', undefined, line, column);
291
+ }
292
+ while (indents.length > 1) {
293
+ indents.pop();
294
+ push('Dedent');
295
+ }
296
+ push('EOF');
297
+ return tokens;
298
+ }
299
+ };
300
+ }
@@ -0,0 +1,395 @@
1
+ import { Token } from './lexer';
2
+ export type Loc = {
3
+ line: number;
4
+ column: number;
5
+ };
6
+ export type TypeNode = {
7
+ kind: 'NamedType';
8
+ name: string;
9
+ loc?: Loc;
10
+ } | {
11
+ kind: 'LiteralType';
12
+ value: string | number | boolean;
13
+ loc?: Loc;
14
+ } | {
15
+ kind: 'GenericType';
16
+ name: string;
17
+ args: TypeNode[];
18
+ loc?: Loc;
19
+ } | {
20
+ kind: 'UnionType' | 'IntersectionType';
21
+ types: TypeNode[];
22
+ } | {
23
+ kind: 'ArrayType';
24
+ element: TypeNode;
25
+ } | {
26
+ kind: 'IndexedAccessType';
27
+ object: TypeNode;
28
+ index: TypeNode;
29
+ loc?: Loc;
30
+ } | {
31
+ kind: 'TypeOfType';
32
+ expression: Expression;
33
+ loc?: Loc;
34
+ } | {
35
+ kind: 'ConditionalType';
36
+ check: TypeNode;
37
+ target: TypeNode;
38
+ consequent: TypeNode;
39
+ alternate: TypeNode;
40
+ loc?: Loc;
41
+ } | {
42
+ kind: 'ObjectType';
43
+ members: TypeMember[];
44
+ } | {
45
+ kind: 'FunctionType';
46
+ params: TypeNode[];
47
+ paramNames?: (string | undefined)[];
48
+ rest?: TypeNode;
49
+ restName?: string;
50
+ genericParameters?: GenericParameter[];
51
+ result: TypeNode;
52
+ };
53
+ type GenericParameter = {
54
+ name: string;
55
+ loc: Loc;
56
+ constraint?: TypeNode;
57
+ defaultType?: TypeNode;
58
+ };
59
+ export type TypeMember = {
60
+ name: string;
61
+ loc?: Loc;
62
+ type: TypeNode;
63
+ optional: boolean;
64
+ readonly: boolean;
65
+ sealed?: boolean;
66
+ constant: boolean;
67
+ defaultValue?: Expression;
68
+ method?: boolean;
69
+ accessor?: 'get' | 'set';
70
+ indexType?: TypeNode;
71
+ generics?: string[];
72
+ genericLocs?: Loc[];
73
+ genericConstraints?: (TypeNode | undefined)[];
74
+ genericDefaults?: (TypeNode | undefined)[];
75
+ params?: Parameter[];
76
+ body?: Statement[];
77
+ };
78
+ export type Parameter = {
79
+ name: string;
80
+ loc?: Loc;
81
+ type?: TypeNode;
82
+ defaultValue?: Expression;
83
+ rest?: boolean;
84
+ };
85
+ export type MatchPattern = {
86
+ kind: 'PatternLiteral';
87
+ value: string | number | bigint | boolean | null;
88
+ loc?: Loc;
89
+ } | {
90
+ kind: 'PatternIdentifier';
91
+ name: string;
92
+ nullable?: boolean;
93
+ loc?: Loc;
94
+ } | {
95
+ kind: 'PatternObject';
96
+ properties: {
97
+ name: string;
98
+ pattern?: MatchPattern;
99
+ loc?: Loc;
100
+ }[];
101
+ loc?: Loc;
102
+ } | {
103
+ kind: 'PatternUnion';
104
+ patterns: MatchPattern[];
105
+ loc?: Loc;
106
+ };
107
+ export type Expression = {
108
+ kind: 'Literal';
109
+ value: string | number | bigint | boolean | null;
110
+ loc?: Loc;
111
+ } | {
112
+ kind: 'RegEx';
113
+ source: string;
114
+ flags: string;
115
+ loc?: Loc;
116
+ } | {
117
+ kind: 'Template';
118
+ parts: (string | Expression)[];
119
+ loc?: Loc;
120
+ } | {
121
+ kind: 'Identifier';
122
+ name: string;
123
+ loc?: Loc;
124
+ } | {
125
+ kind: 'Array';
126
+ elements: Expression[];
127
+ loc?: Loc;
128
+ } | {
129
+ kind: 'Spread';
130
+ value: Expression;
131
+ loc?: Loc;
132
+ } | {
133
+ kind: 'Object';
134
+ properties: {
135
+ key: string;
136
+ keyLoc?: Loc;
137
+ value: Expression;
138
+ accessor?: 'get' | 'set';
139
+ spread?: boolean;
140
+ readonly?: boolean;
141
+ sealed?: boolean;
142
+ typeOnly?: boolean;
143
+ indexType?: TypeNode;
144
+ declaredType?: TypeNode;
145
+ }[];
146
+ loc?: Loc;
147
+ } | {
148
+ kind: 'Unary';
149
+ operator: string;
150
+ operand: Expression;
151
+ loc?: Loc;
152
+ } | {
153
+ kind: 'Assignment';
154
+ name: string;
155
+ loc?: Loc;
156
+ operatorLoc?: Loc;
157
+ operator?: string;
158
+ value: Expression;
159
+ } | {
160
+ kind: 'MemberAssignment';
161
+ object: Expression;
162
+ property?: string;
163
+ propertyLoc?: Loc;
164
+ index?: Expression;
165
+ loc?: Loc;
166
+ operator?: string;
167
+ value: Expression;
168
+ } | {
169
+ kind: 'Binary';
170
+ operator: string;
171
+ left: Expression;
172
+ right: Expression;
173
+ loc?: Loc;
174
+ } | {
175
+ kind: 'Conditional';
176
+ condition: Expression;
177
+ consequent: Expression;
178
+ alternate: Expression;
179
+ loc?: Loc;
180
+ } | {
181
+ kind: 'Match';
182
+ value: Expression;
183
+ cases: {
184
+ pattern?: MatchPattern;
185
+ guard?: Expression;
186
+ body: Statement[];
187
+ loc?: Loc;
188
+ }[];
189
+ loc?: Loc;
190
+ } | {
191
+ kind: 'Try';
192
+ value?: Expression;
193
+ body?: Statement[];
194
+ catches: {
195
+ binding?: string;
196
+ bindingLoc?: Loc;
197
+ type?: TypeNode;
198
+ body: Statement[];
199
+ loc?: Loc;
200
+ }[];
201
+ finallyBody?: Statement[];
202
+ loc?: Loc;
203
+ } | {
204
+ kind: 'Is';
205
+ value: Expression;
206
+ type: TypeNode;
207
+ loc?: Loc;
208
+ } | {
209
+ kind: 'Member';
210
+ object: Expression;
211
+ property: string;
212
+ optional: boolean;
213
+ loc?: Loc;
214
+ } | {
215
+ kind: 'Index';
216
+ object: Expression;
217
+ index: Expression;
218
+ loc?: Loc;
219
+ } | {
220
+ kind: 'Call';
221
+ callee: Expression;
222
+ args: Expression[];
223
+ typeArguments?: TypeNode[];
224
+ } | {
225
+ kind: 'Function';
226
+ loc?: Loc;
227
+ generics?: string[];
228
+ genericLocs?: Loc[];
229
+ genericConstraints?: (TypeNode | undefined)[];
230
+ genericDefaults?: (TypeNode | undefined)[];
231
+ params: Parameter[];
232
+ returnType?: TypeNode;
233
+ body: Statement[];
234
+ expressionBody?: Expression;
235
+ };
236
+ export type Statement = {
237
+ kind: 'Variable';
238
+ name: string;
239
+ loc?: Loc;
240
+ mutable: boolean;
241
+ type?: TypeNode;
242
+ initializer?: Expression;
243
+ } | {
244
+ kind: 'Destructure';
245
+ bindings: {
246
+ name: string;
247
+ loc?: Loc;
248
+ }[];
249
+ mutable: boolean;
250
+ initializer: Expression;
251
+ } | {
252
+ kind: 'ArrayDestructure';
253
+ bindings: {
254
+ name?: string;
255
+ loc?: Loc;
256
+ index: number;
257
+ rest?: boolean;
258
+ }[];
259
+ mutable: boolean;
260
+ initializer: Expression;
261
+ } | {
262
+ kind: 'Import';
263
+ module: string;
264
+ defaultImport?: string;
265
+ defaultImportLoc?: Loc;
266
+ namedImports: string[];
267
+ namedImportLocs?: Loc[];
268
+ importedTypes?: Record<string, TypeNode>;
269
+ importedSymbols?: Record<string, {
270
+ kind: string;
271
+ value?: TypeNode;
272
+ generics?: string[];
273
+ genericConstraints?: (TypeNode | undefined)[];
274
+ genericDefaults?: (TypeNode | undefined)[];
275
+ params?: Parameter[];
276
+ returnType?: TypeNode;
277
+ type?: TypeNode;
278
+ inheritedType?: TypeNode;
279
+ overloads?: {
280
+ params: Parameter[];
281
+ returnType: TypeNode;
282
+ }[];
283
+ methods?: {
284
+ name: string;
285
+ generics?: string[];
286
+ genericConstraints?: (TypeNode | undefined)[];
287
+ genericDefaults?: (TypeNode | undefined)[];
288
+ params: Parameter[];
289
+ returnType: TypeNode;
290
+ }[];
291
+ }>;
292
+ } | {
293
+ kind: 'Export';
294
+ declaration: Statement;
295
+ default?: boolean;
296
+ } | {
297
+ kind: 'FunctionDeclaration';
298
+ name: string;
299
+ loc?: Loc;
300
+ generics?: string[];
301
+ genericLocs?: Loc[];
302
+ genericConstraints?: (TypeNode | undefined)[];
303
+ genericDefaults?: (TypeNode | undefined)[];
304
+ params: Parameter[];
305
+ returnType?: TypeNode;
306
+ body: Statement[];
307
+ } | {
308
+ kind: 'TypeDeclaration';
309
+ name: string;
310
+ loc?: Loc;
311
+ generics: string[];
312
+ genericLocs?: Loc[];
313
+ genericConstraints?: (TypeNode | undefined)[];
314
+ genericDefaults?: (TypeNode | undefined)[];
315
+ value: TypeNode;
316
+ } | {
317
+ kind: 'ConstructorDeclaration';
318
+ name: string;
319
+ loc?: Loc;
320
+ generics: string[];
321
+ genericLocs?: Loc[];
322
+ genericConstraints?: (TypeNode | undefined)[];
323
+ genericDefaults?: (TypeNode | undefined)[];
324
+ inheritedType: TypeNode;
325
+ overloads: Extract<Expression, {
326
+ kind: 'Function';
327
+ }>[];
328
+ methods: Extract<Statement, {
329
+ kind: 'FunctionDeclaration';
330
+ }>[];
331
+ } | {
332
+ kind: 'Return';
333
+ value?: Expression;
334
+ } | {
335
+ kind: 'Break';
336
+ loc?: Loc;
337
+ } | {
338
+ kind: 'ExpressionStatement';
339
+ expression: Expression;
340
+ } | {
341
+ kind: 'If';
342
+ condition: Expression;
343
+ consequent: Statement[];
344
+ alternate?: Statement[];
345
+ } | {
346
+ kind: 'ForOf';
347
+ binding: string;
348
+ loc?: Loc;
349
+ mutable: boolean;
350
+ iterable: Expression;
351
+ body: Statement[];
352
+ } | {
353
+ kind: 'While';
354
+ condition: Expression;
355
+ body: Statement[];
356
+ };
357
+ export declare class Parser {
358
+ private readonly tokens;
359
+ private pos;
360
+ private softExpressionIndents;
361
+ constructor(tokens: Token[]);
362
+ get current(): Token;
363
+ private is;
364
+ private take;
365
+ private value;
366
+ private match;
367
+ private fail;
368
+ private loc;
369
+ private identifier;
370
+ private propertyName;
371
+ private separators;
372
+ private objectSeparators;
373
+ private parenthesisSeparators;
374
+ parse(): Statement[];
375
+ parseExpressionOnly(): Expression;
376
+ private statement;
377
+ private importStatement;
378
+ private block;
379
+ private matchPattern;
380
+ private matchPatternAtom;
381
+ private matchExpression;
382
+ private parameters;
383
+ private genericParameters;
384
+ private type;
385
+ private typeAtom;
386
+ private expression;
387
+ private templateExpression;
388
+ private prefix;
389
+ private tryExpression;
390
+ }
391
+ export declare function parse(source: string, options?: {
392
+ validate?: boolean;
393
+ filePath?: string;
394
+ }): Statement[];
395
+ export {};