func capture_expr(source_id: Int, source: String, input: TokenRange, context: &SyntaxContext) -> SyntaxResult<Expr>Validates input as exactly one expression and captures its canonical tokens.
Every identifier receives the supplied use-site context and original source provenance. No source text is re-lexed because input already owns tokens.
View Source
pub func capture_expr(source_id: Int, source: String, input: TokenRange, context: &SyntaxContext) -> SyntaxResult<Expr> {
let outcome = parse_expr_tokens(source: source, input: input)
if let .some(failure) = parse_failure(outcome: outcome, fallback: input.span) {
return SyntaxResult<Expr>(value: .none, failure: .some(failure))
}
let raw = raw_from_range(source_id: source_id, source: source, input: input, category: .expr, context: context, origin: .use_site)
SyntaxResult<Expr>(value: .some(Syntax<Expr>(raw: raw)), failure: .none)
}