commit 7691527f35ca063b9a4050969cde73e8fc1b7993
parent 3313fac8ebd3fbd4d0166eea7fa94ee37bf43447
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 25 Oct 2021 12:31:02 +0200
tweaks: remove redundant parentheses, trim comments, fold some regexes
Diffstat:
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/syntax/ruby.nanorc b/syntax/ruby.nanorc
@@ -16,20 +16,22 @@ color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|u
color magenta "([ ]|^):[0-9A-Za-z_]+\>"
# Some unique things we want to stand out.
color brightyellow "\<(__FILE__|__LINE__)\>"
+
# Regular expressions.
-color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
-# Shell command expansion is in `backticks` or like %x{this}. These are
-# "double-quotish" (to use a perlism).
-color brightblue "`[^`]*`" "%x\{[^}]*\}"
+color brightmagenta "(/([^/]|\\/)*/|%r\{([^}]|\\\})*\})[iomx]*"
+# Shell command expansion is in `backticks` or like %x{this}.
+color brightblue "`[^`]*`|%x\{[^}]*\}"
+
# Strings, double-quoted.
-color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
-# Expression substitution. These go inside double-quoted strings,
-# "like #{this}".
+color green ""([^"]|\\")*"" "%[QW]?(\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
+# Expression substitution for inside double-quoted strings, "like #{this}".
color brightgreen "#\{[^}]*\}"
# Strings, single-quoted.
-color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
+color green "'([^']|\\')*'" "%[qw](\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
+
# Comments.
-color cyan "#[^{].*" "#$"
-color brightcyan "##[^{].*" "##$"
+color cyan "#([^{].*|$)"
+color brightcyan "##([^{].*|$)"
+
# Some common markers.
color brightcyan "XXX|TODO|FIXME|\?\?\?"