Skip to main content

perl_incremental_parsing/
lib.rs

1//! Incremental parsing support for Perl.
2//!
3//! This crate provides efficient incremental parsing capabilities for Perl code,
4//! enabling Language Server Protocol features to respond quickly to document edits
5//! by reusing portions of the previous parse tree.
6//!
7//! # Overview
8//!
9//! The incremental parser minimizes re-parsing overhead when documents change by:
10//! - Identifying which portions of the AST are affected by an edit
11//! - Reusing unaffected subtrees from the previous parse
12//! - Only re-parsing the modified regions and their dependent nodes
13//!
14//! # Usage
15//!
16//! ```no_run
17//! use perl_incremental_parsing::incremental;
18//! use perl_parser_core::Parser;
19//!
20//! // Initial parse
21//! let source = "sub foo { return 42; }";
22//! let mut parser = Parser::new(source);
23//! let ast = parser.parse();
24//!
25//! // After edit, incrementally reparse only affected portions
26//! // (specific APIs depend on incremental module implementation)
27//! ```
28
29#![deny(unsafe_code)]
30#![deny(unreachable_pub)]
31#![cfg_attr(test, allow(clippy::panic, clippy::unwrap_used, clippy::expect_used))]
32#![warn(rust_2018_idioms)]
33#![warn(missing_docs)]
34#![warn(clippy::all)]
35#![allow(
36    clippy::too_many_lines,
37    clippy::module_name_repetitions,
38    clippy::cast_possible_truncation,
39    clippy::cast_sign_loss,
40    clippy::cast_precision_loss,
41    clippy::cast_possible_wrap,
42    clippy::must_use_candidate,
43    clippy::missing_errors_doc,
44    clippy::missing_panics_doc,
45    clippy::wildcard_imports,
46    clippy::enum_glob_use,
47    clippy::match_same_arms,
48    clippy::if_not_else,
49    clippy::struct_excessive_bools,
50    clippy::items_after_statements,
51    clippy::return_self_not_must_use,
52    clippy::unused_self,
53    clippy::collapsible_match,
54    clippy::collapsible_if,
55    clippy::only_used_in_recursion,
56    clippy::items_after_test_module,
57    clippy::while_let_loop,
58    clippy::single_range_in_vec_init,
59    clippy::arc_with_non_send_sync,
60    clippy::needless_range_loop,
61    clippy::result_large_err,
62    clippy::if_same_then_else,
63    clippy::should_implement_trait,
64    clippy::manual_flatten,
65    clippy::needless_raw_string_hashes,
66    clippy::single_char_pattern,
67    clippy::uninlined_format_args
68)]
69
70pub use perl_edit as edit;
71pub use perl_parser_core::{Node, NodeKind, SourceLocation};
72pub use perl_parser_core::{Parser, ast, error, parser, position};
73
74/// Incremental parsing implementation and helpers.
75pub mod incremental;
76pub use incremental::*;