| 1 |
|
| 2 |
[ |
| 3 |
":" |
| 4 |
"?" |
| 5 |
"~" |
| 6 |
"=>" |
| 7 |
"->" |
| 8 |
"!" |
| 9 |
] @operator |
| 10 |
|
| 11 |
(assignment |
| 12 |
"=" @operator) |
| 13 |
|
| 14 |
(operator_assignment |
| 15 |
operator: ["+=" "-=" "*=" "**=" "/=" "||=" "|=" "&&=" "&=" "%=" ">>=" "<<=" "^="] @operator) |
| 16 |
|
| 17 |
(binary |
| 18 |
operator: ["/" "|" "==" "===" "||" "&&" ">>" "<<" "<" ">" "<=" ">=" "&" "^" "!~" "=~" "<=>" "**" "*" "!=" "%" "-" "+"] @operator) |
| 19 |
|
| 20 |
(range |
| 21 |
operator: [".." "..."] @operator) |
| 22 |
|
| 23 |
[ |
| 24 |
"," |
| 25 |
";" |
| 26 |
"." |
| 27 |
"&." |
| 28 |
] @punctuation.delimiter |
| 29 |
|
| 30 |
[ |
| 31 |
"|" |
| 32 |
"(" |
| 33 |
")" |
| 34 |
"[" |
| 35 |
"]" |
| 36 |
"{" |
| 37 |
"}" |
| 38 |
"%w(" |
| 39 |
"%i(" |
| 40 |
] @punctuation.bracket |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
[ |
| 45 |
(string) |
| 46 |
(bare_string) |
| 47 |
(subshell) |
| 48 |
(heredoc_body) |
| 49 |
(heredoc_beginning) |
| 50 |
] @string |
| 51 |
|
| 52 |
[ |
| 53 |
(simple_symbol) |
| 54 |
(delimited_symbol) |
| 55 |
(bare_symbol) |
| 56 |
] @string.special.symbol |
| 57 |
|
| 58 |
(pair key: ((_)":" @string.special.symbol) @string.special.symbol) |
| 59 |
|
| 60 |
(regex) @string.regexp |
| 61 |
(escape_sequence) @constant.character.escape |
| 62 |
|
| 63 |
[ |
| 64 |
(integer) |
| 65 |
(float) |
| 66 |
] @constant.numeric.integer |
| 67 |
|
| 68 |
[ |
| 69 |
(true) |
| 70 |
(false) |
| 71 |
] @constant.builtin.boolean |
| 72 |
(nil) @constant.builtin |
| 73 |
|
| 74 |
(interpolation |
| 75 |
"#{" @punctuation.special |
| 76 |
"}" @punctuation.special) @embedded |
| 77 |
|
| 78 |
(comment) @comment |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
((identifier) @function.method |
| 83 |
(#is-not? local)) |
| 84 |
|
| 85 |
[ |
| 86 |
(identifier) |
| 87 |
] @variable |
| 88 |
|
| 89 |
[ |
| 90 |
(class_variable) |
| 91 |
(instance_variable) |
| 92 |
] @variable.other.member |
| 93 |
|
| 94 |
(constant) @constructor |
| 95 |
|
| 96 |
((identifier) @constant.builtin |
| 97 |
(#match? @constant.builtin "^(__FILE__|__LINE__|__ENCODING__)$")) |
| 98 |
|
| 99 |
((constant) @constant.builtin |
| 100 |
(#match? @constant.builtin "^(ENV|ARGV|ARGF|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING)$")) |
| 101 |
|
| 102 |
((constant) @constant |
| 103 |
(#match? @constant "^[A-Z\\d_]+$")) |
| 104 |
|
| 105 |
(self) @variable.builtin |
| 106 |
(super) @variable.builtin |
| 107 |
|
| 108 |
[(forward_parameter)(forward_argument)] @variable.parameter |
| 109 |
(keyword_parameter name:((_)":" @variable.parameter) @variable.parameter) |
| 110 |
(optional_parameter name:((_)"=" @operator) @variable.parameter) |
| 111 |
(optional_parameter name: (identifier) @variable.parameter) |
| 112 |
(splat_parameter name: (identifier) @variable.parameter) @variable.parameter |
| 113 |
(hash_splat_parameter name: (identifier) @variable.parameter) @variable.parameter |
| 114 |
(method_parameters (identifier) @variable.parameter) |
| 115 |
(block_parameter (identifier) @variable.parameter) |
| 116 |
(block_parameters (identifier) @variable.parameter) |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
(alias (identifier) @function.method) |
| 121 |
(setter (identifier) @function.method) |
| 122 |
(method name: [(identifier) (constant)] @function.method) |
| 123 |
(singleton_method name: [(identifier) (constant)] @function.method) |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
(call |
| 128 |
method: [(identifier) (constant)] @function.method) |
| 129 |
|
| 130 |
((identifier) @function.builtin |
| 131 |
(#match? @function.builtin "^(attr|attr_accessor|attr_reader|attr_writer|include|prepend|refine|private|protected|public)$")) |
| 132 |
|
| 133 |
"defined?" @function.builtin |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
[ |
| 138 |
"BEGIN" |
| 139 |
"END" |
| 140 |
"alias" |
| 141 |
"begin" |
| 142 |
"class" |
| 143 |
"do" |
| 144 |
"end" |
| 145 |
"module" |
| 146 |
"in" |
| 147 |
"rescue" |
| 148 |
"ensure" |
| 149 |
] @keyword |
| 150 |
|
| 151 |
[ |
| 152 |
"if" |
| 153 |
"else" |
| 154 |
"elsif" |
| 155 |
"when" |
| 156 |
"case" |
| 157 |
"unless" |
| 158 |
"then" |
| 159 |
] @keyword.control.conditional |
| 160 |
|
| 161 |
[ |
| 162 |
"for" |
| 163 |
"while" |
| 164 |
"retry" |
| 165 |
"until" |
| 166 |
"redo" |
| 167 |
] @keyword.control.repeat |
| 168 |
|
| 169 |
[ |
| 170 |
"yield" |
| 171 |
"return" |
| 172 |
"next" |
| 173 |
"break" |
| 174 |
] @keyword.control.return |
| 175 |
|
| 176 |
[ |
| 177 |
"def" |
| 178 |
"undef" |
| 179 |
] @keyword.function |
| 180 |
|
| 181 |
((identifier) @keyword.control.import |
| 182 |
(#match? @keyword.control.import "^(require|require_relative|load|autoload)$")) |
| 183 |
|
| 184 |
[ |
| 185 |
"or" |
| 186 |
"and" |
| 187 |
"not" |
| 188 |
] @keyword.operator |
| 189 |
|
| 190 |
((identifier) @keyword.control.exception |
| 191 |
(#match? @keyword.control.exception "^(raise|fail)$")) |