mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 19:00: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] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
|
||||||
- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z)
|
- [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)
|
- [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] [fsh](https://github.com/mgramigna/tree-sitter-fsh) (maintained by @mgramigna)
|
||||||
- [x] [func](https://github.com/amaanq/tree-sitter-func) (maintained by @amaanq)
|
- [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)
|
- [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",
|
url = "https://github.com/stadelmanma/tree-sitter-fortran",
|
||||||
files = { "src/parser.c", "src/scanner.cc" },
|
files = { "src/parser.c", "src/scanner.cc" },
|
||||||
},
|
},
|
||||||
|
maintainers = { "@amaanq" },
|
||||||
}
|
}
|
||||||
|
|
||||||
list.fsh = {
|
list.fsh = {
|
||||||
|
|
|
||||||
|
|
@ -1,96 +1,224 @@
|
||||||
(identifier) @variable
|
; Preprocs
|
||||||
(string_literal) @string
|
|
||||||
(number_literal) @number
|
(preproc_file_line) @preproc
|
||||||
(boolean_literal) @boolean
|
|
||||||
(comment) @comment
|
; 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"
|
"import"
|
||||||
|
"include"
|
||||||
|
"use"
|
||||||
] @include
|
] @include
|
||||||
|
|
||||||
|
(import_statement
|
||||||
|
","
|
||||||
|
["all" "none"] @keyword)
|
||||||
|
|
||||||
|
; Attributes
|
||||||
|
|
||||||
[
|
[
|
||||||
(none)
|
(none)
|
||||||
"implicit"
|
"implicit"
|
||||||
"intent"
|
"intent"
|
||||||
] @attribute
|
] @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"
|
"endfunction"
|
||||||
"endprogram"
|
"endprogram"
|
||||||
|
"endprocedure"
|
||||||
"endsubroutine"
|
"endsubroutine"
|
||||||
"function"
|
"function"
|
||||||
"procedure"
|
"procedure"
|
||||||
|
"program"
|
||||||
"subroutine"
|
"subroutine"
|
||||||
] @keyword.function
|
] @keyword.function
|
||||||
|
|
||||||
[
|
[
|
||||||
"bind"
|
"result"
|
||||||
"call"
|
"return"
|
||||||
"class"
|
] @keyword.return
|
||||||
"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
|
|
||||||
|
|
||||||
"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"
|
"else"
|
||||||
"elseif"
|
"elseif"
|
||||||
|
"elsewhere"
|
||||||
"endif"
|
"endif"
|
||||||
"endwhere"
|
"endwhere"
|
||||||
"if"
|
"if"
|
||||||
|
|
@ -98,17 +226,44 @@
|
||||||
"where"
|
"where"
|
||||||
] @conditional
|
] @conditional
|
||||||
|
|
||||||
[
|
; Repeats
|
||||||
"do"
|
|
||||||
"enddo"
|
[
|
||||||
"forall"
|
"do"
|
||||||
"while"
|
"concurrent"
|
||||||
] @repeat
|
"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
|
] @operator
|
||||||
|
|
||||||
[
|
[
|
||||||
"\\.and\\."
|
"\\.and\\."
|
||||||
"\\.or\\."
|
"\\.or\\."
|
||||||
"\\.lt\\."
|
|
||||||
"\\.gt\\."
|
|
||||||
"\\.ge\\."
|
|
||||||
"\\.le\\."
|
|
||||||
"\\.eq\\."
|
|
||||||
"\\.eqv\\."
|
"\\.eqv\\."
|
||||||
"\\.neqv\\."
|
"\\.neqv\\."
|
||||||
|
"\\.lt\\."
|
||||||
|
"\\.gt\\."
|
||||||
|
"\\.le\\."
|
||||||
|
"\\.ge\\."
|
||||||
|
"\\.eq\\."
|
||||||
|
"\\.ne\\."
|
||||||
|
"\\.not\\."
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
;; Brackets
|
; Punctuation
|
||||||
[
|
|
||||||
"("
|
|
||||||
")"
|
|
||||||
"["
|
|
||||||
"]"
|
|
||||||
"<<<"
|
|
||||||
">>>"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
;; Delimiter
|
[ "[" "]" ] @punctuation.bracket
|
||||||
[
|
|
||||||
"::"
|
[ "(" ")" ] @punctuation.bracket
|
||||||
|
|
||||||
|
[ "<<<" ">>>" ] @punctuation.bracket
|
||||||
|
|
||||||
|
(array_literal
|
||||||
|
["(/" "/)"] @punctuation.bracket)
|
||||||
|
|
||||||
|
[
|
||||||
|
":"
|
||||||
","
|
","
|
||||||
|
"/"
|
||||||
"%"
|
"%"
|
||||||
] @punctuation.delimiter
|
"::"
|
||||||
|
"=>"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
(parameters
|
; Literals
|
||||||
(identifier) @parameter)
|
|
||||||
|
|
||||||
(program_statement
|
(string_literal) @string
|
||||||
(name) @namespace)
|
|
||||||
|
|
||||||
(module_statement
|
(number_literal) @number
|
||||||
(name) @namespace)
|
|
||||||
|
|
||||||
(function_statement
|
(boolean_literal) @boolean
|
||||||
(name) @function)
|
|
||||||
|
|
||||||
(subroutine_statement
|
(null_literal) @constant.builtin
|
||||||
(name) @function)
|
|
||||||
|
|
||||||
(end_program_statement
|
; Comments
|
||||||
(name) @namespace)
|
|
||||||
|
|
||||||
(end_module_statement
|
(comment) @comment @spell
|
||||||
(name) @namespace)
|
|
||||||
|
|
||||||
(end_function_statement
|
; Errors
|
||||||
(name) @function)
|
|
||||||
|
|
||||||
(end_subroutine_statement
|
(ERROR) @error
|
||||||
(name) @function)
|
|
||||||
|
|
||||||
(subroutine_call
|
|
||||||
(identifier) @function.call)
|
|
||||||
|
|
||||||
(keyword_argument
|
|
||||||
name: (identifier) @keyword)
|
|
||||||
|
|
||||||
(derived_type_member_expression
|
|
||||||
(type_member) @property)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue