A grammar challange regarding that pesky YAML format

I am experimenting with a YAML grammar for IXML.

In YAML you can create a document consisting of a single array with strings:
- a 1
- b 2
- c 3

Convert it into json and you get
[  "a 1",  "b 2",  "c 3" ]
Note the permitted spaces, no need for quotes. Nice.

You can create a document consisting only of key value pairs:
a: 1
b: 2
c: 3

Convert it into json and you get
{  "a": 1,  "b": 2, "c": 3 }
Nice.

However! You can start a new object consisting of key value pairs on the
same array line!!! The YAML parser will look for key <no-space> colon
<space>, if this is found then a new object i started on the array line.
But if there is no space after the colon or if there is space before the
colon, then the array line is a string.... :-/

So this document:
- a: 1
- b:2
- c: 3

Translates into:
[
    {
        "a": 1
    },
    "b:2",
    {
        "c": 3
    }
]

Have I mentioned that I do not like YAML? Anyway, in IXML you can have a
string rule that matches the array line fine, you can have the key value in
array line fine.
But clearly the grammar will be ambigous since >>a: 1<< can be a string or
a key value pair.

Is there a way to write a string matching IXML rule that matches to the end
of line but forbids <letter>:<space>?

//Fredrik

Received on Sunday, 1 February 2026 10:35:29 UTC