|
|
@ -1,44 +1,67 @@
|
|
|
|
; Keywords
|
|
|
|
; Keywords
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
[
|
|
|
|
|
|
|
|
"BEGIN"
|
|
|
|
|
|
|
|
"END"
|
|
|
|
"alias"
|
|
|
|
"alias"
|
|
|
|
"and"
|
|
|
|
|
|
|
|
"begin"
|
|
|
|
"begin"
|
|
|
|
"break"
|
|
|
|
|
|
|
|
"case"
|
|
|
|
|
|
|
|
"class"
|
|
|
|
"class"
|
|
|
|
"def"
|
|
|
|
|
|
|
|
"do"
|
|
|
|
"do"
|
|
|
|
"else"
|
|
|
|
|
|
|
|
"elsif"
|
|
|
|
|
|
|
|
"end"
|
|
|
|
"end"
|
|
|
|
"ensure"
|
|
|
|
|
|
|
|
"for"
|
|
|
|
|
|
|
|
"if"
|
|
|
|
|
|
|
|
"in"
|
|
|
|
|
|
|
|
"module"
|
|
|
|
"module"
|
|
|
|
"next"
|
|
|
|
"in"
|
|
|
|
"or"
|
|
|
|
|
|
|
|
"rescue"
|
|
|
|
"rescue"
|
|
|
|
"retry"
|
|
|
|
"ensure"
|
|
|
|
"return"
|
|
|
|
] @keyword
|
|
|
|
"then"
|
|
|
|
|
|
|
|
"unless"
|
|
|
|
[
|
|
|
|
"until"
|
|
|
|
"if"
|
|
|
|
|
|
|
|
"else"
|
|
|
|
|
|
|
|
"elsif"
|
|
|
|
"when"
|
|
|
|
"when"
|
|
|
|
|
|
|
|
"case"
|
|
|
|
|
|
|
|
"unless"
|
|
|
|
|
|
|
|
"then"
|
|
|
|
|
|
|
|
] @keyword.control.conditional
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
"for"
|
|
|
|
"while"
|
|
|
|
"while"
|
|
|
|
|
|
|
|
"retry"
|
|
|
|
|
|
|
|
"until"
|
|
|
|
|
|
|
|
"redo"
|
|
|
|
|
|
|
|
] @keyword.control.repeat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
"yield"
|
|
|
|
"yield"
|
|
|
|
] @keyword
|
|
|
|
"return"
|
|
|
|
|
|
|
|
"next"
|
|
|
|
|
|
|
|
"break"
|
|
|
|
|
|
|
|
] @keyword.control.return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
"def"
|
|
|
|
|
|
|
|
"undef"
|
|
|
|
|
|
|
|
] @keyword.function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
((identifier) @keyword.control.import
|
|
|
|
|
|
|
|
(#match? @keyword.control.import "^(require|require_relative|load|autoload)$"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
"or"
|
|
|
|
|
|
|
|
"and"
|
|
|
|
|
|
|
|
"not"
|
|
|
|
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
|
|
|
|
|
|
((identifier) @keyword
|
|
|
|
((identifier) @keyword.control.exception
|
|
|
|
(#match? @keyword "^(private|protected|public)$"))
|
|
|
|
(#match? @keyword.control.exception "^(raise|fail)$"))
|
|
|
|
|
|
|
|
|
|
|
|
; Function calls
|
|
|
|
; Function calls
|
|
|
|
|
|
|
|
|
|
|
|
((identifier) @function.method.builtin
|
|
|
|
((identifier) @function.builtin
|
|
|
|
(#eq? @function.method.builtin "require"))
|
|
|
|
(#match? @function.builtin "^(attr|attr_accessor|attr_reader|attr_writer|include|prepend|refine|private|protected|public)$"))
|
|
|
|
|
|
|
|
|
|
|
|
"defined?" @function.method.builtin
|
|
|
|
"defined?" @function.builtin
|
|
|
|
|
|
|
|
|
|
|
|
(call
|
|
|
|
(call
|
|
|
|
method: [(identifier) (constant)] @function.method)
|
|
|
|
method: [(identifier) (constant)] @function.method)
|
|
|
@ -58,7 +81,10 @@
|
|
|
|
] @variable.other.member
|
|
|
|
] @variable.other.member
|
|
|
|
|
|
|
|
|
|
|
|
((identifier) @constant.builtin
|
|
|
|
((identifier) @constant.builtin
|
|
|
|
(#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
|
|
|
|
(#match? @constant.builtin "^(__FILE__|__LINE__|__ENCODING__)$"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
((constant) @constant.builtin
|
|
|
|
|
|
|
|
(#match? @constant.builtin "^(ENV|ARGV|ARGF|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING)$"))
|
|
|
|
|
|
|
|
|
|
|
|
((constant) @constant
|
|
|
|
((constant) @constant
|
|
|
|
(#match? @constant "^[A-Z\\d_]+$"))
|
|
|
|
(#match? @constant "^[A-Z\\d_]+$"))
|
|
|
@ -66,22 +92,23 @@
|
|
|
|
(constant) @constructor
|
|
|
|
(constant) @constructor
|
|
|
|
|
|
|
|
|
|
|
|
(self) @variable.builtin
|
|
|
|
(self) @variable.builtin
|
|
|
|
(super) @variable.builtin
|
|
|
|
(super) @function.builtin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[(forward_parameter)(forward_argument)] @variable.parameter
|
|
|
|
|
|
|
|
(keyword_parameter name:((_)":" @variable.parameter) @variable.parameter)
|
|
|
|
|
|
|
|
(optional_parameter name:((_)"=" @operator) @variable.parameter)
|
|
|
|
|
|
|
|
(optional_parameter name: (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
(splat_parameter name: (identifier) @variable.parameter) @variable.parameter
|
|
|
|
|
|
|
|
(hash_splat_parameter name: (identifier) @variable.parameter) @variable.parameter
|
|
|
|
|
|
|
|
(method_parameters (identifier) @variable.parameter)
|
|
|
|
(block_parameter (identifier) @variable.parameter)
|
|
|
|
(block_parameter (identifier) @variable.parameter)
|
|
|
|
(block_parameters (identifier) @variable.parameter)
|
|
|
|
(block_parameters (identifier) @variable.parameter)
|
|
|
|
(destructured_parameter (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
(hash_splat_parameter (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
(lambda_parameters (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
(method_parameters (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
(splat_parameter (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(keyword_parameter name: (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
(optional_parameter name: (identifier) @variable.parameter)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
((identifier) @function.method
|
|
|
|
((identifier) @function.method
|
|
|
|
(#is-not? local))
|
|
|
|
(#is-not? local))
|
|
|
|
(identifier) @variable
|
|
|
|
[
|
|
|
|
|
|
|
|
(identifier)
|
|
|
|
|
|
|
|
] @variable
|
|
|
|
|
|
|
|
|
|
|
|
; Literals
|
|
|
|
; Literals
|
|
|
|
|
|
|
|
|
|
|
@ -96,10 +123,11 @@
|
|
|
|
[
|
|
|
|
[
|
|
|
|
(simple_symbol)
|
|
|
|
(simple_symbol)
|
|
|
|
(delimited_symbol)
|
|
|
|
(delimited_symbol)
|
|
|
|
(hash_key_symbol)
|
|
|
|
|
|
|
|
(bare_symbol)
|
|
|
|
(bare_symbol)
|
|
|
|
] @string.special.symbol
|
|
|
|
] @string.special.symbol
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(pair key: ((_)":" @string.special.symbol) @string.special.symbol)
|
|
|
|
|
|
|
|
|
|
|
|
(regex) @string.regexp
|
|
|
|
(regex) @string.regexp
|
|
|
|
(escape_sequence) @constant.character.escape
|
|
|
|
(escape_sequence) @constant.character.escape
|
|
|
|
|
|
|
|
|
|
|
@ -112,7 +140,7 @@
|
|
|
|
(nil)
|
|
|
|
(nil)
|
|
|
|
(true)
|
|
|
|
(true)
|
|
|
|
(false)
|
|
|
|
(false)
|
|
|
|
]@constant.builtin
|
|
|
|
] @constant.builtin
|
|
|
|
|
|
|
|
|
|
|
|
(interpolation
|
|
|
|
(interpolation
|
|
|
|
"#{" @punctuation.special
|
|
|
|
"#{" @punctuation.special
|
|
|
@ -121,20 +149,36 @@
|
|
|
|
(comment) @comment
|
|
|
|
(comment) @comment
|
|
|
|
|
|
|
|
|
|
|
|
; Operators
|
|
|
|
; Operators
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
[
|
|
|
|
"="
|
|
|
|
":"
|
|
|
|
|
|
|
|
"?"
|
|
|
|
|
|
|
|
"~"
|
|
|
|
"=>"
|
|
|
|
"=>"
|
|
|
|
"->"
|
|
|
|
"->"
|
|
|
|
|
|
|
|
"!"
|
|
|
|
] @operator
|
|
|
|
] @operator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(assignment
|
|
|
|
|
|
|
|
"=" @operator)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(operator_assignment
|
|
|
|
|
|
|
|
operator: ["+=" "-=" "*=" "**=" "/=" "||=" "|=" "&&=" "&=" "%=" ">>=" "<<=" "^="] @operator)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(binary
|
|
|
|
|
|
|
|
operator: ["/" "|" "==" "===" "||" "&&" ">>" "<<" "<" ">" "<=" ">=" "&" "^" "!~" "=~" "<=>" "**" "*" "!=" "%" "-" "+"] @operator)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(range
|
|
|
|
|
|
|
|
operator: [".." "..."] @operator)
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
[
|
|
|
|
","
|
|
|
|
","
|
|
|
|
";"
|
|
|
|
";"
|
|
|
|
"."
|
|
|
|
"."
|
|
|
|
|
|
|
|
"&."
|
|
|
|
] @punctuation.delimiter
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
[
|
|
|
|
|
|
|
|
"|"
|
|
|
|
"("
|
|
|
|
"("
|
|
|
|
")"
|
|
|
|
")"
|
|
|
|
"["
|
|
|
|
"["
|
|
|
|