Skip to content

Commit

Permalink
fix exception when handling parse error for lonely ) #417
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Dec 10, 2024
1 parent 366ac6f commit b372c7e
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 21 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 1.0.0-beta.21
### Feature
* allow to use copy-paste indent with Node >=18.19.0
* allow to use auto-indent with Node >=18.19.0
* add metadata to the parser [#414](https://github.com/jcubic/lips/issues/414), [#416](https://github.com/jcubic/lips/issues/416)
### Bugfix
* fix exception when handling parse error for lonely `)` [#417](https://github.com/jcubic/lips/issues/417)

## 1.0.0-beta.20
### Feature
Expand Down
14 changes: 9 additions & 5 deletions dist/lips.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions dist/lips.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.esm.min.js

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,11 @@ class Parser {
let e;
if (count < 0) {
e = new Error('Parser: unexpected parenthesis');
e.__code__ = [prev.toString() + ')'];
if (prev) {
e.__code__ = [prev.toString() + ')'];
} else {
e.__code__ = [')'];
}
} else {
e = new Error('Parser: expected parenthesis but eof found');
const re = new RegExp(`\\){${count}}$`);
Expand Down

0 comments on commit b372c7e

Please sign in to comment.