ebnf2railroad
Advanced tools
Comparing version 1.14.0 to 1.14.1
@@ -9,2 +9,8 @@ # Changelog | ||
## [1.14.1] - 2023-04-13 | ||
### Fixed | ||
- Fixed an issue where repeaters written back as text did not reverse repeater sequences. (`a, b, { c, d, a, b }` was turned into `a, b, { d, c, a, b }` in the output text version). | ||
## [1.14.0] - 2023-04-13 | ||
@@ -11,0 +17,0 @@ |
{ | ||
"name": "ebnf2railroad", | ||
"version": "1.14.0", | ||
"version": "1.14.1", | ||
"description": "EBNF to Railroad diagram", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"lint": "eslint src/ test/", | ||
"update-examples": "bin/ebnf2railroad.js examples/json.ebnf --title JSON; bin/ebnf2railroad.js examples/ebnf.ebnf --title EBNF; bin/ebnf2railroad.js examples/optimizations.ebnf", | ||
"update-examples": "bin/ebnf2railroad.js examples/json.ebnf --title JSON; bin/ebnf2railroad.js examples/ebnf.ebnf --title EBNF; bin/ebnf2railroad.js examples/optimizations.ebnf; bin/ebnf2railroad.js examples/optimizations.ebnf --target examples/optimizations.md", | ||
"publish": ".travis/publish-site.sh" | ||
@@ -30,0 +30,0 @@ }, |
@@ -78,7 +78,19 @@ # EBNF 2 RailRoad | ||
- EBNF `ebnf2railroad examples/ebnf.ebnf --title EBNF` [View | ||
online][example-ebnf] | ||
- JSON `ebnf2railroad examples/json.ebnf --title JSON` [View | ||
online][example-json] | ||
- EBNF `ebnf2railroad examples/ebnf.ebnf --title EBNF` | ||
[View html result online][example-ebnf] [View source](./examples/ebnf.ebnf) | ||
- JSON `ebnf2railroad examples/json.ebnf --title JSON` | ||
[View html result online][example-json] [View source](./examples/json.ebnf) | ||
### Optimizations | ||
The following optimizations are applied: | ||
- Ungrouping of groups that do not affect meaning of syntax | ||
- Untangling of nested choice elements | ||
- Duplicate choices are removed | ||
- Pretty printing of original syntax, with wrapping, column alignment | ||
[View html result online][example-optimizations] [View source](./examples/optimizations.ebnf) | ||
[View markdown result](./examples/optimizations.md) | ||
## Usage as module | ||
@@ -112,3 +124,4 @@ | ||
[example-ebnf]: http://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/ebnf.html | ||
[example-json]: http://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/json.html | ||
[example-ebnf]: https://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/ebnf.html | ||
[example-json]: https://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/json.html | ||
[example-optimizations]: https://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/optimizations.html |
@@ -271,4 +271,6 @@ const dasherize = (str) => str.replace(/\s+/g, "-"); | ||
renderConfig | ||
)}, { ${productionToEBNF( | ||
production.repeater, | ||
)} , { ${productionToEBNF( | ||
production.repeater.sequence | ||
? { sequence: [].concat(production.repeater.sequence).reverse() } | ||
: production.repeater, | ||
renderConfig | ||
@@ -275,0 +277,0 @@ )} , ${productionToEBNF(production.repetition, renderConfig)}${ |
122514
3254
126