2021-09-25 15:07:35 +03:00
|
|
|
## Syntax highlighting for YAML files.
|
|
|
|
|
|
|
|
## Original author: Benno Schulenberg
|
|
|
|
## License: GPL version 3 or newer
|
|
|
|
|
|
|
|
syntax yaml "\.ya?ml$"
|
2021-10-03 11:09:28 +03:00
|
|
|
header "^%YAML |^---( |$)"
|
2021-09-25 15:07:35 +03:00
|
|
|
|
|
|
|
tabgives " "
|
|
|
|
comment "#"
|
|
|
|
|
|
|
|
# Keys:
|
2021-10-03 16:22:31 +03:00
|
|
|
color lightgreen "(\w|::|[/.-])+:( |$)"
|
|
|
|
color lightgreen "\[(\w|::|[/., -])+\]:( |$)"
|
2021-09-25 15:07:35 +03:00
|
|
|
|
2021-10-02 18:01:15 +03:00
|
|
|
# Values (booleans, numbers, octal/hex):
|
2021-09-25 15:07:35 +03:00
|
|
|
color lightmagenta "[:,] +(Y(es)?|No?|y(es)?|no?|[Tt]rue|[Ff]alse|[Oo](n|ff))( *[]}]|, | +#|$)"
|
|
|
|
color lightmagenta "[:,] +[+-]?[0-9]+(\.([0-9]+)?)?( *[]}]|, | +#|$)"
|
2021-10-02 17:41:56 +03:00
|
|
|
color lightmagenta " 0(o[0-7]+|x[[:xdigit:]]+)( *[]}]|, | +#|$)"
|
2021-09-25 15:07:35 +03:00
|
|
|
color normal "[:,]( |$)"
|
2021-10-02 18:01:15 +03:00
|
|
|
# Values (dates, strings):
|
2021-09-25 15:07:35 +03:00
|
|
|
color lightmagenta " [12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])"
|
2021-10-02 17:41:56 +03:00
|
|
|
color lightmagenta "("([^"]|\\")+"|'[^']+')"
|
2021-09-25 15:07:35 +03:00
|
|
|
|
2021-10-03 11:41:03 +03:00
|
|
|
# Anchors and aliases:
|
2021-10-02 17:41:56 +03:00
|
|
|
color pink " [&*](\w|-)+( |$)"
|
2021-09-25 15:07:35 +03:00
|
|
|
|
|
|
|
# Symbols:
|
2021-10-03 11:09:28 +03:00
|
|
|
color bold,lagoon "^(%YAML +[1-9]\.[0-9]$|%TAG |(---|\.\.\.)( |$))"
|
|
|
|
color bold,lagoon " [|>]([1-9]?[+-]|[+-][1-9]?)?$"
|
2021-10-02 18:01:15 +03:00
|
|
|
color bold,yellow "^ *(\?|([?:] +)?-) "
|
|
|
|
color yellow "[]{}[]"
|
|
|
|
color normal "^ *: "
|
2021-09-25 15:07:35 +03:00
|
|
|
|
2021-10-03 11:41:03 +03:00
|
|
|
# Tags:
|
2021-10-03 16:22:31 +03:00
|
|
|
color mint " !!(binary|bool|float|int|map|null|omap|seq|set|str)( |,|$)"
|
|
|
|
color mint " ![^! ][^ ]*( |$)"
|
2021-09-25 15:07:35 +03:00
|
|
|
|
2021-10-03 16:22:31 +03:00
|
|
|
# Escaped characters:
|
2021-10-02 17:41:56 +03:00
|
|
|
color orange "\\([0abefnrtv"/ \_NLP]|$)"
|
|
|
|
color orange "\\(x[[:xdigit:]]{2}|u[[:xdigit:]]{4}|U[[:xdigit:]]{8})"
|
|
|
|
|
2021-09-30 18:11:36 +03:00
|
|
|
# Mistakes (control codes, trailing space):
|
|
|
|
color ,red "[[:cntrl:]]| +$"
|
2021-09-25 15:07:35 +03:00
|
|
|
|
|
|
|
# Comments:
|
|
|
|
color italic,cyan "(^| )#.*"
|