[gtksourceview] javascript.lang: Allow \\ in bracketed groups.
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] javascript.lang: Allow \\ in bracketed groups.
- Date: Thu, 28 Jun 2018 16:59:11 +0000 (UTC)
commit 1df80221030f981b2f3fe810e98a0dde1a9b99bb
Author: Christoph Burschka <christoph burschka de>
Date: Tue Dec 22 00:56:06 2015 +0100
javascript.lang: Allow \\ in bracketed groups.
Remove look-behind assertions and add the
"escape" context inside "regex-bracketed".
https://bugzilla.gnome.org/show_bug.cgi?id=759744
data/language-specs/javascript.lang | 7 +++++--
tests/syntax-highlighting/file.js | 6 ++++++
2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/data/language-specs/javascript.lang b/data/language-specs/javascript.lang
index 2d081495..0b39a9ae 100644
--- a/data/language-specs/javascript.lang
+++ b/data/language-specs/javascript.lang
@@ -58,8 +58,11 @@
</context>
<context id="regex-bracketed" style-ref="escape" style-inside="true">
- <start>(?<!\\)[[]</start>
- <end>(?<!\\)]</end>
+ <start>\[</start>
+ <end>]</end>
+ <include>
+ <context ref="escape"/>
+ </include>
</context>
<!--contexts used in the main context-->
diff --git a/tests/syntax-highlighting/file.js b/tests/syntax-highlighting/file.js
index 78cf4ef1..75800b9a 100644
--- a/tests/syntax-highlighting/file.js
+++ b/tests/syntax-highlighting/file.js
@@ -13,6 +13,12 @@ var matches = /abc/.exec('Alphabet ... that should contain abc, right?');
a = [thing / thing, thing / thing];
x = a /b/ c / d;
+// Character groups with backslashes:
+/[ab\\]/ // a, b or \
+/[ab\]]/ // a, b or ]
+/\\[ab]/ // a or b preceded by \
+/\[ab]/ // Literally "[ab]"
+
// Template strings
// ----------------
// Template strings are delimited by back-ticks (grave accent) and
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]