|
5 | 5 | ] @variable |
6 | 6 |
|
7 | 7 | ; Keywords |
8 | | - |
9 | 8 | [ |
10 | 9 | "alias" |
11 | 10 | "and" |
|
40 | 39 | (#match? @keyword "^(private|protected|public)$")) |
41 | 40 |
|
42 | 41 | ; Function calls |
43 | | - |
44 | 42 | (call |
45 | | - method: [(identifier) (constant)] @function.method) |
| 43 | + method: [ |
| 44 | + (identifier) |
| 45 | + (constant) |
| 46 | + ] @function.method) |
46 | 47 |
|
47 | 48 | ((identifier) @keyword.import |
48 | | - (#any-of? @keyword.import "require" "require_relative" "load")) |
| 49 | + (#any-of? @keyword.import "require" "require_relative" "load")) |
49 | 50 |
|
50 | 51 | "defined?" @function.method.builtin |
51 | 52 |
|
52 | 53 | ; Function definitions |
53 | | - |
54 | | -(alias (identifier) @function.method) |
55 | | -(setter (identifier) @function.method) |
56 | | -(method name: [(identifier) (constant)] @function.method) |
57 | | -(singleton_method name: [(identifier) (constant)] @function.method) |
58 | | -(method_parameters [ |
59 | | - (identifier) @variable.parameter |
60 | | - (optional_parameter name: (identifier) @variable.parameter) |
61 | | - (keyword_parameter [name: (identifier) (":")] @variable.parameter) |
| 54 | +(alias |
| 55 | + (identifier) @function.method) |
| 56 | + |
| 57 | +(setter |
| 58 | + (identifier) @function.method) |
| 59 | + |
| 60 | +(method |
| 61 | + name: [ |
| 62 | + (identifier) |
| 63 | + (constant) |
| 64 | + ] @function.method) |
| 65 | + |
| 66 | +(singleton_method |
| 67 | + name: [ |
| 68 | + (identifier) |
| 69 | + (constant) |
| 70 | + ] @function.method) |
| 71 | + |
| 72 | +(method_parameters |
| 73 | + [ |
| 74 | + (identifier) @variable.parameter |
| 75 | + (optional_parameter |
| 76 | + name: (identifier) @variable.parameter) |
| 77 | + (keyword_parameter |
| 78 | + [ |
| 79 | + name: (identifier) |
| 80 | + ":" |
| 81 | + ] @variable.parameter) |
62 | 82 | ]) |
63 | 83 |
|
64 | | -(block_parameters (identifier) @variable.parameter) |
| 84 | +(block_parameters |
| 85 | + (identifier) @variable.parameter) |
65 | 86 |
|
66 | 87 | ; Identifiers |
67 | | - |
68 | 88 | ((identifier) @constant.builtin |
69 | 89 | (#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$")) |
70 | 90 |
|
71 | 91 | (file) @constant.builtin |
| 92 | + |
72 | 93 | (line) @constant.builtin |
| 94 | + |
73 | 95 | (encoding) @constant.builtin |
74 | 96 |
|
75 | 97 | (hash_splat_nil |
76 | | - "**" @operator |
77 | | -) @constant.builtin |
| 98 | + "**" @operator) @constant.builtin |
78 | 99 |
|
79 | 100 | (constant) @type |
80 | 101 |
|
|
94 | 115 | (constant) @type.super))) |
95 | 116 |
|
96 | 117 | (self) @variable.special |
| 118 | + |
97 | 119 | (super) @variable.special |
98 | 120 |
|
99 | 121 | [ |
|
110 | 132 | (#any-of? @keyword.exception "raise" "fail" "catch" "throw")) |
111 | 133 |
|
112 | 134 | ; Literals |
113 | | - |
114 | 135 | [ |
115 | 136 | (string) |
116 | 137 | (bare_string) |
|
127 | 148 | ] @string.special.symbol |
128 | 149 |
|
129 | 150 | (regex) @string.regex |
| 151 | + |
130 | 152 | (escape_sequence) @string.escape |
131 | 153 |
|
132 | 154 | [ |
|
139 | 161 | (false) |
140 | 162 | ] @boolean |
141 | 163 |
|
142 | | -[ |
143 | | - (nil) |
144 | | -] @constant.builtin |
| 164 | +(nil) @constant.builtin |
145 | 165 |
|
146 | 166 | ; Regular comments (exclude RBS inline comments) |
147 | 167 | ((comment) @comment |
148 | 168 | (#not-match? @comment "^\\s*#[:|]") |
149 | 169 | (#not-match? @comment "^\\s*#\\s*(@rbs|\\|)")) |
150 | 170 |
|
151 | 171 | ; Operators |
152 | | - |
153 | 172 | [ |
154 | 173 | "!" |
155 | 174 | "~" |
|
0 commit comments