]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/javascript.yaml
Fixes #1249
[micro.git] / runtime / syntax / javascript.yaml
index 01553321c25617ade30b0cfbd79cca64fb9d864b..dfce427265362724b6df6b679032ebacd79b02ff 100644 (file)
@@ -1,7 +1,7 @@
 filetype: javascript
 
 detect:
-    filename: "(\\.js$|\\.es[5678]?$)"
+    filename: "(\\.js$|\\.es[5678]?$|\\.mjs$)"
     header: "^#!.*/(env +)?node( |$)"
 
 rules:
@@ -17,7 +17,7 @@ rules:
     - symbol.brackets: "(\\[|\\])"
     - symbol.operator: "[-+/*=<>!~%?:&|]"
     - statement: "\\b(async|await|break|case|catch|const|continue|debugger|default|delete|do|else|export|finally)\\b"
-    - statement: "\\b(for|function|class|extends|get|if|import|in|instanceof|let|new|return|set)\\b"
+    - statement: "\\b(for|function|class|extends|get|if|import|from|in|of|instanceof|let|new|return|set)\\b"
     - statement: "\\b(super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b"
     # reserved but unassigned
     - error: "\\b(enum|implements|interface|package|private|protected|public)"
@@ -25,8 +25,10 @@ rules:
     - constant: "\\b(true|false)\\b"
     - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
     - type: "\\b(Number|Object|RegExp|String)\\b"
-    - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
+    - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
     - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
+    - comment: "^#!.*/(env +)?node( |$)"
+
 
     - constant.string:
         start: "\""