[gtksourceview/gnome-3-24] ruby.lang: fix highlighting of number methods
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gnome-3-24] ruby.lang: fix highlighting of number methods
- Date: Mon, 6 Jan 2020 21:57:51 +0000 (UTC)
commit 4230b90f9f89b1c4d5537b6c2d00590aae3d2eb8
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>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))\%{float}((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))\%{float}((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
</context>
<context id="decimal" style-ref="decimal">
-
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))([1-9](_?[0-9])*|0)((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))([1-9](_?[0-9])*|0)((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
</context>
<context id="hex" style-ref="base-n-integer">
-
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))0[xX][0-9A-Fa-f](_?[0-9A-Fa-f])*((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))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>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))0[0-7](_?[0-7])*((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))0[0-7](_?[0-7])*((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
</context>
<context id="binary" style-ref="base-n-integer">
-
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))0[bB][01](_?[01])*((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</match>
+
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))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]