External grammar libraries
4.0.0
Released: 2024-02-13
Major Changes
- #379 Fix infinite recursion
issue by moving reportInfiniteRecursion to the new prepare pass, and having
it fail after finding the first issue. This will require plugin authors
to ensure that reportInfiniteRecursion is in the new pass correctly. - #417 BREAKING: change to AST to
allow topLevelInitializer and initializer to be arrays, in support of
multi-file inputs. This will require plugin updates. The CLI and API now
take multiple files as input, where the first file is your main library, and
subsequent files consist of a library of other rules. The CLI can take file
names of the formnpm:<package-name>/<filename>
to load library rules from
an NPM package that is installed relative to the previous non-npm file name,
or to the current working directory if this is the first file name. - #420 BREAKING: Node v16+ is now
required for running the CLI or using Peggy as a library. Generated code
still targets older runtimes. - #456 BREAKING: Allow imports
from external compiled grammars inside a source grammar, usingimport {rule} from "external.js"
. Note that this syntax will generate either
import
orrequire
in the JavaScript output, depending on the value of
theformat
parameter. This will need explicit support from
plugins, with a few new AST node types and a few visitor changes. - #463 Drop support for
Internet Explorer. Move to eslint flat configs in order to lint minimized
browser code for compatibility with
defaults, maintained node versions, not op_mini all
.
Minor Changes
- #400 Use
@generated
in generated
code - #404 Add support for -w/--watch
to the command line interface. - #415 Added
browser
key to package.json, pointing to Webpack output. - #420 Updated dependencies to
avoid audit warnings. - #425 Add a pass to simplify single-character choices
- #427 Avoid double extraction of
substrings in various MATCH_ bytecodes - #430 Make generate-js.js ts clean
- #432 Add peggy.code-workspace
- #435 Setup tsconfig to detect use of library functions from es6 or later
- #436 Get rid of tsd
- #437 Better type checking for visitor
- #438 Make test build deterministic
- #439 Make peg$computePosDetails a little faster
- #440 Create directories for
output and source-map if they do not exist, rather than erroring. - #446 Add a right-associative
ExponentiationExpression
rule (operator**
) tojavascript.pegjs
example grammar. - #451 Make stack.js ts clean
- #452 Fixes to prepare generate-bytecode.js for ts-check
- #453 Make generate-bytecode.js ts-clean
- #460 Allow
-t
and-T
testing
from the CLI with--format es
.