From 05eb5dfe504ded9950111e3bac6e29a472fd3d01 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 27 Nov 2024 16:09:16 +0900 Subject: [PATCH 1/3] Restrict path pattern with full-match --- kdl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kdl.yaml b/kdl.yaml index 61989fd..eb82963 100644 --- a/kdl.yaml +++ b/kdl.yaml @@ -1,7 +1,7 @@ filetype: 'kdl' detect: - filename: "\\.kdl" + filename: "\\.kdl$" rules: # Punctuation From 74c7aee3459e3f74d9b7eeb635537526f09fc229 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 27 Nov 2024 16:28:40 +0900 Subject: [PATCH 2/3] Consider null value --- example/official.kdl | 6 ++++++ kdl.yaml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/example/official.kdl b/example/official.kdl index 1db8a4b..bed99bb 100644 --- a/example/official.kdl +++ b/example/official.kdl @@ -30,3 +30,9 @@ package { } } } + +// https://github.com/zyedidia/micro/pull/3549 +examples-micro-3549 { + // https://github.com/zyedidia/micro/pull/3549#discussion_r1858298053 + node-null null +} diff --git a/kdl.yaml b/kdl.yaml index eb82963..b3fff7c 100644 --- a/kdl.yaml +++ b/kdl.yaml @@ -40,8 +40,10 @@ rules: # Float - constant.number: '[-+]?(\d+)\.\d*' # Boolean and inf, nan without sign + # `\s` might be better than `\b` for separators? `foo-contantish` pattern is available for KDL node - constant.bool.true: '\btrue\b' - constant.bool.false: '\bfalse\b' + - constant: '\bnull\b' # Comments - comment: start: '//' From 49487c7e7908bcc0aec6ae652c7e534a4a387c1c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 27 Nov 2024 16:40:15 +0900 Subject: [PATCH 3/3] Giveup to support Slashdash comments --- kdl.yaml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/kdl.yaml b/kdl.yaml index b3fff7c..9426c76 100644 --- a/kdl.yaml +++ b/kdl.yaml @@ -50,17 +50,7 @@ rules: end: '$' rules: - todo: '(TODO|FIXME|XXX|NOTE)' - # Slashdash comments + # Unavailable to support Slashdash comments # https://github.com/kdl-org/kdl/blob/de1dbd2c330c9193b836499db241787484627c3b/SPEC.md#L77-L79 # vscode extension realizes this with lookahead and lookbehind, the regex feature cannot be used in micro - # https://github.com/kdl-org/vscode-kdl/blob/646d7b819d72b2f0d9dd05102a305506bafa3cf6/syntaxes/kdl.tmLanguage.json#L182-L199 - # https://github.com/zyedidia/micro/issues/901#issuecomment-354931928 - # So simplified it, it means this is inaccurate - - comment.block: - start: '^\s*/-' - end: '\s' - rules: [] - - comment.block: - start: '/-{' - end: '}' - rules: [] + # It is hard to support much of the use-case, so omitted. See https://github.com/zyedidia/micro/pull/3549#discussion_r1858265630