mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 20:00:07 -04:00
feat(orca): add support for ORCA input files
This commit is contained in:
parent
bf0234010a
commit
22b1d7526a
6 changed files with 292 additions and 0 deletions
1
SUPPORTED_LANGUAGES.md
generated
1
SUPPORTED_LANGUAGES.md
generated
|
|
@ -200,6 +200,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka
|
|||
[ocaml_interface](https://github.com/tree-sitter/tree-sitter-ocaml) | unstable | `HFIJL` | | @undu
|
||||
[ocamllex](https://github.com/atom-ocaml/tree-sitter-ocamllex) | unstable | `H J ` | | @undu
|
||||
[odin](https://github.com/tree-sitter-grammars/tree-sitter-odin) | unstable | `HFIJL` | | @amaanq
|
||||
[orca](https://github.com/kszenes/tree-sitter-orca) | unstable | `HFI ` | | @kszenes
|
||||
[pascal](https://github.com/Isopod/tree-sitter-pascal) | unstable | `HFIJL` | | @Isopod
|
||||
[passwd](https://github.com/ath3/tree-sitter-passwd) | unstable | `H ` | | @amaanq
|
||||
[pem](https://github.com/tree-sitter-grammars/tree-sitter-pem) | unstable | `HF J ` | | @ObserverOfTime
|
||||
|
|
|
|||
|
|
@ -1538,6 +1538,14 @@ return {
|
|||
maintainers = { '@amaanq' },
|
||||
tier = 2,
|
||||
},
|
||||
orca = {
|
||||
install_info = {
|
||||
revision = '6b74f981bcb62edd78c2a04f43e3975f9e1d546b',
|
||||
url = "https://github.com/kszenes/tree-sitter-orca",
|
||||
},
|
||||
maintainers = { '@kszenes' },
|
||||
tier = 2,
|
||||
},
|
||||
pascal = {
|
||||
install_info = {
|
||||
revision = '5054931bcd022860dd5936864f981e359fb63aef',
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ local filetypes = {
|
|||
markdown = { 'pandoc' },
|
||||
muttrc = { 'neomuttrc' },
|
||||
ocaml_interface = { 'ocamlinterface' },
|
||||
orca = { 'inp' },
|
||||
perl = { 'pl' },
|
||||
poe_filter = { 'poefilter' },
|
||||
powershell = { 'ps1' },
|
||||
|
|
|
|||
9
runtime/queries/orca/folds.scm
Normal file
9
runtime/queries/orca/folds.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
(input_block)
|
||||
(geom_block)
|
||||
(subblock)
|
||||
(compound_script)
|
||||
(compound_step_block)
|
||||
(compound_for_loop)
|
||||
(compound_if_block)
|
||||
] @fold
|
||||
252
runtime/queries/orca/highlights.scm
Normal file
252
runtime/queries/orca/highlights.scm
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
(comment) @comment
|
||||
|
||||
(integer) @number
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(element) @string
|
||||
|
||||
(simple_line) @variable.parameter
|
||||
|
||||
(input_title) @keyword
|
||||
|
||||
(input_key) @property
|
||||
|
||||
(quoted_string) @string
|
||||
|
||||
(geom_line_types) @type
|
||||
|
||||
[
|
||||
(geom_line_types)
|
||||
"xyz"
|
||||
"int"
|
||||
"gzmt"
|
||||
] @type
|
||||
|
||||
"*" @keyword
|
||||
|
||||
(string) @number
|
||||
|
||||
; Variables (FIRST - higher priority than general rules) - using @function for prominence
|
||||
(variable_ref
|
||||
(variable_name) @operator) ; {r} in geometry blocks
|
||||
|
||||
(variable_ref
|
||||
"{" @punctuation.bracket)
|
||||
|
||||
(variable_ref
|
||||
"}" @punctuation.bracket)
|
||||
|
||||
(variable_def
|
||||
(variable_name) @operator) ; r in variable definitions
|
||||
|
||||
(variable_range
|
||||
(float) @number.float)
|
||||
|
||||
(variable_array
|
||||
(float) @number.float)
|
||||
|
||||
; Variable definitions in %paras blocks (when parsed as regular kv_pair)
|
||||
(input_block
|
||||
(input_title
|
||||
(word) @_paras)
|
||||
(input_body
|
||||
(kv_pair
|
||||
(input_key
|
||||
(word) @operator)))
|
||||
(#eq? @_paras "paras"))
|
||||
|
||||
; Variable definitions in pardef subblocks
|
||||
(subblock
|
||||
(word) @_pardef
|
||||
(input_body
|
||||
(kv_pair
|
||||
(input_key
|
||||
(word) @operator)))
|
||||
(#eq? @_pardef "pardef"))
|
||||
|
||||
";" @punctuation.delimiter
|
||||
|
||||
; Brace blocks
|
||||
(brace_block
|
||||
"{" @property)
|
||||
|
||||
(brace_block
|
||||
"}" @property)
|
||||
|
||||
(brace_value
|
||||
(float) @number.float)
|
||||
|
||||
(brace_value
|
||||
(integer) @number)
|
||||
|
||||
(constraint_content) @string
|
||||
|
||||
"," @punctuation.delimiter
|
||||
|
||||
; General word values (LAST - lower priority)
|
||||
(value_atom
|
||||
(word) @number) ; Words used as values get same color as other values
|
||||
|
||||
; Internal coordinate highlighting
|
||||
(int_line
|
||||
connect1: (integer) @operator)
|
||||
|
||||
(int_line
|
||||
connect2: (integer) @operator)
|
||||
|
||||
(int_line
|
||||
connect3: (integer) @operator)
|
||||
|
||||
(int_line
|
||||
(coord_value
|
||||
(float) @number.float))
|
||||
|
||||
(int_line
|
||||
(coord_value
|
||||
(variable_ref) @operator))
|
||||
|
||||
; Zmatrix coordinate highlighting - alternating pattern like internal coords
|
||||
(zmat_line2
|
||||
zmat_atom1: (integer) @operator)
|
||||
|
||||
(zmat_line2
|
||||
(coord_value
|
||||
(float) @number.float))
|
||||
|
||||
(zmat_line2
|
||||
(coord_value
|
||||
(variable_ref) @operator))
|
||||
|
||||
(zmat_line3
|
||||
zmat_atom1: (integer) @operator)
|
||||
|
||||
(zmat_line3
|
||||
zmat_atom2: (integer) @operator)
|
||||
|
||||
(zmat_line3
|
||||
(coord_value
|
||||
(float) @number.float))
|
||||
|
||||
(zmat_line3
|
||||
(coord_value
|
||||
(variable_ref) @operator))
|
||||
|
||||
(zmat_line4
|
||||
zmat_atom1: (integer) @operator)
|
||||
|
||||
(zmat_line4
|
||||
zmat_atom2: (integer) @operator)
|
||||
|
||||
(zmat_line4
|
||||
zmat_atom3: (integer) @operator)
|
||||
|
||||
(zmat_line4
|
||||
(coord_value
|
||||
(float) @number.float))
|
||||
|
||||
(zmat_line4
|
||||
(coord_value
|
||||
(variable_ref) @operator))
|
||||
|
||||
; Subblocks
|
||||
(subblock
|
||||
name: (word) @character)
|
||||
|
||||
(subblock
|
||||
"end" @character)
|
||||
|
||||
; Compound script highlighting - use node types instead of regexes
|
||||
(compound_script) @keyword
|
||||
|
||||
(compound_variable_declaration) @keyword
|
||||
|
||||
(compound_step_block) @keyword
|
||||
|
||||
(compound_end) @keyword
|
||||
|
||||
(compound_variable_declaration
|
||||
(variable_name) @function)
|
||||
|
||||
(compound_variable_reference
|
||||
(variable_name) @function)
|
||||
|
||||
(compound_variable_reference
|
||||
"&{" @punctuation.bracket)
|
||||
|
||||
(compound_variable_reference
|
||||
"}" @punctuation.bracket)
|
||||
|
||||
(compound_boolean) @boolean
|
||||
|
||||
(compound_assignment
|
||||
(variable_name) @function)
|
||||
|
||||
(coord_value
|
||||
(compound_variable_reference) @function)
|
||||
|
||||
; Control flow structures
|
||||
(compound_for_loop) @keyword
|
||||
|
||||
(compound_if_block) @keyword
|
||||
|
||||
; For loop keywords and components
|
||||
(compound_for_loop
|
||||
(variable_name) @function)
|
||||
|
||||
; If/else condition components
|
||||
(compound_condition) @keyword.conditional
|
||||
|
||||
(compound_comparison) @operator
|
||||
|
||||
; Array access
|
||||
(compound_array_access
|
||||
(variable_name) @function)
|
||||
|
||||
(compound_array_access
|
||||
"[" @punctuation.bracket)
|
||||
|
||||
(compound_array_access
|
||||
"]" @punctuation.bracket)
|
||||
|
||||
; Function calls
|
||||
(compound_function_call
|
||||
(variable_name) @function.call)
|
||||
|
||||
(compound_function_call
|
||||
"(" @punctuation.bracket)
|
||||
|
||||
(compound_function_call
|
||||
")" @punctuation.bracket)
|
||||
|
||||
; Array assignments
|
||||
(compound_array_assignment
|
||||
(compound_array_access
|
||||
(variable_name) @function))
|
||||
|
||||
; Variables in expressions - general pattern to catch all variable usage
|
||||
(compound_primary_expr
|
||||
(variable_name) @function)
|
||||
|
||||
[
|
||||
"*"
|
||||
"/"
|
||||
"+"
|
||||
"-"
|
||||
"="
|
||||
] @operator
|
||||
|
||||
; Parentheses in expressions and conditions
|
||||
(compound_primary_expr
|
||||
"(" @punctuation.bracket)
|
||||
|
||||
(compound_primary_expr
|
||||
")" @punctuation.bracket)
|
||||
|
||||
(compound_if_block
|
||||
"(" @punctuation.bracket)
|
||||
|
||||
(compound_if_block
|
||||
")" @punctuation.bracket)
|
||||
|
||||
";" @punctuation.delimiter
|
||||
21
runtime/queries/orca/indents.scm
Normal file
21
runtime/queries/orca/indents.scm
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[
|
||||
(input_block)
|
||||
(subblock)
|
||||
(geom_block)
|
||||
(compound_script)
|
||||
(compound_step_block)
|
||||
(compound_for_loop)
|
||||
(compound_if_block)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(input_block)
|
||||
(subblock)
|
||||
(geom_block)
|
||||
(compound_script)
|
||||
(compound_step_block)
|
||||
(compound_for_loop)
|
||||
(compound_if_block)
|
||||
] @indent.end
|
||||
|
||||
"*" @indent.end
|
||||
Loading…
Add table
Add a link
Reference in a new issue