mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(fortran): update highlight queries
This commit is contained in:
parent
e2a9fc8e5c
commit
5cfb5d7768
3 changed files with 265 additions and 120 deletions
|
|
@ -214,7 +214,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
|||
- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
|
||||
- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z)
|
||||
- [x] [foam](https://github.com/FoamScience/tree-sitter-foam) (experimental, maintained by @FoamScience)
|
||||
- [ ] [fortran](https://github.com/stadelmanma/tree-sitter-fortran)
|
||||
- [x] [fortran](https://github.com/stadelmanma/tree-sitter-fortran) (maintained by @amaanq)
|
||||
- [x] [fsh](https://github.com/mgramigna/tree-sitter-fsh) (maintained by @mgramigna)
|
||||
- [x] [func](https://github.com/amaanq/tree-sitter-func) (maintained by @amaanq)
|
||||
- [x] [fusion](https://gitlab.com/jirgn/tree-sitter-fusion.git) (maintained by @jirgn)
|
||||
|
|
|
|||
|
|
@ -443,6 +443,7 @@ list.fortran = {
|
|||
url = "https://github.com/stadelmanma/tree-sitter-fortran",
|
||||
files = { "src/parser.c", "src/scanner.cc" },
|
||||
},
|
||||
maintainers = { "@amaanq" },
|
||||
}
|
||||
|
||||
list.fsh = {
|
||||
|
|
|
|||
|
|
@ -1,96 +1,224 @@
|
|||
(identifier) @variable
|
||||
(string_literal) @string
|
||||
(number_literal) @number
|
||||
(boolean_literal) @boolean
|
||||
(comment) @comment
|
||||
; Preprocs
|
||||
|
||||
(preproc_file_line) @preproc
|
||||
|
||||
; Namespaces
|
||||
|
||||
(program_statement
|
||||
(name) @namespace)
|
||||
|
||||
(end_program_statement
|
||||
(name) @namespace)
|
||||
|
||||
(module_statement
|
||||
(name) @namespace)
|
||||
|
||||
(end_module_statement
|
||||
(name) @namespace)
|
||||
|
||||
(submodule_statement
|
||||
(name) @namespace)
|
||||
|
||||
(end_submodule_statement
|
||||
(name) @namespace)
|
||||
|
||||
; Includes
|
||||
|
||||
[
|
||||
(intrinsic_type)
|
||||
"pointer"
|
||||
] @type
|
||||
|
||||
[
|
||||
"allocatable"
|
||||
"attributes"
|
||||
"device"
|
||||
"dimension"
|
||||
"global"
|
||||
"grid_global"
|
||||
"host"
|
||||
"optional"
|
||||
"private"
|
||||
"public"
|
||||
"value"
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
"endtype"
|
||||
"type"
|
||||
] @type.definition
|
||||
|
||||
[
|
||||
"in"
|
||||
"inout"
|
||||
"out"
|
||||
] @storageclass
|
||||
|
||||
[
|
||||
"contains"
|
||||
"import"
|
||||
"include"
|
||||
"use"
|
||||
] @include
|
||||
|
||||
(import_statement
|
||||
","
|
||||
["all" "none"] @keyword)
|
||||
|
||||
; Attributes
|
||||
|
||||
[
|
||||
(none)
|
||||
"implicit"
|
||||
"intent"
|
||||
] @attribute
|
||||
|
||||
(implicit_statement
|
||||
"type" @attribute)
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"attributes"
|
||||
"associate"
|
||||
"block"
|
||||
"class"
|
||||
"classis"
|
||||
"contains"
|
||||
"default"
|
||||
"dimension"
|
||||
"endassociate"
|
||||
"endenum"
|
||||
"endinterface"
|
||||
"endmodule"
|
||||
"endselect"
|
||||
"endsubmodule"
|
||||
"endtype"
|
||||
"enum"
|
||||
"enumerator"
|
||||
"equivalence"
|
||||
"extends"
|
||||
"goto"
|
||||
"interface"
|
||||
"intrinsic"
|
||||
"non_intrinsic"
|
||||
"module"
|
||||
"submodule"
|
||||
"namelist"
|
||||
"parameter"
|
||||
"quiet"
|
||||
"rank"
|
||||
"save"
|
||||
"selectcase"
|
||||
"selectrank"
|
||||
"selecttype"
|
||||
"sequence"
|
||||
"stop"
|
||||
"target"
|
||||
"type"
|
||||
"typeis"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
(default)
|
||||
] @keyword
|
||||
|
||||
; Types
|
||||
|
||||
[
|
||||
(type_name)
|
||||
] @type
|
||||
|
||||
[
|
||||
(intrinsic_type)
|
||||
] @type.builtin
|
||||
|
||||
; Qualifiers
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"allocatable"
|
||||
"automatic"
|
||||
"constant"
|
||||
"contiguous"
|
||||
"data"
|
||||
"deferred"
|
||||
"device"
|
||||
"external"
|
||||
"family"
|
||||
"final"
|
||||
"generic"
|
||||
"global"
|
||||
"grid_global"
|
||||
"host"
|
||||
"initial"
|
||||
"local"
|
||||
"local_init"
|
||||
"managed"
|
||||
"nopass"
|
||||
"non_overridable"
|
||||
"optional"
|
||||
"pass"
|
||||
"pinned"
|
||||
"pointer"
|
||||
"private"
|
||||
"property"
|
||||
"protected"
|
||||
"public"
|
||||
"shared"
|
||||
"static"
|
||||
"texture"
|
||||
"value"
|
||||
"volatile"
|
||||
(procedure_qualifier)
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
"common"
|
||||
"in"
|
||||
"inout"
|
||||
"out"
|
||||
] @storageclass
|
||||
|
||||
; Labels
|
||||
|
||||
[
|
||||
(statement_label)
|
||||
(statement_label_reference)
|
||||
] @label
|
||||
|
||||
[
|
||||
"call"
|
||||
"endfunction"
|
||||
"endprogram"
|
||||
"endprocedure"
|
||||
"endsubroutine"
|
||||
"function"
|
||||
"procedure"
|
||||
"program"
|
||||
"subroutine"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"bind"
|
||||
"call"
|
||||
"class"
|
||||
"continue"
|
||||
"cycle"
|
||||
"endenum"
|
||||
"endinterface"
|
||||
"endmodule"
|
||||
"endprogram"
|
||||
"enum"
|
||||
"enumerator"
|
||||
"equivalence"
|
||||
"exit"
|
||||
"format"
|
||||
"goto"
|
||||
"include"
|
||||
"interface"
|
||||
"module"
|
||||
"namelist"
|
||||
"only"
|
||||
"parameter"
|
||||
"print"
|
||||
"program"
|
||||
"read"
|
||||
"stop"
|
||||
"use"
|
||||
"write"
|
||||
(default)
|
||||
(procedure_qualifier)
|
||||
] @keyword
|
||||
"result"
|
||||
"return"
|
||||
] @keyword.return
|
||||
|
||||
"return" @keyword.return
|
||||
; Functions
|
||||
|
||||
(function_statement
|
||||
(name) @function)
|
||||
|
||||
(end_function_statement
|
||||
(name) @function)
|
||||
|
||||
(subroutine_statement
|
||||
(name) @function)
|
||||
|
||||
(end_subroutine_statement
|
||||
(name) @function)
|
||||
|
||||
(module_procedure_statement
|
||||
(name) @function)
|
||||
|
||||
(end_module_procedure_statement
|
||||
(name) @function)
|
||||
|
||||
(subroutine_call
|
||||
(identifier) @function.call)
|
||||
|
||||
[
|
||||
"character"
|
||||
"close"
|
||||
"bind"
|
||||
"format"
|
||||
"open"
|
||||
"print"
|
||||
"read"
|
||||
"write"
|
||||
] @function.builtin
|
||||
|
||||
; Exceptions
|
||||
|
||||
[
|
||||
"error"
|
||||
] @exception
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"else"
|
||||
"elseif"
|
||||
"elsewhere"
|
||||
"endif"
|
||||
"endwhere"
|
||||
"if"
|
||||
|
|
@ -98,17 +226,44 @@
|
|||
"where"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"do"
|
||||
"enddo"
|
||||
"forall"
|
||||
"while"
|
||||
] @repeat
|
||||
; Repeats
|
||||
|
||||
[
|
||||
"do"
|
||||
"concurrent"
|
||||
"enddo"
|
||||
"endforall"
|
||||
"forall"
|
||||
"while"
|
||||
"continue"
|
||||
"cycle"
|
||||
"exit"
|
||||
] @repeat
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Parameters
|
||||
|
||||
(keyword_argument
|
||||
name: (identifier) @parameter)
|
||||
|
||||
(parameters
|
||||
(identifier) @parameter)
|
||||
|
||||
; Properties
|
||||
|
||||
(derived_type_member_expression
|
||||
(type_member) @property)
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"*"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"**"
|
||||
"/"
|
||||
"="
|
||||
"<"
|
||||
|
|
@ -117,69 +272,58 @@
|
|||
">="
|
||||
"=="
|
||||
"/="
|
||||
"//"
|
||||
(assumed_rank)
|
||||
] @operator
|
||||
|
||||
[
|
||||
"\\.and\\."
|
||||
"\\.or\\."
|
||||
"\\.lt\\."
|
||||
"\\.gt\\."
|
||||
"\\.ge\\."
|
||||
"\\.le\\."
|
||||
"\\.eq\\."
|
||||
"\\.eqv\\."
|
||||
"\\.neqv\\."
|
||||
"\\.lt\\."
|
||||
"\\.gt\\."
|
||||
"\\.le\\."
|
||||
"\\.ge\\."
|
||||
"\\.eq\\."
|
||||
"\\.ne\\."
|
||||
"\\.not\\."
|
||||
] @keyword.operator
|
||||
|
||||
;; Brackets
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"<<<"
|
||||
">>>"
|
||||
] @punctuation.bracket
|
||||
; Punctuation
|
||||
|
||||
;; Delimiter
|
||||
[
|
||||
"::"
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[ "<<<" ">>>" ] @punctuation.bracket
|
||||
|
||||
(array_literal
|
||||
["(/" "/)"] @punctuation.bracket)
|
||||
|
||||
[
|
||||
":"
|
||||
","
|
||||
"/"
|
||||
"%"
|
||||
] @punctuation.delimiter
|
||||
"::"
|
||||
"=>"
|
||||
] @punctuation.delimiter
|
||||
|
||||
(parameters
|
||||
(identifier) @parameter)
|
||||
; Literals
|
||||
|
||||
(program_statement
|
||||
(name) @namespace)
|
||||
(string_literal) @string
|
||||
|
||||
(module_statement
|
||||
(name) @namespace)
|
||||
(number_literal) @number
|
||||
|
||||
(function_statement
|
||||
(name) @function)
|
||||
(boolean_literal) @boolean
|
||||
|
||||
(subroutine_statement
|
||||
(name) @function)
|
||||
(null_literal) @constant.builtin
|
||||
|
||||
(end_program_statement
|
||||
(name) @namespace)
|
||||
; Comments
|
||||
|
||||
(end_module_statement
|
||||
(name) @namespace)
|
||||
(comment) @comment @spell
|
||||
|
||||
(end_function_statement
|
||||
(name) @function)
|
||||
; Errors
|
||||
|
||||
(end_subroutine_statement
|
||||
(name) @function)
|
||||
|
||||
(subroutine_call
|
||||
(identifier) @function.call)
|
||||
|
||||
(keyword_argument
|
||||
name: (identifier) @keyword)
|
||||
|
||||
(derived_type_member_expression
|
||||
(type_member) @property)
|
||||
(ERROR) @error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue