[gtksourceview: 1/4] css.lang (and family): Define own comment contexts
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 1/4] css.lang (and family): Define own comment contexts
- Date: Fri, 29 Nov 2019 16:56:32 +0000 (UTC)
commit e0c1dbb68706aeca387fd97fc6c701a2e6c72ae2
Author: Jeffery To <jeffery to gmail com>
Date: Fri Nov 29 06:34:25 2019 +0800
css.lang (and family): Define own comment contexts
This will allow comment content to be modified without
modifying/replacing def:in-comment.
data/language-specs/css.lang | 13 +++++++++++--
data/language-specs/less.lang | 10 +++++++++-
data/language-specs/scss.lang | 19 +++++++++++++------
3 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/data/language-specs/css.lang b/data/language-specs/css.lang
index d069269d..9382f764 100644
--- a/data/language-specs/css.lang
+++ b/data/language-specs/css.lang
@@ -34,6 +34,7 @@
<styles>
<!-- global -->
+ <style id="comment" name="Comment" map-to="def:comment"/>
<style id="error" name="Error" map-to="def:error"/>
<style id="vendor-specific" name="Vendor Specific" map-to="def:warning"/>
<style id="keyword" name="Keyword" map-to="def:constant"/>
@@ -191,10 +192,18 @@
<define-regex id="test-value-end">(?=\))</define-regex>
+ <context id="multiline-comment" style-ref="comment" class-disabled="no-spell-check" class="comment">
+ <start>/\*</start>
+ <end>\*/</end>
+ <include>
+ <context ref="def:in-comment"/>
+ </include>
+ </context>
+
<context id="comment">
<include>
- <context ref="def:c-like-comment-multiline"/>
- <context ref="def:c-like-close-comment-outside-comment"/>
+ <context ref="multiline-comment"/>
+ <context ref="def:c-like-close-comment-outside-comment" style-ref="comment"/>
</include>
</context>
diff --git a/data/language-specs/less.lang b/data/language-specs/less.lang
index a74288aa..00f18921 100644
--- a/data/language-specs/less.lang
+++ b/data/language-specs/less.lang
@@ -65,9 +65,17 @@
(?: ; | (?= } ) )
</define-regex>
+ <context id="single-line-comment" style-ref="css:comment" end-at-line-end="true"
class-disabled="no-spell-check" class="comment">
+ <start>//</start>
+ <include>
+ <!-- line continuations not allowed -->
+ <context ref="def:in-comment"/>
+ </include>
+ </context>
+
<context id="less-comment">
<include>
- <context ref="def:c-like-comment"/>
+ <context ref="single-line-comment"/>
<context ref="css:comment" original="true"/>
</include>
</context>
diff --git a/data/language-specs/scss.lang b/data/language-specs/scss.lang
index c0919d66..b2c7bca7 100644
--- a/data/language-specs/scss.lang
+++ b/data/language-specs/scss.lang
@@ -64,7 +64,7 @@
<!-- global -->
- <context id="sass-c-like-comment-multiline" style-ref="def:comment" class-disabled="no-spell-check"
class="comment">
+ <context id="scss-multiline-comment" style-ref="css:comment" class-disabled="no-spell-check"
class="comment">
<start>/\*</start>
<end>\*/</end>
<include>
@@ -73,14 +73,22 @@
</include>
</context>
+ <context id="single-line-comment" style-ref="css:comment" end-at-line-end="true"
class-disabled="no-spell-check" class="comment">
+ <start>//</start>
+ <include>
+ <!-- line continuations not allowed -->
+ <context ref="def:in-comment"/>
+ </include>
+ </context>
+
<context id="scss-comment">
<include>
- <context ref="def:c-like-comment"/>
- <context ref="sass-c-like-comment-multiline"/>
- <context ref="def:c-like-close-comment-outside-comment"/>
+ <context ref="single-line-comment"/>
+ <context ref="css:comment" original="true"/>
</include>
</context>
+ <replace id="css:multiline-comment" ref="scss-multiline-comment"/>
<replace id="css:comment" ref="scss-comment"/>
@@ -227,8 +235,7 @@
<context sub-pattern="0" where="start" style-ref="css:function"/>
<context sub-pattern="0" where="end" style-ref="css:function"/>
<!-- only accept multi-line comments because // is part of urls -->
- <context ref="sass-c-like-comment-multiline"/>
- <context ref="def:c-like-close-comment-outside-comment"/>
+ <context ref="css:comment" original="true"/>
<context ref="css:string-value"/>
</include>
</context>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]