Languages / Fortran · Edit queries/tags.scm

Tier 2 · Declarative tags.scm

Fortran

Declarative tree-sitter query plugin powered by QueryLanguagePlugin (rgctl-lang-runtime) and crates/rgctl-lang-fortran/queries/tags.scm. Compiles once at startup, validates captures against the Tier-2 vocabulary gate, and extracts symbols, container hierarchy (Container::member), imports, and call edges.

Grammar Crate
tree-sitter-fortran
Plugin
QueryLanguagePlugin (rgctl-lang-fortran)
Extensions
.f90, .f95, .f03, .f08, .F90
Discover
rgctl discover . -l fortran
Function Kinds
function, subroutine
Class / Container Kinds
derived_type_definition

Capture summary

CapturePatternsGraph mapping
@definition.class1Emits SymbolType::Class (acts as enclosing container).
@definition.function2Emits SymbolType::Function (acts as caller scope & container).
@definition.module1Emits SymbolType::Module (acts as enclosing container).
@import.path1Emits SymbolType::Import with normalized import_path metadata.
@name6Symbol identifier or target callee/type name.
@reference.call2Emits RelationType::Calls from innermost enclosing function to @name.

Query source (crates/rgctl-lang-fortran/queries/tags.scm)

; Tier-2 Fortran tags for rgctl (`handler = "queries"`).

(function_statement (name) @name) @definition.function

(subroutine_statement (name) @name) @definition.function

(module_statement (name) @name) @definition.module

(derived_type_definition
  (derived_type_statement
    (type_name) @name)) @definition.class

(call_expression (identifier) @name) @reference.call

(subroutine_call
  subroutine: (identifier) @name) @reference.call

(use_statement
  (module_name) @import.path)

Related: Tier 2 language support · Tier 1 language support · Discovering and indexing