Crate ast_grep_core

Source
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 Matcher trait in ast-grep.
meta_var
ops
replacer
source
This module defines the Doc and Content traits 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 byte offsets. Note, accessing column is O(n) operation.

Enums§

MatchStrictness

Type Aliases§

AstGrep