]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/javascript.yaml
Merge pull request #613 from GeigerCounter/build_tools
[micro.git] / runtime / syntax / javascript.yaml
index 79afd3e53a60398a047c2c70d0fe9f213d13e4ae..e51c5ff7d2e512f2b5d6864710dba29295d072cf 100644 (file)
@@ -1,16 +1,23 @@
 filetype: javascript
 
 detect:
-    filename: "\\.js$"
+    filename: "(\\.js$|\\.es[5678]?$)"
+    header: "^#!.*/(env +)?node( |$)"
 
 rules:
     - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
     - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
     - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
     - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
+    - symbol.brackets: "(\\{|\\})"
+    - symbol.brackets: "(\\(|\\))"
+    - symbol.brackets: "(\\[|\\])"
+    - symbol.brackets: "(\\{|\\})"
+    - symbol.brackets: "(\\(|\\))"
+    - symbol.brackets: "(\\[|\\])"
     - statement: "\\b(break|case|catch|continue|default|delete|do|else|finally)\\b"
-    - statement: "\\b(for|function|get|if|in|instanceof|new|return|set|switch)\\b"
-    - statement: "\\b(switch|this|throw|try|typeof|var|void|while|with)\\b"
+    - statement: "\\b(for|function|class|extends|get|if|in|instanceof|new|return|set|switch|async|await)\\b"
+    - statement: "\\b(switch|this|throw|try|typeof|var|const|let|void|while|with)\\b"
     - constant: "\\b(null|undefined|NaN)\\b"
     - constant: "\\b(true|false)\\b"
     - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
@@ -22,12 +29,14 @@ rules:
     - constant.string:
         start: "\""
         end: "\""
+        skip: "\\\\."
         rules:
             - constant.specialChar: "\\\\."
 
     - constant.string:
         start: "'"
         end: "'"
+        skip: "\\\\."
         rules:
             - constant.specialChar: "\\\\."