mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-08-17 07:00:22 +03:00
[language-ruby] Enhancements for percent-array notation in Ruby
Fixes #945.
This commit is contained in:
parent
78deb79146
commit
e030105820
@ -9,6 +9,8 @@
|
||||
(lambda)
|
||||
(hash)
|
||||
(array)
|
||||
(string_array)
|
||||
(symbol_array)
|
||||
] @fold
|
||||
|
||||
|
||||
|
@ -515,6 +515,32 @@
|
||||
"[" @punctuation.definition.begin.array.bracket.square.ruby
|
||||
"]" @punctuation.definition.end.array.bracket.square.ruby
|
||||
|
||||
; Some array delimiters don't use the correct anonymous nodes, so we have to test their content.
|
||||
;
|
||||
; Handle `%w[` and `%i[`.
|
||||
(["%w(" "%i("] @punctuation.definition.begin.array.bracket.square.ruby
|
||||
(#match? @punctuation.definition.begin.array.bracket.square.ruby "%[a-z]\\["))
|
||||
|
||||
; Handle `%w(` and `%i(`.
|
||||
(["%w(" "%i("] @punctuation.definition.begin.array.bracket.round.ruby
|
||||
(#match? @punctuation.definition.begin.array.bracket.round.ruby "^%[a-z]\\("))
|
||||
|
||||
; Handle ending delimiter of `%w(`.
|
||||
((string_array ")" @punctuation.definition.end.array.bracket.round.ruby)
|
||||
(#eq? @punctuation.definition.end.array.bracket.round.ruby ")"))
|
||||
|
||||
; Handle ending delimiter of `%i(`.
|
||||
((symbol_array ")" @punctuation.definition.end.array.bracket.round.ruby)
|
||||
(#eq? @punctuation.definition.end.array.bracket.round.ruby ")"))
|
||||
|
||||
; Any character can be used as the delimiter for a special percent-something! For the rest we can define catch-alls.
|
||||
(["%w(" "%i("] @punctuation.definition.begin.array.ruby
|
||||
(#set! capture.shy true))
|
||||
((string_array ")" @punctuation.definition.end.array.ruby)
|
||||
(#set! capture.shy true))
|
||||
((symbol_array ")" @punctuation.definition.end.array.ruby)
|
||||
(#set! capture.shy true))
|
||||
|
||||
(parenthesized_statements
|
||||
"(" @punctuation.definition.expression.begin.bracket.round.ruby
|
||||
")" @punctuation.definition.expression.end.bracket.round.ruby)
|
||||
|
@ -25,7 +25,6 @@
|
||||
"while"
|
||||
"until"
|
||||
"for"
|
||||
; (for)
|
||||
"begin"
|
||||
"do"
|
||||
"rescue"
|
||||
@ -33,6 +32,11 @@
|
||||
"("
|
||||
"{"
|
||||
"["
|
||||
; “Special” array notations. (Currently, they all have the same anonymous
|
||||
; node, even if they’re delimited with another character pair instead of
|
||||
; parentheses.)
|
||||
"%w("
|
||||
"%i("
|
||||
] @indent
|
||||
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user