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

How to show line/col on rule conflicts ? #3

Open
mingodad opened this issue Jul 25, 2022 · 1 comment
Open

How to show line/col on rule conflicts ? #3

mingodad opened this issue Jul 25, 2022 · 1 comment

Comments

@mingodad
Copy link

Trying an alternative online playground for tscc here https://meimporta.eu/TsccYaccLex/playground.html I want to be able to click on the conflict messages and the editor jump to the line/col of it, I already got something close but all line/col info are the one from the head lhs of the rule instead of the sub rule.

To see it go to https://meimporta.eu/TsccYaccLex/playground.html select JZend using the select in the upper middle screen then comment this line:

//%left '*' '/' '%'

Now click the Parse button (upper left corner) to get this messages:

Warning: state 75, shift/reduce conflict:
    token: "*"
    used rule: [ 112: expr_without_var => expr . "*" expr ]* (line 600, column 0)
    discarded rule: [ 118: expr_without_var => "+" expr . ]*  (line 600, column 0)
Warning: state 75, shift/reduce conflict:
    token: "/"
    used rule: [ 113: expr_without_var => expr . "/" expr ]* (line 600, column 0)
    discarded rule: [ 118: expr_without_var => "+" expr . ]*  (line 600, column 0)
Warning: state 75, shift/reduce conflict:
    token: "%"
    used rule: [ 114: expr_without_var => expr . "%" expr ]* (line 600, column 0)
    discarded rule: [ 118: expr_without_var => "+" expr . ]*  (line 600, column 0)
...

I would like to have the line/col of each used/discarded rule correctly pointing to then.

Could you give any help on it ?

This is based on https://github.com/yhirose/cpp-peglib playground here https://yhirose.github.io/cpp-peglib/
and also https://github.com/ChrisHixon/chpeg playground here https://chrishixon.github.io/chpeg/playground/
and https://github.com/mingodad/CocoR-Typescript playground here https://mingodad.github.io/CocoR-Typescript/playground

Cheers !

@mingodad
Copy link
Author

Also the line/col numbers seem to be zero based and that doesn't match what editors use to jump/show then.

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

No branches or pull requests

1 participant