Closed Bannerets closed 7 months ago
As far as I understand the line continuations breaks a node, let's say:
node 1 2 \
3 4
So you can't really put nothing (or end the file) after \
, that's why it expects a new line.
Just like the KDL below is invalid, ending a file after a line continuation is invalid.
node 1 2 \
node
Instead a single line comment CAN end a file since it's not really part of a node, and it's not breaking a node.
Or at least that's why I understood from the specification :sweat_smile:.
probably what we want is something like (single-line-comment eof? | newline)
So you can't really put nothing (or end the file) after \, that's why it expects a new line.
It feels like it would be better UX if the file is valid regardless of the final newline (and regardless of whether the editor is configured the insert the final \n
or not). FWIW, zsh (but not bash) seems to allow \
before EOF:
$ zsh -c "echo 1 \\"
1
This has been merged into the kdl-v2 branch
I thought this was already reported, but I can't seem to find any issue/discussion, so I'm opening a new one.
Right now, the line continuation is defined as
Where
single-line-comment
is (includes eof):This means that
node \ // comment <EOF>
is allowed as the last line, butnode \ <EOF>
is not, which feels weird. I thinkescline
should probably includeeof
as well.