Core & Engine
This page documents the core base classes and the engine used to match sequences.
ast_pattern_engine.core
Pattern
Bases: AST
Base class for AST matching patterns.
Source code in src/ast_pattern_engine/core.py
ast_pattern_engine.engine
match_sequence
Return list of binding dicts for non-overlapping matches in nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patterns
|
Sequence[Pattern]
|
The sequence of patterns to match. |
required |
nodes
|
list[Any]
|
The list of AST nodes to match against. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of binding dictionaries for each successful match. |