Closed tabatkins closed 2 years ago
I'll defer to Kat / the community, but I'm actually sort of inclined towards the error here. escline
conceptually is for extending a single-line construct (a node and its entities) over several physical lines; there isn't really any meaningful interpretation of that in between nodes.
escline conceptually is for extending a single-line construct (a node and its entities) over several physical lines; there isn't really any meaningful interpretation of that in between nodes.
Yeah, I've been a bit back and forth on this, but I find this pretty acceptable. I'll throw up a PR deleting the expected_kdl file, then.
Gosh darn it, I missed this one! My implementations didn't have a problem with this one because esclines and comments are resolved at the tokenizer level, effectively hiding them from the parser, and therefore are interpreted with no context, therefore they're allowed anywhere
The
escline_comment_node.kdl
test contains the following:and it expects this to parse validly and reserialize out as:
However, my impl is marking it as a parse error (starting at line 2 col 3, the
\
), and as far as I can tell it's correct to do so. Escaped newlines are from theescline
production, and escline only shows up in one place, thenode-space
production. However,node-space
is only allowed between components of a node, not before or after. The space between a node terminator and the start of the following node is only allowed to belinespace
, per thenodes
production.I think this is a corner case and not very important besides for completeness, so here are three possible solutions that I don't have a strong opinion between:
expected_kdl/
file)node-space
to the start of thenode
productionescline
to thelinespace
productionI lean slightly towards the third, as it seems the most elegant; linespace is generally meant to be nodespace + line breaks, and it is allowed to be just a single space or similar, so I don't see why an escaped linebreak is problematic for it.