2017-12-25 14:50:14 +00:00
|
|
|
## Syntax highlighting for Javascript.
|
2014-05-16 20:21:34 +00:00
|
|
|
|
2018-02-07 10:25:46 +00:00
|
|
|
syntax javascript "\.js$"
|
2016-05-25 20:13:50 +00:00
|
|
|
comment "//"
|
2014-05-16 20:21:34 +00:00
|
|
|
|
2017-12-25 14:50:14 +00:00
|
|
|
# Declarational stuff.
|
2017-12-18 19:26:21 +00:00
|
|
|
color green "\<(async|class|const|extends|function|let|this|typeof|var|void)\>"
|
2017-12-25 14:50:14 +00:00
|
|
|
# Flow control and special keywords.
|
2017-12-25 14:40:05 +00: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 14:50:14 +00:00
|
|
|
# "Exit" points.
|
2017-12-25 14:40:05 +00:00
|
|
|
color magenta "\<(break|continue|return|yield)\>"
|
2014-03-24 12:39:58 +00:00
|
|
|
|
2017-12-25 14:50:14 +00:00
|
|
|
# Octal/decimal and hexadecimal numbers.
|
2021-11-15 14:56:11 +00:00
|
|
|
color cyan "\<([0-9]+|0x[[:xdigit:]]+)\>"
|
2019-10-23 08:00:55 +00:00
|
|
|
# Special values.
|
2019-11-03 17:49:22 +00:00
|
|
|
color cyan "\<(true|false|null|undefined)\>"
|
2017-12-25 14:50:14 +00:00
|
|
|
|
2014-05-16 20:21:34 +00:00
|
|
|
# Strings.
|
2021-10-27 07:45:42 +00:00
|
|
|
color brightmagenta ""([^"\]|\\.)*"|'([^'\]|\\.)*'|`([^`\]|\\.)*`"
|
2014-05-16 20:21:34 +00:00
|
|
|
# Comments.
|
2021-04-27 09:18:41 +00:00
|
|
|
color brightblue "(^|[[:blank:]])//.*"
|
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:]]+$"
|