Expand description
Rule context and typed node views for rule matching.
This module provides RuleContext, the runtime context object passed to
RewriteRule::apply() during AST
transformation. It bundles mutable AST access with knowledge-base lookups,
validation helpers, and statistics tracking.
It also defines a family of read-only view structs (CommandView,
InfixView, DeclarativeView, EnvironmentView) that the
match_* helpers extract from AST nodes. Rules operate on these views
instead of pattern-matching raw Node variants directly, which keeps
rule implementations concise and type-safe.
Structsยง
- Command
View - A read-only view of a prefix command node for use in rule matching.
- Declarative
View - A read-only view of a declarative command node for use in rule matching.
- Environment
View - A read-only view of an environment node for use in rule matching.
- Infix
View - A read-only view of an infix command node for use in rule matching.
- Rule
Context - The runtime context object passed to
RewriteRule::apply(). - Rule
Scoped Context - A read-only scoped context bound to a rule key for diagnostics and slot extraction.