1
1
# ## all *js and *mjs files ( e.g. Firefox user.js, prefs.js )
2
2
3
3
# # Old version
4
-
5
4
# syntax "JavaScript" "(\.|/|)js$"
6
5
# color green "//.*$" start="\/\*" end="\*\/"
7
6
# color blue "'(\\.|[^'])*'"
12
11
13
12
# # New updated taken from http://wiki.linuxhelp.net/index.php/Nano_Syntax_Highlighting
14
13
15
- syntax "JavaScript" " \. (m? js)$ "
14
+ syntax "JavaScript" " \. (m? js| ts | javascript | typescript )$ "
16
15
header " ^ #!. * \/ (env + )node"
17
16
comment " //"
18
17
@@ -28,29 +27,42 @@ color yellow "\<[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
28
27
29
28
# # Keywords
30
29
color green " \< (break| case| catch| continue| default| delete| do| else| finally)\> "
31
- color green " \< (for| function| if| in| instanceof| new| null | return| switch)\> "
32
- color green " \< (switch| this| throw| try| typeof| undefined | var| void| while| with)\> "
30
+ color green " \< (for| function| if| in| instanceof| new| return| switch)\> "
31
+ color green " \< (switch| this| throw| try| typeof| var| void| while| with)\> "
33
32
color green " \< (import| as| from| export)\> "
34
33
color green " \< (const| let| class| extends| of| get| set| await| async| yield)\> "
35
34
36
35
# # Type specifiers
37
36
color red " \< (Array| Boolean| Date| Enumerator| Error| Function| Math)\> "
38
37
color red " \< (WeakMap| Map| WeakSet| Set| Symbol| Promise)\> "
39
38
color red " \< (Number| Object| RegExp| String)\> "
40
- color red " \< (true| false)\> "
39
+ color red " \< (true| false| null| undefined| NaN)\> "
40
+
41
+ # # Function names
42
+ color cyan " [A -Za -z_ ][A -Za -z0 -9_ ]* [[:space :] ]* [(]| )"
43
+
44
+ # # Operators
45
+ # color red "[-+/*=<>!~%?:&|]"
41
46
42
47
# # String
43
48
color brightyellow " L? \" (\\ "| [^ " ])* \" "
44
- color brightyellow " L? '(\' | [^ ' ])* '"
45
- color brightcyan " L? `(\` | [^ ` ])* `"
49
+ color brightyellow " L? '(\\ '| [^ ' ])* '"
50
+ color brightyellow " L? `(\ \ `| [^ ` ])* `"
46
51
color brightwhite ,blue start =" \$\{ " end =" \} "
47
52
48
- # # Trailing spaces
49
- color , green " [ [: space :] ] + $ "
53
+ # # Regex
54
+ color magenta " /[ ^ * ]([ ^ / ] | ( \\ /)) * [ ^ \\ ]/[ gim ] * "
50
55
51
56
# # Escapes
52
- color red " \\ [0 -7 ][0 -7 ]? [0 -7 ]? | \\ x[0 -9a -fA -F ]+ | \\ [bfnrt'" \?\\ ]"
57
+ color yellow " \\ [0 -7 ][0 -7 ]? [0 -7 ]? | \\ x[0 -9a -fA -F ]+ | \\ [bfnrt'"` \?\\ ]"
53
58
54
59
# # Comments
55
60
color brightblue start =" ^ \s * /\* " end =" \* /"
56
61
color brightblue " ^ \s * //. * $ "
62
+
63
+ # # Trailing spaces and mixed whitespaces
64
+ color ,green " [[:space :] ]+ $ "
65
+ color ,red " ( + + | + + )"
66
+
67
+ # # Reminders
68
+ color brightwhite ,yellow " \< (FIXME| TODO| XXX)\> "
0 commit comments