Tokenizing fallibility (#883)

Tokenization tracks invalid tokens and produces a nice error about them

---------

Co-authored-by: Adam Chalmers <adam.chalmers@kittycad.io>
This commit is contained in:
Alfredo Gutierrez
2023-11-01 17:20:49 -05:00
committed by GitHub
parent 3d0c5c10b0
commit 2e419907e6
6 changed files with 113 additions and 15 deletions

View File

@ -18,6 +18,13 @@ export class KCLError {
}
}
export class KCLLexicalError extends KCLError {
constructor(msg: string, sourceRanges: [number, number][]) {
super('lexical', msg, sourceRanges)
Object.setPrototypeOf(this, KCLSyntaxError.prototype)
}
}
export class KCLSyntaxError extends KCLError {
constructor(msg: string, sourceRanges: [number, number][]) {
super('syntax', msg, sourceRanges)