1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//! Core parser engine for Perl source code.
//!
//! `perl-parser-core` is the foundational crate that wires together the lexer,
//! AST, error recovery, and position mapping into a single [`Parser`] entry
//! point. Higher-level crates -- semantic analysis, workspace indexing, and the
//! LSP server -- all build on top of this crate.
//!
//! # Key types
//!
//! | Type | Role |
//! |------|------|
//! | [`Parser`] | Recursive-descent parser; call [`Parser::parse`] to get an AST |
//! | [`Node`] / [`NodeKind`] | AST node and its discriminant (re-exported from `perl-ast`) |
//! | [`ParseError`] | Syntax error collected during parsing |
//! | [`ParseOutput`] | AST + diagnostics bundle for IDE workflows |
//! | [`Token`] / [`TokenKind`] | Lexer tokens consumed by the parser |
//! | [`SourceLocation`] | Byte-offset span for every node |
//!
//! # Quick start
//!
//! ```rust
//! use perl_parser_core::{Parser, Node, NodeKind};
//!
//! let mut parser = Parser::new("my $x = 42;");
//! let ast = parser.parse().expect("should parse");
//!
//! // The root is always a Program node
//! assert!(matches!(ast.kind, NodeKind::Program { .. }));
//!
//! // Non-fatal errors are collected, not returned as Err
//! assert!(parser.errors().is_empty());
//! ```
//!
//! For IDE workflows that need error-tolerant parsing, use
//! [`Parser::parse_with_recovery`]:
//!
//! ```rust
//! use perl_parser_core::Parser;
//!
//! let mut parser = Parser::new("if (");
//! let output = parser.parse_with_recovery();
//!
//! // Always returns an AST (possibly with ERROR nodes)
//! assert!(!output.diagnostics.is_empty());
//! ```
/// Builtin function signatures and metadata.
pub use builtins;
/// Parser engine components and supporting utilities.
/// Syntax-level types absorbed from Wave D satellite crates.
/// Token stream and trivia utilities for the parser.
/// Index into the diagnostics array in [`ParseOutput`] (from `ast_v2`).
pub use ;
/// Abstract Syntax Tree (AST) definitions for Perl parsing.
pub use ast;
/// Experimental second-generation AST (work in progress).
pub use ast_v2;
/// Parser context with error recovery support.
pub use parser_context;
/// Pragma tracking for `use` and related directives.
pub use pragma_tracker;
/// Parser for Perl quote and quote-like operators.
pub use quote_parser;
/// Legacy module aliases for moved engine components.
pub use ;
/// Parser utilities and helpers.
pub use util;
/// Edit tracking for incremental parsing (internal module, previously `perl-edit`).
pub use edit;
/// Heredoc content collector with FIFO ordering and indent stripping (internal module, previously `perl-heredoc`).
pub use heredoc as heredoc_collector;
/// Secure workspace-relative path normalization (previously `perl-path-normalize`).
pub use path_normalize;
/// Workspace-bound path validation and traversal prevention (previously `perl-path-security`).
pub use path_security;
/// Percentile helpers for integer metric samples (previously `perl-percentile`).
pub use percentile;
/// Perl qualified-name parsing, splitting, and validation helpers (previously `perl-qualified-name`).
pub use qualified_name;
/// Perl source-file classification helpers (previously `perl-source-file`).
pub use source_file;
/// Text-line cursor and boundary helpers (previously `perl-text-line`).
pub use text_line;
/// Recursive-descent parser -- the main entry point for parsing Perl source.
pub use Parser;
/// Error classification and recovery strategies for parse failures.
pub use classifier as error_classifier;
/// Error recovery helpers and strategies.
pub use recovery as error_recovery;
/// Result of an error recovery attempt.
pub use RecoveryResult;
/// Line indexing and position mapping utilities.
/// Line ending detection for mixed-EOL source files.
pub use ;
/// Core AST types re-exported for convenience.
pub use ;
/// Recovery-salvage metrics and classifier for accuracy closeout reporting.
pub use ;
/// Parse error, budget, and output types.
pub use ;
/// Builtin function signature lookup tables.
pub use builtin_signatures;
/// Perfect hash function (PHF) based builtin signature lookup.
pub use builtin_signatures_phf;
/// Token stream module for lexer-to-parser bridge.
pub use token_stream;
/// Lightweight token wrapper for AST integration.
pub use token_wrapper;
/// Trivia (whitespace and comments) representation.
pub use trivia;
/// Trivia-preserving parser and formatting utilities.
pub use trivia_parser;
/// Individual token, its classification, and the streaming iterator.
pub use ;
/// Trivia types attached to AST nodes for formatting preservation.
pub use ;
/// Trivia-preserving parser and source formatting helper.
pub use ;