Skip to main content

perl_symbol_surface/
lib.rs

1//! Projection layer: derives stable, reusable symbol-bearing views from the Perl AST.
2//!
3//! This crate sits at the seam between the *syntax model* (`perl-ast`) and *IDE
4//! features* (semantic analyzer, workspace index, navigation, rename, workspace
5//! symbols, call hierarchy).  It converts raw AST nodes into well-typed
6//! projection structs that consumers can work with without re-implementing
7//! per-node pattern matching.
8//!
9//! # Design goals
10//!
11//! - **No `perl-parser-core`** dependency — depends only on `perl-ast`,
12//!   `perl-position-tracking`, and `perl-symbol-types`.
13//! - **Single extraction pass** — `extract_symbol_decls` walks the entire tree
14//!   once and returns all declaration sites.
15//! - **MVP scope** — Phase 2a ships `SymbolDecl` only.  `SymbolRef` and
16//!   `CallSite` will follow in later phases.
17//!
18//! # Quick start
19//!
20//! ```rust,ignore
21//! use perl_symbol_surface::extract_symbol_decls;
22//!
23//! // `ast` is a `perl_ast::Node` produced by the parser
24//! let decls = extract_symbol_decls(&ast, Some("MyPackage"));
25//! for d in &decls {
26//!     println!("{} {:?} @ {:?}", d.qualified_name, d.kind, d.full_span);
27//! }
28//! ```
29
30pub mod decl;
31
32pub use decl::{SymbolDecl, extract_symbol_decls};