Skip to content

Commit

Permalink
Merge pull request #76 from jviereck/fix-stuck-bail
Browse files Browse the repository at this point in the history
Adding bail error output in case the parser gets stuck
  • Loading branch information
jviereck committed Aug 16, 2015
2 parents 0411839 + b38d294 commit 24c38cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@
var result = parseDisjunction();

if (result.range[1] !== str.length) {
throw SyntaxError('Could not parse entire input - got stuck: ' + str);
bail('Could not parse entire input - got stuck', '', result.range[1]);
}

// The spec requires to interpret the `\2` in `/\2()()/` as backreference.
Expand Down
4 changes: 2 additions & 2 deletions test/test-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -4712,7 +4712,7 @@
")*": {
"type": "error",
"name": "SyntaxError",
"message": "Could not parse entire input - got stuck: )*",
"message": "Could not parse entire input - got stuck at position 0\n )*\n ^",
"input": ")*"
},
"**a": {
Expand Down Expand Up @@ -30228,7 +30228,7 @@
"\\": {
"type": "error",
"name": "SyntaxError",
"message": "Could not parse entire input - got stuck: \\",
"message": "Could not parse entire input - got stuck at position 2\n \\\n ^",
"input": "\\"
},
"\\!": {
Expand Down

0 comments on commit 24c38cd

Please sign in to comment.