Skip to content

Report error (or warning) when grammar contains two rules with the same name #15

@mewmew

Description

@mewmew

I noticed today that the grammar I was writing contained a typo where two different rules had the same name.

From mewspring/l-tm@2734890

Prior to this commit AlignStack was defined both as

AlignStack -> AlignStack
: 'alignstack'
;

and

AlignStack -> AlignStack
: 'alignstack' '=' N=UintLit
;

However, no warning was emitted by Textmapper. This seems
like a bug?

What surprised me was that Textmapper did not report any error or warning for this grammar, so it may have gone unnoticed for much longer.

I would like to suggest that Textmapper reports an error or outputs a warning when a grammar contains two rules of the same name. It is quite possible that a valid grammar may contain two rules with the same name for some of the more advanced use cases of Textmapper. Of this, I'm not yet aware. However, in the context of a simple grammar, a warning would be helpful.

Cheers,
Robin

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