mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-06 15:10:27 +09:00
Improve JavaScript syntax highlighting
- Sort keywords alphabetically - Use `symbol.operator` for operators instead of `statement` - Add a basic support for back-tick strings - Mark unassigned keywords as errors
This commit is contained in:
@@ -15,14 +15,16 @@ rules:
|
||||
- symbol.brackets: "(\\{|\\})"
|
||||
- symbol.brackets: "(\\(|\\))"
|
||||
- symbol.brackets: "(\\[|\\])"
|
||||
- statement: "\\b(break|case|catch|continue|default|delete|do|else|finally)\\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"
|
||||
- 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(super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b"
|
||||
# reserved but unassigned
|
||||
- error: "\\b(enum|implements|interface|package|private|protected|public)"
|
||||
- constant: "\\b(null|undefined|NaN)\\b"
|
||||
- constant: "\\b(true|false)\\b"
|
||||
- type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
|
||||
- type: "\\b(Number|Object|RegExp|String)\\b"
|
||||
- statement: "[-+/*=<>!~%?:&|]"
|
||||
- constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
|
||||
- constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
|
||||
|
||||
@@ -40,6 +42,12 @@ rules:
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "`"
|
||||
end: "`"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
|
||||
Reference in New Issue
Block a user