lib/match-plan.x
Lowering Match patterns to prepared plans.
Runtime-internal callables
These callables connect runtime translation units. They are documented for source readers but are not supported as user API.
| Function | Summary |
|---|---|
MatchPlan.free | Releases resources owned by plan. |
MatchPlan.prepare | Compiles pattern into a reusable immutable MatchPlan. |
MatchPlan
MatchPlan.free
void MatchPlan.free(MatchPlan plan)
Releases resources owned by plan.
A null plan is ignored; the plan, layout, program, and all aliases to them
are invalid afterward. Borrowed pattern constants are not released.
Source: lib/match-plan.x:78
MatchPlan.prepare
MatchPlan MatchPlan.prepare(Var pattern)
Compiles pattern into a reusable immutable MatchPlan.
The caller owns the returned plan in the active Scope. Preparation
records MACHINE_PREPARED, MACHINE_MALFORMED, or MACHINE_INELIGIBLE
in the plan and raises for none of them; only a prepared plan has a
program. reason is a borrowed static category string. The plan borrows
pattern constants, which must outlive it.
Raises: <alloc-fail> while analyzing, lowering, or freezing.
Source: lib/match-plan.x:48
Design notes
A MatchPlan is the prepared form of one pattern: its capture layout and
a program in the wordcode of machine.x. A plan owns both and borrows
the canonical values in its pattern. Preparation records why a pattern
has no program and raises for none of them; match.x runs the plan.