- Tolerant parsing:
parse(input, { tolerant: true })collects all errors and returns a best-effort CST instead of throwing on the first syntax error. Useful for editor integrations, as-you-type validation, and multi-error diagnostics. - Tolerant tokenization:
tokenize(input, { tolerant: true })returns aTokenizeResultwith the token stream and any lexer errors. toCleanTree(): narrows a tolerantParseResultto a strictFilterNodewhen error-free, or returnsnull. Safe to pass directly totransform().hasErrorNodes(): walks a tolerant CST and returnstrueif anyErrorNodeis present.ErrorNodeCST type: new node type representing recovered syntax errors, with the original error, skipped tokens, andexpectedAtspan for editor diagnostics.
toCleanTree, hasErrorNodes, ErrorNode, ParseResult, TokenizeResult, MaybeError
Minor test improvements.
Enable npm provenance attestation on publish.
Package metadata and CI fixes.
Initial release.
- Full AIP-160 grammar: comparisons (
=,!=,<,<=,>,>=),AND/OR/NOT, field traversal (.), has operator (:), functions, wildcards, parentheses filter(): one-shot parse + evaluate in a single callcompile(): parse once, evaluate many times withCompiledFilter.evaluate()evaluateAsync(): async variant supporting custom functions that return promises- Serialization:
CompiledFilter.toJSON()/CompiledFilter.fromJSON()for persistence to databases, caches, or network transfer - Structured errors: typed error classes (
InputLengthError,DepthLimitError,UnexpectedTokenError, etc.) with source spans and contextual hints - Full CST and AST:
parse()produces a concrete syntax tree (for tooling),transform()produces an abstract syntax tree (for evaluation or custom backends) - Security hardening: input length limits, recursion depth limits, prototype chain guards, error message truncation
- Zero dependencies