import { type Lexer } from "https://deno.land/x/nearley@2.19.7-deno/mod.ts";
Methods
reset(data: string, state?: LexerState): void
Sets the internal buffer to data, and restores line/col/state info taken from save().
next(): Token | undefined
Returns e.g. {type, value, line, col, β¦}. Only the value attribute is required.
save(): LexerState
Returns an object describing the current line/col etc. This allows us to preserve this information between feed() calls, and also to support Parser#rewind(). The exact structure is lexer-specific; nearley doesn't care what's in it.
formatError(token: Token, message: string): string
Returns a string with an error message describing the line/col of the offending token. You might like to include a preview of the line in question.