pub fn parse_str<'arena>(
arena: &'arena Bump,
span: Span,
input: &'arena [u8],
) -> Result<Type<'arena>, ParseError>Expand description
Parses a string representation of a PHPDoc type into an arena-allocated Abstract Syntax Tree.
All AST nodes are allocated in the caller-supplied bumpalo::Bump, so
no per-node heap allocation happens during parsing. The resulting
Type borrows from input (for textual slices) and from arena
(for nested sub-trees) for the duration of 'arena.
§Arguments
arena- The arena that will own every AST node.span- The originalSpanof theinputstring slice within its source file; used to anchor every produced span.input- The type string to parse (e.g."int|string","array<int, MyClass>").
§Errors
Returns a ParseError if any lexing or parsing error occurs.