[gtksourceview] perl.lang: Fix regular expression highlighting in statement modifiers



commit 213397759fb2b6b7ec22de82a83dfede36fcf58f
Author: Jeffery To <jeffery to gmail com>
Date:   Mon Oct 28 05:34:42 2019 +0800

    perl.lang: Fix regular expression highlighting in statement modifiers
    
    This fixes regular expression highlighting for all statement modifiers
    that accept an expression (if/unless/while/until/when), and highlights
    the modifier as a keyword instead of builtin.
    
    This also updates the lists of modifiers for regular expressions. (The
    lists are from perlop 5.30.0[1], and are copied directly with no
    alphabetical sorting.)
    
    Fixes #74.
    
    [1]: https://perldoc.perl.org/5.30.0/perlop.html

 data/language-specs/perl.lang     | 26 ++++++++++++++++++--------
 tests/syntax-highlighting/file.pl |  7 +++++++
 2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/data/language-specs/perl.lang b/data/language-specs/perl.lang
index a1cf91f8..5acb65a7 100644
--- a/data/language-specs/perl.lang
+++ b/data/language-specs/perl.lang
@@ -480,7 +480,7 @@ FIXME: =pod should require an empty line before/after, as written in perlpod
 
     <context id="regular-expression" style-ref="regex">
       <start>\%{pattern-before}qr\b</start>
-      <end>\%{end-of-pattern}[imosx]*</end>
+      <end>\%{end-of-pattern}[msixpodualn]*</end>
       <include><context ref="simple-pattern"/></include>
     </context>
 
@@ -500,19 +500,19 @@ FIXME: =pod should require an empty line before/after, as written in perlpod
 
     <context id="match" style-ref="regex">
       <start>\%{pattern-before}m\b</start>
-      <end>\%{end-of-pattern}[cgimosx]*</end>
+      <end>\%{end-of-pattern}[msixpodualngc]*</end>
       <include><context ref="simple-pattern"/></include>
     </context>
 
     <context id="substitution" style-ref="regex">
       <start>\%{pattern-before}s\b</start>
-      <end>\%{end-of-pattern}[ecgimosx]*</end>
+      <end>\%{end-of-pattern}[msixpodualngcer]*</end>
       <include><context ref="double-pattern"/></include>
     </context>
 
     <context id="transliteration" style-ref="regex">
       <start>\%{pattern-before}(tr|y)\b</start>
-      <end>\%{end-of-pattern}[cds]*</end>
+      <end>\%{end-of-pattern}[cdsr]*</end>
       <include><context ref="double-pattern-no-ve"/></include>
     </context>
 
@@ -523,8 +523,18 @@ FIXME: =pod should require an empty line before/after, as written in perlpod
     <context id="match-slashslash">
       <include>
         <context style-inside="true" style-ref="regex">
-          <start>(^|[^$@%&amp;])(split|while|if)\s+(/)</start>
-          <end>/[cgimosx]*</end>
+          <start>(^|[^$@%&amp;])(if|unless|while|until|when)\s+(/)</start>
+          <end>/[msixpodualngc]*</end>
+          <include>
+            <context sub-pattern="2" where="start" style-ref="keyword"/>
+            <context sub-pattern="3" where="start" style-ref="regex"/>
+            <context sub-pattern="0" where="end" style-ref="regex"/>
+            <context ref="in-pattern"/>
+          </include>
+        </context>
+        <context style-inside="true" style-ref="regex">
+          <start>(^|[^$@%&amp;])(split)\s+(/)</start>
+          <end>/[msixpodualngc]*</end>
           <include>
             <context sub-pattern="2" where="start" style-ref="builtin"/>
             <context sub-pattern="3" where="start" style-ref="regex"/>
@@ -534,7 +544,7 @@ FIXME: =pod should require an empty line before/after, as written in perlpod
         </context>
         <context style-inside="true" style-ref="regex">
           <start>(^|(?&lt;=[\(\{]))\s*(/)</start>
-          <end>/[cgimosx]*</end>
+          <end>/[msixpodualngc]*</end>
           <include>
             <context sub-pattern="2" where="start" style-ref="regex"/>
             <context sub-pattern="0" where="end" style-ref="regex"/>
@@ -543,7 +553,7 @@ FIXME: =pod should require an empty line before/after, as written in perlpod
         </context>
         <context style-inside="true" style-ref="regex">
           <start>([!=]\~)\s*(/)</start>
-          <end>/[cgimosx]*</end>
+          <end>/[msixpodualngc]*</end>
           <include>
             <context sub-pattern="1" where="start" style-ref="operator"/>
             <context sub-pattern="2" where="start" style-ref="regex"/>
diff --git a/tests/syntax-highlighting/file.pl b/tests/syntax-highlighting/file.pl
index 580fe183..36742a41 100644
--- a/tests/syntax-highlighting/file.pl
+++ b/tests/syntax-highlighting/file.pl
@@ -95,6 +95,13 @@ sub tsame {
     return  eq ;
 }
 
+sub login {
+  my @words = split /:/, $str;
+  do {
+    $_ = shift @members;
+  } until /^\s+$/;
+}
+
 =head1 EXAMPLE
 B<collateindex.pl> B<-o> F<index.sgml> F<HTML.index>
 =head1 EXIT STATUS


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