2017-12-25 15:50:14 +01:00
|
|
|
## Syntax highlighting for Javascript.
|
2014-05-16 20:21:34 +00:00
|
|
|
|
2018-02-07 11:25:46 +01:00
|
|
|
syntax javascript "\.js$"
|
2016-05-25 22:13:50 +02:00
|
|
|
comment "//"
|
2014-05-16 20:21:34 +00:00
|
|
|
|
2017-12-25 15:50:14 +01:00
|
|
|
# Declarational stuff.
|
2017-12-18 14:26:21 -05:00
|
|
|
color green "\<(async|class|const|extends|function|let|this|typeof|var|void)\>"
|
2017-12-25 15:50:14 +01:00
|
|
|
# Flow control and special keywords.
|
2017-12-25 15:40:05 +01:00
|
|
|
color brightyellow "\<(do|while|if|else|switch|case|default|for|each|in|of|with)\>"
|
|
|
|
color brightyellow "\<(await|export|import|throw|try|catch|finally|new|delete)\>"
|
2017-12-25 15:50:14 +01:00
|
|
|
# "Exit" points.
|
2017-12-25 15:40:05 +01:00
|
|
|
color magenta "\<(break|continue|return|yield)\>"
|
2014-03-24 12:39:58 +00:00
|
|
|
|
2017-12-25 15:50:14 +01:00
|
|
|
# Octal/decimal and hexadecimal numbers.
|
2019-11-04 20:49:17 +02:00
|
|
|
color cyan "\<([0-9]+|0x[0-9A-Fa-f]+)\>"
|
2019-10-23 10:00:55 +02:00
|
|
|
# Special values.
|
2019-11-03 19:49:22 +02:00
|
|
|
color cyan "\<(true|false|null|undefined)\>"
|
2017-12-25 15:50:14 +01:00
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Strings.
|
2017-12-25 15:40:05 +01:00
|
|
|
color brightmagenta ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
|
2014-05-16 20:21:34 +00:00
|
|
|
# Comments.
|
2017-12-25 15:25:04 +01:00
|
|
|
color brightblue "(^|[[:space:]])//.*"
|
2014-03-24 12:39:58 +00:00
|
|
|
color brightblue start="/\*" end="\*/"
|
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Trailing whitespace.
|
2014-03-24 12:39:58 +00:00
|
|
|
color ,green "[[:space:]]+$"
|