Shift-reduce conflict again

Hello!
I’m rewriting a lezer parser for a custom language, and I’m trying to parse hierarchically-organized paths like a.b.c, where a.b is the “scope”, and c is the “name”. Using a grammar like

@top Expr { (Name ".")* ExprName { Name } }
@tokens {
    Name { ($[0-9a-zA-Z_] | "\\" ![^\\])+ }
}

works, but I would also like to give a name to the “scope” part. However, when I add an inline rule for the scope path like so

@top Expr { ExprScope { (Name ".")* } ExprName { Name } }
@tokens {
    Name { ($[0-9a-zA-Z_] | "\\" ![^\\])+ }
}

I get a shift/reduce error. Can anybode help here? I’m probably misunderstanding something, but I thougt “naming” the scope part via an inline rule should not alter the parser?

It does. Inline rules are just a shorthand syntax for rules. When seeing a Name after a ".", your parser doesn’t know whether to reduce the ExprScope or not. This may work better if you structure your grammar to have a separate ExprScope node for each Name "." pair.

Thanks, that worked! I’m stumped why though, guess I need to refresh my memory on LR parsers. Thanks for your help!