[gtksourceview/gtksourceview-4-2] ruby.lang: fix highlighting of number methods



commit 17077284ef270b926e4bdcf111ab209ee167776b
Author: Vlasta Vesely <vlastavesely protonmail ch>
Date:   Sat Jan 4 14:15:32 2020 +0100

    ruby.lang: fix highlighting of number methods

 data/language-specs/ruby.lang     | 10 +++++-----
 tests/syntax-highlighting/file.rb |  4 ++++
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/data/language-specs/ruby.lang b/data/language-specs/ruby.lang
index c9a5b95c..3b83c4d6 100644
--- a/data/language-specs/ruby.lang
+++ b/data/language-specs/ruby.lang
@@ -386,23 +386,23 @@
     </define-regex>
 
     <context id="float" style-ref="floating-point">
-      <match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))\%{float}((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))\%{float}((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
     </context>
 
     <context id="decimal" style-ref="decimal">
-      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))([1-9](_?[0-9])*|0)((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))([1-9](_?[0-9])*|0)((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
     </context>
 
     <context id="hex" style-ref="base-n-integer">
-      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))0[xX][0-9A-Fa-f](_?[0-9A-Fa-f])*((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))0[xX][0-9A-Fa-f](_?[0-9A-Fa-f])*((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
     </context>
 
     <context id="octal" style-ref="base-n-integer">
-      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))0[0-7](_?[0-7])*((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))0[0-7](_?[0-7])*((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
     </context>
 
     <context id="binary" style-ref="base-n-integer">
-      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))0[bB][01](_?[01])*((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+      
<match>(?&lt;!\.\.\.\.)((?&lt;![\w\.])|(?&lt;=\.\.))0[bB][01](_?[01])*((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
     </context>
 
     <context id="numeric-literal" style-ref="numeric-literal">
diff --git a/tests/syntax-highlighting/file.rb b/tests/syntax-highlighting/file.rb
index 2d243f15..e3224b73 100644
--- a/tests/syntax-highlighting/file.rb
+++ b/tests/syntax-highlighting/file.rb
@@ -5,6 +5,10 @@ puts "\141" # Shows 'a'
 str = 'lorem'
 puts str[1..3] # 'ore'
 
+# Number methods
+puts -11.to_s + ' ' + 0x11.to_s  + ' ' + 1.1.to_s + ' ' + ?a.to_s + ' ' + 1.x
+11.1aa # not a valid method name
+
 # Ranges
 11..11, 0x11..0x11, 01..07, ?a..?f, 1.1..2.2 # range incl. the last value
 11...11, 0x11...0x11, 01...07, ?a...?f, 1.1...2.2 # range excl. the last value


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