Releases: peggyjs/peggy
Releases · peggyjs/peggy
v5.0.2
v5.0.1
v5.0.0
5.0.0
Released: 2025-05-03
Major Changes
- BREAKING: Generated code no longer supports ES5. You can still generate
commonjs or es6 exports, but the code itself requires ES2020. If you need
to support earlier runtimes, you should use a transpiler such as Babel.
Generated code now usesconst
andlet
, but is still not strict about
usingconst
wherever possible, due to the complexities of code generation.
Work-arounds and polyfills for class extension, padding, andObject.assign
have been removed in favor of their ES2020 equivalents.
#593 - BREAKING: Node.js v20+ is now required for the CLI tools. No testing is
performed on earlier versions of Node, and no issues will be fixed for
earlier versions. #593 - BREAKING: The SyntaxError class exported from generated parsers is now a
proper subclass of the built-in ECMAscript SyntaxError class. The name of
the type has changed toPeggySyntaxError
, which may cause some slight need
for rework in TypeScript-aware projects. This was the main driver behind
moving away from ES5. #593 - BREAKING: The grammar parser now uses your JavaScript environment's understanding
of Unicode classes, rather than a partial copy of Unicode 8 as before. This
should be more correct and evolve over time while staying backward-compatible
to the extent that the Unicode Consortium keeps to its goals. Because this
might slightly affect what rule names are valid, we are marking this as a
breaking change just in case.
#602
New features
- Extend library mode to include a success flag and a function for throwing
syntax errors when needed. Library mode is still intended as internal-only,
and subject to backward-incompatible changes in future versions.
#501 - Slightly better verbose output from the CLI, showing where files are written.
#601 - Merged class rules (rules which consist of a character class like
foo = [0-9]
that are only called from a rule likebar = foo / [a-z]
, which
merges the two classes together into a single rule likebar = [0-9a-z]
),
and which are not allowedStartRules, are no longer output into the generated
parser, since there is no way for that code to be called. This has a chance
of generating issues for people who are calling the internals of the
generated parser using
@peggyjs/coverage, but that's a
lightly-documented feature of that library.
#594 - Superfluous rules (rules which cannot be reached from an allowedStartRule)
no longer generate code into the parser. An INFO-level debug statement is
generated for each of these removals. Like merged class rules above, this
should only be removing dead code.
#594 - Character classes now process characters not in the Basic Multi-Lingual
Plane (BMP) correctly. This feature requires a JavaScript environment
that supports theu
flag to regular expressions. Theu
flag will only
be used on character classes that make use of this new feature.
#602 - Unicode characters may now be specified with the
\u{hex}
syntax, allowing
easier inclusion of characters not in the BMP (such as newer emoji). This
syntax works both in string literals and in character classes.
#602 - Errors pointing to non-BMP characters as the "found" text will now show the
full character and not the replacement character for the first surrogate in
the UTF-16 representation.
#602 - Character classes can now be annotated with the "u" flag, which will force
the character class into Unicode mode, where one full Codepoint will be matched.
For example,[^a]u
will match 💪 (U+1F4AA). Without the "u" flag,[^a]
would only match \uD83D, the first surrogate that makes up U+1F4AA in UTF-16
encoding. #602 - Empty inverted character classes such as
[^]
or[^]u
now match one
character, because they match "not-nothing". Without the "u" flag, this is
the same as.
. With the "u" flag, this matches an entire codepoint that
is not a lone surrogate, not just a single UTF-16 code unit (one or two JS
characters). Previously, this expression compiled without the "u" flag, but
was useless. #602 - String literals may now contain characters from outside the BMP.
#602 - Character classes may now contain
\p{}
or\P{}
escapes to match or
inverted-match Unicode properties. See
MDN
for more details. If you are generating code for a non-JavaScript environment
using a plugin, this may be somewhat challenging for the plugin author.
Please file an issue on Peggy for help.
#602 - A new "semantic" pass has been added to the compiler, which occurs after all
transformations, but before code generation. Plugins in this pass can rely
on annotations from previous passes to reason about the code.
#606 - Unreachable code in rules like
'b'* / 'c'
,![]
,&[]
,!('f'*)
, and
&('f'*)
now cause a semantic warning. This warning may be escalated to an
error in a future release, once experience in the field has shown that the
approach does not catch code that is valid.
#606 - Globals, UMD, and CommonJS are now downloadable from the online version. The
weird version of globals that was only available from the web download was
removed. #608
Bug fixes
- Switch to pnpm-action instead of corepack for GitHub Actions. Ensure that help text always wraps the same in tests, no matter the actual terminal width. #588
- All libraries used in the web site brought up-to-date, versioned with all
other dependencies, and served locally. (TODO: Old version of CodeMirror to
be replaced with Monaco). #593 - Code coverage increased for Peggy Grammar parser.
#593 - Minor changes in code generation for parsers. More consistent indentation,
trailing commas (for consistency with the Peggy house style).
#593 - Avoid performance cliff for deeply-nested grammars when checking for
infinite recursion. Previously, nesting more than about 30 layers deep
caused drastically increasing processing time. Now, nesting more than 700
layers deep causes "Maximum call stack size exceeded"; hopefully this is
deep enough in practice. #600 - Small measures to try to get
deno run -A npm:peggy
to work. We will not
know if these were successful until the package is published next. Testing
with--format es -t foo
will still not work in Deno.
#603 - Fix a bug with named NEVER_MATCH expressions.
#454 - Warnings from grammar parsing are now presented more fully to the user in
the CLI. Info messages from grammar parsing are presented the same if in
verbose mode. #605 - One of the intermediate files that is generated in tests was not getting
a warning when it was unexpectedly found on test start.
#604
Documentation
- Link to browserlist support matrix in documentation.
#593 - When clicking on the link to the examples grammar, do not download the
.peggy file, but instead show a .peggy.txt file in a browser window.
#595 - Set a minimum height for the editors in the online version.
#596 - Update the docs for newly-created compiler passes. Make pluck and literal
syntax use the new "dim" approach for optional bits.
$612
v4.2.0
New features
- #568 Upgrading to TypeScript 5.6 allowed for generating
parser.d.ts
, which should may help people that use Peggy programmatically in nonstandard ways.
Bug fixes
- #567 Load config files and plugins correctly on Windows by using file: URIs in import().
Documentation
- #566 Slight tweaks to document generation.
v4.1.1
v4.1.0 did not actually get published due to a workflow issue that should
be sorted out now.
New features
- #477 Option to output .d.ts files next to .js from CLI.
- #530 Allow es6 plugins from CLI
- #532 Allow es6 options files from the CLI
Bug fixes
- #531 Clean up rollup hacks from CLI code.
- #514 Allow execution of the
peggy
binary on Windows by handling node runtime flags manually, executing a sub-instance of node to actually runpeggy
. - #538 Fixed error in TS types for
peg$maxFailExpected
andpeg$maxFailPos
. - #551 Moved to package-extract instead of a custom script for version file generation.
v4.1.0
New features
- #477 Option to output .d.ts
files next to .js from CLI. - #530 Allow es6 plugins from CLI
- #532 Allow es6 options files
from the CLI
Bug fixes
- #531 Clean up rollup hacks
from CLI code. - #514 Allow execution of
thepeggy
binary on Windows by handling node runtime flags manually,
executing a sub-instance of node to actually runpeggy
. - #538 Fixed error in TS types
forpeg$maxFailExpected
andpeg$maxFailPos
. - #551 Moved to package-extract
instead of a custom script for version file generation.
v4.1.0-pre.2
Testing what I hope is the final release process. This should not get the
@latest
tag.
v4.1.0-pre.1
Checking publish process.
v4.1.0-pre.0
New features
- #477 Option to output .d.ts
files next to .js from CLI. - #530 Allow es6 plugins from CLI
- #532 Allow es6 options files
from the CLI
Bug fixes
- #531 Clean up rollup hacks
from CLI code. - #514 Allow execution of
thepeggy
binary on Windows by handling node runtime flags manually,
executing a sub-instance of node to actually runpeggy
. - #538 Fixed error in TS types
forpeg$maxFailExpected
andpeg$maxFailPos
. - #551 Moved to package-extract
instead of a custom script for version file generation.
Bug fixes
4.0.3
Released: 2024-06-19
New features
- #509 Add and implement ES6 export button
Bug fixes
- #493 Allow use of an empty
array, null, or undefined as allowedStartRules option - #505 Fix vscode-eslint settings
to work with eslint flat config - #507 Remove stray semicolon in CSS
- #508 Fix broken text input in
web version - #512 Add "StartRules" to peg.d.ts
- #513 Allow whitespace between
plucked word and its pattern. - #520 Grammar with token "constructor" fails to generate
- #522 Switched from puppeteer
to playwright for web tests, and added them to CI.
Documentation
- #506 Added END OF INPUT (
!.
).