-
Notifications
You must be signed in to change notification settings - Fork 32
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
Issue 473 assertion #476
base: master
Are you sure you want to change the base?
Issue 473 assertion #476
Conversation
Previously the spans of empty productions were lost from the AST. When a conflict involving an empty production was found a panic would ensue due to the missing span.
Oops, I missed this one because I wasn't assigned -- sorry! |
Dumb question: does this fix the |
My bad, I seem to consistently mix up assignment vs request review. It does fix it, however I'm not entirely absolutely certain it is totally correct. I had been thinking that it would be good to do some local testing where I made the I don't think it is worth including that kind of patch just because of compatibility, but just locally to get a better idea of where this |
Good idea! |
@ratmice I was just wondering if you've had any luck with this? |
No I'm sorry, I haven't managed to sit down and work on this, or anything yet really. I've taken the month for attempting to see if I can sustain walking 24km a day (hint I cannot, If I really push myself I can still only seem to sustain 22km), So most of my time has been just walking or recovering for the next day. But been keeping at it considering how close to that goal I seem to be... It is inevitable that I'll need a rest day soon, but have a pretty good streak going and when I do it is the first thing on my list. Sorry if that isn't a very satisfying answer. |
@ratmice Happy new year! I hope all is going well in your neck of the woods. I just thought I'd see if you've had any luck with this one? I quite understand if not! |
I tried going though making that field private and seeing if it was enlightening at all this morning, making the GrammarAST In my previous message it seems I was thinking the The difference between the two being that Trying to experiment with making the My impression is that the place that this change can cause mappings to go awry is fairly well isolated to the function YaccGrammar::new_from_ast_with_validity_info but we correctly handle the Perhaps that is not totally reassuring? |
|
Just for the record, this patch should fix the assertion and known bug, the question that is left is mostly whether our confidence that the changes do not have any unintended effects on what most likely would be I think it is likely that the patch as is probably behaves perfectly fine, but the use of numerical indices makes it difficult to attain the degree of confidence that I normally like to have in a patch :( |
Dumb question: is the fix just to remove the diff --git nimbleparse/src/diagnostics.rs nimbleparse/src/diagnostics.rs
index babfdae..ae37483 100644
--- nimbleparse/src/diagnostics.rs
+++ nimbleparse/src/diagnostics.rs
@@ -304,7 +304,7 @@ impl<'a> SpannedDiagnosticFormatter<'a> {
.collect::<Vec<_>>();
prod_lines.sort();
prod_lines.dedup();
- assert!(!r_prod_spans.is_empty());
+ // assert!(!r_prod_spans.is_empty());
for lines in &prod_lines {
let mut spans_on_line = Vec::new(); When I look at the output that I get with this diff from nimbleparse, it's not obvious to me that it's wrong. |
By simply removing the span we can get the occurrence that the
So the effect of removing the assert is that we print the rule in which the So it's really just a case where error printing needs some info that the runtime representation doesn't need in order to print errors uniformly across all shift/reduce conflicts. So, yes it will not lead to any further panics by removing the assert, but the assert currently is catching an exceptional case where we lack any span info for these productions. |
Ah, right, yes, now I remember! So is your aim here that we keep the user's |
well this attempt at an implementation we have 2 cases, both of which are implemented as First there is the rule containing
The second is productions absent any text, these result in a zero length span at the location to the left of the
The only case where produce But besides that
Edit: It's worth noting that the |
Ah, I see. Let me chew on this for a bit, mostly because the |
This seems to fix the assert in issue 473, however i'm marking this as draft because
for some reason the spans seem off by one when parsing the examples posted in that issue.
Strangely the spans are fine for the fuzzer minimized reproducer. Should probably also add test cases etc.
I wonder if this could be due to comments?
The other thing is that after fixing the assertion, nimbleparse seems to return to taking forever to parse the file.
I believe that it might be caused by running error recovery, as I did see some error recovery output.
For some reason It isn't clear whether a mention of @mingodad will work, but he may want to try this patch.