diff --git a/src/errors.ts b/src/errors.ts index 422a859..537a322 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -84,6 +84,19 @@ export namespace TokenizerErrors { this.name = "NonFourIndentError"; } } + + export class InvalidNumberError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, start: number, current: number) { + let msg = getFullLine(source, start) + "\n"; + let hint = `^ Invalid Number input.`; + const diff = (current - start); + // +1 because we want the arrow to point after the string (where we expect the closing ") + hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, "~"); + hint = hint.padStart(hint.length + col - diff, " "); + super(msg + hint, line, col); + this.name = "InvalidNumberError"; + } + } export class InconsistentIndentError extends BaseTokenizerError { constructor(line: number, col: number, source: string, start: number) {