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;
Modules§
- language
- matcher
- This module defines the core
Matchertrait in ast-grep. - meta_
var - ops
- replacer
- source
- This module defines the
DocandContenttraits to abstract away source code encoding issues. - tree_
sitter
Structs§
- Node
- ’r represents root lifetime
- Position
- 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
byteoffsets. Note, accessingcolumnis O(n) operation.