Skip to content
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

Allow custom parse error messages #7

Open
akirschbaum opened this issue May 20, 2014 · 1 comment
Open

Allow custom parse error messages #7

akirschbaum opened this issue May 20, 2014 · 1 comment
Assignees
Milestone

Comments

@akirschbaum
Copy link

It should be possible to generate custom error messages from a parser. For example with a function like BaseParser.parseError(String message) which causes a parse error with the given custom error message.

@fge fge added this to the 1.0.0 milestone May 20, 2014
@fge
Copy link
Owner

fge commented May 20, 2014

Yes, I agree with that.

The (internal) current API however causes two problems:

  • error messages are either collected (ReportingParseRunner, others) or not at all (BasicParseRunner);
  • the Rule interface leaves no possibility to insert a custom error message; in fact, there is no "errorMessage" field in AbstractMatcher.

I'll have to collect more knowledge on the API to be able to figure out how to collect user error messages, and also the interface to do it, since it's quite important. I thought about something like this:

Rule myRule()
{
    return sequence("foo", bar()).errorMessage("no dice...");
}

That is a definite feature I want in 1.0.0 so I'll be working on it. Not sure yet how I'll do it though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants