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:
Fredrik Ekre 2024-11-22 16:51:33 +01:00 committed by Christian Clason
parent 94853ae932
commit 3f377c0739
2 changed files with 11 additions and 3 deletions

View file

@ -2,13 +2,13 @@ function load_data(::Symbol; ::Int) :: Tuple
# <- @keyword.function
# ^ @function.call
# ^ @punctuation.bracket
# ^^ @punctuation.delimiter
# ^^ @operator
# ^ @type.builtin
# ^ @punctuation.delimiter
# ^^ @punctuation.delimiter
# ^^ @operator
# ^^^ @type.builtin
# ^ @punctuation.bracket
# ^^ @punctuation.delimiter
# ^^ @operator
# ^ @type.builtin
dataset = CIFAR10(; Tx = Float32, split = split)
# ^^^^^^^ @variable