10 releases
0.21.0 | Mar 13, 2024 |
---|---|
0.20.8 | Feb 13, 2024 |
0.20.7 | Jan 22, 2024 |
0.20.6 | Aug 13, 2023 |
0.20.1 | Sep 20, 2021 |
#32 in Text editors
13,566 downloads per month
Used in 21 crates
(18 directly)
5MB
146K
SLoC
tree-sitter-c
C grammar for tree-sitter. Adapted from this C99 grammar.
lib.rs
:
This crate provides a C grammar for the tree-sitter parsing library.
Typically, you will use the language function to add this grammar to a tree-sitter Parser, and then use the parser to parse some code:
use tree_sitter::Parser;
let code = r#"
int double(int x) {
return x * 2;
}
"#;
let mut parser = Parser::new();
parser.set_language(&tree_sitter_c::language()).expect("Error loading C grammar");
let parsed = parser.parse(code, None);
Dependencies
~2.8–4MB
~72K SLoC