[gtksourceview] css.lang: Add highlighting for :lang() and :not() arguments
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] css.lang: Add highlighting for :lang() and :not() arguments
- Date: Fri, 18 May 2018 09:26:29 +0000 (UTC)
commit 020ca81a465d49cb116c7a688ccb5b0f51e52564
Author: Jeffery To <jeffery to gmail com>
Date: Fri May 11 08:00:23 2018 +0800
css.lang: Add highlighting for :lang() and :not() arguments
This adds contexts to highlight the parentheses and arguments of :lang()
and :not().
https://bugzilla.gnome.org/show_bug.cgi?id=796130
data/language-specs/css.lang | 44 ++++++++++++++++++++++++++++++++++++
tests/syntax-highlighting/file.css | 12 +++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index b92d596..ee2f345 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -1677,6 +1677,47 @@
<keyword>visited</keyword>
</context>
+ <context id="lang-selector-argument">
+ <start>(?<=:lang)\(</start>
+ <end>\)</end>
+ <include>
+ <context sub-pattern="0" where="start" style-ref="function"/>
+ <context sub-pattern="0" where="end" style-ref="function"/>
+ <context ref="comment"/>
+ </include>
+ </context>
+
+ <context id="not-selector-nested-not-without-argument-error" style-ref="error">
+ <match>:not(?!\()</match>
+ </context>
+
+ <context id="not-selector-nested-not-with-argument-error" style-ref="error">
+ <start>:not\(</start>
+ <end>\)</end>
+ </context>
+
+ <context id="not-selector-argument">
+ <start>(?<=:not)\(</start>
+ <end>\)</end>
+ <include>
+ <context sub-pattern="0" where="start" style-ref="function"/>
+ <context sub-pattern="0" where="end" style-ref="function"/>
+ <context ref="comment"/>
+ <context ref="not-selector-nested-not-without-argument-error"/>
+ <context ref="not-selector-nested-not-with-argument-error"/>
+ <context ref="namespace-qualifier"/>
+ <context ref="selector-grammar"/>
+ <context ref="selector-id"/>
+ <context ref="selector-class"/>
+ <context ref="selector-tagname"/>
+ <context ref="attribute-selector"/>
+ <context ref="selector-vendor-specific-pseudo-elements-classes"/>
+ <context ref="selector-pseudo-classes"/>
+ <context ref="lang-selector-argument"/>
+ <context ref="selector-nth-argument"/>
+ </include>
+ </context>
+
<context id="selector-nth-argument-keywords" style-ref="property-values">
<keyword>even</keyword>
<keyword>odd</keyword>
@@ -1692,6 +1733,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="function"/>
<context sub-pattern="0" where="end" style-ref="function"/>
+ <context ref="comment"/>
<context ref="selector-nth-argument-keywords"/>
<context ref="selector-nth-argument-An-plus-B"/>
</include>
@@ -1709,6 +1751,8 @@
<context ref="selector-pseudo-elements-one-colon"/>
<context ref="selector-pseudo-elements"/>
<context ref="selector-pseudo-classes"/>
+ <context ref="lang-selector-argument"/>
+ <context ref="not-selector-argument"/>
<context ref="selector-nth-argument"/>
<context ref="comma"/>
</include>
diff --git a/tests/syntax-highlighting/file.css b/tests/syntax-highlighting/file.css
index 6945156..6bf633c 100644
--- a/tests/syntax-highlighting/file.css
+++ b/tests/syntax-highlighting/file.css
@@ -38,6 +38,18 @@ p + div {
ul::before {}
+:lang(fr) > q {
+ quotes: '« ' ' »';
+}
+
+p:not(.fancy) {
+ color: green;
+}
+
+body :not(p) {
+ text-decoration: underline;
+}
+
li:nth-child(2n+1) {}
link:hover {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]