Skip to content

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

@mingodad

Description

@mingodad

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions