-
Notifications
You must be signed in to change notification settings - Fork 25
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
Parse errors are not user friendly... #26
Comments
Hi, note that the esrap repository from which quicklisp fetches is scymtym/esrap. Regarding your question: I have been working on parse error reports like
Do you think that would help? @nikodemus: would do you think about this? |
It would help tremendously, yes! |
OK, the code will need some work before it can go into master, but I will try to get it done as soon as possible. |
@dimitri, I pushed a draft of the improved parse error reporting to scymtym/esrap:wip-better-errors. In addition to the error position, parse errors report
I tested the code by hacking an Emacs completion backend that displays the expected strings or characters: Could you test whether it would improve the situation for you? I would be interested to hear whether it works for you and whether error messages are too verbose/too terse/just right. After some cleanup, the code could go into esrap master, I think. PS: The completion hack above uncovered the following potential bug in the pgloader parser: the
The |
Hi, Jan Moringen notifications@github.com writes:
Thanks a lot for your work on that, it's going to be awesome! I did git clone your project and branch and am trying it by injecting (pgloader::with-monitor () As far as the error message goes, it's already way better, but as far as Could you please try removing a comma separator in the file (I tested It seems that all I can get from those tests is the following error
It might that my esrap grammar is just confused, tho.
Yes please! ;-)
I will see about that, thanks for reporting!
My understanding is that using ecase prevents the parser to do proper Regards,dim |
This is indeed caused by a problem in the grammar. I debugged this by doing
i.e. the (defrule username (+ (or (not (or ":" "@" )) doubled-at-sign doubled-colon))
(:text t)) meaning that it can consume anything as long as it is neither ":" nor "@". Restricting
Fixing the above problem should make the error messages much more useful. One problem will probably remain, though: in typical grammars, whitespace and comments are permitted almost everywhere. However, it is not helpful if virtually every error messages contains "you know, you could just insert whitespace or a comment at the problematic position". So I suppose we need a mechanism for excluding certain rules from error messages.
Kind of. "Normally" the parser first applies rules without calling result producing code ( The parse vs. result production phase separation is not absolute, though. "Semantic predicates" can be used to steer the parse based on intermediate results. A simple example would be (defrule integer ...) ; returns parsed integer
(defrule odd-integer (oddp integer)) When |
I did as you propose in dimitri/pgloader@0f3103d and I really like the error messages I get now. It's a huge improvement, thanks a lot for it! Please consider merging that into main esrap already, even if some improvements can be think of for later revisions, such as avoiding mentioning some parts of the syntax tree such as the comments. |
As per grammar review at nikodemus/esrap#26, improve the situation.
I also fixed (I think) the dsn prefix parsing bits thanks to the patch linked here. |
I will try to clean up and merge the code as quickly as I can. No promises though. |
Thanks for your efforts and interest (and code) ;-) |
@dimitri Just to keep you informed: most of the improved error reporting code is approaching acceptable quality with tests and all. However, there is one design decision (scraping the required result information from the cache, "post-mortem" vs. storing more information in results while parsing) which needs at least benchmarking and potentially more thought. Sorry for dragging this out like this but I would hate to sacrifice (much) performance for the improved error reporting. I think that is how @nikodemus would feel about this as well. |
Thanks a lot for the update, really. I understand that some design decisions are more tricky than others and time is needed. I'm still waiting for debian packaging work to release pgloader 3.1.0, I hope that with some luck we will be able to benefit from the new error reporting as soon as 3.1.0, let's see how it goes ;-) |
The better errors branch has already helped me dig myself out of a PEBCAK problem with pgloader, so thanks for the work on this. IMO, it's very valuable. |
A much improved version of this code is in https://github.com/scymtym/esrap master (which is the maintained upstream repository) |
The WIP branch about better error messages made its way through the main code, so switch back to the mainline as available directly in Quicklisp. See nikodemus/esrap#26.
As seen in dimitri/pgloader#56 we have problems with users trying to decipher error messages. Is it possible to do something about it? Do you have plans to improve error reporting?
The text was updated successfully, but these errors were encountered: