nano/syntax/javascript.nanorc
Benno Schulenberg f1a04f780a syntax: javascript: recognize also the .mjs extension
The V8 JavaScript-engine developers recommend using this extension:
  https://v8.dev/features/modules#mjs

Also, add the fairly new "JavaScript source" as magic description.

This fulfills https://savannah.gnu.org/bugs/?65334.
Requested-by: Matt Whitlock <gnu@mattwhitlock.name>
2024-02-20 17:00:48 +01:00

28 lines
850 B
Plaintext

## Syntax highlighting for Javascript.
syntax javascript "\.m?js$"
magic "JavaScript source"
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:]]+$"