Make last semicolon optional for inline nodes

Fixes: https://github.com/kdl-org/kdl/issues/341
This commit is contained in:
Kat Marchán 2023-12-12 22:20:52 -08:00
parent 5a7b339ed4
commit c8488db13e
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
2 changed files with 7 additions and 2 deletions

View File

@ -43,6 +43,9 @@
Values](https://unicode.org/glossary/#unicode_scalar_value) only, including
values used in string escapes (`\u{}`). All KDL documents and string values
should be valid UTF-8 now, as was intended.
* The last node in a child block no longer needs to be terminated with `;`,
even if the closing `}` is on the same line, so this is now a legal node:
`node {foo;bar;baz}`
### KQL

View File

@ -527,9 +527,11 @@ node-space := plain-node-space+ ('/-' plain-node-space* (node-prop-or-arg | node
required-node-space := node-space* plain-node-space+
optional-node-space := node-space*
node := type? identifier (required-node-space node-prop-or-arg)* (required-node-space node-children)? optional-node-space node-terminator
base-node := type? identifier (required-node-space node-prop-or-arg)* (required-node-space node-children)?
node := base-node optional-node-space node-terminator
final-node := base-node optional-node-space node-terminator?
node-prop-or-arg := prop | value
node-children := '{' nodes '}'
node-children := '{' nodes final-node? '}'
node-terminator := single-line-comment | newline | ';' | eof
identifier := string | bare-identifier