Structsยง
- Cleaner ๐
- Visitor that normalizes AST by removing syntax contexts and type annotations. This allows for more reliable expression matching across different parsing contexts.
- Code
Frame ๐ - Expression
Finder ๐ - Visitor that searches for a specific expression in an AST. Uses discriminant matching for fast filtering before expensive eq_ignore_span checks.
- TplConverter ๐
- Visitor that normalizes template literals and string concatenations. Helps match expressions that may be written differently in source vs AST.
Functionsยง
- build_
code_ ๐frame_ error - build_
code_ ๐frame_ error_ and_ panic - compute_
cache_ ๐key - Computes a cache key for an expression based on its type and structure
- create_
module ๐ - find_
expression_ ๐span - Finds the span of a target expression within a program AST
- get_
memoized_ ๐frame_ source_ code - Gets or parses the source code as a Program AST, with memoization. Returns a cleaned and normalized Program that can be used for expression finding.
- get_
source_ ๐code - Gets the source code with the following priority:
- get_
span_ ๐from_ source_ code - Finds the span (source location) of a target expression within the source code. Uses caching to avoid redundant AST traversals for the same expression.
- load_
code_ ๐frame_ from_ cache - Loads a CodeFrame with the source file for error display
- parse_
and_ ๐normalize_ program - Parses source code into a Program AST and normalizes it
- print_
module ๐ - print_
program ๐ - read_
source_ ๐file