-
Notifications
You must be signed in to change notification settings - Fork 151
Description
It would be useful if the parser and/or Instaparse routines took an optional callback function to allow graceful halting of a parse.
While developing a grammar and parser and even when that parser is in production, I've encountered a situation in which a particular input inspires the parser to run uninterruptibly until exhausting heap. No doubt there are improvements needed in the grammar however debugging and dealing with the run-away parse is problematic and that it is possible causes some angst when we want to parse data in a production server with Instaparse. We've tried wrapping the parser in a future and interrupting it, and this approach is fraught with the usual interrupted thread issues.
It would be useful if the parser and/or Instaparse routines took an optional callback function to allow graceful halting of a parse. This function, if set, could be called periodically during the parse to confirm if parsing should carry on. This would help us improve resilience to the occasional run-away parse process.