Something went wrong. Try again.
Fork of micro-editor/micro
Something went wrong. Try again.
2.7 kB · 204 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205; Variables;----------
(identifier) @variable
; Properties;-----------
(property_identifier) @property
; Function and method definitions;--------------------------------
(function_expression name: (identifier) @function)(function_declaration name: (identifier) @function)(method_definition name: (property_identifier) @function.method)
(pair key: (property_identifier) @function.method value: [(function_expression) (arrow_function)])
(assignment_expression left: (member_expression property: (property_identifier) @function.method) right: [(function_expression) (arrow_function)])
(variable_declarator name: (identifier) @function value: [(function_expression) (arrow_function)])
(assignment_expression left: (identifier) @function right: [(function_expression) (arrow_function)])
; Function and method calls;--------------------------
(call_expression function: (identifier) @function)
(call_expression function: (member_expression property: (property_identifier) @function.method))
; Special identifiers;--------------------
((identifier) @constructor (#match? @constructor "^[A-Z]"))
([ (identifier) (shorthand_property_identifier) (shorthand_property_identifier_pattern) ] @constant (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
((identifier) @variable.builtin (#match? @variable.builtin "^(arguments|module|console|window|document)$") (#is-not? local))
((identifier) @function.builtin (#eq? @function.builtin "require") (#is-not? local))
; Literals;---------
(this) @variable.builtin(super) @variable.builtin
[ (true) (false) (null) (undefined)] @constant.builtin
(comment) @comment
[ (string) (template_string)] @string
(regex) @string.special(number) @number
; Tokens;-------
[ ";" (optional_chain) "." ","] @punctuation.delimiter
[ "-" "--" "-=" "+" "++" "+=" "*" "*=" "**" "**=" "/" "/=" "%" "%=" "<" "<=" "<<" "<<=" "=" "==" "===" "!" "!=" "!==" "=>" ">" ">=" ">>" ">>=" ">>>" ">>>=" "~" "^" "&" "|" "^=" "&=" "|=" "&&" "||" "??" "&&=" "||=" "??="] @operator
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
(template_substitution "${" @punctuation.special "}" @punctuation.special) @embedded
[ "as" "async" "await" "break" "case" "catch" "class" "const" "continue" "debugger" "default" "delete" "do" "else" "export" "extends" "finally" "for" "from" "function" "get" "if" "import" "in" "instanceof" "let" "new" "of" "return" "set" "static" "switch" "target" "throw" "try" "typeof" "var" "void" "while" "with" "yield"] @keyword