Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get into infinite loop if keeping parsing when encountered errors #22

Closed
jillyj opened this issue Mar 24, 2022 · 6 comments
Closed

Get into infinite loop if keeping parsing when encountered errors #22

jillyj opened this issue Mar 24, 2022 · 6 comments

Comments

@jillyj
Copy link
Contributor

jillyj commented Mar 24, 2022

Grammar file: https://github.com/opencybersecurityalliance/kestrel-lang/blob/develop/src/kestrel/syntax/kestrel.lark
Generated parser:
kestrelParser.js.zip

Code

function handle_errors(e) { return true; }

  try {
    treeData = parser.parse("proc2 =", null, handle_errors).children[0];
  } catch (e) {
    console.debug("uncaught error:", e)
  }

Expected: can stop parsing and get error info.

@jillyj
Copy link
Contributor Author

jillyj commented Apr 11, 2022

@erezsh could you please take a look at this issue?

erezsh added a commit that referenced this issue Apr 11, 2022
@erezsh
Copy link
Member

erezsh commented Apr 11, 2022

Fixed in PR #26

Can you test that it works as expected?

erezsh added a commit that referenced this issue Apr 11, 2022
Bugfix for on_error (found in issue #22)
@erezsh
Copy link
Member

erezsh commented Apr 11, 2022

(now also merged to master)

@jillyj
Copy link
Contributor Author

jillyj commented Apr 13, 2022

@erezsh how do I test with the master? I usually generated the parser by the larkJS package.

@jillyj
Copy link
Contributor Author

jillyj commented Apr 13, 2022

I got it worked by pip install -e. :)
The fix works! Thanks.

@erezsh
Copy link
Member

erezsh commented Apr 13, 2022

Great! It will get into the next release.

@erezsh erezsh closed this as completed Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants