@@ -0,0 +1,203 @@
1+; CREDITS @stumash (stuart.mashaal@gmail.com)
6+((identifier) @variable.builtin
7+ (#match? @variable.builtin "^this$"))
11+; Assume other uppercase names constants.
12+; NOTE: In order to distinguish constants we highlight
13+; all the identifiers that are uppercased. But this solution
14+; is not suitable for all occurrences e.g. it will highlight
15+; an uppercased method as a constant if used with no params.
16+; Introducing highlighting for those specific cases, is probably
17+; best way to resolve the issue.
18+((identifier) @constant (#match? @constant "^[A-Z]"))
22+(type_identifier) @type
25+ name: (identifier) @type)
28+ name: (identifier) @type)
31+ name: (identifier) @type)
34+ name: (type_identifier) @type)
41+ name: (identifier) @function.method)))
45+ name: (identifier) @function.method)))
49+ name: (identifier) @function.method)))
54+ path: (identifier) @namespace)
55+((stable_identifier (identifier) @namespace))
58+ path: (identifier) @type) (#match? @type "^[A-Z]"))
59+((stable_identifier (identifier) @type) (#match? @type "^[A-Z]"))
61+((import_selectors (identifier) @type) (#match? @type "^[A-Z]"))
67+ function: (identifier) @function)
70+ function: (field_expression
71+ field: (identifier) @function.method))
74+ function: (identifier) @variable.other.member)
75+ (#match? @variable.other.member "^[A-Z]"))
78+ function: (identifier) @function)
81+ (identifier) @function.builtin
82+ (#match? @function.builtin "^super$")
85+; function definitions
88+ name: (identifier) @function)
91+ name: (identifier) @variable.parameter)
96+(field_expression field: (identifier) @variable.other.member)
97+(field_expression value: (identifier) @type
98+ (#match? @type "^[A-Z]"))
100+(infix_expression operator: (identifier) @operator)
101+(infix_expression operator: (operator_identifier) @operator)
102+(infix_type operator: (operator_identifier) @operator)
103+(infix_type operator: (operator_identifier) @operator)
106+(boolean_literal) @constant.builtin.boolean
107+(integer_literal) @constant.numeric.integer
108+(floating_point_literal) @constant.numeric.float
111+(symbol_literal) @string.special.symbol
116+(interpolated_string_expression)
119+(interpolation "$" @punctuation.special)
130+;; `forSome` existential types not implemented yet
133+;; `macro` not implemented yet
147+(null_literal) @constant.builtin
152+"new" @keyword.operator
161+] @keyword.control.conditional
170+] @punctuation.bracket
175+] @punctuation.delimiter
182+] @keyword.control.repeat
184+"def" @keyword.function
192+"import" @keyword.control.import
194+"return" @keyword.control.return
198+;; `case` is a conditional keyword in case_block
201+ (case_clause ("case") @keyword.control.conditional))
203+(identifier) @variable