mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix(julia): treat :: as operator in type contexts
This patch captures `::` as `@operator` within `(unary_typed_expression)` and `(typed_expression)`. These should be the only two cases that the parser can emit when encountering `::` in the source, but as a fallback it is still captured as `@punctuation` in all other cases. The reasons for capturing `::` as an operator are i) the close relation with the other type-operators `<:` and `>:` and ii) the fact that it is treated as an operator by the Julia parser, just like `<:` and `>:`.
This commit is contained in:
parent
94853ae932
commit
3f377c0739
2 changed files with 11 additions and 3 deletions
|
|
@ -281,6 +281,14 @@
|
||||||
"::"
|
"::"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
; Treat `::` as operator in type contexts, see
|
||||||
|
; https://github.com/nvim-treesitter/nvim-treesitter/pull/7392
|
||||||
|
(typed_expression
|
||||||
|
"::" @operator)
|
||||||
|
|
||||||
|
(unary_typed_expression
|
||||||
|
"::" @operator)
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
")"
|
")"
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ function load_data(::Symbol; ::Int) :: Tuple
|
||||||
# <- @keyword.function
|
# <- @keyword.function
|
||||||
# ^ @function.call
|
# ^ @function.call
|
||||||
# ^ @punctuation.bracket
|
# ^ @punctuation.bracket
|
||||||
# ^^ @punctuation.delimiter
|
# ^^ @operator
|
||||||
# ^ @type.builtin
|
# ^ @type.builtin
|
||||||
# ^ @punctuation.delimiter
|
# ^ @punctuation.delimiter
|
||||||
# ^^ @punctuation.delimiter
|
# ^^ @operator
|
||||||
# ^^^ @type.builtin
|
# ^^^ @type.builtin
|
||||||
# ^ @punctuation.bracket
|
# ^ @punctuation.bracket
|
||||||
# ^^ @punctuation.delimiter
|
# ^^ @operator
|
||||||
# ^ @type.builtin
|
# ^ @type.builtin
|
||||||
dataset = CIFAR10(; Tx = Float32, split = split)
|
dataset = CIFAR10(; Tx = Float32, split = split)
|
||||||
# ^^^^^^^ @variable
|
# ^^^^^^^ @variable
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue