From 2f216281e737bcc6e3e9ed96ae87e9ed6e6ba188 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 3 Oct 2021 15:22:31 +0200 Subject: [PATCH] syntax: yaml: allow slash and period in key names Some Yaml files use path names and sometimes version numbers as keys, even though / and . are not officially in the character set allowed for key names (just like underscore is not), as far as I understand. Also, do not colorize any backslash escapes as invalid because some of them occur sometimes in value strings. Also, colorize only the valid double-exclamation tags. --- syntax/yaml.nanorc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/syntax/yaml.nanorc b/syntax/yaml.nanorc index a8ef08f2..d6965085 100644 --- a/syntax/yaml.nanorc +++ b/syntax/yaml.nanorc @@ -10,8 +10,8 @@ tabgives " " comment "#" # Keys: -color lightgreen "(\w|::|-)+:( |$)" -color lightgreen "\[(\w|::|[, -])+\]:( |$)" +color lightgreen "(\w|::|[/.-])+:( |$)" +color lightgreen "\[(\w|::|[/., -])+\]:( |$)" # Values (booleans, numbers, octal/hex): color lightmagenta "[:,] +(Y(es)?|No?|y(es)?|no?|[Tt]rue|[Ff]alse|[Oo](n|ff))( *[]}]|, | +#|$)" @@ -33,11 +33,10 @@ color yellow "[]{}[]" color normal "^ *: " # Tags: -color mint " !!(binary|bool|float|int|map|null|omap|seq|set|str)( |$)" -color mint " ![^ ]+( |$)" +color mint " !!(binary|bool|float|int|map|null|omap|seq|set|str)( |,|$)" +color mint " ![^! ][^ ]*( |$)" -# Escaped characters (first color all as bad, then recolor the good ones): -color lightwhite,red "\\." +# Escaped characters: color orange "\\([0abefnrtv"/ \_NLP]|$)" color orange "\\(x[[:xdigit:]]{2}|u[[:xdigit:]]{4}|U[[:xdigit:]]{8})"