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