[gtksourceview/gnome-3-24] ruby.lang: fix highlighting numbers in ranges
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gnome-3-24] ruby.lang: fix highlighting numbers in ranges
- Date: Mon, 6 Jan 2020 21:57:46 +0000 (UTC)
commit 3ee2980e19e286903228e68911cc52d9657064fc
Author: Vlasta Vesely <vlastavesely protonmail ch>
Date: Sat Jan 4 14:02:18 2020 +0100
ruby.lang: fix highlighting numbers in ranges
data/language-specs/ruby.lang | 12 ++++++------
tests/syntax-highlighting/file.rb | 8 ++++++++
2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/data/language-specs/ruby.lang b/data/language-specs/ruby.lang
index ff2625b2..c9a5b95c 100644
--- a/data/language-specs/ruby.lang
+++ b/data/language-specs/ruby.lang
@@ -386,27 +386,27 @@
</define-regex>
<context id="float" style-ref="floating-point">
- <match>(?<![\w\.])\%{float}(?![\w\.])</match>
+ <match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))\%{float}((?![\w\.])|(?=\.\.))(?!\.\.\.\.)</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\.])|(?=\.\.))(?!\.\.\.\.)</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\.])|(?=\.\.))(?!\.\.\.\.)</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\.])|(?=\.\.))(?!\.\.\.\.)</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\.])|(?=\.\.))(?!\.\.\.\.)</match>
</context>
<context id="numeric-literal" style-ref="numeric-literal">
- <match>(?<![\w\.])\?((\\[MC]-){1,2}|\\?)\S</match>
+ <match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))\?((\\[MC]-){1,2}|\\?)\S</match>
</context>
<!-- in double quotes and backticks -->
diff --git a/tests/syntax-highlighting/file.rb b/tests/syntax-highlighting/file.rb
index 04f71244..2d243f15 100644
--- a/tests/syntax-highlighting/file.rb
+++ b/tests/syntax-highlighting/file.rb
@@ -1,3 +1,11 @@
#!/usr/bin/env ruby
#
puts "\141" # Shows 'a'
+
+str = 'lorem'
+puts str[1..3] # 'ore'
+
+# 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
+11....111, 0x11......0x11, 1.1.....1.2 # 4 (and more) dots are not a valid range
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]