]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/javascript.yaml
support es files and fix parenthesis highlighting
[micro.git] / runtime / syntax / javascript.yaml
1 filetype: javascript
2
3 detect:
4     filename: "(\\.js$|\\.es[5678]?$)"
5
6 rules:
7     - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
8     - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
9     - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
10     - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*"
11     - statement: "\\b(break|case|catch|continue|default|delete|do|else|finally)\\b"
12     - statement: "\\b(for|function|class|extends|get|if|in|instanceof|new|return|set|switch)\\b"
13     - statement: "\\b(switch|this|throw|try|typeof|var|const|let|void|while|with)\\b"
14     - constant: "\\b(null|undefined|NaN)\\b"
15     - constant: "\\b(true|false)\\b"
16     - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
17     - type: "\\b(Number|Object|RegExp|String)\\b"
18     - statement: "[-+/*=<>!~%?:&|]"
19     - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
20     - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
21
22     - constant.string:
23         start: "\""
24         end: "\""
25         skip: "\\\\."
26         rules:
27             - constant.specialChar: "\\\\."
28
29     - constant.string:
30         start: "'"
31         end: "'"
32         skip: "\\\\."
33         rules:
34             - constant.specialChar: "\\\\."
35
36     - comment:
37         start: "//"
38         end: "$"
39         rules: []
40
41     - comment:
42         start: "/\\*"
43         end: "\\*/"
44         rules: []
45