[gtksourceview: 1/2] sh.lang: Fix short parameter expansion
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 1/2] sh.lang: Fix short parameter expansion
- Date: Tue, 1 Jun 2021 17:44:55 +0000 (UTC)
commit 50e4a47c6a80d3ab7f041983f0fcffe8f4906dc1
Author: Gaƫl Bonithon <gael xfce org>
Date: Tue Jun 1 18:12:28 2021 +0200
sh.lang: Fix short parameter expansion
`\%{identifier}` must match first for the parameter names starting with
'_' to be properly highlighted.
data/language-specs/sh.lang | 2 +-
tests/syntax-highlighting/file.sh | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/data/language-specs/sh.lang b/data/language-specs/sh.lang
index b574243a..ee2d1236 100644
--- a/data/language-specs/sh.lang
+++ b/data/language-specs/sh.lang
@@ -427,7 +427,7 @@
</context>
<context id="short-parameter-expansion" style-ref="variable" class="no-spell-check">
- <match>\$(\%{special-parameter}|\%{identifier})</match>
+ <match>\$(\%{identifier}|\%{special-parameter})</match>
</context>
<context id="parameter-expansion" style-ref="def:statement" style-inside="true" class="no-spell-check">
diff --git a/tests/syntax-highlighting/file.sh b/tests/syntax-highlighting/file.sh
index 90586387..13964ab8 100644
--- a/tests/syntax-highlighting/file.sh
+++ b/tests/syntax-highlighting/file.sh
@@ -10,6 +10,7 @@ xxx${var\
xxx$0000 # One digit parameter
xxx$-xxx xxx$$xxx xxx$@xxx # Special parameters
+xxx$_param-xxx # Starting with '_'
xxx${!array[@]}xxx${#array[-1]}xxx${array[0x1+var/2*$(cmd)]/a/b}xxx # Arrays
xxx${parameter:-word}xxx${parameter-word}xxx # Use Default Values
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]