Skip to content

Conversation

@ratmice
Copy link
Collaborator

@ratmice ratmice commented May 23, 2025

This adds printing using spans for the lookahead information that was added in #506
using the example from that PR

%start S
%%
S: A X | B X | A Y;
A: '0' ; B: '0' ; C: '0' ;
X: '1' ; Y: '2' ;

Adds the last line to this conflict printing output:

Reduce/Reduce conflict, can reduce 'A' or 'B' with lookahead '1' at rr.y:5:1
5| A: '0' ; B: '0' ; C: '0' ;
   ^ First reduce
5| A: '0' ; B: '0' ; C: '0' ;
            - Second reduce
6| X: '1' ; Y: '2' ;
       + Lookahead

Not certain we need to be using different underline characters for each thing here, but it was currently doing that so I kept the tradition?

@ltratt
Copy link
Member

ltratt commented May 23, 2025

Not certain we need to be using different underline characters for each thing here, but it was currently doing that so I kept the tradition?

Hmm, probably it would be better to use ^ for all of them (which seems more consistent with other tools)? But we can do that in a follow-up PR if you agree.

@ltratt ltratt added this pull request to the merge queue May 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 23, 2025
@ratmice
Copy link
Collaborator Author

ratmice commented May 23, 2025

Yeah, I think my original attempts probably had more of a footnote style attempting to reduce duplicate line output.
By having multiple underlines on a single line, and then footnote text on their own line.

But as we can see from the duplicate line output that isn't actually being done, so I agree that keeping to ^ is probably better.

@ratmice ratmice force-pushed the rr_conflict_lookahead_span branch from 6688a6c to e193dd3 Compare May 23, 2025 14:42
@ratmice
Copy link
Collaborator Author

ratmice commented May 23, 2025

Force pushed a clippy/rustfmt update

@ltratt ltratt added this pull request to the merge queue May 23, 2025
Merged via the queue into softdevteam:master with commit da567b8 May 23, 2025
2 checks passed
@ratmice ratmice deleted the rr_conflict_lookahead_span branch May 24, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants