pub fn parse_prefix<'arena>(
arena: &'arena Bump,
span: Span,
input: &'arena [u8],
) -> Result<(Type<'arena>, Position), ParseError>Expand description
Parses the longest valid type prefix of input and reports the
absolute position just past the consumed bytes.
Unlike parse_str, this does not require the entire input to be a
single type. It is the handoff point for embedding callers (e.g. the
phpdoc-syntax parser): they parse one type, fast-forward their own
scanner to the returned position, and keep going with their own
tokens from there.
§Arguments
arena- The arena that will own every AST node.span- The absolute span coveringinputwithin its source file.input- The slice to parse; only the prefix that forms a complete type expression is consumed.
§Errors
Returns a ParseError if the prefix does not start with a valid
type.