[gtksourceview/gtksourceview-4-2] sh.lang: improve recognition of "case ... esac" statement
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gtksourceview-4-2] sh.lang: improve recognition of "case ... esac" statement
- Date: Wed, 25 Sep 2019 02:21:25 +0000 (UTC)
commit 6b8f1e4e4c31da16ae2e160df5c3eaf64dcfcb99
Author: neyfag <trash paradise protonmail com>
Date: Tue Sep 24 15:59:11 2019 +0000
sh.lang: improve recognition of "case ... esac" statement
data/language-specs/sh.lang | 6 +++---
tests/syntax-highlighting/file.sh | 12 ++++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/data/language-specs/sh.lang b/data/language-specs/sh.lang
index b6a80538..86702525 100644
--- a/data/language-specs/sh.lang
+++ b/data/language-specs/sh.lang
@@ -481,10 +481,10 @@
<include>
<context sub-pattern="0" where="start" style-ref="keyword"/>
<context sub-pattern="0" where="end" style-ref="keyword"/>
- <context ref="double-quoted-string"/>
- <context ref="single-quoted-string"/>
+ <context ref="variable-definition"/>
+ <define-regex id="slitem">([^)'"\s]|\\['"])+</define-regex>
<context style-ref="others">
- <match>[^\)\s]+\s*\)|;;</match>
+ <match>^\s*\%{slitem}?('[^)]+'|"[^)]+")?\%{slitem}?\s*\)|;;</match>
</context>
<context ref="sh"/>
</include>
diff --git a/tests/syntax-highlighting/file.sh b/tests/syntax-highlighting/file.sh
index 10d63923..d48dd296 100644
--- a/tests/syntax-highlighting/file.sh
+++ b/tests/syntax-highlighting/file.sh
@@ -29,3 +29,15 @@ xxx${x#$HOME}xxx
xxx${x##*/}xxx
xxx${x#*}xxx
xxx${x#"*"}xxx
+
+# Case statements
+case $item in
+[1-6]*)
+ ;;
+9[1-8])
+ ;;
+')')
+ ;;
+*)
+ ;;
+esac
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]