diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /queries/julia | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'queries/julia')
| -rw-r--r-- | queries/julia/folds.scm | 14 | ||||
| -rw-r--r-- | queries/julia/highlights.scm | 372 | ||||
| -rw-r--r-- | queries/julia/indents.scm | 52 | ||||
| -rw-r--r-- | queries/julia/injections.scm | 42 | ||||
| -rw-r--r-- | queries/julia/locals.scm | 75 |
5 files changed, 0 insertions, 555 deletions
diff --git a/queries/julia/folds.scm b/queries/julia/folds.scm deleted file mode 100644 index 2cbdc2815..000000000 --- a/queries/julia/folds.scm +++ /dev/null @@ -1,14 +0,0 @@ -[ - (module_definition) - (struct_definition) - (macro_definition) - (function_definition) - (if_statement) - (try_statement) - (for_statement) - (while_statement) - (let_statement) - (quote_statement) - (do_clause) - (compound_statement) -] @fold diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm deleted file mode 100644 index 9a82c5d41..000000000 --- a/queries/julia/highlights.scm +++ /dev/null @@ -1,372 +0,0 @@ -; Identifiers -(identifier) @variable - -(field_expression - (identifier) @variable.member .) - -; Symbols -(quote_expression - ":" @string.special.symbol - [ - (identifier) - (operator) - ] @string.special.symbol) - -; Function calls -(call_expression - (identifier) @function.call) - -(call_expression - (field_expression - (identifier) @function.call .)) - -(broadcast_call_expression - (identifier) @function.call) - -(broadcast_call_expression - (field_expression - (identifier) @function.call .)) - -(binary_expression - (_) - (operator) @_pipe - (identifier) @function.call - (#any-of? @_pipe "|>" ".|>")) - -; Macros -(macro_identifier - "@" @function.macro - (identifier) @function.macro) - -(macro_definition - (signature - (call_expression - . - (identifier) @function.macro))) - -; Built-in functions -; filter(name -> Base.eval(Core, name) isa Core.Builtin, names(Core)) -((identifier) @function.builtin - (#any-of? @function.builtin - "applicable" "fieldtype" "getfield" "getglobal" "invoke" "isa" "isdefined" "modifyfield!" - "modifyglobal!" "nfields" "replacefield!" "replaceglobal!" "setfield!" "setfieldonce!" - "setglobal!" "setglobalonce!" "swapfield!" "swapglobal!" "throw" "tuple" "typeassert" "typeof")) - -; Type definitions -(type_head - (_) @type.definition) - -; Type annotations -(parametrized_type_expression - [ - (identifier) @type - (field_expression - (identifier) @type .) - ] - (curly_expression - (_) @type)) - -(typed_expression - (identifier) @type .) - -(unary_typed_expression - (identifier) @type .) - -(where_expression - [ - (curly_expression - (_) @type) - (_) @type - ] .) - -(unary_expression - (operator) @operator - (_) @type - (#any-of? @operator "<:" ">:")) - -(binary_expression - (_) @type - (operator) @operator - (_) @type - (#any-of? @operator "<:" ">:")) - -; Built-in types -; filter(name -> typeof(Base.eval(Core, name)) in [DataType, UnionAll], names(Core)) -((identifier) @type.builtin - (#any-of? @type.builtin - "AbstractArray" "AbstractChar" "AbstractFloat" "AbstractString" "Any" "ArgumentError" "Array" - "AssertionError" "Bool" "BoundsError" "Char" "ConcurrencyViolationError" "Cvoid" "DataType" - "DenseArray" "DivideError" "DomainError" "ErrorException" "Exception" "Expr" "Float16" "Float32" - "Float64" "Function" "GlobalRef" "IO" "InexactError" "InitError" "Int" "Int128" "Int16" "Int32" - "Int64" "Int8" "Integer" "InterruptException" "LineNumberNode" "LoadError" "Method" - "MethodError" "Module" "NTuple" "NamedTuple" "Nothing" "Number" "OutOfMemoryError" - "OverflowError" "Pair" "Ptr" "QuoteNode" "ReadOnlyMemoryError" "Real" "Ref" "SegmentationFault" - "Signed" "StackOverflowError" "String" "Symbol" "Task" "Tuple" "Type" "TypeError" "TypeVar" - "UInt" "UInt128" "UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer" "UndefKeywordError" - "UndefRefError" "UndefVarError" "Union" "UnionAll" "Unsigned" "VecElement" "WeakRef")) - -; Keywords -[ - "global" - "local" -] @keyword - -(compound_statement - [ - "begin" - "end" - ] @keyword) - -(quote_statement - [ - "quote" - "end" - ] @keyword) - -(let_statement - [ - "let" - "end" - ] @keyword) - -(if_statement - [ - "if" - "end" - ] @keyword.conditional) - -(elseif_clause - "elseif" @keyword.conditional) - -(else_clause - "else" @keyword.conditional) - -(ternary_expression - [ - "?" - ":" - ] @keyword.conditional.ternary) - -(try_statement - [ - "try" - "end" - ] @keyword.exception) - -(catch_clause - "catch" @keyword.exception) - -(finally_clause - "finally" @keyword.exception) - -(for_statement - [ - "for" - "end" - ] @keyword.repeat) - -(for_binding - "outer" @keyword.repeat) - -; comprehensions -(for_clause - "for" @keyword.repeat) - -(if_clause - "if" @keyword.conditional) - -(while_statement - [ - "while" - "end" - ] @keyword.repeat) - -[ - (break_statement) - (continue_statement) -] @keyword.repeat - -[ - "const" - "mutable" -] @keyword.modifier - -(function_definition - [ - "function" - "end" - ] @keyword.function) - -(do_clause - [ - "do" - "end" - ] @keyword.function) - -(macro_definition - [ - "macro" - "end" - ] @keyword) - -(return_statement - "return" @keyword.return) - -(module_definition - [ - "module" - "baremodule" - "end" - ] @keyword.import) - -(export_statement - "export" @keyword.import) - -(public_statement - "public" @keyword.import) - -(import_statement - "import" @keyword.import) - -(using_statement - "using" @keyword.import) - -(import_alias - "as" @keyword.import) - -(selected_import - ":" @punctuation.delimiter) - -(struct_definition - [ - "mutable" - "struct" - "end" - ] @keyword.type) - -(abstract_definition - [ - "abstract" - "type" - "end" - ] @keyword.type) - -(primitive_definition - [ - "primitive" - "type" - "end" - ] @keyword.type) - -; Operators & Punctuation -(operator) @operator - -(adjoint_expression - "'" @operator) - -(range_expression - ":" @operator) - -(arrow_function_expression - "->" @operator) - -[ - "." - "..." -] @punctuation.special - -[ - "," - ";" - "::" -] @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) - -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket - -; Interpolation -(string_interpolation - . - "$" @punctuation.special) - -(interpolation_expression - . - "$" @punctuation.special) - -; Keyword operators -((operator) @keyword.operator - (#any-of? @keyword.operator "in" "isa")) - -(where_expression - "where" @keyword.operator) - -; Built-in constants -((identifier) @constant.builtin - (#any-of? @constant.builtin "nothing" "missing")) - -((identifier) @variable.builtin - (#any-of? @variable.builtin "begin" "end") - (#has-ancestor? @variable.builtin index_expression)) - -; Literals -(boolean_literal) @boolean - -(integer_literal) @number - -(float_literal) @number.float - -((identifier) @number.float - (#any-of? @number.float "NaN" "NaN16" "NaN32" "Inf" "Inf16" "Inf32")) - -(character_literal) @character - -(escape_sequence) @string.escape - -(string_literal) @string - -(prefixed_string_literal - prefix: (identifier) @function.macro) @string - -(command_literal) @string.special - -(prefixed_command_literal - prefix: (identifier) @function.macro) @string.special - -((string_literal) @string.documentation - . - [ - (abstract_definition) - (assignment) - (const_statement) - (function_definition) - (macro_definition) - (module_definition) - (struct_definition) - ]) - -(source_file - (string_literal) @string.documentation - . - [ - (identifier) - (call_expression) - ]) - -[ - (line_comment) - (block_comment) -] @comment @spell diff --git a/queries/julia/indents.scm b/queries/julia/indents.scm deleted file mode 100644 index 7b40f876e..000000000 --- a/queries/julia/indents.scm +++ /dev/null @@ -1,52 +0,0 @@ -[ - (struct_definition) - (macro_definition) - (function_definition) - (compound_statement) - (if_statement) - (try_statement) - (for_statement) - (while_statement) - (let_statement) - (quote_statement) - (do_clause) - (assignment) - (for_binding) - (call_expression) - (parenthesized_expression) - (tuple_expression) - (comprehension_expression) - (matrix_expression) - (vector_expression) -] @indent.begin - -[ - "end" - ")" - "]" - "}" -] @indent.end - -[ - "end" - ")" - "]" - "}" - (else_clause) - (elseif_clause) - (catch_clause) - (finally_clause) -] @indent.branch - -[ - (line_comment) - (block_comment) -] @indent.ignore - -((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) - -((curly_expression) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}")) diff --git a/queries/julia/injections.scm b/queries/julia/injections.scm deleted file mode 100644 index 72d181066..000000000 --- a/queries/julia/injections.scm +++ /dev/null @@ -1,42 +0,0 @@ -; Inject markdown in docstrings -((string_literal - (content) @injection.content) - . - [ - (module_definition) - (abstract_definition) - (struct_definition) - (function_definition) - (macro_definition) - (assignment) - (const_statement) - (call_expression) - (identifier) - ] - (#set! injection.language "markdown")) - -; Inject comments -([ - (line_comment) - (block_comment) -] @injection.content - (#set! injection.language "comment")) - -; Inject regex in r"..." and r"""...""" (e.g. r"hello\bworld") -(prefixed_string_literal - prefix: (identifier) @_prefix - (content) @injection.content - (#eq? @_prefix "r") - (#set! injection.language "regex")) - -; Inject markdown in md"..." and md"""...""" (e.g. md"**Bold** and _Italics_") -(prefixed_string_literal - prefix: (identifier) @_prefix - (content) @injection.content - (#eq? @_prefix "md") - (#set! injection.language "markdown")) - -; Inject bash in `...` and ```...``` (e.g. `git add --help`) -(command_literal - (content) @injection.content - (#set! injection.language "bash")) diff --git a/queries/julia/locals.scm b/queries/julia/locals.scm deleted file mode 100644 index 500b7fe58..000000000 --- a/queries/julia/locals.scm +++ /dev/null @@ -1,75 +0,0 @@ -; References -(identifier) @local.reference - -; Variables -(assignment - (identifier) @local.definition.var) - -(assignment - (tuple_expression - (identifier) @local.definition.var)) - -; let/const bindings -(let_binding - (identifier) @local.definition.var) - -(let_binding - (tuple_expression - (identifier) @local.definition.var)) - -; For bindings -(for_binding - (identifier) @local.definition.var) - -(for_binding - (tuple_expression - (identifier) @local.definition.var)) - -; Types -(module_definition - (identifier) @local.definition.type) - -(struct_definition - (identifier) @local.definition.type) - -(type_head - (identifier) @local.definition.type) - -(type_head - (binary_expression - . - (identifier) @local.definition.type)) - -; Module imports -(import_statement - (identifier) @local.definition.import) - -(using_statement - (identifier) @local.definition.import) - -(selected_import - (identifier) @local.definition.import) - -; Scopes -(function_definition - (signature - (call_expression - . - (identifier) @local.definition.function))) @local.scope - -(macro_definition - (signature - (call_expression - . - (identifier) @local.definition.function))) @local.scope - -[ - (quote_statement) - (let_statement) - (for_statement) - (while_statement) - (try_statement) - (catch_clause) - (finally_clause) - (do_clause) -] @local.scope |
