Registry / utility / ast-grep-core

ast-grep-core

JSON →
library0.43.0rscratesunverified

Search and rewrite code at large scale using precise AST pattern matching.

# Cargo.toml [dependencies] ast-grep-core = "0.43.0"
INSTALL
IMPORT
SIG · AST-GREP-CORE
A
ast-grep-core
utilityrustv0.43.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AstGrep
use ast_grep_core::AstGrep;

Search JavaScript code for pattern matches.

use ast_grep_core::AstGrep; fn main() { let source = "let x = 1;"; let grep = AstGrep::new(source, "javascript"); let results = grep.all("let $A = $B"); for r in results { println!("Found: {}", r.text()); } }
Debug
Known issues
gotchaRequires language-specific parser feature flags (e.g., 'javascript', 'python').
fix
Enable the corresponding feature in Cargo.toml: ast-grep-core = { features = ["javascript"] }
affects: >=0.43.0
Upgrade
Version history
0.43.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
2
Meta
1
Resources
ast-grep-core — cargo add ast-grep-core · libregistry