Lutra/crates/syntax/src/lib.rs
danny a5236acd7e M2.1: tree-sitter PHP in crates/syntax
Parser (parse, incremental reparse from lutra_text edits), outline with
UTF-16 ranges and short signatures, folding ranges, 8 MiB parse cap.
Snapshot tests for five PHP 8.3 fixtures, proptests (random bytes,
reparse equals fresh parse, undo round trip), ignored release timing
test. Docs: architecture Syntax section, parity evidence, G4 note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 22:06:21 +02:00

24 lines
983 B
Rust

//! Syntax layer for Lutra (layer L1).
//!
//! Parses PHP source with tree-sitter and derives the structure the rest of
//! the IDE builds on: the outline (namespaces, classes, functions, members)
//! and folding ranges. Highlighting in the editor is done by CodeMirror's
//! Lezer grammar in the UI; this crate is the structural source for the
//! outline, folding and the symbol index (see `docs/architecture.md`).
//!
//! Source text is untrusted: nothing here panics on broken PHP or random
//! bytes. Files over [`MAX_PARSE_BYTES`] are not parsed; their [`Tree`]
//! reports [`Tree::truncated`] and yields an empty outline.
//!
//! Positions are zero-based lines and columns counted in UTF-16 code units,
//! converted through `lutra_text`.
mod folding;
mod outline;
mod parser;
mod range;
pub use folding::folding;
pub use outline::{ANONYMOUS_CLASS_NAME, OutlineItem, OutlineKind, outline};
pub use parser::{MAX_PARSE_BYTES, Parser, SyntaxError, Tree};
pub use range::Range;