materialize_expr_syntax

func materialize_expr_syntax(syntax: &Syntax<Expr>) -> MaterializedResult<Expr>

Materializes expression syntax into virtual source, tokens, AST, and metadata.

Expression splices are parenthesized to preserve their grouping. The canonical expression parser validates the complete result before it crosses to the host.

View Source
pub func materialize_expr_syntax(syntax: &Syntax<Expr>) -> MaterializedResult<Expr> {
	let materialized = materialize(raw: syntax.raw, group_splices: true)
	let outcome = parse_expr_tokens(source: materialized.source, input: materialized.input)
	if let .some(failure) = parse_failure(outcome: outcome, fallback: materialized.input.span) {
		return MaterializedResult<Expr>(value: .none, failure: .some(failure))
	}
	MaterializedResult<Expr>(
		value: .some(MaterializedSyntax<Expr>(source: materialized.source, input: materialized.input, outcome: outcome, identifiers: materialized.identifiers)),
		failure: .none
	)
}