[gtksourceview: 3/13] css.lang: Allow comments inside An+B expressions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 3/13] css.lang: Allow comments inside An+B expressions
- Date: Wed, 11 Dec 2019 15:46:08 +0000 (UTC)
commit bd3b60aad1b568626febe69c7e286eab8d636122
Author: Jeffery To <jeffery to gmail com>
Date: Sat Nov 30 21:15:57 2019 +0800
css.lang: Allow comments inside An+B expressions
Comments are allowed on either side of the plus/minus symbol.
data/language-specs/css.lang | 42 +++++++++++++++++++++++++++++++++----
tests/syntax-highlighting/file.css | 2 +-
tests/syntax-highlighting/file.less | 2 +-
tests/syntax-highlighting/file.scss | 2 +-
4 files changed, 41 insertions(+), 7 deletions(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index 209247e4..3a709643 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -2479,12 +2479,45 @@
<keyword>odd</keyword>
</context>
+ <context id="nth-pseudo-class-argument-expression-offset-magnitude" end-parent="true">
+ <start extended="true">
+ (?<! \%{non-number-char} )
+ (?=
+ \%{integer-magnitude}
+ (?! \%{non-number-char} )
+ )
+ </start>
+ <end>\%{integer-magnitude}</end>
+ </context>
+
+ <context id="nth-pseudo-class-argument-expression-offset" end-parent="true">
+ <start>[+-]</start>
+ <end>(?=\S)</end>
+ <include>
+ <context ref="embedded-lang-hook"/>
+ <context ref="comment"/>
+ <context ref="nth-pseudo-class-argument-expression-offset-magnitude"/>
+ </include>
+ </context>
+
<context id="nth-pseudo-class-argument-expression" once-only="true" style-ref="expression">
+ <start extended="true">
+ (?<! \%{non-number-char} )
+ \%{integer}? n
+ </start>
+ <end>(?=\S)</end>
+ <include>
+ <context ref="embedded-lang-hook"/>
+ <context ref="comment"/>
+ <context ref="nth-pseudo-class-argument-expression-offset"/>
+ </include>
+ </context>
+
+ <context id="nth-pseudo-class-argument-integer-only" once-only="true" style-ref="expression">
<match extended="true">
- (
- \%{integer}? n ( \s* [+-] \s* \%{integer-magnitude} )? |
- \%{integer}
- )
+ (?<! \%{non-number-char} )
+ \%{integer}
+ (?! \%{non-number-char} )
</match>
</context>
@@ -2492,6 +2525,7 @@
<include>
<context ref="nth-pseudo-class-argument-keywords"/>
<context ref="nth-pseudo-class-argument-expression"/>
+ <context ref="nth-pseudo-class-argument-integer-only"/>
</include>
</context>
diff --git a/tests/syntax-highlighting/file.css b/tests/syntax-highlighting/file.css
index 11fc9cb8..a31674fa 100644
--- a/tests/syntax-highlighting/file.css
+++ b/tests/syntax-highlighting/file.css
@@ -68,7 +68,7 @@ ul ul { /* descendant */
:lang(fr),
:not(div#sidebar.fancy),
:nth-child(n+1),
-:nth-last-child(-2n - 30),
+:nth-last-child(-2n /* comment */ - /* comment */ 30),
:nth-of-type(5),
:nth-last-of-type(even) {
color: yellow;
diff --git a/tests/syntax-highlighting/file.less b/tests/syntax-highlighting/file.less
index f268eac3..0640f6b3 100644
--- a/tests/syntax-highlighting/file.less
+++ b/tests/syntax-highlighting/file.less
@@ -490,7 +490,7 @@ ul ul { /* descendant */
:lang(fr),
:not(div#sidebar.fancy),
:nth-child(n+1),
-:nth-last-child(-2n - 30),
+:nth-last-child(-2n /* comment */ - /* comment */ 30),
:nth-of-type(5),
:nth-last-of-type(even) {
color: yellow;
diff --git a/tests/syntax-highlighting/file.scss b/tests/syntax-highlighting/file.scss
index f31f861e..3242e224 100644
--- a/tests/syntax-highlighting/file.scss
+++ b/tests/syntax-highlighting/file.scss
@@ -515,7 +515,7 @@ ul ul { /* descendant */
:lang(fr),
:not(div#sidebar.fancy),
:nth-child(n+1),
-:nth-last-child(-2n - 30),
+:nth-last-child(-2n /* comment */ - /* comment */ 30),
:nth-of-type(5),
:nth-last-of-type(even) {
color: yellow;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]