-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Guidance for warn_ungrouped_named_tokens_in_collection #111
Comments
Absolutely! There are 4 new warning-style You may have gotten that warning if you are running the interim-released 2.4.1.1, which installs with several diag switches enabled. If you upgrade to 2.4.2, all these diagnostics are disabled by default, so your warning ugliness will go away. But your comments are still valid for when you wish to make use of these new switches. Here is an example of an ungrouped named tokens in collection:
The resulting output is:
Note that all the results names are at the same level, no hierarchy. If other expressions in this parser had 'lhs' or 'rhs' names, in similar ungrouped hierarchy, the 'lhs' and 'rhs' names would clash, and the default would be for only the last name to be reported. The resolution for this warning is to Group
Which gives this output:
Now 'lhs' and 'rhs' are grouped under 'eqn', and would not be overwritten by other 'lhs' or 'rhs' names in other expressions. |
Sorry - you asked a specific question, which I talked about at length but didn't actually answer. This change should resolve the warning for you. Change:
to:
|
See the wiki page "Parser Development Tips" |
Thanks a lot for that in-depth reply. I guess I'll start Group'ing my expressions more, from now on :-) That's a great wiki page you wrote there. I would encourage you to create short-links to this page and put them inside your warnings. That's such a great experience to just click on the warning link and get a full explanation. Cheers! |
Excellent suggestion, thanks! I've also renamed that page to "Parser Debugging and Diagnostics" since the only general suggestion was "Write a BNF", so I'm going to move that part (when it gets written) to a separate "Writing Your Parser" or something page. Should make it easier to find this page when dealing with a diag warning. |
Issue #110 (and others) are about
warn_ungrouped_named_tokens_in_collection
being particularly noisy. According to the release notes, this warning was added in the latest major release, and recently silenced by default.Looking at the code, the only explanation for this new warning is:
I find this a bit unhelpful. Warnings are meant to notify developers that something's wrong with their code and they should feel bad, eg. deprecation notices. But for such a warning to be effective, the path to a sane, no-warning state must be easily identified so developers are compelled to fix their code.
Could we get an explanation on how best to modify our code to fix this warning? I currently have code that relies on the behavior of having "nested"
setResultName
. It's probably bad practice, but works fine for me. Here is a small albeit dumb code that reproduces the issue. How would you approach the fix?The text was updated successfully, but these errors were encountered: