Languages / Perl · Edit queries/tags.scm

Tier 2 · Declarative tags.scm

Perl

Declarative tree-sitter query plugin powered by QueryLanguagePlugin (rgctl-lang-runtime) and crates/rgctl-lang-perl/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
ts-parser-perl
Plugin
QueryLanguagePlugin (rgctl-lang-perl)
Extensions
.pl, .pm, .t
Discover
rgctl discover . -l perl
Function Kinds
subroutine_declaration_statement, method_declaration_statement
Class / Container Kinds
—

Capture summary

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

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

; Tier-2 Perl tags for rgctl (`handler = "queries"`).
; Grammar: ts-parser-perl (tree-sitter-perl 1.1 is ABI-incompatible with tree-sitter 0.25).

(package_statement
  name: (package) @name) @definition.module

(subroutine_declaration_statement
  name: (bareword) @name) @definition.function

(method_declaration_statement
  name: (bareword) @name) @definition.function

(use_statement
  module: (package) @import.path)

(require_expression
  (bareword) @import.path)

(function_call_expression
  (function) @name) @reference.call

(method_call_expression
  (method) @name) @reference.call

(ambiguous_function_call_expression
  (function) @name) @reference.call

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