Skip to content

Commit

Permalink
Merge pull request #488 from peggyjs/main
Browse files Browse the repository at this point in the history
Merge main onto stable
  • Loading branch information
hildjj authored Feb 23, 2024
2 parents 9783de1 + 7906d7b commit 6027f36
Show file tree
Hide file tree
Showing 30 changed files with 485 additions and 608 deletions.
20 changes: 13 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ Change Log

This file documents all notable changes to Peggy.

Unreleased
----------

Released: TBD

### Breaking Changes
4.0.1
-----

### New Features
Released: 2024-02-23

### Bug fixes

- [#478](https://github.com/peggyjs/peggy/issues/478) Add "npx" to some doc
examples.
- [#479](https://github.com/peggyjs/peggy/issues/479)
Refactor `cli/fromMem.js` into separate project
[from-mem](https://github.com/peggyjs/from-mem/).
- [#481](https://github.com/peggyjs/peggy/issues/481) Add CLI test for
--library
- [#483](https://github.com/peggyjs/peggy/issues/483) fix errors in
typescript file.

4.0.0
-----

Expand Down
188 changes: 0 additions & 188 deletions bin/fromMem.js

This file was deleted.

2 changes: 1 addition & 1 deletion bin/peggy-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ class PeggyCLI extends Command {
? path.resolve(this.outputJS)
: path.join(process.cwd(), "stdout.js"); // Synthetic

const fromMem = require("./fromMem.js");
const fromMem = require("@peggyjs/from-mem");
const exec = await fromMem(source, {
filename,
format: this.argv.format,
Expand Down
18 changes: 9 additions & 9 deletions docs/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ <h3 id="generating-a-parser-command-line">Command Line</h3>
<p>To generate a parser from your grammar, use the <code>peggy</code>
command:</p>

<pre><code class="language-console">$ peggy arithmetics.pegjs</code></pre>
<pre><code class="language-console">$ npx peggy arithmetics.pegjs</code></pre>

<p>This writes parser source code into a file with the same name as the grammar
file but with “.js” extension. You can also specify the output file
explicitly:</p>

<pre><code class="language-console">$ peggy -o arithmetics-parser.js arithmetics.pegjs</code></pre>
<pre><code class="language-console">$ npx peggy -o arithmetics-parser.js arithmetics.pegjs</code></pre>

<p>If you omit both input and output file, standard input and standard output
are used.</p>
Expand Down Expand Up @@ -295,33 +295,33 @@ <h3 id="generating-a-parser-command-line">Command Line</h3>

<pre><code class="language-console"># - write test results to stdout (42)
# - exit with the code 0
echo "foo = '1' { return 42 }" | peggy --test 1
echo "foo = '1' { return 42 }" | npx peggy --test 1

# - write a parser error to stdout (Expected "1" but "2" found)
# - exit with the code 2
echo "foo = '1' { return 42 }" | peggy --test 2
echo "foo = '1' { return 42 }" | npx peggy --test 2

# - write an error to stdout (Generation of the source map is useless if you don't
# store a generated parser code, perhaps you forgot to add an `-o/--output` option?)
# - exit with the code 1
echo "foo = '1' { return 42 }" | peggy --source-map --test 1
echo "foo = '1' { return 42 }" | npx peggy --source-map --test 1

# - write an error to stdout (Generation of the source map is useless if you don't
# store a generated parser code, perhaps you forgot to add an `-o/--output` option?)
# - exit with the code 1
echo "foo = '1' { return 42 }" | peggy --source-map --test 2
echo "foo = '1' { return 42 }" | npx peggy --source-map --test 2

# - write an output to `parser.js`,
# - write a source map to `parser.js.map`
# - write test results to stdout (42)
# - exit with the code 0
echo "foo = '1' { return 42 }" | peggy --output parser.js --source-map --test 1
echo "foo = '1' { return 42 }" | npx peggy --output parser.js --source-map --test 1

# - write an output to `parser.js`,
# - write a source map to `parser.js.map`
# - write a parser error to stdout (Expected "1" but "2" found)
# - exit with the code 2
echo "foo = '1' { return 42 }" | peggy --output parser.js --source-map --test 2
echo "foo = '1' { return 42 }" | npx peggy --output parser.js --source-map --test 2
</code></pre>

<h3 id="generating-a-parser-javascript-api">JavaScript API</h3>
Expand Down Expand Up @@ -726,7 +726,7 @@ <h3 id="importing-external-rules">Importing External Rules</h3>
<p><code>number.peggy</code>:</p>
<pre><code class="language-peggy">number = n:$[0-9]+ { return parseInt(n, 10); }</code></pre>
<p>Generate:</p>
<pre><code class="language-console">$ peggy csv.peggy number.peggy</code></pre>
<pre><code class="language-console">$ npx peggy csv.peggy number.peggy</code></pre>
</li>

<li>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="label">Download browser version</div>
<span id="download">
<a title="Download a minified version of Peggy for the browser"
href="https://unpkg.com/[email protected].0/browser/peggy.min.js">minified</a>
href="https://unpkg.com/[email protected].1/browser/peggy.min.js">minified</a>
</span>
<iframe id="discord"
src="https://discordapp.com/widget?id=985995982909100082&theme=dark"
Expand Down
4 changes: 2 additions & 2 deletions docs/js/benchmark-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/examples.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by Peggy 4.0.0.
// @generated by Peggy 4.0.1.
//
// https://peggyjs.org/
(function(root) {
Expand Down
4 changes: 2 additions & 2 deletions docs/js/test-bundle.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/vendor/peggy/peggy.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by Peggy 4.0.0.
// @generated by Peggy 4.0.1.
//
// https://peggyjs.org/

Expand Down
4 changes: 2 additions & 2 deletions lib/peg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ export namespace compiler {
* @param node Leaf node, representing calling a rule in an external library.
* @param args Any arguments passed to the `Visitor`
*/
library_ref?(node: ast.LibraryReference, ...args: an[]): any;
library_ref?(node: ast.LibraryReference, ...args: any[]): any;

/**
* Default behavior: do nothing
Expand Down Expand Up @@ -1077,7 +1077,7 @@ export interface ParserOptions {
/**
* Pending list of expectations.
*/
peg$maxFailExpected?: Expectation[];
peg$maxFailExpected?: parser.Expectation[];
}

export interface LibraryResults {
Expand Down
2 changes: 1 addition & 1 deletion lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

"use strict";

module.exports = "4.0.0";
module.exports = "4.0.1";
Loading

0 comments on commit 6027f36

Please sign in to comment.