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]] [[grammar]]
name = "fortran" 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]] [[language]]
name = "ungrammar" name = "ungrammar"

View File

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

View File

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

View File

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