[gtksourceview: 1/2] sh.lang: Fix function syntax highlighting
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 1/2] sh.lang: Fix function syntax highlighting
- Date: Mon, 3 Feb 2020 17:15:52 +0000 (UTC)
commit 6a9d996453ef0bd304fab36c23c684b0ac72daec
Author: Johannes Wolf <mail johannes-wolf com>
Date: Fri Jan 31 21:56:58 2020 +0100
sh.lang: Fix function syntax highlighting
* Allow space inside parentheses
* Make parentheses for declarations using the `function` keyword
optional
data/language-specs/sh.lang | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/data/language-specs/sh.lang b/data/language-specs/sh.lang
index d3c63002..88adc473 100644
--- a/data/language-specs/sh.lang
+++ b/data/language-specs/sh.lang
@@ -264,7 +264,17 @@
</context>
<context id="function" style-ref="function">
- <match>\%{lb}\%{command-name}\s*\(\)</match>
+ <!-- Function declaration with or without function keyword.
+ For the later one, parentheses are mandatory -->
+ <match extended="true">
+ \%{lb}(?:
+ (function)\s+\%{command-name}\s*(\(\s*\))? |
+ \%{command-name}\s*\(\s*\)
+ )
+ </match>
+ <include>
+ <context sub-pattern="1" style-ref="keyword"/>
+ </include>
</context>
<context id="redirection" style-ref="others">
@@ -529,7 +539,6 @@
<keyword>elif</keyword>
<keyword>else</keyword>
<keyword>fi</keyword>
- <keyword>function</keyword>
<keyword>if</keyword>
<keyword>in</keyword>
<keyword>select</keyword>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]