kdl-org / kdl

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

Slashdash at the start of a KDL file (KDL2 grammar) #378

Closed zkat closed 7 months ago

zkat commented 7 months ago

Discussed in https://github.com/kdl-org/kdl/discussions/377

Originally posted by **alightgoesout** February 12, 2024 Hello, While working on KDL4J, I noticed that the grammar for KDL 2.0 does not seem to allow a slashdash right at the start of the document: ``` plain-line-space := newline | ws | single-line-comment line-space := plain-line-space+ ('/-' plain-node-space* node)? ``` We can see that at least one plain line space is required before a slashdash of a node and plain line space cannot be empty. This does not seem right, especially since several test cases seem to imply that it is perfectly fine (e.g., `slashdash_full_node.kdl` or `slashdash_only_node.kdl`). Am I not reading the grammar right ?
zkat commented 7 months ago

@alightgoesout this is definitely a bug. Thanks for finding it!

zkat commented 7 months ago

I've pushed a crappy fix for this, but it's probably "good enough" lmk if you think it's bad.