[gtksourceview/gtksourceview-4-2] ruby.lang: Rename string-literal context, reuse escape regex
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gtksourceview-4-2] ruby.lang: Rename string-literal context, reuse escape regex
- Date: Wed, 8 Jan 2020 04:37:58 +0000 (UTC)
commit 9d92c9a17565f4b357145ae4905c285d2d2b146c
Author: Jeffery To <jeffery to gmail com>
Date: Wed Jan 8 04:27:26 2020 +0800
ruby.lang: Rename string-literal context, reuse escape regex
This renames the string-literal context to character-literal, and also
reuses the updated escape regex for character literals.
data/language-specs/ruby.lang | 8 ++++----
tests/syntax-highlighting/file.rb | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/data/language-specs/ruby.lang b/data/language-specs/ruby.lang
index abd6cb97..564e58f4 100644
--- a/data/language-specs/ruby.lang
+++ b/data/language-specs/ruby.lang
@@ -43,7 +43,7 @@
<style id="decimal" name="Decimal number" map-to="def:decimal"/>
<style id="base-n-integer" name="Base-N number" map-to="def:base-n-integer"/>
<style id="numeric-literal" name="Numeric literal" map-to="def:base-n-integer"/>
- <style id="string-literal" name="String literal" map-to="def:string"/>
+ <style id="character-literal" name="Character literal" map-to="def:string"/>
<style id="string" name="String" map-to="def:string"/>
<style id="literal" name="Literal" map-to="def:special-char"/>
<style id="builtin" name="Builtin" map-to="def:type"/>
@@ -439,8 +439,8 @@
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))0[bB][01](_?[01])*((?![\w\.])|(?=\.\.)|(?=\.[a-zA-Z_]))(?!\.\.\.\.)</match>
</context>
- <context id="string-literal" style-ref="string-literal">
-
<match>(?<!\.\.\.\.)((?<![\w\.])|(?<=\.\.))\?((\\[MC]-){1,2}|\\?)(x[a-fA-F0-9]{2}|[0-7]{3}|\S)</match>
+ <context id="character-literal" style-ref="character-literal">
+ <match>(?<!\w)\?(\%{escape}|[^\\\s])(?!\w)</match>
</context>
<!-- in double quotes and backticks -->
@@ -771,7 +771,7 @@
<context ref="hex"/>
<context ref="octal"/>
<context ref="binary"/>
- <context ref="string-literal"/>
+ <context ref="character-literal"/>
<context ref="regex-alt-form"/>
<context ref="regex-simple"/>
<context ref="non-interpolated-literal"/>
diff --git a/tests/syntax-highlighting/file.rb b/tests/syntax-highlighting/file.rb
index 0d20ea0f..b6440835 100644
--- a/tests/syntax-highlighting/file.rb
+++ b/tests/syntax-highlighting/file.rb
@@ -31,9 +31,9 @@ puts -11.to_s + ' ' + 0x11.to_s + ' ' + 1.1.to_s + ' ' + ?a.to_s + ' ' + 1.x
# Ranges
11..11, 0x11..0x11, 01..07, ?a..?f, 1.1..2.2 # range incl. the last value
-11...11, 0x11...0x11, 01...07, ?x40...?\101, 1.1...2.2 # range excl. the last value
+11...11, 0x11...0x11, 01...07, ?\x40...?\101, 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
-# String literals
+# Character literals
str = ?\x41 + ?\101 # == 'AA'
puts ?\M-\C-x
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]