pull/13802/merge
bclmary 2025-07-20 14:52:09 -04:00 committed by GitHub
commit 95fd9b3b47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 167 additions and 137 deletions

View File

@ -2610,7 +2610,7 @@ language-servers = [ "fortls" ]
[[grammar]]
name = "fortran"
source = { git = "https://github.com/stadelmanma/tree-sitter-fortran", rev = "f0f2f100952a353e64e26b0fa710b4c296d7af13" }
source = { git = "https://github.com/stadelmanma/tree-sitter-fortran", rev = "1b08f4c65fb47c76d3532cd3f7432d03abb9ef69" }
[[language]]
name = "ungrammar"

View File

@ -7,5 +7,6 @@
(derived_type_definition)
(function)
(subroutine)
(module_procedure)
(interface)
] @fold

View File

@ -1,93 +1,112 @@
(identifier) @variable
(string_literal) @string
(number_literal) @number
(boolean_literal) @boolean
(comment) @comment
[
(intrinsic_type)
"dimension"
"intent"
"in"
"out"
"inout"
"type"
"endtype"
"allocatable"
"attributes"
"global"
"device"
"host"
"dimension"
"endtype"
"global"
"grid_global"
"host"
"import"
"in"
"inout"
"intent"
"optional"
"out"
"pointer"
] @keyword.storage.modifier
"type"
"value"
] @type
[
"contains"
"public"
"private"
] @keyword.directive
"public"
] @include
[
"implicit"
(none)
] @attribute
(none)
"implicit"
] @attribute
[
"function"
"endfunction"
"endprogram"
"subroutine"
"endsubroutine"
] @keyword.storage
"function"
"procedure"
"subroutine"
] @keyword.function
[
"module"
"endmodule"
(default)
(procedure_qualifier)
"abstract"
"bind"
"call"
"class"
"continue"
"cycle"
"endenum"
"endinterface"
"endmodule"
"endprocedure"
"endprogram"
"endsubmodule"
"enum"
"enumerator"
"equivalence"
"exit"
"extends"
"format"
"goto"
"include"
"interface"
"endinterface"
"intrinsic"
"non_intrinsic"
"module"
"namelist"
"only"
"parameter"
"procedure"
"print"
"procedure"
"program"
"endprogram"
"read"
"return"
"result"
"stop"
"submodule"
"use"
"write"
"enum"
"endenum"
(default)
(procedure_qualifier)
] @keyword
] @keyword
"return" @keyword.return
[
"if"
"then"
"else"
"elseif"
"elsewhere"
"endif"
"where"
"endwhere"
] @keyword.control.conditional
"if"
"then"
"where"
] @conditional
[
"do"
"enddo"
"while"
"forall"
] @keyword.control.repeat
"while"
] @repeat
[
"*"
"**"
"+"
"-"
"/"
@ -98,7 +117,7 @@
">="
"=="
"/="
] @operator
] @operator
[
"\\.and\\."
@ -110,27 +129,27 @@
"\\.eq\\."
"\\.eqv\\."
"\\.neqv\\."
] @keyword.operator
] @keyword.operator
(identifier) @variable
;; Brackets
[
;; Brackets
[
"("
")"
"["
"]"
"<<<"
">>>"
] @punctuation.bracket
;; Delimiter
[
;; Delimiter
[
"::"
","
"%"
] @punctuation.delimiter
(parameters
(identifier) @variable.parameter)
(identifier) @parameter)
(program_statement
(name) @namespace)
@ -138,35 +157,41 @@
(module_statement
(name) @namespace)
(submodule_statement
(module_name) (name) @namespace)
(function_statement
(name) @function)
(subroutine_statement
(name) @function)
(module_procedure_statement
(name) @function)
(end_program_statement
(name) @namespace)
(end_module_statement
(name) @namespace)
(end_submodule_statement
(name) @namespace)
(end_function_statement
(name) @function)
(end_subroutine_statement
(name) @function)
(subroutine_call
(end_module_procedure_statement
(name) @function)
(subroutine_call
(identifier) @function)
(keyword_argument
name: (identifier) @keyword)
(derived_type_member_expression
(type_member) @variable.other.member)
(string_literal) @string
(number_literal) @constant.numeric
(boolean_literal) @constant.builtin.boolean
(comment) @comment
(type_member) @property)

View File

@ -1,7 +1,9 @@
[
(module)
(submodule)
(program)
(subroutine)
(module_procedure)
(function)
; (interface)
(if_statement)
@ -13,8 +15,10 @@
[
(end_module_statement)
(end_submodule_statement)
(end_program_statement)
(end_subroutine_statement)
(end_module_procedure_statement)
(end_function_statement)
; (end_interface_statement)
(end_if_statement)
@ -24,4 +28,4 @@
(end_type_statement)
(end_enum_statement)
(end_where_statement)
] @outdent
] @branch