[gtksourceview: 1/2] ruby.lang: fix indented heredoc with tilde



commit dc9101ada6400784c75d49238a097bb863f88b63
Author: Vlasta Vesely <vlastavesely protonmail ch>
Date:   Fri Jan 31 12:01:50 2020 +0100

    ruby.lang: fix indented heredoc with tilde
    
    Heredocs with a tilde strip the leading whitespaces inside the
    strings.

 data/language-specs/ruby.lang     |  2 +-
 tests/syntax-highlighting/file.rb | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/data/language-specs/ruby.lang b/data/language-specs/ruby.lang
index 564e58f4..3ec0abf3 100644
--- a/data/language-specs/ruby.lang
+++ b/data/language-specs/ruby.lang
@@ -512,7 +512,7 @@
     </context>
 
     <context id="here-doc-indented-string" style-ref="here-doc" style-inside="true">
-      <start>&lt;&lt;-([a-zA-Z_]\w*)</start>
+      <start>&lt;&lt;[-~]([a-zA-Z_]\w*)</start>
       <end>^\s*\%{1@start}</end>
       <include>
         <context ref="inside-interpolated-string"/>
diff --git a/tests/syntax-highlighting/file.rb b/tests/syntax-highlighting/file.rb
index b6440835..121d8afb 100644
--- a/tests/syntax-highlighting/file.rb
+++ b/tests/syntax-highlighting/file.rb
@@ -37,3 +37,22 @@ puts -11.to_s + ' ' + 0x11.to_s  + ' ' + 1.1.to_s + ' ' + ?a.to_s + ' ' + 1.x
 # Character literals
 str = ?\x41 + ?\101 # == 'AA'
 puts ?\M-\C-x
+
+
+       # xml == '\tlorem\n\tipsum'
+       xml = <<-XML
+       lorem
+       ipsum
+       XML
+
+# xml == 'lorem\nipsum'
+xml = <<XML
+lorem
+ipsum
+XML
+
+       # strip the leading tabs; xml == 'lorem\nipsum'
+       xml = <<~XML
+       lorem
+       ipsum
+       XML


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