Expand description
This module contains the core library for ast-grep.
It provides APIs for parsing, traversing, searching and replacing tree-sitter nodes. Usually you will only need ast-grep CLI instead of this crate. But if you want to use ast-grep as a library, this is the right place.
Re-exports§
pub use language::Language;
pub use matcher::Matcher;
pub use matcher::NodeMatch;
pub use matcher::Pattern;
pub use matcher::PatternError;
pub use source::Doc;
pub use source::StrDoc;
Modules§
- This module defines the core
Matcher
trait in ast-grep. - This module defines the
Doc
andContent
traits to abstract away source code encoding issues. - Traverse Node AST
Structs§
- ’r represents root lifetime
- Represents a position in the source code. The line and column are zero-based, character offsets. It is different from tree-sitter’s position which is zero-based
byte
offsets. Note, accessingcolumn
is O(n) operation.