[gtksourceview] rst.lang: Fix comment parsing



commit 1a9f77c1b0979471c7a8a694476092e18b367aa1
Author: Pierre Ossman <ossman cendio se>
Date:   Fri Oct 15 17:04:40 2021 +0200

    rst.lang: Fix comment parsing
    
    Make sure continuations are handled properly.

 data/language-specs/rst.lang | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/data/language-specs/rst.lang b/data/language-specs/rst.lang
index 6aeeb4a0..aa2ae735 100644
--- a/data/language-specs/rst.lang
+++ b/data/language-specs/rst.lang
@@ -59,17 +59,20 @@
     </context>
 
     <context id="comment" style-ref="comment">
-      <start>^(\s*)\.\.(\s+).+$</start>
-      <end>^(?!(\%{1@start}  \%{2@start})|(^$))</end>
+      <start>^(\s*)\.\.\s*.+$</start>
+      <end>^(?!(\%{1@start}   )|(\s*$))</end>
     </context>
 
     <context id="comment-single" style-ref="comment">
-      <start>^(\s*)\.\.(\s*)$</start>
-      <end>x</end>
+      <start>^(\s*)\.\.\s*$</start>
+      <end>^(?!(\%{1@start}   )|(\s*$))</end>
       <include>
-        <context id="comment-single-block" style-ref="comment" end-parent="true">
-          <start>(\s*).+$</start>
-          <end>^(?!(\%{1@start}))</end>
+        <context id="comment-non-empty-block" extend-parent="false" end-parent="true">
+          <start>^(\s*)\S</start>
+          <end>^(?!(\%{1@start})|(\s*$))</end>
+        </context>
+        <context id="comment-empty-block" extend-parent="false" end-parent="true">
+          <match>^\s*$</match>
         </context>
       </include>
     </context>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]