Languages / Pascal / Delphi · Edit queries/tags.scm

Tier 2 · Declarative tags.scm

Pascal / Delphi

Declarative tree-sitter query plugin powered by QueryLanguagePlugin (rgctl-lang-runtime) and crates/rgctl-lang-pascal/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-pascal
Plugin
QueryLanguagePlugin (rgctl-lang-pascal)
Extensions
.pas, .dpr, .dpk, .lpr
Discover
rgctl discover . -l pascal
Function Kinds
defProc, declProc
Class / Container Kinds
declClass, declIntf, declType

Capture summary

CapturePatternsGraph mapping
@_cls1Lexical scope capture.
@definition.class1Emits SymbolType::Class (acts as enclosing container).
@definition.function1Emits SymbolType::Function (acts as caller scope & container).
@definition.interface1Emits SymbolType::Interface (acts as enclosing container).
@definition.method1Emits SymbolType::Method (acts as caller scope & container).
@definition.module3Emits SymbolType::Module (acts as enclosing container).
@definition.type1Emits SymbolType::Type (acts as enclosing container).
@import.path1Emits SymbolType::Import with normalized import_path metadata.
@name9Symbol identifier or target callee/type name.
@reference.call1Emits RelationType::Calls from innermost enclosing function to @name.

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

; Tier-2 Pascal/Delphi tags for rgctl (`handler = "queries"`).

(unit
  (moduleName
    (identifier) @name)) @definition.module

(program
  (moduleName
    (identifier) @name)) @definition.module

(library
  (moduleName
    (identifier) @name)) @definition.module

(declType
  (identifier) @name
  (declClass)) @definition.class

(declType
  (identifier) @name
  (declIntf)) @definition.interface

(declType
  (identifier) @name
  [(declEnum) (declSet) (declArray) (declString) (declFile) (declProcRef)]) @definition.type

(declProc
  (identifier) @name) @definition.function

(defProc
  header: (declProc
    (genericDot
      (identifier) @_cls
      (identifier) @name))) @definition.method

(declUses
  (moduleName
    (identifier) @import.path))

(exprCall
  entity: (identifier) @name) @reference.call

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