# Ambiguity problem in ChordPro (new question created)

**URL:** https://discuss.codemirror.net/t/ambiguity-problem-in-chordpro-new-question-created/9850
**Category:** Lezer
**Created:** [August 5, 2026, 11:49am UTC](https://discuss.codemirror.net/t/ambiguity-problem-in-chordpro-new-question-created/9850 "2026-08-05T11:49:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![OTheNonE](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/othenone/32/5529_2.png) [@OTheNonE](https://discuss.codemirror.net/u/OTheNonE)
#### Post date: [August 5, 2026, 11:49am UTC](https://discuss.codemirror.net/t/ambiguity-problem-in-chordpro-new-question-created/9850/1 "2026-08-05T11:49:54Z")

</div>

_Ops!_ I created a [new question](https://discuss.codemirror.net/t/chordpro-environment-grammar-question/9851) 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](https://www.chordpro.org/chordpro/directives-env_verse/). 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](https://discuss.codemirror.net/t/overlapping-tokens-in-lezer/3824?utm_source=chatgpt.com) 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.
