kdl-org / kdl

the kdl document language specifications
https://kdl.dev
Other
1.07k stars 61 forks source link

KDL 2.0: spaces before/after prop = #340

Closed zkat closed 7 months ago

zkat commented 7 months ago

The current definition for props is like this: prop := identifier '=' value, which does not allow spaces.

Instead, I propose the following definition:

prop := identifier ws* escline* ws* '=' ws* escline* ws* value, which will require parsers to have one step of lookahead, but that's pretty normal and totally fine and common to do.

tabatkins commented 7 months ago

While I generally don't like how it looks, whitespace is allowed around the = in HTML/XML too, so I support this.

Exidex commented 7 months ago

In intellij-kdl I had to add support for this to have better error reporting. See parser

larsgw commented 7 months ago

This would be more than one step of lookahead right? identifier ws* escline* ws* could still be a value instead of a prop. Also, should more than one escline be allowed? I don't see why you would need more but I feel the same about the whitespace in the first place, and in comparison it feels like a just as arbitrary restriction. Also, I think this disallows whitespace at the start of a line with a second or subsequent escline.

zkat commented 7 months ago

Closing in favor of https://github.com/kdl-org/kdl/issues/355