Error handling

classic Classic list List threaded Threaded
2 messages Options
Rob
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Error handling

Rob
Without too much difficulty I was able to prototype a parser in parboiled for a custom language for a project I'm working on.
However, I'm now thinking about modifying it so users can get reasonable parse errors.

I haven't found much documentation on how to do this effectively.
Can anyone point me to some docs, or a project which has successfully generated some useful error messages?
Or even what the intended strategy is? Do I look at the matchers after the fact and try to reconstruct a reasonable error? Is there a way to annotate a rule with a message that should get attached?

In some of the examples, ErrorUtils.printParseErrors gets called, but I only get out null out...

Thank you for any help you can provide.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error handling

mathias
Administrator
Rob,

what kind of error messages would you like to produce, i.e. in what way to they differ from the default ones?
The easiest way to influence the error messages is to give your rules the right names (e.g. with the `rule.label(name)` method).

Cheers,
Mathias

---
[hidden email]
http://www.parboiled.org

On 31.10.2014, at 20:05, Rob [via parboiled users] <[hidden email]> wrote:

> Without too much difficulty I was able to prototype a parser in parboiled for a custom language for a project I'm working on.
> However, I'm now thinking about modifying it so users can get reasonable parse errors.
>
> I haven't found much documentation on how to do this effectively.
> Can anyone point me to some docs, or a project which has successfully generated some useful error messages?
> Or even what the intended strategy is? Do I look at the matchers after the fact and try to reconstruct a reasonable error? Is there a way to annotate a rule with a message that should get attached?
>
> In some of the examples, ErrorUtils.printParseErrors gets called, but I only get out null out...
>
> Thank you for any help you can provide.
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://users.parboiled.org/Error-handling-tp4024351.html
> To start a new topic under parboiled users, email [hidden email]
> To unsubscribe from parboiled users, click here.
> NAML

Loading...