From cc45c9856282e37abed8aa3434e9ef490fb56295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Mon, 14 Dec 2020 20:54:04 -0800 Subject: [PATCH] spec out slashdash comments Fixes: https://github.com/kdl-org/kdl/issues/22 --- README.md | 16 ++++++++++++++++ SPEC.md | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cc90509..3c09c92 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,22 @@ bignum 1_000_000 my-hex 0xdeadbeef my-octal 0o755 my-binary 0b1010_1101 + +// You can comment out individual nodes with /-. In the case below, everything +// up until the closing `}` becomes commented. +/-mynode "foo" key=1 { + a + b + c +} + +// You can apply /- ("slashdash") comments to individual values, properties, +// or child blocks, too: +mynode /-"commented" "not commented" /-key="value" /-{ + a + b +} + ``` The following SDLang features are removed altogether: diff --git a/SPEC.md b/SPEC.md index 5b0d86f..a6f8491 100644 --- a/SPEC.md +++ b/SPEC.md @@ -45,8 +45,9 @@ linespace := newline | ws | single-line-comment newline := ('\r' '\n') | '\n' -ws := bom | ' ' | '\t' | multi-line-comment +ws := bom | ' ' | '\t' | multi-line-comment | slashdash-comment single-line-comment := '//' ('\r' [^\n] | [^\r\n])* newline multi-line-comment := '/*' ('*' [^\/] | [^*])* '*/' +slashdash-comment := '/-' (node | value | prop | node-children) ```