javallone/regexper

Better handling of regexp errors

Closed this issue · 2 comments

Do something better when the regexp encounters an error.

e.g. Show the compiled regexp up to the point of the error.

Perhaps something like: If compilation fails, insert an "error" token at the point of the error, close any groups, recompile. Now you can at least display the regex up to the point of error.

Rendering the partially parsed expression may be prohibitively difficult at this time (I'm using Treetop to do the parsing, and have limited access to handling errors), but I am going to work on improving the error reporting.

At the very least, I will highlight the offending section in the input.

Error messages are slightly better in the regexper rewrite that just went live. Code is available on https://github.com/javallone/regexper-static