From 6c6a3f6bd3d42afeabfb9934ad6b056923b13433 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 23 Feb 2020 19:46:54 +0100 Subject: [PATCH] syntax: spec: colorize the date and author of changelog items differently Also, remove superfluous parentheses, add missing edge-of-word markers, correct the "ppciseries" keyword, and fold some regexes (or elements of them) together. --- syntax/spec.nanorc | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/syntax/spec.nanorc b/syntax/spec.nanorc index c406d13f..582fe427 100644 --- a/syntax/spec.nanorc +++ b/syntax/spec.nanorc @@ -4,20 +4,17 @@ syntax spec "\.spec(\.[^/]+)?$" comment "#" # Main tags. -color brightblue "((Icon|ExclusiveOs|ExcludeOs)[[:space:]]*:)" -color brightblue "((BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch)[[:space:]]*:)" -color brightblue "((Conflicts|Obsoletes|Provides|Requires|Requires\(.*\)|Enhances|Suggests|BuildConflicts|BuildRequires|Recommends|PreReq|Supplements)[[:space:]]*:)" -color brightblue "((Epoch|Serial|Nosource|Nopatch)[[:space:]]*:)" -color brightblue "((AutoReq|AutoProv|AutoReqProv)[[:space:]]*:)" -color brightblue "((Copyright|License|Summary|Summary\(.*\)|Distribution|Vendor|Packager|Group|BuildRoot|Prefix)[[:space:]]*:)" -color brightblue "((Name|Version|Release|Url|URL)[[:space:]]*:)" +color brightblue "\<(BuildArch(itectures)?|Exclusive(Arch|OS)|Exclude(Arch|OS))[[:space:]]*:" +color brightblue "\<(Conflicts|Enhances|Obsoletes|Provides|Requires(\(.*\))?|Recommends|Suggests|Supplements|BuildConflicts|BuildRequires|PreReq)[[:space:]]*:" +color brightblue "\<(Epoch|Icon|Nosource|Nopatch|Serial)[[:space:]]*:" +color brightblue "\<(AutoReq|AutoProv|AutoReqProv)[[:space:]]*:" +color brightblue "\<(Copyright|License|Summary(\(.*\))?|Distribution|Vendor|Packager|Group|BuildRoot|Prefix)[[:space:]]*:" +color brightblue "\<(Name|Version|Release|URL|Url)[[:space:]]*:" color brightblue "\<(Source|Patch)[0-9]*[[:space:]]*:" # Architectures. -color brightred "(i386|i486|i586|i686|athlon|ia64|alpha|alphaev5|alphaev56|alphapca56|alphaev6|alphaev67|sparc|sparcv9|sparc64armv3l|armv4b|armv4lm|ips|mipsel|ppc|ppc|iseries|ppcpseries|ppc64|m68k|m68kmint|Sgi|rs6000|i370|s390x|s390|noarch)" -# Architecture conditionals. -color brightred "%(ifarch|ifnarch|elifarch)" -# OS conditionals. -color brightred "%(ifos|ifnos|elifos)" +color brightred "\<(i386|i486|i586|i686|athlon|ia64|alpha|alphaev5|alphaev56|alphapca56|alphaev6|alphaev67|sparc|sparcv9|sparc64armv3l|armv4b|armv4lm|ips|mipsel|ppc|ppciseries|ppcpseries|ppc64|m68k|m68kmint|Sgi|rs6000|i370|s390x?|noarch)\>" +# Architecture and OS conditionals. +color brightred "%(ifarch|elifarch|ifnarch|ifos|elifos|ifnos)\>" # %* strings. color green "%([A-Z_a-z_0-9_]*)" color magenta "%_([A-Z_a-z_0-9_]*)" @@ -25,19 +22,19 @@ color yellow start="%__" end="\ " color magenta start="%\{" end="\}" color yellow start="%\{__" end="\}" # Sections. -color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|pretrans|preun)" -color red "^%(post|posttrans|postun|trigger|triggerprein|triggerin|triggerun|triggerpostun|verifyscript)" -color red "^%(filetriggerin|filetriggerpostun|filetriggerun|transfiletriggerin|transfiletriggerpostun|transfiletriggerun)" +color red "^%(build$|changelog|check$|clean$|description|files|install$|package|prep$)" +color red "^%((pre|post)(trans|un)?|trigger(prein|in|un|postun)?|verifyscript)" +color red "^%(trans)?filetrigger(in|un|postun)?" color red "^%(sourcelist|patchlist|generate_buildrequires)" # Conditionals and defines. -color brightred "%(if|elif|else|endif|define|global|undefine)" +color brightred "%(if|elif|else|endif|define|global|undefine)\>" # Comments. -color cyan "#.*" -color cyan "%dnl[[:space:]].*" +color cyan "(#|%dnl[[:space:]]).*" # Special case: "# norootforbuild" is handled as main tag. color brightblue "^# norootforbuild" -# Date-plus-author headers of %changelog entries. -color brightyellow "^\* .+>" +# First the author, then just the date of %changelog entries. +color yellow "^\* .+>" +color brightyellow "^\* [[:alnum:] ]+ [0-9]{4} " # Trailing whitespace. color ,green "[[:space:]]+$"