[gtksourceview/gtksourceview-4-8] Merge branch 'fix-sh-short-param-exp' into 'master'



commit 1112b48b18b58b545a3763274b62934eeedf5188
Author: Christian Hergert <christian hergert me>
Date:   Tue Jun 1 17:44:53 2021 +0000

    Merge branch 'fix-sh-short-param-exp' into 'master'
    
    sh.lang: Fix short parameter expansion
    
    See merge request GNOME/gtksourceview!192
    
    (cherry picked from commit 0e0afea8a51d5e8e61ff35dd607eafcc87f8da75)
    
    50e4a47c sh.lang: Fix short parameter expansion

 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]