@mirascript/constants 0.1.26

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.
@@ -0,0 +1,810 @@
1
+ /**
2
+ * Diagnostic codes for MiraScript compiler and tools.
3
+ */
4
+ export var DiagnosticCode;
5
+ (function (DiagnosticCode) {
6
+ DiagnosticCode[DiagnosticCode["ErrorStart"] = 1000] = "ErrorStart";
7
+ DiagnosticCode[DiagnosticCode["InternalError"] = 1001] = "InternalError";
8
+ DiagnosticCode[DiagnosticCode["LexerError"] = 1002] = "LexerError";
9
+ DiagnosticCode[DiagnosticCode["ParserError"] = 1003] = "ParserError";
10
+ DiagnosticCode[DiagnosticCode["EmitterError"] = 1004] = "EmitterError";
11
+ DiagnosticCode[DiagnosticCode["OptimizerError"] = 1005] = "OptimizerError";
12
+ DiagnosticCode[DiagnosticCode["Unimplemented"] = 1006] = "Unimplemented";
13
+ DiagnosticCode[DiagnosticCode["UnknownToken"] = 1007] = "UnknownToken";
14
+ DiagnosticCode[DiagnosticCode["UnexpectedToken"] = 1008] = "UnexpectedToken";
15
+ DiagnosticCode[DiagnosticCode["InvalidReservedKeyword"] = 1009] = "InvalidReservedKeyword";
16
+ DiagnosticCode[DiagnosticCode["InvalidKeyword"] = 1010] = "InvalidKeyword";
17
+ DiagnosticCode[DiagnosticCode["InvalidNumberLiteralUnderscore"] = 1011] = "InvalidNumberLiteralUnderscore";
18
+ DiagnosticCode[DiagnosticCode["InvalidNumberLiteral"] = 1012] = "InvalidNumberLiteral";
19
+ DiagnosticCode[DiagnosticCode["OverflowNumberLiteral"] = 1013] = "OverflowNumberLiteral";
20
+ DiagnosticCode[DiagnosticCode["OverflowIntegerLiteral"] = 1014] = "OverflowIntegerLiteral";
21
+ DiagnosticCode[DiagnosticCode["InvalidOrdinalLiteral"] = 1015] = "InvalidOrdinalLiteral";
22
+ DiagnosticCode[DiagnosticCode["UnterminatedString"] = 1016] = "UnterminatedString";
23
+ DiagnosticCode[DiagnosticCode["InvalidEscapeSequence"] = 1017] = "InvalidEscapeSequence";
24
+ DiagnosticCode[DiagnosticCode["InvalidHexEscapeSequence"] = 1018] = "InvalidHexEscapeSequence";
25
+ DiagnosticCode[DiagnosticCode["InvalidUnicodeEscapeSequence"] = 1019] = "InvalidUnicodeEscapeSequence";
26
+ DiagnosticCode[DiagnosticCode["BadArraySpread"] = 1020] = "BadArraySpread";
27
+ DiagnosticCode[DiagnosticCode["UnterminatedInterpolation"] = 1021] = "UnterminatedInterpolation";
28
+ DiagnosticCode[DiagnosticCode["BadInterpolation"] = 1022] = "BadInterpolation";
29
+ DiagnosticCode[DiagnosticCode["UnexpectedUnderscore"] = 1023] = "UnexpectedUnderscore";
30
+ DiagnosticCode[DiagnosticCode["UnexpectedGlobal"] = 1024] = "UnexpectedGlobal";
31
+ DiagnosticCode[DiagnosticCode["MissingComma"] = 1025] = "MissingComma";
32
+ DiagnosticCode[DiagnosticCode["MissingCloseBracket"] = 1026] = "MissingCloseBracket";
33
+ DiagnosticCode[DiagnosticCode["MissingOpenBrace"] = 1027] = "MissingOpenBrace";
34
+ DiagnosticCode[DiagnosticCode["MissingCloseBrace"] = 1028] = "MissingCloseBrace";
35
+ DiagnosticCode[DiagnosticCode["MissingCloseParen"] = 1029] = "MissingCloseParen";
36
+ DiagnosticCode[DiagnosticCode["MissingSemicolon"] = 1030] = "MissingSemicolon";
37
+ DiagnosticCode[DiagnosticCode["MissingBindOperator"] = 1031] = "MissingBindOperator";
38
+ DiagnosticCode[DiagnosticCode["InvalidConstantName"] = 1032] = "InvalidConstantName";
39
+ DiagnosticCode[DiagnosticCode["MissingFunctionName"] = 1033] = "MissingFunctionName";
40
+ DiagnosticCode[DiagnosticCode["MissingOpenParenAfterExtension"] = 1034] = "MissingOpenParenAfterExtension";
41
+ DiagnosticCode[DiagnosticCode["MissingOpenParenAfterType"] = 1035] = "MissingOpenParenAfterType";
42
+ DiagnosticCode[DiagnosticCode["InvalidTypeCall"] = 1036] = "InvalidTypeCall";
43
+ DiagnosticCode[DiagnosticCode["RecordLiteralInExtensionCaller"] = 1037] = "RecordLiteralInExtensionCaller";
44
+ DiagnosticCode[DiagnosticCode["MissingCase"] = 1038] = "MissingCase";
45
+ DiagnosticCode[DiagnosticCode["UnknownExpression"] = 1039] = "UnknownExpression";
46
+ DiagnosticCode[DiagnosticCode["UnmatchedCloseBrace"] = 1040] = "UnmatchedCloseBrace";
47
+ DiagnosticCode[DiagnosticCode["UnmatchedCloseBracket"] = 1041] = "UnmatchedCloseBracket";
48
+ DiagnosticCode[DiagnosticCode["UnmatchedCloseParen"] = 1042] = "UnmatchedCloseParen";
49
+ DiagnosticCode[DiagnosticCode["UnknownPattern"] = 1043] = "UnknownPattern";
50
+ DiagnosticCode[DiagnosticCode["InvalidConstantLiteral"] = 1044] = "InvalidConstantLiteral";
51
+ DiagnosticCode[DiagnosticCode["UnknownStatement"] = 1045] = "UnknownStatement";
52
+ DiagnosticCode[DiagnosticCode["ExpressionExpected"] = 1046] = "ExpressionExpected";
53
+ DiagnosticCode[DiagnosticCode["PatternExpected"] = 1047] = "PatternExpected";
54
+ DiagnosticCode[DiagnosticCode["ExclamationInLiteralPattern"] = 1048] = "ExclamationInLiteralPattern";
55
+ DiagnosticCode[DiagnosticCode["MutInRebindPattern"] = 1049] = "MutInRebindPattern";
56
+ DiagnosticCode[DiagnosticCode["ConstantInBindPattern"] = 1050] = "ConstantInBindPattern";
57
+ DiagnosticCode[DiagnosticCode["MutInDiscardPattern"] = 1051] = "MutInDiscardPattern";
58
+ DiagnosticCode[DiagnosticCode["DiscardInSpreadPattern"] = 1052] = "DiscardInSpreadPattern";
59
+ DiagnosticCode[DiagnosticCode["SpreadDiscardInRecordPattern"] = 1053] = "SpreadDiscardInRecordPattern";
60
+ DiagnosticCode[DiagnosticCode["MispositionedSpreadInRecordPattern"] = 1054] = "MispositionedSpreadInRecordPattern";
61
+ DiagnosticCode[DiagnosticCode["InterpolatedNameRecordPattern"] = 1055] = "InterpolatedNameRecordPattern";
62
+ DiagnosticCode[DiagnosticCode["BadOmitKeyRecordPattern"] = 1056] = "BadOmitKeyRecordPattern";
63
+ DiagnosticCode[DiagnosticCode["AmbiguousRangePattern"] = 1057] = "AmbiguousRangePattern";
64
+ DiagnosticCode[DiagnosticCode["DuplicateSpreadPattern"] = 1058] = "DuplicateSpreadPattern";
65
+ DiagnosticCode[DiagnosticCode["MispositionedRestParameter"] = 1059] = "MispositionedRestParameter";
66
+ DiagnosticCode[DiagnosticCode["UndefinedVariableAssignment"] = 1060] = "UndefinedVariableAssignment";
67
+ DiagnosticCode[DiagnosticCode["ImmutableVariableAssignment"] = 1061] = "ImmutableVariableAssignment";
68
+ DiagnosticCode[DiagnosticCode["UninitializedVariable"] = 1062] = "UninitializedVariable";
69
+ DiagnosticCode[DiagnosticCode["DuplicateVariableDeclaration"] = 1063] = "DuplicateVariableDeclaration";
70
+ DiagnosticCode[DiagnosticCode["UnexpectedBreak"] = 1064] = "UnexpectedBreak";
71
+ DiagnosticCode[DiagnosticCode["UnexpectedContinue"] = 1065] = "UnexpectedContinue";
72
+ DiagnosticCode[DiagnosticCode["MisuseOfGlobalKeyword"] = 1066] = "MisuseOfGlobalKeyword";
73
+ DiagnosticCode[DiagnosticCode["BadOmitKeyRecordExpression"] = 1067] = "BadOmitKeyRecordExpression";
74
+ DiagnosticCode[DiagnosticCode["UnassignableExpression"] = 1068] = "UnassignableExpression";
75
+ DiagnosticCode[DiagnosticCode["NonNumberInRange"] = 1069] = "NonNumberInRange";
76
+ DiagnosticCode[DiagnosticCode["NonNumberOrStringInComparison"] = 1070] = "NonNumberOrStringInComparison";
77
+ DiagnosticCode[DiagnosticCode["NonNumberInArithmetic"] = 1071] = "NonNumberInArithmetic";
78
+ DiagnosticCode[DiagnosticCode["NonBooleanInLogical"] = 1072] = "NonBooleanInLogical";
79
+ DiagnosticCode[DiagnosticCode["ErrorEnd"] = 1999] = "ErrorEnd";
80
+ DiagnosticCode[DiagnosticCode["WarningStart"] = 2000] = "WarningStart";
81
+ DiagnosticCode[DiagnosticCode["UnnecessaryParentheses"] = 2001] = "UnnecessaryParentheses";
82
+ DiagnosticCode[DiagnosticCode["MisleadingNilVariable"] = 2002] = "MisleadingNilVariable";
83
+ DiagnosticCode[DiagnosticCode["UnnecessaryIrrefutablePattern"] = 2003] = "UnnecessaryIrrefutablePattern";
84
+ DiagnosticCode[DiagnosticCode["MatchExpressionHasNoCases"] = 2004] = "MatchExpressionHasNoCases";
85
+ DiagnosticCode[DiagnosticCode["GlobalVariableNotDeclared"] = 2005] = "GlobalVariableNotDeclared";
86
+ DiagnosticCode[DiagnosticCode["WarningEnd"] = 2999] = "WarningEnd";
87
+ DiagnosticCode[DiagnosticCode["InfoStart"] = 3000] = "InfoStart";
88
+ DiagnosticCode[DiagnosticCode["InfoEnd"] = 3999] = "InfoEnd";
89
+ DiagnosticCode[DiagnosticCode["HintStart"] = 4000] = "HintStart";
90
+ DiagnosticCode[DiagnosticCode["UnusedLocalVariable"] = 4001] = "UnusedLocalVariable";
91
+ DiagnosticCode[DiagnosticCode["UnusedLocalFunction"] = 4002] = "UnusedLocalFunction";
92
+ DiagnosticCode[DiagnosticCode["HintEnd"] = 4999] = "HintEnd";
93
+ DiagnosticCode[DiagnosticCode["ReferenceStart"] = 5000] = "ReferenceStart";
94
+ DiagnosticCode[DiagnosticCode["VariableDeclaredHere"] = 5001] = "VariableDeclaredHere";
95
+ DiagnosticCode[DiagnosticCode["FunctionDeclaredHere"] = 5002] = "FunctionDeclaredHere";
96
+ DiagnosticCode[DiagnosticCode["ParameterDeclaredHere"] = 5003] = "ParameterDeclaredHere";
97
+ DiagnosticCode[DiagnosticCode["ParameterItDeclaredHere"] = 5004] = "ParameterItDeclaredHere";
98
+ DiagnosticCode[DiagnosticCode["ParameterRestDeclaredHere"] = 5005] = "ParameterRestDeclaredHere";
99
+ DiagnosticCode[DiagnosticCode["ParameterSubPatternDeclaredHere"] = 5006] = "ParameterSubPatternDeclaredHere";
100
+ DiagnosticCode[DiagnosticCode["ReferenceEnd"] = 5999] = "ReferenceEnd";
101
+ DiagnosticCode[DiagnosticCode["TagStart"] = 10000] = "TagStart";
102
+ DiagnosticCode[DiagnosticCode["LocalConst"] = 10001] = "LocalConst";
103
+ DiagnosticCode[DiagnosticCode["LocalImmutable"] = 10002] = "LocalImmutable";
104
+ DiagnosticCode[DiagnosticCode["LocalMutable"] = 10003] = "LocalMutable";
105
+ DiagnosticCode[DiagnosticCode["LocalFunction"] = 10004] = "LocalFunction";
106
+ DiagnosticCode[DiagnosticCode["ParameterIt"] = 10005] = "ParameterIt";
107
+ DiagnosticCode[DiagnosticCode["ParameterImmutable"] = 10006] = "ParameterImmutable";
108
+ DiagnosticCode[DiagnosticCode["ParameterMutable"] = 10007] = "ParameterMutable";
109
+ DiagnosticCode[DiagnosticCode["ParameterImmutableRest"] = 10008] = "ParameterImmutableRest";
110
+ DiagnosticCode[DiagnosticCode["ParameterMutableRest"] = 10009] = "ParameterMutableRest";
111
+ DiagnosticCode[DiagnosticCode["ParameterPattern"] = 10010] = "ParameterPattern";
112
+ DiagnosticCode[DiagnosticCode["ParameterRestPattern"] = 10011] = "ParameterRestPattern";
113
+ DiagnosticCode[DiagnosticCode["ParameterSubPatternImmutable"] = 10012] = "ParameterSubPatternImmutable";
114
+ DiagnosticCode[DiagnosticCode["ParameterSubPatternMutable"] = 10013] = "ParameterSubPatternMutable";
115
+ DiagnosticCode[DiagnosticCode["GlobalVariable"] = 10014] = "GlobalVariable";
116
+ DiagnosticCode[DiagnosticCode["GlobalDynamicAccess"] = 10015] = "GlobalDynamicAccess";
117
+ DiagnosticCode[DiagnosticCode["RecordFieldIdName"] = 10016] = "RecordFieldIdName";
118
+ DiagnosticCode[DiagnosticCode["RecordFieldOrdinalName"] = 10017] = "RecordFieldOrdinalName";
119
+ DiagnosticCode[DiagnosticCode["RecordFieldStringName"] = 10018] = "RecordFieldStringName";
120
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField0"] = 10019] = "UnnamedRecordField0";
121
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField1"] = 10020] = "UnnamedRecordField1";
122
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField2"] = 10021] = "UnnamedRecordField2";
123
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField3"] = 10022] = "UnnamedRecordField3";
124
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField4"] = 10023] = "UnnamedRecordField4";
125
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField5"] = 10024] = "UnnamedRecordField5";
126
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField6"] = 10025] = "UnnamedRecordField6";
127
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField7"] = 10026] = "UnnamedRecordField7";
128
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField8"] = 10027] = "UnnamedRecordField8";
129
+ DiagnosticCode[DiagnosticCode["UnnamedRecordField9"] = 10028] = "UnnamedRecordField9";
130
+ DiagnosticCode[DiagnosticCode["UnnamedRecordFieldN"] = 10029] = "UnnamedRecordFieldN";
131
+ DiagnosticCode[DiagnosticCode["OmitNamedRecordField"] = 10030] = "OmitNamedRecordField";
132
+ DiagnosticCode[DiagnosticCode["FunctionCall"] = 10031] = "FunctionCall";
133
+ DiagnosticCode[DiagnosticCode["ExtensionCall"] = 10032] = "ExtensionCall";
134
+ DiagnosticCode[DiagnosticCode["Scope"] = 10033] = "Scope";
135
+ DiagnosticCode[DiagnosticCode["String"] = 10034] = "String";
136
+ DiagnosticCode[DiagnosticCode["Interpolation"] = 10035] = "Interpolation";
137
+ DiagnosticCode[DiagnosticCode["ForExpression"] = 10036] = "ForExpression";
138
+ DiagnosticCode[DiagnosticCode["WhileExpression"] = 10037] = "WhileExpression";
139
+ DiagnosticCode[DiagnosticCode["LoopExpression"] = 10038] = "LoopExpression";
140
+ DiagnosticCode[DiagnosticCode["FnDeclaration"] = 10039] = "FnDeclaration";
141
+ DiagnosticCode[DiagnosticCode["FnExpression"] = 10040] = "FnExpression";
142
+ DiagnosticCode[DiagnosticCode["IfExpression"] = 10041] = "IfExpression";
143
+ DiagnosticCode[DiagnosticCode["MatchExpression"] = 10042] = "MatchExpression";
144
+ DiagnosticCode[DiagnosticCode["TagEnd"] = 10999] = "TagEnd";
145
+ DiagnosticCode[DiagnosticCode["TagRefStart"] = 11000] = "TagRefStart";
146
+ DiagnosticCode[DiagnosticCode["ReadLocal"] = 11001] = "ReadLocal";
147
+ DiagnosticCode[DiagnosticCode["ReadWriteLocal"] = 11002] = "ReadWriteLocal";
148
+ DiagnosticCode[DiagnosticCode["WriteLocal"] = 11003] = "WriteLocal";
149
+ DiagnosticCode[DiagnosticCode["RedeclareLocal"] = 11004] = "RedeclareLocal";
150
+ DiagnosticCode[DiagnosticCode["Callable"] = 11005] = "Callable";
151
+ DiagnosticCode[DiagnosticCode["ArgumentExtension"] = 11006] = "ArgumentExtension";
152
+ DiagnosticCode[DiagnosticCode["ArgumentStart"] = 11007] = "ArgumentStart";
153
+ DiagnosticCode[DiagnosticCode["ArgumentEnd"] = 11008] = "ArgumentEnd";
154
+ DiagnosticCode[DiagnosticCode["ArgumentComma"] = 11009] = "ArgumentComma";
155
+ DiagnosticCode[DiagnosticCode["ArgumentSpread"] = 11010] = "ArgumentSpread";
156
+ DiagnosticCode[DiagnosticCode["KeywordFor"] = 11011] = "KeywordFor";
157
+ DiagnosticCode[DiagnosticCode["KeywordIn"] = 11012] = "KeywordIn";
158
+ DiagnosticCode[DiagnosticCode["KeywordWhile"] = 11013] = "KeywordWhile";
159
+ DiagnosticCode[DiagnosticCode["KeywordLoop"] = 11014] = "KeywordLoop";
160
+ DiagnosticCode[DiagnosticCode["KeywordBreak"] = 11015] = "KeywordBreak";
161
+ DiagnosticCode[DiagnosticCode["KeywordContinue"] = 11016] = "KeywordContinue";
162
+ DiagnosticCode[DiagnosticCode["KeywordIf"] = 11017] = "KeywordIf";
163
+ DiagnosticCode[DiagnosticCode["KeywordElse"] = 11018] = "KeywordElse";
164
+ DiagnosticCode[DiagnosticCode["KeywordMatch"] = 11019] = "KeywordMatch";
165
+ DiagnosticCode[DiagnosticCode["KeywordCase"] = 11020] = "KeywordCase";
166
+ DiagnosticCode[DiagnosticCode["KeywordFn"] = 11021] = "KeywordFn";
167
+ DiagnosticCode[DiagnosticCode["KeywordReturn"] = 11022] = "KeywordReturn";
168
+ /**
169
+ * Work with [DiagnosticCode::OmitNamedRecordField]
170
+ */
171
+ DiagnosticCode[DiagnosticCode["OmitNamedRecordFieldName"] = 11023] = "OmitNamedRecordFieldName";
172
+ DiagnosticCode[DiagnosticCode["TagRefEnd"] = 11999] = "TagRefEnd";
173
+ DiagnosticCode[DiagnosticCode["SourceMap"] = 12000] = "SourceMap";
174
+ })(DiagnosticCode || (DiagnosticCode = {}));
175
+ /**
176
+ * Encoding for counting positions in diagnostics.
177
+ */
178
+ export var DiagnosticPositionEncoding;
179
+ (function (DiagnosticPositionEncoding) {
180
+ /**
181
+ * Use the default encoding (UTF-8) and
182
+ * 0-based indexing from the start of the file.
183
+ * Do not convert positions to line-column format.
184
+ */
185
+ DiagnosticPositionEncoding[DiagnosticPositionEncoding["None"] = 0] = "None";
186
+ /**
187
+ * Convert positions to 1-based UTF-8 line-column format.
188
+ */
189
+ DiagnosticPositionEncoding[DiagnosticPositionEncoding["Utf8"] = 1] = "Utf8";
190
+ /**
191
+ * Convert positions to 1-based UTF-16 line-column format.
192
+ */
193
+ DiagnosticPositionEncoding[DiagnosticPositionEncoding["Utf16"] = 2] = "Utf16";
194
+ /**
195
+ * Convert positions to 1-based UTF-32 line-column format.
196
+ */
197
+ DiagnosticPositionEncoding[DiagnosticPositionEncoding["Utf32"] = 3] = "Utf32";
198
+ })(DiagnosticPositionEncoding || (DiagnosticPositionEncoding = {}));
199
+ /**
200
+ * Mode for reading input.
201
+ */
202
+ export var InputMode;
203
+ (function (InputMode) {
204
+ InputMode[InputMode["Script"] = 0] = "Script";
205
+ InputMode[InputMode["Template"] = 1] = "Template";
206
+ })(InputMode || (InputMode = {}));
207
+ /**
208
+ * MiraScript OpCodes
209
+ */
210
+ export var OpCode;
211
+ (function (OpCode) {
212
+ /**
213
+ * No operation
214
+ */
215
+ OpCode[OpCode["Noop"] = 0] = "Noop";
216
+ /**
217
+ * ADD %ret %1 %2\
218
+ * %ret = %1 + %2
219
+ */
220
+ OpCode[OpCode["Add"] = 1] = "Add";
221
+ /**
222
+ * SUB %ret %1 %2\
223
+ * %ret = %1 - %2
224
+ */
225
+ OpCode[OpCode["Sub"] = 2] = "Sub";
226
+ /**
227
+ * MUL %ret %1 %2\
228
+ * %ret = %1 * %2
229
+ */
230
+ OpCode[OpCode["Mul"] = 3] = "Mul";
231
+ /**
232
+ * DIV %ret %1 %2\
233
+ * %ret = %1 / %2
234
+ */
235
+ OpCode[OpCode["Div"] = 4] = "Div";
236
+ /**
237
+ * MOD %ret %1 %2\
238
+ * %ret = %1 % %2
239
+ */
240
+ OpCode[OpCode["Mod"] = 5] = "Mod";
241
+ /**
242
+ * EXP %ret %1 %2\
243
+ * %ret = %1 ^ %2
244
+ */
245
+ OpCode[OpCode["Pow"] = 6] = "Pow";
246
+ /**
247
+ * POS %ret %1\
248
+ * %ret = +%1
249
+ */
250
+ OpCode[OpCode["Pos"] = 7] = "Pos";
251
+ /**
252
+ * NEG %ret %1\
253
+ * %ret = -%1
254
+ */
255
+ OpCode[OpCode["Neg"] = 8] = "Neg";
256
+ /**
257
+ * NOT %ret %1\
258
+ * %ret = !%1
259
+ */
260
+ OpCode[OpCode["Not"] = 9] = "Not";
261
+ /**
262
+ * PLUS %ret %1\
263
+ * %ret = +%1
264
+ */
265
+ OpCode[OpCode["Plus"] = 10] = "Plus";
266
+ /**
267
+ * EQ %ret %1 %2\
268
+ * %ret = %1 == %2
269
+ */
270
+ OpCode[OpCode["Eq"] = 11] = "Eq";
271
+ /**
272
+ * NEQ %ret %1 %2\
273
+ * %ret = %1 != %2
274
+ */
275
+ OpCode[OpCode["Neq"] = 12] = "Neq";
276
+ /**
277
+ * LT %ret %1 %2\
278
+ * %ret = %1 < %2
279
+ */
280
+ OpCode[OpCode["Lt"] = 13] = "Lt";
281
+ /**
282
+ * LTE %ret %1 %2\
283
+ * %ret = %1 <= %2
284
+ */
285
+ OpCode[OpCode["Lte"] = 14] = "Lte";
286
+ /**
287
+ * GT %ret %1 %2\
288
+ * %ret = %1 > %2
289
+ */
290
+ OpCode[OpCode["Gt"] = 15] = "Gt";
291
+ /**
292
+ * GTE %ret %1 %2\
293
+ * %ret = %1 >= %2
294
+ */
295
+ OpCode[OpCode["Gte"] = 16] = "Gte";
296
+ /**
297
+ * AEQ %ret %1 %2\
298
+ * %ret = %1 =~ %2
299
+ */
300
+ OpCode[OpCode["Aeq"] = 17] = "Aeq";
301
+ /**
302
+ * NAEQ %ret %1 %2\
303
+ * %ret = %1 !~ %2
304
+ */
305
+ OpCode[OpCode["Naeq"] = 18] = "Naeq";
306
+ /**
307
+ * SAME %ret %1 %2\
308
+ * %ret = %1 === %2 // Same value zero
309
+ */
310
+ OpCode[OpCode["Same"] = 19] = "Same";
311
+ /**
312
+ * Nsame %ret %1 %2\
313
+ * %ret = %1 !== %2
314
+ */
315
+ OpCode[OpCode["Nsame"] = 20] = "Nsame";
316
+ /**
317
+ * IN %ret %1 %2\
318
+ * %ret = %1 in %2
319
+ */
320
+ OpCode[OpCode["In"] = 21] = "In";
321
+ /**
322
+ * IN_GLOBAL %ret %1 %2\
323
+ * %ret = %1 in global
324
+ */
325
+ OpCode[OpCode["InGlobal"] = 22] = "InGlobal";
326
+ /**
327
+ * CONCAT %ret `n` %1 %2 ... %n\
328
+ * %ret = %1 .. %2 .. ... .. %n
329
+ */
330
+ OpCode[OpCode["Concat"] = 23] = "Concat";
331
+ /**
332
+ * FORMAT %ret %1 %2\
333
+ * %ret = format(%1, %2)
334
+ */
335
+ OpCode[OpCode["Format"] = 24] = "Format";
336
+ /**
337
+ * AND %ret %1 %2\
338
+ * %ret = %1 && %2
339
+ */
340
+ OpCode[OpCode["And"] = 25] = "And";
341
+ /**
342
+ * OR %ret %1 %2\
343
+ * %ret = %1 || %2
344
+ */
345
+ OpCode[OpCode["Or"] = 26] = "Or";
346
+ /**
347
+ * ASSERT_INIT %v\
348
+ * assert(%v != uninitialized)
349
+ */
350
+ OpCode[OpCode["AssertInit"] = 27] = "AssertInit";
351
+ /**
352
+ * ASSERT_NON_NIL %v\
353
+ * assert(%v != nil)
354
+ */
355
+ OpCode[OpCode["AssertNonNil"] = 28] = "AssertNonNil";
356
+ /**
357
+ * TYPE %ret %1\
358
+ * %ret = type(%1)
359
+ */
360
+ OpCode[OpCode["Type"] = 29] = "Type";
361
+ /**
362
+ * TO_BOOLEAN %ret %1\
363
+ * %ret = boolean(%1)
364
+ */
365
+ OpCode[OpCode["ToBoolean"] = 30] = "ToBoolean";
366
+ /**
367
+ * TO_NUMBER %ret %1\
368
+ * %ret = number(%1)
369
+ */
370
+ OpCode[OpCode["ToNumber"] = 31] = "ToNumber";
371
+ /**
372
+ * TO_STRING %ret %1\
373
+ * %ret = string(%1)
374
+ */
375
+ OpCode[OpCode["ToString"] = 32] = "ToString";
376
+ /**
377
+ * IS_BOOLEAN %ret %1\
378
+ * %ret = type(%1) == "boolean"
379
+ */
380
+ OpCode[OpCode["IsBoolean"] = 33] = "IsBoolean";
381
+ /**
382
+ * IS_NUMBER %ret %1\
383
+ * %ret = type(%1) == "number"
384
+ */
385
+ OpCode[OpCode["IsNumber"] = 34] = "IsNumber";
386
+ /**
387
+ * IS_STRING %ret %1\
388
+ * %ret = type(%1) == "string"
389
+ */
390
+ OpCode[OpCode["IsString"] = 35] = "IsString";
391
+ /**
392
+ * IS_RECORD %ret %1\
393
+ * %ret = type(%1) == "record"
394
+ */
395
+ OpCode[OpCode["IsRecord"] = 36] = "IsRecord";
396
+ /**
397
+ * IS_ARRAY %ret %1\
398
+ * %ret = type(%1) == "array"
399
+ */
400
+ OpCode[OpCode["IsArray"] = 37] = "IsArray";
401
+ /**
402
+ * CONSTANT %reg `index`\
403
+ * %reg = CONSTANTS\[index]
404
+ */
405
+ OpCode[OpCode["Constant"] = 38] = "Constant";
406
+ /**
407
+ * UNINIT %reg
408
+ * %reg = uninitialized
409
+ */
410
+ OpCode[OpCode["Uninit"] = 39] = "Uninit";
411
+ /**
412
+ * ASSIGN %ret %1\
413
+ * %ret = %1
414
+ */
415
+ OpCode[OpCode["Assign"] = 40] = "Assign";
416
+ /**
417
+ * SWAP %1 %2\
418
+ * (%1, %2) = (%2, %1)
419
+ */
420
+ OpCode[OpCode["Swap"] = 41] = "Swap";
421
+ /**
422
+ * GET_UPVALUE %ret `level` %%up\
423
+ * %ret = UPVALUES\[level]\[%%up]
424
+ */
425
+ OpCode[OpCode["GetUpvalue"] = 42] = "GetUpvalue";
426
+ /**
427
+ * SET_UPVALUE %value `level` %%up \
428
+ * UPVALUES\[level]\[%%up] = %value
429
+ */
430
+ OpCode[OpCode["SetUpvalue"] = 43] = "SetUpvalue";
431
+ /**
432
+ * GET_GLOBAL %ret `name` \
433
+ * %ret = GLOBALS\[CONSTANTS\[name]]
434
+ */
435
+ OpCode[OpCode["GetGlobal"] = 44] = "GetGlobal";
436
+ /**
437
+ * GET_GLOBAL_DYN %ret %name \
438
+ * %ret = GLOBALS\[%name]
439
+ */
440
+ OpCode[OpCode["GetGlobalDyn"] = 45] = "GetGlobalDyn";
441
+ /**
442
+ * RECORD %ret\
443
+ * %ret = (
444
+ */
445
+ OpCode[OpCode["Record"] = 46] = "Record";
446
+ /**
447
+ * FIELD `name` %field\
448
+ * \[CONSTANTS\[name]]: %field,
449
+ */
450
+ OpCode[OpCode["Field"] = 47] = "Field";
451
+ /**
452
+ * FIELD_DYN %name %field\
453
+ * \[%name]: %field,
454
+ */
455
+ OpCode[OpCode["FieldDyn"] = 48] = "FieldDyn";
456
+ /**
457
+ * FIELD_INDEX `index` %field\
458
+ * \[index]: %field,
459
+ */
460
+ OpCode[OpCode["FieldIndex"] = 49] = "FieldIndex";
461
+ /**
462
+ * FIELD_OPT `name` %field\
463
+ * \[CONSTANTS\[name]]?: %field,
464
+ */
465
+ OpCode[OpCode["FieldOpt"] = 50] = "FieldOpt";
466
+ /**
467
+ * FIELD_OPT_DYN %name %field\
468
+ * \[%name]?: %field,
469
+ */
470
+ OpCode[OpCode["FieldOptDyn"] = 51] = "FieldOptDyn";
471
+ /**
472
+ * FIELD_OPT_INDEX `index` %field\
473
+ * \[index]?: %field,
474
+ */
475
+ OpCode[OpCode["FieldOptIndex"] = 52] = "FieldOptIndex";
476
+ /**
477
+ * PICK %ret %var `n` `key_1` `key_2` ... `key_n`\
478
+ * %ret = %var pick keys CONSTANTS\[key_1], CONSTANTS\[key_2], ..., CONSTANTS\[key_n]
479
+ */
480
+ OpCode[OpCode["Pick"] = 53] = "Pick";
481
+ /**
482
+ * OMIT %ret %var `n` `key_1` `key_2` ... `key_n`\
483
+ * %ret = %var omit keys CONSTANTS\[key_1], CONSTANTS\[key_2], ..., CONSTANTS\[key_n]
484
+ */
485
+ OpCode[OpCode["Omit"] = 54] = "Omit";
486
+ /**
487
+ * ARRAY %ret\
488
+ * %ret = \[
489
+ */
490
+ OpCode[OpCode["Array"] = 55] = "Array";
491
+ /**
492
+ * ITEM %item\
493
+ * %item,
494
+ */
495
+ OpCode[OpCode["Item"] = 56] = "Item";
496
+ /**
497
+ * ITEM_RANGE `start` `end`\
498
+ * `start`..`end`,
499
+ */
500
+ OpCode[OpCode["ItemRange"] = 57] = "ItemRange";
501
+ /**
502
+ * ITEM_RANGE_DYN %start %end\
503
+ * %start..%end,
504
+ */
505
+ OpCode[OpCode["ItemRangeDyn"] = 58] = "ItemRangeDyn";
506
+ /**
507
+ * ITEM_RANGE_EXCLUSIVE_DYN %start %end\
508
+ * %start..<%end,
509
+ */
510
+ OpCode[OpCode["ItemRangeExclusiveDyn"] = 59] = "ItemRangeExclusiveDyn";
511
+ /**
512
+ * SPREAD %var\
513
+ * ..%var,
514
+ */
515
+ OpCode[OpCode["Spread"] = 60] = "Spread";
516
+ /**
517
+ * FREEZE\
518
+ * ) for record or ] for array
519
+ */
520
+ OpCode[OpCode["Freeze"] = 61] = "Freeze";
521
+ /**
522
+ * HAS %ret %var `key`\
523
+ * %ret = initialized(%var\[CONSTANTS\[key]])
524
+ */
525
+ OpCode[OpCode["Has"] = 62] = "Has";
526
+ /**
527
+ * HAS_DYN %ret %var %key\
528
+ * %ret = initialized(%var\[%key])
529
+ */
530
+ OpCode[OpCode["HasDyn"] = 63] = "HasDyn";
531
+ /**
532
+ * HAS_INDEX %ret %var `index`\
533
+ * %ret = initialized(%var\[index])
534
+ */
535
+ OpCode[OpCode["HasIndex"] = 64] = "HasIndex";
536
+ /**
537
+ * GET %ret %var `key`\
538
+ * %ret = %var\[CONSTANTS\[key]] ?? nil
539
+ */
540
+ OpCode[OpCode["Get"] = 65] = "Get";
541
+ /**
542
+ * GET_DYN %ret %var %key\
543
+ * %ret = %var\[%key] ?? nil
544
+ */
545
+ OpCode[OpCode["GetDyn"] = 66] = "GetDyn";
546
+ /**
547
+ * GET_INDEX %ret %var `index`\
548
+ * %ret = %var\[index] ?? nil
549
+ */
550
+ OpCode[OpCode["GetIndex"] = 67] = "GetIndex";
551
+ /**
552
+ * SET %value %var `key`\
553
+ * %var\[CONSTANTS\[key]] = %value
554
+ */
555
+ OpCode[OpCode["Set"] = 68] = "Set";
556
+ /**
557
+ * SET_DYN %value %var %key\
558
+ * %var\[%key] = %value
559
+ */
560
+ OpCode[OpCode["SetDyn"] = 69] = "SetDyn";
561
+ /**
562
+ * SET_INDEX %value %var `index`\
563
+ * %var\[index] = %value
564
+ */
565
+ OpCode[OpCode["SetIndex"] = 70] = "SetIndex";
566
+ /**
567
+ * SLICE %ret %var `start` `end`\
568
+ * %ret = %var\[start..end]
569
+ */
570
+ OpCode[OpCode["Slice"] = 71] = "Slice";
571
+ /**
572
+ * SLICE_START %ret %var `end`\
573
+ * %ret = %var\[..end]
574
+ */
575
+ OpCode[OpCode["SliceStart"] = 72] = "SliceStart";
576
+ /**
577
+ * SLICE_END %ret %var `start`\
578
+ * %ret = %var\[start..]
579
+ */
580
+ OpCode[OpCode["SliceEnd"] = 73] = "SliceEnd";
581
+ /**
582
+ * SLICE_DYN %ret %var %start %end\
583
+ * %ret = %var\[%start..%end]
584
+ */
585
+ OpCode[OpCode["SliceDyn"] = 74] = "SliceDyn";
586
+ /**
587
+ * SLICE_EXCLUSIVE_DYN %ret %var %start %end\
588
+ * %ret = %var\[%start..<%end]
589
+ */
590
+ OpCode[OpCode["SliceExclusiveDyn"] = 75] = "SliceExclusiveDyn";
591
+ /**
592
+ * LENGTH %ret %var\
593
+ * %ret = $Length(%var)
594
+ */
595
+ OpCode[OpCode["Length"] = 76] = "Length";
596
+ /**
597
+ * LOOP `regn`\
598
+ * loop { let %1, .. ,%regn;
599
+ */
600
+ OpCode[OpCode["Loop"] = 77] = "Loop";
601
+ /**
602
+ * LOOP_FOR `regn` %iterable\
603
+ * for %1 in %iterable { let %2, .. ,%regn;
604
+ */
605
+ OpCode[OpCode["LoopFor"] = 78] = "LoopFor";
606
+ /**
607
+ * LOOP_RANGE `regn` %start %end\
608
+ * for %1 in %start..%end { let %2, .. ,%regn;
609
+ */
610
+ OpCode[OpCode["LoopRange"] = 79] = "LoopRange";
611
+ /**
612
+ * LOOP_RANGE_EXCLUSIVE `regn` %start %end\
613
+ * for %1 in %start..<%end { let %2, .. ,%regn;
614
+ */
615
+ OpCode[OpCode["LoopRangeExclusive"] = 80] = "LoopRangeExclusive";
616
+ /**
617
+ * LOOP_END\
618
+ * }
619
+ */
620
+ OpCode[OpCode["LoopEnd"] = 81] = "LoopEnd";
621
+ /**
622
+ * BREAK\
623
+ * break;
624
+ */
625
+ OpCode[OpCode["Break"] = 82] = "Break";
626
+ /**
627
+ * CONTINUE\
628
+ * continue;
629
+ */
630
+ OpCode[OpCode["Continue"] = 83] = "Continue";
631
+ /**
632
+ * IF %cond\
633
+ * if (%cond) {
634
+ */
635
+ OpCode[OpCode["If"] = 84] = "If";
636
+ /**
637
+ * IF_NOT %cond\
638
+ * if (!%cond) {
639
+ */
640
+ OpCode[OpCode["IfNot"] = 85] = "IfNot";
641
+ /**
642
+ * IF_INIT %var\
643
+ * if (initialized(%var)) {
644
+ */
645
+ OpCode[OpCode["IfInit"] = 86] = "IfInit";
646
+ /**
647
+ * IF_NOT_INIT %var\
648
+ * if (!initialized(%var)) {
649
+ */
650
+ OpCode[OpCode["IfNotInit"] = 87] = "IfNotInit";
651
+ /**
652
+ * IF_NIL %var\
653
+ * if (%var == nil) {
654
+ */
655
+ OpCode[OpCode["IfNil"] = 88] = "IfNil";
656
+ /**
657
+ * IF_NOT_NIL %var\
658
+ * if (%var != nil) {
659
+ */
660
+ OpCode[OpCode["IfNotNil"] = 89] = "IfNotNil";
661
+ /**
662
+ * ELSE\
663
+ * } else {
664
+ */
665
+ OpCode[OpCode["Else"] = 90] = "Else";
666
+ /**
667
+ * EL_IF IF*\
668
+ * } else if *** {\
669
+ * This instruction must be followed by an `IF*` instruction\
670
+ */
671
+ OpCode[OpCode["ElIf"] = 91] = "ElIf";
672
+ /**
673
+ * IF_END\
674
+ * }
675
+ */
676
+ OpCode[OpCode["IfEnd"] = 92] = "IfEnd";
677
+ /**
678
+ * FUNC %f `argn` `regn`\
679
+ * %f = (%1, %2, ... , %argn) => { let %argn+1, ... , %regn;
680
+ */
681
+ OpCode[OpCode["Func"] = 93] = "Func";
682
+ /**
683
+ * FUNC_VARG %f `argn` `regn`\
684
+ * %f = (%1, %2, ... , %argn-1, ...%argn) => { let %argn+1, ... , %regn;
685
+ */
686
+ OpCode[OpCode["FuncVarg"] = 94] = "FuncVarg";
687
+ /**
688
+ * FUNC_END\
689
+ * }
690
+ */
691
+ OpCode[OpCode["FuncEnd"] = 95] = "FuncEnd";
692
+ /**
693
+ * RETURN %value\
694
+ * return %value;
695
+ */
696
+ OpCode[OpCode["Return"] = 96] = "Return";
697
+ /**
698
+ * CALL %ret `f` `argn` %1 %2 ... %argn `spread_n` `spread_arg_a` ...\
699
+ * %ret = GLOBAL[CONSTANTS[f]](%1, %2, ... , %argn);
700
+ *
701
+ * If spread_arg_a is present, arg at that index will be spread
702
+ */
703
+ OpCode[OpCode["Call"] = 97] = "Call";
704
+ /**
705
+ * CALL_DYN %ret %f `argn` %1 %2 ... %argn `spread_n` `spread_arg_a` ...\
706
+ * %ret = %f(%1, %2, ... , %argn);
707
+ *
708
+ * If spread_arg_a is present, arg at that index will be spread
709
+ */
710
+ OpCode[OpCode["CallDyn"] = 98] = "CallDyn";
711
+ })(OpCode || (OpCode = {}));
712
+ /** Diagnostic messages for MiraScript compiler and tools. */
713
+ export const DIAGNOSTIC_MESSAGES = Object.freeze({
714
+ "1001": "Unknown internal error occurred",
715
+ "1002": "Unknown lexer error occurred",
716
+ "1003": "Unknown parser error occurred",
717
+ "1004": "Unknown emitter error occurred",
718
+ "1005": "Unknown optimizer error occurred",
719
+ "1006": "This feature is not implemented yet",
720
+ "1007": "Unknown token encountered",
721
+ "1008": "Unexpected token found",
722
+ "1009": "`$0` is a reserved keyword and cannot be used as an identifier",
723
+ "1010": "`$0` is a keyword and cannot be used as an identifier",
724
+ "1011": "A number literal cannot start or end with an underscore",
725
+ "1012": "Invalid number literal",
726
+ "1013": "Number literal is too large",
727
+ "1014": "Integer literal is too large",
728
+ "1015": "Invalid ordinal literal; consider remove leading zeros and underscores, or use `[$0]` instead",
729
+ "1016": "String literal is not terminated",
730
+ "1017": "Invalid escape sequence in string",
731
+ "1018": "The value of hex escape sequence is not a valid ASCII character",
732
+ "1019": "The value of Unicode escape sequence is not a valid Unicode code point",
733
+ "1020": "An expression is expected after `..`",
734
+ "1021": "Interpolation expression is not terminated",
735
+ "1022": "Invalid interpolation expression",
736
+ "1023": "Unexpected `_`; it is a reserved keyword for discarding values",
737
+ "1024": "Unexpected `global`; it is a reserved keyword for global variables",
738
+ "1025": "Missing `,` in the list",
739
+ "1026": "Missing `]` to close the bracket",
740
+ "1027": "Missing `{` to open the brace",
741
+ "1028": "Missing `}` to close the brace",
742
+ "1029": "Missing `)` to close the parenthesis",
743
+ "1030": "Missing `;` at the end of the statement",
744
+ "1031": "Operator `=` is expected in a bind statement or const statement",
745
+ "1032": "Constant name must start with '@'",
746
+ "1033": "Missing function name in the declaration",
747
+ "1034": "Extension call must be ended with parameter list; add `(` here",
748
+ "1035": "`type` is a function-like keyword; add `(` here",
749
+ "1036": "`type` call must have exactly one argument",
750
+ "1037": "Unexpected record literal; a grouping expression is expected",
751
+ "1038": "Missing `case` in the statement",
752
+ "1039": "Unknown expression encountered",
753
+ "1040": "Unmatched `}` found",
754
+ "1041": "Unmatched `]` found",
755
+ "1042": "Unmatched `)` found",
756
+ "1043": "Unknown pattern encountered",
757
+ "1044": "Only constants or literal values are allowed here",
758
+ "1045": "Unknown statement encountered",
759
+ "1046": "An expression is expected here",
760
+ "1047": "A pattern is expected here",
761
+ "1048": "Operator `!` is not allowed in a literal pattern",
762
+ "1049": "`mut` is not allowed during rebinding",
763
+ "1050": "variable whose name starts with `@` is not allowed to be rebound",
764
+ "1051": "Cannot use `mut` in a discard pattern",
765
+ "1052": "Discard pattern should be omitted in a spread pattern",
766
+ "1053": "Spread discard in record pattern is not allowed",
767
+ "1054": "Spread in record pattern should be the last field",
768
+ "1055": "Interpolated names are not allowed in record patterns",
769
+ "1056": "A bind pattern is required when omitting a record field name",
770
+ "1057": "Range pattern in array pattern should be parenthesized",
771
+ "1058": "Spread pattern can only be used once in an array pattern",
772
+ "1059": "Rest parameter should be the last parameter in a function declaration",
773
+ "1060": "Cannot assign to an undeclared variable",
774
+ "1061": "Cannot assign to an immutable variable...",
775
+ "1062": "Cannot access a variable before it is...",
776
+ "1063": "The variable is already...",
777
+ "1064": "Unexpected `break` outside of a loop",
778
+ "1065": "Unexpected `continue` outside of a loop",
779
+ "1066": "`global` keyword can only be used as `global.<name>`, `global[<name>]`, or on the right-hand side of the `in` operator",
780
+ "1067": "Cannot infer key from the expression",
781
+ "1068": "Can only assign to a variable or a field access",
782
+ "1069": "Non-number literal cannot be used in range",
783
+ "1070": "Non-number-or-string literal cannot be used in comparison expression",
784
+ "1071": "Non-number literal cannot be used in arithmetic expression",
785
+ "1072": "Non-boolean literal cannot be used in logical expression",
786
+ "2001": "Unnecessary parentheses; consider removing them",
787
+ "2002": "Either use `global.$0` explicitly or `nil` if you want to use the nil value",
788
+ "2003": "This pattern in a irrefutable matching is unnecessary; consider removing it or using in an `is` expression instead",
789
+ "2004": "This `match` expression has no cases; it will never match any value",
790
+ "2005": "Global variable `$0` is not declared",
791
+ "4001": "Local variable is unused; consider removing it or use `_` to ignore it",
792
+ "4002": "Local function is unused; consider removing it",
793
+ "5001": "...declared here",
794
+ "5002": "...declared here",
795
+ "5003": "...declared as a parameter here",
796
+ "5004": "...declared as the auto parameter `it` by this function here",
797
+ "5005": "...declared as a rest parameter here",
798
+ "5006": "...declared as a sub-pattern of parameter pattern here"
799
+ });
800
+ /** MiraScript keywords */
801
+ export const KEYWORDS = Object.freeze(["true", "false", "nil", "nan", "inf", "_", "global", "in", "is", "and", "or", "not", "type", "if", "else", "match", "case", "for", "while", "loop", "break", "continue", "return", "fn", "op", "let", "const", "mut", "where", "mod", "pub", "use", "effect", "try", "handle", "finally", "perform", "resume"]);
802
+ /** MiraScript constant keywords */
803
+ export const CONSTANT_KEYWORDS = Object.freeze(["true", "false", "nil", "nan", "inf"]);
804
+ /** MiraScript control flow keywords */
805
+ export const CONTROL_KEYWORDS = Object.freeze(["if", "else", "match", "case", "for", "while", "loop", "break", "continue", "return"]);
806
+ /** MiraScript numeric keywords */
807
+ export const NUMERIC_KEYWORDS = Object.freeze(["nan", "inf"]);
808
+ /** MiraScript reserved keywords */
809
+ export const RESERVED_KEYWORDS = Object.freeze(["op", "where", "mod", "pub", "use", "effect", "try", "handle", "finally", "perform", "resume"]);
810
+ //# sourceMappingURL=constants.g.js.map