-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.fls
More file actions
458 lines (319 loc) · 11.8 KB
/
errors.fls
File metadata and controls
458 lines (319 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
all: []
export all: all
class CompileError: Error
ctor(type) super('Compile Error')
this.type: type
all.push(this)
func print()
console.error(this.toString())
func toString()
throw 'abstract CompileError.toString'
class BaseError: CompileError
ctor(pos, type) super(type)
this.pos: pos
func toString()
return this.pos.toString() + '\n ' + this._message()
func _message()
throw 'abstract BaseError._message'
export class IllegalToken: BaseError
ctor(pos, image) super(pos, __class__)
this.image: image
func _message()
return 'illegal token: ' + this.image
export class InvalidRegExp: BaseError
ctor(pos, image, error) super(pos, __class__)
this.image: image
this.error: error
func _message()
return this.error
export class InvalidSingleLineLiteralText: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'the begin of literal text cannot be at the same line with the end'
export class InvalidLiteralTextEnd: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'text is not allowed to be at the same line with the end of literal text'
export class InvalidLiteralPropertyValue: BaseError
ctor(pos, prop, value) super(pos, __class__)
this.prop: prop
this.value: value
func _message()
if this.value = null
return 'no such literal text property: ' + this.prop
return 'invalid value for literal text property: ' + this.prop + ':' + this.value
export class InvalidLiteralProperty: BaseError
ctor(pos, prop) super(pos, __class__)
this.prop: prop
func _message()
return 'invalid literal text property-value: ' + this.prop
export class NoSuchLiteralProperty: BaseError
ctor(pos, prop) super(pos, __class__)
this.prop: prop
func _message()
return 'no such literal text property: ' + this.prop
export class DupLiteralTextProperty: BaseError
ctor(pos, prop) super(pos, __class__)
this.prop: prop
func _message()
return 'duplicated literal text property: ' + this.prop
export class NoSuchMacro: BaseError
ctor(pos, image) super(pos, __class__)
this.image: image
func _message()
return 'no such macro ' + this.image
export class UseReserved: BaseError
ctor(pos, image) super(pos, __class__)
this.image: image
func _message()
return 'use reserved: ' + this.image
export class InvalidIndent: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'invalid indentation'
export class UnexpectedToken: BaseError
ctor(pos, image, type) super(pos, __class__)
this.image: image
func _message()
return 'unexpected token: ' + this.image
export class ExcessiveExprInStmt: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'excessive expressions in a statement'
export class InvalidLeftValue: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'invalid left value'
export class MismatchParen: BaseError
ctor(pos, expected) super(pos, __class__)
this.expected: expected
func _message()
return 'mismatch parentheses, expect ' + this.expect
export class InvalidParam: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'invalid parameter'
export class MoreThanOneAsyncPlaceholder: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'more than one asynchronous placeholders in one call'
export class AsyncParamNotExpr: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'asynchronous parameter should appear as an expression'
export class ArgOmitted: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'argument omitted'
export class ArrElementOmitted: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'array element omitted'
export class ObjKeyOmitted: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'object key omitted'
export class ObjValueOmitted: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'object value omitted'
export class ExceptionOmitted: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'exception omitted in throw statement'
export class InvalidName: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'invalid name'
export class TooManySliceParts: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'more than 3 expressions as list slice arguments'
export class NoWrappedExpr: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'no expression wrapped'
export class ExcessiveWrappedExpr: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'more than one expressions wrapped'
export class PipeBodyOmitted: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'expression pipeline body omitted'
export class LambdaRetOmitted: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'lambda return value omitted'
export class EmptyPredicate: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'branch predicate omitted'
export class ClauseNotMatch: BaseError
ctor(pos, clause, match) super(pos, __class__)
this.clause: clause
this.match: match
func _message()
return 'clause ' + this.clause + ' not match ' + this.match
export class CtorNotInClass: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'constructors not allowed outside class definition'
export class DuplicatedMatch: BaseError
ctor(prevPos, thisPos, kw) super(thisPos, __class__)
this.kw: kw
this.prevPos: prevPos
func _message()
return 'duplicated match of ' + this.kw + ', previous match at ' + this.prevPos.asLine()
export class TryWithoutCatch: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'try without catch'
export class CatchWithoutExcName: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'catch without exception name'
export class ExcessiveExprInForRange: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'more than 3 expressions in for range'
export class UnexpectedEOF: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'unexpected end of file'
export class SuperWithoutCall: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'use of `super` is not a call to super property'
export class SymbolNotDef: BaseError
ctor(pos, name) super(pos, __class__)
this.name: name
func _message()
return 'name not defined: ' + this.name
export class SymbolRedefined: BaseError
ctor(pos, name, defPos) super(pos, __class__)
this.name: name
this.defPos: defPos
func _message()
return 'name not already defined: ' + this.name +
', previous defined at ' + this.defPos.asLine()
export class SymbolDefAfterRefs: BaseError
ctor(pos, name, refPosList) super(pos, __class__)
this.name: name
this.refPosList: refPosList
func _message()
return 'name `' + this.name + '` definition after reference. see references at:' +
(this.refPosList |: ' - ' + $.asLine()).join('')
export class LiteralValueError: BaseError
ctor(pos, value, op) super(pos, __class__)
this.value: value
this.op: op
func _message()
return 'unsupported operation `' + this.op + '` on literal value ' + this.value
export class ExternOnlyInGlobal: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'external names declaration can only appear in the global space'
export class FuncDefNotAllowed: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'functions definitions not allowed in branch or try-catch'
export class ClassDefNotAllowed: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'class definitions not allowed in branch or try-catch'
export class FlowTerminated: BaseError
ctor(pos, termPos) super(pos, __class__)
this.termPos: termPos
func _message()
return 'block already terminated at ' + this.termPos.asLine()
export class InvalidStatementInScope: BaseError
ctor(pos, stmt) super(pos, __class__)
this.stmt: stmt
func _message()
return 'invalid statement ' + this.stmt + ' in the scope'
export class ReferenceThisInGlobal: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'reference to `this` not allowed in global scope'
export class AsyncNotAllowedInIncludeFile: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'asynchronous expression not allowed in global scope of an included file'
export class AsyncNotAllowedInThrow: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'asynchronous expression not allowed being thrown'
export class RangeStepNonLiteral: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'asynchronous expression not allowed being thrown'
export class InvalidRangeStep: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'step not a compile-time non-zero number in range iteration'
export class PipeItemOutOfContext: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'pipeline items not in pipeline context'
export class SuperNotInMember: BaseError
ctor(pos) super(pos, __class__)
func _message()
return '`super` not in member function or constructor'
export class ContructorNotCallSuper: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'no call to the super class constructor'
export class NoSuperClass: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'no super class'
export class DuplicateMemFunc: BaseError
ctor(pos, name, defPos) super(pos, __class__)
this.name: name
this.defPos: defPos
func _message()
return 'a member function named `' << this.name << '` already defined at ' +
this.defPos.asLine()
export class InvalidFileName: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'invalid include file name'
export class NotInClass: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'not in a class scope'
export class NotInFunc: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'not in a function scope'
export class StmtsForbiddedInClassBody: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'no statement allowed in class body'
export class NotDeleteProperty: BaseError
ctor(pos) super(pos, __class__)
func _message()
return 'not delete a property'
export class ExternalError: BaseError
ctor(pos, what) super(pos, __class__)
this.what: what
func _message()
return 'external error: ' + this.what
export class DepenedenciesUnresolvable: CompileError
ctor(circularDeps) super(__class__)
this.circularDeps: circularDeps
func toString()
return 'detect circular dependencies:' + ('\n - ').join('')
export func count()
return all.length
export func hasError()
return all.length != 0
export func clear()
all.length: 0
export func deliver()
r: all[,]
all.length: 0
return r
export func printErrors()
all |: $.print()