Skip to main content

Crate perl_symbol_surface

Crate perl_symbol_surface 

Source
Expand description

Projection layer: derives stable, reusable symbol-bearing views from the Perl AST.

This crate sits at the seam between the syntax model (perl-ast) and IDE features (semantic analyzer, workspace index, navigation, rename, workspace symbols, call hierarchy). It converts raw AST nodes into well-typed projection structs that consumers can work with without re-implementing per-node pattern matching.

§Design goals

  • No perl-parser-core dependency — depends only on perl-ast, perl-position-tracking, and perl-symbol-types.
  • Single extraction passextract_symbol_decls walks the entire tree once and returns all declaration sites.
  • MVP scope — Phase 2a ships SymbolDecl only. SymbolRef and CallSite will follow in later phases.

§Quick start

use perl_symbol_surface::extract_symbol_decls;

// `ast` is a `perl_ast::Node` produced by the parser
let decls = extract_symbol_decls(&ast, Some("MyPackage"));
for d in &decls {
    println!("{} {:?} @ {:?}", d.qualified_name, d.kind, d.full_span);
}

Re-exports§

pub use decl::SymbolDecl;
pub use decl::extract_symbol_decls;

Modules§

decl
SymbolDecl — a projected declaration site derived from the Perl AST.