Repository: Eliah-Lakhin/lady-deirdre (language: rust)

Issue:
Proc macro `Node` panic: duplicate covered token
```
!! LADY DEIRDRE INTERNAL ERROR
!!
!! This is a bug.
!! If you see this message, please open an Issue: https://github.com/Eliah-Lakhin/lady-deirdre/issues
!!
!! Message: Duplicate covered token.
!! File: /home/jerome/.cargo/git/checkouts/lady-deirdre-32d6389957ff7fde/fb02983/work/crates/derive/src/node/rule.rs
!! Line: 315
!! Column: 29
```
I can confirm this occurs on v2.0.1, bdb70e22 and fb029833. Minimal reproduction:
```rust
use lady_deirdre::lexis::Token as LexisToken;

#[derive(LexisToken, Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
pub enum T {
    Eoi = 0,
    Mismatch = 1,
    #[rule(i("true"))]
    #[priority(5)]
    LitTrue,
}

#[derive(lady_deirdre::syntax::Node)]
#[token(Token)]
pub enum S {
    #[root]
    #[rule((top: A | B)*)]
    Root {
        #[node]
        node: NodeRef,
        #[parent]
        parent: NodeRef,
        #[child]
        top: Vec<NodeRef>,
    },
    #[rule($LitTrue)]
    A {
        #[node]
        node: NodeRef,
        #[parent]
        parent: NodeRef,
    },
    #[rule($LitTrue)]
    B {
        #[node]
        node: NodeRef,
        #[parent]
        parent: NodeRef,
    },
}
```


Discussion / hints:
For context, I was attempting to define a grammar for a language which does not declare any keywords to its lexer in the formal sense. Instead, its lexer only tokenises identifiers, and the parser then checks the strings of these identifiers to determine if they match the keywords to assemble syntax elements.

I was trying to replicate this behaviour in Lady Deirdre by making each syntax node use `#[rule($Identifier)]` as its left-most set, and then defining custom parsers for each which manually check for chains of identifiers matching the keywords.
Bug confirmed. Thank you for reporting!

A note regarding your approach. I think matching on the generic tokens in the parser's context is fine, but you don't need a parsing rule for each of these Keyword-nodes. Here is an example: https://gist.github.com/Eliah-Lakhin/4c543cdf7415c1c2b98c88e353beb87f

In the snippet from the description, normally the macro should yield a grammar error message because A and B have overlapping leftmost sets. But for some obscure reason, it throws an assertion error that I'm currently investigating.



Fix patch:
diff --git a/work/crates/derive/src/node/input.rs b/work/crates/derive/src/node/input.rs
index 7d979b8..3212701 100644
--- a/work/crates/derive/src/node/input.rs
+++ b/work/crates/derive/src/node/input.rs
@@ -499,10 +499,6 @@ impl TryFrom<DeriveInput> for NodeInput {
         }
 
         for (_, variant) in &variants {
-            if variant.root.is_some() {
-                continue;
-            }
-
             let rule = match &variant.rule {
                 None => continue,
                 Some(rule) => rule,


Test patch: