UNPKG

@1771technologies/lytenyte-pro

Version:

Blazingly fast headless React data grid with 100s of features.

15 lines (14 loc) 565 B
import { ExpressionError } from "../errors/expression-error.js"; export function current(ctx) { return ctx.tokens[ctx.pos]; } export function advance(ctx) { return ctx.tokens[ctx.pos++]; } export function expect(ctx, type, value) { const tok = current(ctx); if (tok.type !== type || (value !== undefined && tok.value !== value)) { throw new ExpressionError(`Expected ${value ? `"${value}"` : type} but got ${tok.value ? `"${tok.value}"` : tok.type}`, { source: ctx.source, start: tok.start, end: tok.end }); } return advance(ctx); }