aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_sh.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-11-15 12:11:21 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-11-15 12:11:21 +0100
commit9042f2c36a6b3729ce472d55447d2fe5964cb2ce (patch)
tree5f1e8ebfba34b68700bc04422f7aa0299118877a /plugins/language_sh.lua
parent2069fd8e14ba8224c4f040b4e2b0f2ec0000743f (diff)
downloadlite-xl-plugins-9042f2c36a6b3729ce472d55447d2fe5964cb2ce.tar.gz
lite-xl-plugins-9042f2c36a6b3729ce472d55447d2fe5964cb2ce.zip
Fix language_sh with $ string interpolation and '#'
When an expansion like "${#arr[@]}" is met the par after # was interpreted as a comment. Move the pattern for dollar/brace expansion befor the pattern for comments to avoid the problem.
Diffstat (limited to 'plugins/language_sh.lua')
-rw-r--r--plugins/language_sh.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua
index 9159f3b..a44b212 100644
--- a/plugins/language_sh.lua
+++ b/plugins/language_sh.lua
@@ -9,6 +9,7 @@ syntax.add {
-- $# is a bash special variable and the '#' shouldn't be interpreted
-- as a comment.
{ pattern = "$[%a_@*#][%w_]*", type = "keyword2" },
+ { pattern = "${.-}", type = "keyword2" },
{ pattern = "#.*\n", type = "comment" },
{ pattern = [[\.]], type = "normal" },
{ pattern = { '"', '"', '\\' }, type = "string" },
@@ -17,7 +18,6 @@ syntax.add {
{ pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" },
{ pattern = "[!<>|&%[%]=*]", type = "operator" },
{ pattern = "%f[%S]%-[%w%-_]+", type = "function" },
- { pattern = "${.-}", type = "keyword2" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {