[gtksourceview] sh.lang: fix variable definition in conditions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] sh.lang: fix variable definition in conditions
- Date: Mon, 7 Oct 2019 20:05:06 +0000 (UTC)
commit 499977f11f9e616bbc0c995286cf2eb570950102
Author: Vlasta Vesely <vlastavesely protonmail ch>
Date: Mon Oct 7 08:52:15 2019 +0200
sh.lang: fix variable definition in conditions
data/language-specs/sh.lang | 2 +-
tests/syntax-highlighting/file.sh | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/data/language-specs/sh.lang b/data/language-specs/sh.lang
index b4f8be3a..f8e244b7 100644
--- a/data/language-specs/sh.lang
+++ b/data/language-specs/sh.lang
@@ -202,7 +202,7 @@
</context>
<context id="variable-definition">
- <match>(^\s*|(?<=then|else|do|export)\s+)([a-zA-Z_][a-zA-Z0-9_]*)\=</match>
+ <match>(^\s*|(?<=if|then|else|do|export|&&|\|\||\|)\s+)([a-zA-Z_][a-zA-Z0-9_]*)\=</match>
<include>
<context sub-pattern="2" style-ref="variable-definition"/>
</include>
diff --git a/tests/syntax-highlighting/file.sh b/tests/syntax-highlighting/file.sh
index 10d63923..93dfb410 100644
--- a/tests/syntax-highlighting/file.sh
+++ b/tests/syntax-highlighting/file.sh
@@ -29,3 +29,8 @@ xxx${x#$HOME}xxx
xxx${x##*/}xxx
xxx${x#*}xxx
xxx${x#"*"}xxx
+
+# Variable definitions
+var=val
+if var=$(cmd); then some; fi
+test -f xxx && var=xxx || var=yyy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]