-
Notifications
You must be signed in to change notification settings - Fork 65
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
Error handling improvements #48
Comments
On Sat, Sep 29, 2012 at 4:05 AM, Alex Rønne Petersen <
For example, "one or more (literal "abc") followed by (any character)."
|
Hi, |
Hi, No there is no error recovery implemented. I could not find a generic |
Actually, I found a nice way to do some error handling. It requires changing it from
after
It's also better for compile times to have a separate D file with the custom tree builder. I use https://github.com/globecsys/asn1.d/blob/master/asn1/app.d Here's an example of the generated log: Beware though I changed the interpretation of the |
The problem with error handling (which requires a log here) is that there's no way of knowing which kind of branching was really an error, because the grammar is very generic like Philippe stated. So I just read through a log to try and see what pathing pegged was going through. |
On Tue, Apr 29, 2014 at 7:29 PM, Etienne Cimon [email protected]:
I got the log file. Where can we see some error recovery?
So you introduce ambiguity? |
There's no error recovery there, it's a developer helper and reading through it can tell you what part of the grammar should be corrected and, if I were to implement recovery I'd just use semantic actions there to rewind or branch it correctly when I meet certain conditions, or I could modify the generated grammar file.
Yes, I don't do it on CTFE because pegged compiles grammars using a PEG format, but I added a static HashMap to detect recursions and I register a success tree the same way it registers the best failure (longest ParseTree input length), I return with a success once I reach the end of the You can see it here: |
You can see it here:
|
I don't do it for |
Oh, I needed Type < BuiltinType / ReferencedType / ConstrainedType ConstrainedType < Type Constraint / TypeWithConstraint which made Pegged stack overflow, and also BNF would use it to generate lists. I limited it to 2 to allow it minimally but it should be limited to dozens to fully support recursive listing schemes. BNF: |
Just creating this as a sort of meta-bug. A couple of things that come to mind:
The text was updated successfully, but these errors were encountered: