Ops! I created a new question as this was poorly described, and i described it way better in the new question.
I am trying to create a parser for the ChordPro format. Currently i am struggling with ambiguity with environments. I’ll describe the problem:
An environment with label can be described in the following two ways:
{start_of_verse: Verse 1} // Verse 1 parses to “UnnamedValue”
and
{start_of_verse: label=“Verse 1”} label=“Verse 1” parses to “Attribute”
The parsing of Verse 1 and label=“Verse 1”, whether this part should belong to “UnnamedValue” or “Attribute” is ambiguous, as both of these can start with any regular character. Although, the difference between these two is found (atleast intuitively) from that “Attribute” includes “=” and text inbetween two “\”", and “UnnamedValue” does not include this, and “UnnamedValue” can includes spaces, which “name” in “Attribute” cannot include.
I am struggling to create rules that can parse this correctly. I found this topic that almosts solves the problem, but the proposed solution uses a shared token “identifier”, which does not suit my usecase (atleast to my knowledge and skills of lezer), as the token in the first example (Verse 1) can include spaces which the second example (label) cannot.