Re: A grammar challange regarding that pesky YAML format

Hmm... no, I missed something - my grammar doesn't deal with a line like:

- a:

(with no space after the colon).

Fredrik, your original grammar would treat this as a string, but would treat:

- a: 

(with a space after the colon) as a kvp with a missing value. Is that the behaviour you actually want?

Bethan

___________________________________________________ 
Dr. Bethan Tovey-Walsh 

linguacelta.com

Golygydd | Editor geirfan.cymru

Croeso i chi ysgrifennu ataf yn y Gymraeg.

> On 2 Feb 2026, at 11:51, Bethan Tovey-Walsh <bytheway@linguacelta.com> wrote:
> 
> doc = arrayline+.
> arrayline = -'- ', (valonly | kvp).
> 
> valonly = (-key, not_val | not_key, val), -#a.
> -not_val = ':', ~[' ';#a], val | ~[':_';L], val.
> -not_key = ~[L;'_'].
> 
> kvp = kcs, val, -#a.
> -val = ~[#a]*.
> -kcs = @key, -': '.
> key = [L;'_']+.

Received on Monday, 2 February 2026 12:55:11 UTC