From 4abd966a9912441c78bc9fc0d9b803b2c0e76c40 Mon Sep 17 00:00:00 2001 From: niten94 <127052329+niten94@users.noreply.github.com> Date: Sat, 15 Feb 2025 07:54:22 +0800 Subject: [PATCH 1/2] sh.yaml: Match valid parameter expansions without braces Match parameter expansions with valid name only in shell syntax file when there are no braces. --- runtime/syntax/sh.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/sh.yaml b/runtime/syntax/sh.yaml index 6aefa0e7..3d06317e 100644 --- a/runtime/syntax/sh.yaml +++ b/runtime/syntax/sh.yaml @@ -42,7 +42,7 @@ rules: - statement: "\\s+(-[A-Za-z]+|--[a-z]+)" - identifier: "\\$\\{[0-9A-Za-z_:!%&=+#~@*^$?, .\\-\\/\\[\\]]+\\}" - - identifier: "\\$[0-9A-Za-z_:!%&=+#~@*^$?,\\-\\[\\]]+" + - identifier: "\\$([0-9_!#@*$?-]|[A-Za-z_]\\w*)" - constant.string: start: "\"" From 0985d2caddd719e248178dfee226f87341ddfe2d Mon Sep 17 00:00:00 2001 From: niten94 <127052329+niten94@users.noreply.github.com> Date: Sun, 23 Feb 2025 11:39:11 +0800 Subject: [PATCH 2/2] sh.yaml: Match parameter expansions with braces using \w --- runtime/syntax/sh.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/sh.yaml b/runtime/syntax/sh.yaml index 3d06317e..5b42e8e9 100644 --- a/runtime/syntax/sh.yaml +++ b/runtime/syntax/sh.yaml @@ -41,7 +41,7 @@ rules: # Conditional flags - statement: "\\s+(-[A-Za-z]+|--[a-z]+)" - - identifier: "\\$\\{[0-9A-Za-z_:!%&=+#~@*^$?, .\\-\\/\\[\\]]+\\}" + - identifier: "\\$\\{[\\w:!%&=+#~@*^$?, .\\-\\/\\[\\]]+\\}" - identifier: "\\$([0-9_!#@*$?-]|[A-Za-z_]\\w*)" - constant.string: