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>
This commit is contained in:
parent
d12a517009
commit
a5236acd7e
25 changed files with 1768 additions and 6 deletions
|
|
@ -1,4 +1,24 @@
|
|||
//! Syntax layer for Lutra (layer L1).
|
||||
//!
|
||||
//! Parses source files with tree-sitter (PHP first) and derives outlines,
|
||||
//! folding ranges and highlight tokens from the syntax tree.
|
||||
//! 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue