nano/syntax/javascript.nanorc
Benno Schulenberg f757c4a512 syntaxes: colorize hex more strictly by using character class [:xdigit:]
In UTF-8 locales, the ranges A-F and a-f include several accented
characters beyond "ABCDEF" and "abcdef", such as the Croat č and ć.

This fixes https://savannah.gnu.org/bugs/?61487.

Bug existed since the beginning of each of the syntaxes,
for the C syntax since version 1.3.6, commit 159bdfdc.
2021-11-15 16:17:31 +01:00

27 lines
822 B
Plaintext

## Syntax highlighting for Javascript.
syntax javascript "\.js$"
comment "//"
# Declarational stuff.
color green "\<(async|class|const|extends|function|let|this|typeof|var|void)\>"
# Flow control and special keywords.
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)\>"
# "Exit" points.
color magenta "\<(break|continue|return|yield)\>"
# Octal/decimal and hexadecimal numbers.
color cyan "\<([0-9]+|0x[[:xdigit:]]+)\>"
# Special values.
color cyan "\<(true|false|null|undefined)\>"
# Strings.
color brightmagenta ""([^"\]|\\.)*"|'([^'\]|\\.)*'|`([^`\]|\\.)*`"
# Comments.
color brightblue "(^|[[:blank:]])//.*"
color brightblue start="/\*" end="\*/"
# Trailing whitespace.
color ,green "[[:space:]]+$"