mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
* feat(perl): highlight hash keys as @variable.member in various contexts
also, injections for s///e should fully re-parse
This commit is contained in:
parent
98a3fdd5d9
commit
f09a2215b8
2 changed files with 49 additions and 33 deletions
|
|
@ -243,50 +243,65 @@
|
|||
; highlights punc vars and also numeric only like $11
|
||||
(#lua-match? @variable.builtin "^%A+$"))
|
||||
|
||||
(scalar) @variable
|
||||
|
||||
(scalar_deref_expression
|
||||
[
|
||||
"$"
|
||||
"*"
|
||||
] @variable)
|
||||
|
||||
[
|
||||
(scalar)
|
||||
(array)
|
||||
(arraylen)
|
||||
(hash)
|
||||
(glob)
|
||||
; arraylen's sigil is kinda special b/c it's not a data type
|
||||
(arraylen
|
||||
"$#" @operator)
|
||||
] @variable
|
||||
|
||||
(array_deref_expression
|
||||
; all post deref sigils highlighted as operators, and the unrolly star is a special char
|
||||
(postfix_deref
|
||||
[
|
||||
"$"
|
||||
"@"
|
||||
"*"
|
||||
] @variable)
|
||||
|
||||
(hash) @variable
|
||||
|
||||
(hash_deref_expression
|
||||
[
|
||||
"%"
|
||||
"*"
|
||||
] @variable)
|
||||
"$#"
|
||||
] @operator
|
||||
"*" @character.special)
|
||||
|
||||
(array_element_expression
|
||||
array: (_) @variable)
|
||||
(slices
|
||||
[
|
||||
arrayref: _
|
||||
hashref: _
|
||||
]
|
||||
[
|
||||
"@"
|
||||
"%"
|
||||
] @operator)
|
||||
|
||||
(slice_expression
|
||||
array: (_) @variable)
|
||||
; except for subref deref, b/c that's actually a function call
|
||||
(amper_deref_expression
|
||||
[
|
||||
"&"
|
||||
"*"
|
||||
] @function.call)
|
||||
|
||||
(keyval_expression
|
||||
array: (_) @variable)
|
||||
; mark hash or glob keys that are any form of string in any form of access
|
||||
(_
|
||||
"{"
|
||||
[
|
||||
(autoquoted_bareword)
|
||||
(_
|
||||
(string_content))
|
||||
] @variable.member
|
||||
"}")
|
||||
|
||||
(hash_element_expression
|
||||
hash: (_) @variable)
|
||||
|
||||
(slice_expression
|
||||
hash: (_) @variable)
|
||||
|
||||
(keyval_expression
|
||||
hash: (_) @variable)
|
||||
; mark stringies on the LHS of a fat comma as a hash key, b/c that's usually what it
|
||||
; denotes somewhat
|
||||
(_
|
||||
[
|
||||
(autoquoted_bareword)
|
||||
(_
|
||||
(string_content))
|
||||
] @variable.member
|
||||
.
|
||||
"=>"
|
||||
(_))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@
|
|||
; match if there's a single `e` in the modifiers list
|
||||
(#lua-match? @_modifiers "e")
|
||||
(#not-lua-match? @_modifiers "e.*e")
|
||||
(#set! injection.language "perl"))
|
||||
(#set! injection.language "perl")
|
||||
(#set! injection.include-children))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue