[gtksourceview] sh.lang: Add semicolon separated variable definitions



commit 74d749a81564b770cfafc4c0c04f58afc685930f
Author: neyfag <11970-neyfag users noreply gitlab gnome org>
Date:   Mon Oct 28 23:31:20 2019 +0100

    sh.lang: Add semicolon separated variable definitions

 data/language-specs/sh.lang       | 2 +-
 tests/syntax-highlighting/file.sh | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/data/language-specs/sh.lang b/data/language-specs/sh.lang
index a53a9b05..dc123d58 100644
--- a/data/language-specs/sh.lang
+++ b/data/language-specs/sh.lang
@@ -202,7 +202,7 @@
     </context>
 
     <context id="variable-definition">
-      <match>(^\s*|(?&lt;=if|then|else|do|export|&amp;&amp;|\|\||\|)\s+)([a-zA-Z_][a-zA-Z0-9_]*)\=</match>
+      
<match>(^\s*|(?&lt;=if|then|else|do|export)\s+|(?&lt;=&amp;&amp;|\|\||\||;)\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 d488950f..c424142a 100644
--- a/tests/syntax-highlighting/file.sh
+++ b/tests/syntax-highlighting/file.sh
@@ -31,10 +31,12 @@ xxx${x#*}xxx
 xxx${x#"*"}xxx
 
 # Variable definitions
-var=val
+var1=val1; var2=val2
 if var=$(cmd); then some; fi
 test -f xxx && var=xxx || var=yyy
+echo text | var=xxx cmd
 
+# For statements
 for word in hello world
 do
     echo $word


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]