mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
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 `>:`.
26 lines
1.1 KiB
Julia
26 lines
1.1 KiB
Julia
function load_data(::Symbol; ::Int) :: Tuple
|
|
# <- @keyword.function
|
|
# ^ @function.call
|
|
# ^ @punctuation.bracket
|
|
# ^^ @operator
|
|
# ^ @type.builtin
|
|
# ^ @punctuation.delimiter
|
|
# ^^ @operator
|
|
# ^^^ @type.builtin
|
|
# ^ @punctuation.bracket
|
|
# ^^ @operator
|
|
# ^ @type.builtin
|
|
dataset = CIFAR10(; Tx = Float32, split = split)
|
|
# ^^^^^^^ @variable
|
|
# ^ @operator
|
|
# ^ @function.call
|
|
# ^ @operator
|
|
# ^ @type.builtin
|
|
X = reshape(dataset.features[:, :, :, begin:n_obs], :, n_obs) # flattening the image pixels
|
|
# ^^^^^ @variable.builtin
|
|
y = categorical2onehot(dataset.targets[begin:n_obs], N_LABELS)
|
|
# ^^^^^ @variable.builtin
|
|
return X, y
|
|
# ^^^^^^ @keyword.return
|
|
end
|
|
# <- @keyword.function
|