summaryrefslogtreecommitdiff
path: root/.config/nano/js.nanorc
blob: 89919282d831e4256bec3b6cb042c465df7810ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
### all *js files  ( e.g. Firefox user.js, prefs.js )

## Old version

#syntax "JavaScript" "(\.|/|)js$"
#color green "//.*$" start="\/\*" end="\*\/"
#color blue "'(\\.|[^'])*'"
#color red ""(\\.|[^\"])*""
#color brightgreen "\<(true)\>"
#color brightred "\<(false)\>" "http\:\/\/.*$"
#color brightmagenta "[0-9](\\.|[^\"])*)"

## New updated taken from http://wiki.linuxhelp.net/index.php/Nano_Syntax_Highlighting

syntax "JavaScript" "\.(js)$"
header "^#!.*\/(env +)node"
comment "//"

## 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 "\<(break|case|catch|continue|default|delete|do|else|finally)\>"
color green "\<(for|function|if|in|instanceof|new|null|return|switch)\>"
color green "\<(switch|this|throw|try|typeof|undefined|var|void|while|with)\>"
color green "\<(import|as|from|export)\>"
color green "\<(const|let|class|extends|of|get|set|await|async|yield)\>"

## Type specifiers
color red "\<(Array|Boolean|Date|Enumerator|Error|Function|Math)\>"
color red "\<(WeakMap|Map|WeakSet|Set|Symbol|Promise)\>"
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="\}"

## Trailing spaces
color ,green "[[:space:]]+$"

## Escapes
color red "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"

## Comments
color brightblue start="^\s*/\*" end="\*/"
color brightblue "^\s*//.*$"