Skip to main content

Module ast

Module ast 

Source
Expand description

Core AST infrastructure: arena-backed ParsedDoc, span utilities, and TypeHint formatting.

Convention: a borrowed SourceView is idiomatically bound to sv across the crate (offset↔position math). A ParsedDoc value is doc. See the crate-root glossary in lib.rs.

Structs§

ParsedDoc
Owns a parsed PHP document: the bumpalo arena, source snapshot, and Program.
SourceView
Bundles source text with its precomputed line-start table. Copy so inner functions can pass it by value without lifetime annotation churn.

Functions§

format_type_hint
Format a TypeHint as a PHP type string, e.g. ?int, string|null.
name_range
Build an LSP Range for a name that is a sub-slice of source, or None if not found.
offset_to_position
Convert a byte offset into source to an LSP Position (0-based line/char).
str_offset
Return the byte offset of substr within source, or None if not found.
str_offset_in_range
Find a name within a specific byte range of the source, with word-boundary matching. Returns the absolute byte offset if found, None otherwise.
use_item_alias_and_fqn
The (alias-or-short-name, FQN) pair for one use import item: the import’s local name (an explicit alias when present, otherwise the last segment of the imported FQN) paired with its fully-qualified name. Shared by navigation::references’s import-map builder and index::file_index’s persistent-index extraction, which otherwise duplicated this exact per-item computation.