|
| 1 | +(dotted_identifier_list) @string |
| 2 | + |
| 3 | +; Methods |
| 4 | +; -------------------- |
| 5 | +(super) @function.builtin |
| 6 | + |
| 7 | +(function_expression_body (identifier) @function.method) |
| 8 | +((identifier)(selector (argument_part)) @function.method) |
| 9 | + |
| 10 | +; Annotations |
| 11 | +; -------------------- |
| 12 | +(annotation |
| 13 | + name: (identifier) @attribute) |
| 14 | +(marker_annotation |
| 15 | + name: (identifier) @attribute) |
| 16 | + |
| 17 | +; Types |
| 18 | +; -------------------- |
| 19 | +(class_definition |
| 20 | + name: (identifier) @type) |
| 21 | + |
| 22 | +(constructor_signature |
| 23 | + name: (identifier) @function.method) |
| 24 | + |
| 25 | +(function_signature |
| 26 | + name: (identifier) @function.method) |
| 27 | + |
| 28 | +(getter_signature |
| 29 | + (identifier) @function.builtin) |
| 30 | + |
| 31 | +(setter_signature |
| 32 | + name: (identifier) @function.builtin) |
| 33 | + |
| 34 | +(enum_declaration |
| 35 | + name: (identifier) @type) |
| 36 | + |
| 37 | +(enum_constant |
| 38 | + name: (identifier) @type.builtin) |
| 39 | + |
| 40 | +(void_type) @type.builtin |
| 41 | + |
| 42 | +((scoped_identifier |
| 43 | + scope: (identifier) @type) |
| 44 | + (#match? @type "^[a-zA-Z]")) |
| 45 | + |
| 46 | +((scoped_identifier |
| 47 | + scope: (identifier) @type |
| 48 | + name: (identifier) @type) |
| 49 | + (#match? @type "^[a-zA-Z]")) |
| 50 | + |
| 51 | +; the DisabledDrawerButtons in : const DisabledDrawerButtons(history: true), |
| 52 | +(type_identifier) @type.builtin |
| 53 | + |
| 54 | +; Variables |
| 55 | +; -------------------- |
| 56 | +; the "File" in var file = File(); |
| 57 | +((identifier) @namespace |
| 58 | + (#match? @namespace "^_?[A-Z].*[a-z]")) ; catch Classes or IClasses not CLASSES |
| 59 | + |
| 60 | +("Function" @type.builtin) |
| 61 | +(inferred_type) @type.builtin |
| 62 | + |
| 63 | +; properties |
| 64 | +(unconditional_assignable_selector |
| 65 | + (identifier) @variable.other.member) |
| 66 | + |
| 67 | +(conditional_assignable_selector |
| 68 | + (identifier) @variable.other.member) |
| 69 | + |
| 70 | +; assignments |
| 71 | +; -------------------- |
| 72 | +; the "strings" in : strings = "some string" |
| 73 | +(assignment_expression |
| 74 | + left: (assignable_expression) @variable) |
| 75 | + |
| 76 | +(this) @variable.builtin |
| 77 | + |
| 78 | +; Parameters |
| 79 | +; -------------------- |
| 80 | +(formal_parameter |
| 81 | + name: (identifier) @variable) |
| 82 | + |
| 83 | +(named_argument |
| 84 | + (label (identifier) @variable)) |
| 85 | + |
| 86 | +; Literals |
| 87 | +; -------------------- |
| 88 | +[ |
| 89 | + (hex_integer_literal) |
| 90 | + (decimal_integer_literal) |
| 91 | + (decimal_floating_point_literal) |
| 92 | + ;(octal_integer_literal) |
| 93 | + ;(hex_floating_point_literal) |
| 94 | +] @constant.numeric.integer |
| 95 | + |
| 96 | +(symbol_literal) @string.special.symbol |
| 97 | +(string_literal) @string |
| 98 | + |
| 99 | +[ |
| 100 | + (const_builtin) |
| 101 | + (final_builtin) |
| 102 | +] @variable.builtin |
| 103 | + |
| 104 | +[ |
| 105 | + (true) |
| 106 | + (false) |
| 107 | +] @constant.builtin.boolean |
| 108 | + |
| 109 | +(null_literal) @constant.builtin |
| 110 | + |
| 111 | +(comment) @comment.line |
| 112 | +(documentation_comment) @comment.block.documentation |
| 113 | + |
| 114 | +; Tokens |
| 115 | +; -------------------- |
| 116 | +(template_substitution |
| 117 | + "$" @punctuation.special |
| 118 | + "{" @punctuation.special |
| 119 | + "}" @punctuation.special |
| 120 | +) @embedded |
| 121 | + |
| 122 | +(template_substitution |
| 123 | + "$" @punctuation.special |
| 124 | + (identifier_dollar_escaped) @variable |
| 125 | +) @embedded |
| 126 | + |
| 127 | +(escape_sequence) @constant.character.escape |
| 128 | + |
| 129 | +; Punctuation |
| 130 | +;--------------------- |
| 131 | +[ |
| 132 | + "(" |
| 133 | + ")" |
| 134 | + "[" |
| 135 | + "]" |
| 136 | + "{" |
| 137 | + "}" |
| 138 | +] @punctuation.bracket |
| 139 | + |
| 140 | +[ |
| 141 | + ";" |
| 142 | + "." |
| 143 | + "," |
| 144 | + ":" |
| 145 | +] @punctuation.delimiter |
| 146 | + |
| 147 | +; Operators |
| 148 | +;--------------------- |
| 149 | +[ |
| 150 | + "@" |
| 151 | + "?" |
| 152 | + "=>" |
| 153 | + ".." |
| 154 | + "==" |
| 155 | + "&&" |
| 156 | + "%" |
| 157 | + "<" |
| 158 | + ">" |
| 159 | + "=" |
| 160 | + ">=" |
| 161 | + "<=" |
| 162 | + "||" |
| 163 | + (multiplicative_operator) |
| 164 | + (increment_operator) |
| 165 | + (is_operator) |
| 166 | + (prefix_operator) |
| 167 | + (equality_operator) |
| 168 | + (additive_operator) |
| 169 | +] @operator |
| 170 | + |
| 171 | +; Keywords |
| 172 | +; -------------------- |
| 173 | +["import" "library" "export"] @keyword.control.import |
| 174 | +["do" "while" "continue" "for"] @keyword.control.repeat |
| 175 | +["return" "yield"] @keyword.control.return |
| 176 | +["as" "in" "is"] @keyword.operator |
| 177 | + |
| 178 | +[ |
| 179 | + "?." |
| 180 | + "??" |
| 181 | + "if" |
| 182 | + "else" |
| 183 | + "switch" |
| 184 | + "default" |
| 185 | + "late" |
| 186 | +] @keyword.control.conditional |
| 187 | + |
| 188 | +[ |
| 189 | + "try" |
| 190 | + "throw" |
| 191 | + "catch" |
| 192 | + "finally" |
| 193 | + (break_statement) |
| 194 | +] @keyword.control.exception |
| 195 | + |
| 196 | +; Reserved words (cannot be used as identifiers) |
| 197 | +[ |
| 198 | + (case_builtin) |
| 199 | + "abstract" |
| 200 | + "async" |
| 201 | + "async*" |
| 202 | + "await" |
| 203 | + "class" |
| 204 | + "covariant" |
| 205 | + "deferred" |
| 206 | + "dynamic" |
| 207 | + "enum" |
| 208 | + "extends" |
| 209 | + "extension" |
| 210 | + "external" |
| 211 | + "factory" |
| 212 | + "Function" |
| 213 | + "get" |
| 214 | + "implements" |
| 215 | + "interface" |
| 216 | + "mixin" |
| 217 | + "new" |
| 218 | + "on" |
| 219 | + "operator" |
| 220 | + "part" |
| 221 | + "required" |
| 222 | + "set" |
| 223 | + "show" |
| 224 | + "static" |
| 225 | + "super" |
| 226 | + "sync*" |
| 227 | + "typedef" |
| 228 | + "with" |
| 229 | +] @keyword |
| 230 | + |
| 231 | +; when used as an identifier: |
| 232 | +((identifier) @variable.builtin |
| 233 | + (#match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$")) |
| 234 | + |
| 235 | +; Error |
| 236 | +(ERROR) @error |
| 237 | + |
0 commit comments