vibe.review.parsing.rules.engine¶
Rule engine for the parsing pipeline.
Rules are declarative specifications that: - Match nodes based on predicates - Apply actions (tag, classify, transform) - Track provenance of decisions
Rules are organized by layer and applied in priority order.
Layer ¶
Valid pipeline layers for rules.
ActionType ¶
Types of rule actions.
RuleAction ¶
An action to perform when a rule matches.
| Attributes: |
|
|---|
Rule ¶
A parsing rule.
| Attributes: |
|
|---|
RuleMatch ¶
RuleResult ¶
Result of applying rules to nodes.
| Attributes: |
|
|---|
RuleEngine ¶
Engine for evaluating and applying parsing rules.
Rules are evaluated in priority order. When multiple rules match, the highest priority rule wins (or first in case of tie).
__init__ ¶
__init__(rules: list[Rule] | None = None, context: dict[str, Any] | None = None, predicate_functions_dir: Path | None = None) -> None
Initialize the rule engine.
| Parameters: |
|---|
get_rules_for_layer ¶
Get all rules for a specific layer, sorted by priority.
match ¶
apply ¶
apply(nodes: Sequence[IRNode], layer: str, action_handlers: dict[ActionType, Callable[[IRNode, RuleAction], IRNode]] | None = None) -> RuleResult
Apply rules to a list of nodes.
| Parameters: |
|
|---|
| Returns: |
|
|---|
apply_deferred_actions ¶
Apply deferred merge/split actions to a node list.
Call this after apply() to process any merge/split markers. This method modifies the node list in place and returns it.
| Parameters: |
|
|---|
| Returns: |
|---|