[gtksourceview: 2/4] scss.lang, less.lang: Rename subpatterns, use one DEFINE section



commit e90eae1ba4dc66d5d43a6f00107f2fec5195bf25
Author: Jeffery To <jeffery to gmail com>
Date:   Tue Jan 21 02:16:42 2020 +0800

    scss.lang, less.lang: Rename subpatterns, use one DEFINE section

 data/language-specs/less.lang | 46 +++++++++++++++-----------------------
 data/language-specs/scss.lang | 52 +++++++++++++++++--------------------------
 2 files changed, 39 insertions(+), 59 deletions(-)
---
diff --git a/data/language-specs/less.lang b/data/language-specs/less.lang
index b65ffca5..2f483944 100644
--- a/data/language-specs/less.lang
+++ b/data/language-specs/less.lang
@@ -397,29 +397,23 @@
 
     <context id="less-declaration-value">
       <start extended="true">
-        (?(DEFINE) (?&lt;escape_comment_start&gt; (?: \\ /\* )+ ) )
-        (?(DEFINE) (?&lt;escape&gt;               (?: \\ .   )+ ) )
+        (?(DEFINE)
+          (?&lt;escape_comment_start&gt; (?: \\ /\* )+ )
+          (?&lt;escape&gt;               (?: \\ .   )+ )
 
-        (?(DEFINE) (?&lt;escape_not_interpolation_start&gt; (?: \\ (?! @{ ) . )+ ) )
+          (?&lt;escape_not_interpolation_start&gt; (?: \\ (?! @{ ) . )+ )
 
-        (?(DEFINE)
           (?&lt;interpolation_start_chars&gt;
             (?: (?: @ (?! { ) )+ | (?: (?&lt;! @ ) { )+ )
           )
-        )
-        (?(DEFINE)
           (?&lt;comment_start_chars&gt;
             (?: (?: / (?! \* ) )+ | (?: (?&lt;! / ) \* )+ )
           )
-        )
-        (?(DEFINE)
           (?&lt;comment_end_chars&gt;
             (?: (?: \* (?! / ) )+ | (?: (?&lt;! \* ) / )+ )
           )
-        )
 
-        (?(DEFINE)
-          (?&lt;interpolation&gt;  # recursive subpattern to find matching brackets
+          (?&lt;interpolation&gt;  # recursive subpattern to find matching braces
             @{
             (?:
               (?&gt;
@@ -433,8 +427,7 @@
             )*
             }
           )
-        )
-        (?(DEFINE)
+
           (?&lt;parentheses&gt;  # recursive subpattern to find matching parentheses
             \(
             (?:
@@ -447,15 +440,14 @@
                 )+
               ) |
               (?&amp;parentheses) |
-              (?&amp;comment) |
-              (?&amp;double_quotes) |
-              (?&amp;single_quotes)
+              (?&amp;multiline_comment) |
+              (?&amp;double_quote_string) |
+              (?&amp;single_quote_string)
             )*
             \)
           )
-        )
-        (?(DEFINE)
-          (?&lt;comment&gt;  # subpattern to find matching comment delimiters
+
+          (?&lt;multiline_comment&gt;  # subpattern to find matching comment delimiters
             /\*
             (?:
               (?&gt;
@@ -468,9 +460,8 @@
             )*
             \*/
           )
-        )
-        (?(DEFINE)
-          (?&lt;double_quotes&gt;  # subpattern to find matching double quotes
+
+          (?&lt;double_quote_string&gt;  # subpattern to find matching double quotes
             "
             (?:
               (?&gt;
@@ -484,9 +475,8 @@
             )*
             "
           )
-        )
-        (?(DEFINE)
-          (?&lt;single_quotes&gt;  # subpattern to find matching single quotes
+
+          (?&lt;single_quote_string&gt;  # subpattern to find matching single quotes
             '
             (?:
               (?&gt;
@@ -523,9 +513,9 @@
                   )+
                 ) |
                 (?&amp;parentheses) |
-                (?&amp;comment) |
-                (?&amp;double_quotes) |
-                (?&amp;single_quotes)
+                (?&amp;multiline_comment) |
+                (?&amp;double_quote_string) |
+                (?&amp;single_quote_string)
               )*
               \%{css:declaration-value-end}     #   with a semicolon or at the end of a block
             )
diff --git a/data/language-specs/scss.lang b/data/language-specs/scss.lang
index d52b325c..63ffa8e9 100644
--- a/data/language-specs/scss.lang
+++ b/data/language-specs/scss.lang
@@ -408,28 +408,22 @@
 
     <context id="scss-declaration-value">
       <start extended="true">
-        (?(DEFINE) (?&lt;escape_interpolation_start&gt; (?: \\ \#{ )+ ) )
-        (?(DEFINE) (?&lt;escape_comment_start&gt;       (?: \\ /\* )+ ) )
-        (?(DEFINE) (?&lt;escape&gt;                     (?: \\ .   )+ ) )
-
         (?(DEFINE)
+          (?&lt;escape_interpolation_start&gt; (?: \\ \#{ )+ )
+          (?&lt;escape_comment_start&gt;       (?: \\ /\* )+ )
+          (?&lt;escape&gt;                     (?: \\ .   )+ )
+
           (?&lt;interpolation_start_chars&gt;
             (?: (?: \# (?! { ) )+ | (?: (?&lt;! \# ) { )+ )
           )
-        )
-        (?(DEFINE)
           (?&lt;comment_start_chars&gt;
             (?: (?: / (?! \* ) )+ | (?: (?&lt;! / ) \* )+ )
           )
-        )
-        (?(DEFINE)
           (?&lt;comment_end_chars&gt;
             (?: (?: \* (?! / ) )+ | (?: (?&lt;! \* ) / )+ )
           )
-        )
 
-        (?(DEFINE)
-          (?&lt;interpolation&gt;  # recursive subpattern to find matching brackets
+          (?&lt;interpolation&gt;  # recursive subpattern to find matching braces
             \#{
             (?:
               (?&gt;
@@ -444,14 +438,13 @@
               ) |
               (?&amp;interpolation) |
               (?&amp;parentheses) |
-              (?&amp;comment) |
-              (?&amp;double_quotes) |
-              (?&amp;single_quotes)
+              (?&amp;multiline_comment) |
+              (?&amp;double_quote_string) |
+              (?&amp;single_quote_string)
             )*
             }
           )
-        )
-        (?(DEFINE)
+
           (?&lt;parentheses&gt;  # recursive subpattern to find matching parentheses
             \(
             (?:
@@ -467,15 +460,14 @@
               ) |
               (?&amp;interpolation) |
               (?&amp;parentheses) |
-              (?&amp;comment) |
-              (?&amp;double_quotes) |
-              (?&amp;single_quotes)
+              (?&amp;multiline_comment) |
+              (?&amp;double_quote_string) |
+              (?&amp;single_quote_string)
             )*
             \)
           )
-        )
-        (?(DEFINE)
-          (?&lt;comment&gt;  # subpattern to find matching comment delimiters
+
+          (?&lt;multiline_comment&gt;  # subpattern to find matching comment delimiters
             /\*
             (?:
               (?&gt;
@@ -490,9 +482,8 @@
             )*
             \*/
           )
-        )
-        (?(DEFINE)
-          (?&lt;double_quotes&gt;  # subpattern to find matching double quotes
+
+          (?&lt;double_quote_string&gt;  # subpattern to find matching double quotes
             "
             (?:
               (?&gt;
@@ -507,9 +498,8 @@
             )*
             "
           )
-        )
-        (?(DEFINE)
-          (?&lt;single_quotes&gt;  # subpattern to find matching single quotes
+
+          (?&lt;single_quote_string&gt;  # subpattern to find matching single quotes
             '
             (?:
               (?&gt;
@@ -549,9 +539,9 @@
                 ) |
                 (?&amp;interpolation) |
                 (?&amp;parentheses) |
-                (?&amp;comment) |
-                (?&amp;double_quotes) |
-                (?&amp;single_quotes)
+                (?&amp;multiline_comment) |
+                (?&amp;double_quote_string) |
+                (?&amp;single_quote_string)
               )*
             )
             \%{css:declaration-value-end}     #   with a semicolon or at the end of a block


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