dotfiles/nanorc/highlighting/js.nanorc

41 lines
1.4 KiB
Plaintext

syntax "javascript" "\.(mjs)|(js)|(jsx)|(json)$"
## Default
color white "^.+$"
## Decimal, cotal and hexadecimal numbers
color yellow "\<[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\>"
## Floating point number with at least one digit before decimal point
color yellow "\<[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
color yellow "\<[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
## Keywords
color green "\<(abstract|await|boolean|break|byte|case|catch|char)\>"
color green "\<(class|const|continue|debugger|default|delete|double)\>"
color green "\<(do|else|enum|export|extends|finally|final|float|for)\>"
color green "\<(from|function|goto|if|implements|import|instanceof)\>"
color green "\<(interface|int|in|let|long|native|new|package|private)\>"
color green "\<(protected|public|return|short|static|super|switch)\>"
color green "\<(synchronized|this|throws|throw|transient|try|typeof)\>"
color green "\<(var|void|volatile|while|with|yield)\>"
## Type specifiers
color red "\<(Array|Boolean|Date|Enumerator|Error|Function|Math)\>"
color red "\<(Number|Object|RegExp|String)\>"
color red "\<(true|false)\>"
## String
color brightyellow "L?\"(\\"|[^"])*\""
color brightyellow "L?'(\'|[^'])*'"
color brightcyan "L?`(\`|[^`])*`"
color brightwhite,blue start="\$\{" end="\}"
## Escapes
color red "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
## Comments
color magenta start="/\*" end="\*/"
color magenta "//.*$"