-
Notifications
You must be signed in to change notification settings - Fork 68
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
[Feature Request] Add Expression name to wanted when parsing error occured #69
Comments
@F4ncyMooN Thanks for your feature request. At the moment I feel like all the necessary possibilities to achieve your goal are already present in pigeon grammar. Have you read the section about error reporting on godoc? Additionally there is also the concept of labeled failures, which is described in the documentation as well (at the end of this section). |
I tried the labeled failure, but it seems only error message could be customized. What I want is to customize the expected field in parserError. For example,
When parse ValidString failed, pigeon will recover and throw an error with expected:[ Thanks for your kindly reply. |
@F4ncyMooN I am currently on vacation. I will have a look when I am back. |
@F4ncyMooN Are you willing to provide a PR for this? |
When I use pigeon, parsing error information is very important to me.
Metric "METRIC" = left:ValidString+ "::" right:ValidString+ {
// some code...
return metric, nil
}
ValidString = ':'? [a-zA-Z0-9_.-]+ {
return string(c.text), nil
}
For my use case, when I type something not correct, I want to get the expression name "METRIC". And then I will give a metric list to user. The metric list is about to change all the time so it can't be added to peg file.
The generated program will give detailed literal options in the expected list. But I want the optional expression name when parsing error occured.
Thanks in advance.
The text was updated successfully, but these errors were encountered: