commit 2f216281e737bcc6e3e9ed96ae87e9ed6e6ba188
parent 9459030d66ac82779917dcf3a330bf982919acd2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 3 Oct 2021 15:22:31 +0200
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.
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git 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})"