From 7691527f35ca063b9a4050969cde73e8fc1b7993 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 25 Oct 2021 12:31:02 +0200 Subject: [PATCH] tweaks: remove redundant parentheses, trim comments, fold some regexes --- syntax/ruby.nanorc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/syntax/ruby.nanorc b/syntax/ruby.nanorc index 02de0e64..69a6e626 100644 --- 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|\?\?\?"