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.
master
Benno Schulenberg 2021-10-03 15:22:31 +02:00
parent 9459030d66
commit 2f216281e7
1 changed files with 5 additions and 6 deletions

View File

@ -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})"