SQL-like query API for AST search.
This module builds on ExAST.Selector with names that read like query
predicates:
import ExAST.Query
from("def _ do ... end")
|> where(contains("Repo.transaction(_)"))
|> where(not contains("IO.inspect(_)"))The resulting query can be passed to ExAST.search/3 or
ExAST.Patcher.find_all/3 anywhere a selector is accepted.
Summary
Functions
Matches when all nested predicates match.
Matches when any nested predicate matches.
Matches when the selected node contains a descendant matching pattern.
Finds matching descendants of the current selection.
Finds matching direct children of the current selection.
Matches the first semantic child in its parent.
Matches when a previous sibling matches pattern.
Starts a query from one pattern or a list of alternative patterns.
Matches when the selected node has a direct child matching pattern.
Matches when the immediately previous sibling matches pattern.
Matches when the immediately following sibling matches pattern.
Matches when the selected node is inside an ancestor matching pattern.
Matches the last semantic child in its parent.
Matches the nth semantic child in its parent, using 1-based indexing.
Matches when the selected node has a direct parent matching pattern.
Matches when a following sibling matches pattern.
Adds a predicate filter without changing the selected node.
Types
@type t() :: ExAST.Selector.t()
Functions
Matches when all nested predicates match.
Matches when any nested predicate matches.
Matches when the selected node contains a descendant matching pattern.
Finds matching descendants of the current selection.
Finds matching direct children of the current selection.
Matches the first semantic child in its parent.
Matches when a previous sibling matches pattern.
Starts a query from one pattern or a list of alternative patterns.
Matches when the selected node has a direct child matching pattern.
Matches when the immediately previous sibling matches pattern.
Matches when the immediately following sibling matches pattern.
Matches when the selected node is inside an ancestor matching pattern.
Matches the last semantic child in its parent.
Matches the nth semantic child in its parent, using 1-based indexing.
Matches when the selected node has a direct parent matching pattern.
Matches when a following sibling matches pattern.
Adds a predicate filter without changing the selected node.