]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/javascript.yaml
Merge pull request #1426 from Nergel3/master
[micro.git] / runtime / syntax / javascript.yaml
1 filetype: javascript
2
3 detect:
4     filename: "(\\.js$|\\.es[5678]?$|\\.mjs$)"
5     header: "^#!.*/(env +)?node( |$)"
6
7 rules:
8     - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
9     - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
10     - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
11     #- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
12     # ^ this is not correct usage of the identifier color
13     - symbol.brackets: "(\\{|\\})"
14     - symbol.brackets: "(\\(|\\))"
15     - symbol.brackets: "(\\[|\\])"
16     - symbol.brackets: "(\\{|\\})"
17     - symbol.brackets: "(\\(|\\))"
18     - symbol.brackets: "(\\[|\\])"
19     - symbol.operator: "[-+/*=<>!~%?:&|]"
20     - statement: "\\b(async|await|break|case|catch|const|continue|debugger|default|delete|do|else|export|finally)\\b"
21     - statement: "\\b(for|function|class|extends|get|if|import|from|in|of|instanceof|let|new|return|set)\\b"
22     - statement: "\\b(super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b"
23     # reserved but unassigned
24     - error: "\\b(enum|implements|interface|package|private|protected|public|TODO)"
25     - constant: "\\b(globalThis|Infinity|null|undefined|NaN)\\b"
26     - constant: "\\b(null|undefined|NaN)\\b"
27     - constant: "\\b(true|false)\\b"
28     - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math|Map|Set|WeakMap|WeakSet)\\b"
29     - type: "\\b(Number|Object|RegExp|String)\\b"
30     # - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
31     - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
32     - comment: "^#!.*/(env +)?node( |$)"
33
34     - identifier: "\\b(alert|decodeURI|decodeURIComponent|document|encodeURI|encodeURIComponent|escape|eval|isFinite|isNaN|parseFloat|parseInt|unescape|uneval|window)\\b"
35     - identifier: "\\b(Intl|WebAssembly)\\b"
36     - identifier: "\\b(Arguments)\\b"
37
38
39     - constant.string:
40         start: "\""
41         end: "\""
42         skip: "\\\\."
43         rules:
44             - constant.specialChar: "\\\\."
45
46     - constant.string:
47         start: "'"
48         end: "'"
49         skip: "\\\\."
50         rules:
51             - constant.specialChar: "\\\\."
52
53     - constant.string:
54         start: "`"
55         end: "`"
56         rules:
57             - constant.specialChar: "\\\\."
58
59     - comment:
60         start: "//"
61         end: "$"
62         rules: []
63
64     - comment:
65         start: "/\\*"
66         end: "\\*/"
67         rules: []
68