kdl-org / kdl

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

Only one line continuation is allowed by formal grammar #254

Closed CAD97 closed 2 years ago

CAD97 commented 2 years ago
node-space := ws* escline ws* | ws+
escline := '\\' ws* (single-line-comment | newline)

If this is intended, it should probably be noted in the prose part of the spec.

If multiple line continuations should be allowed, then this adjustment should be sufficient:

node-space := ws* (escline ws*)+ | ws+

Example previously invalid but made valid document:

node 1 2 \ // I don't know why you would want to do this
         \ // but I think you should be allowed to do it
     3 4   // and see no non-formal reason to forbid it.
spaarmann commented 2 years ago

I'm not super familiar with reading grammars, so apologies if I'm missing something, but: node-space only appears in the grammar as node-space+ or node-space*. If I'm understanding it correctly, that means that effectively multiple line continuations are allowed everywhere, because multiple node-spaces are.

CAD97 commented 2 years ago

You're.... correct, I think. I think I originally misread/misimplemented the spec, leading to this issue. Whoops 🙃