1 unstable release
new 0.1.0 | Apr 30, 2025 |
---|---|
0.0.1 |
|
#110 in #tree-sitter-parser
109 downloads per month
305KB
11K
SLoC
This crate provides GraphQL language support for the tree-sitter parsing library.
Typically, you will use the [LANGUAGE][] constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:
let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_graphql::LANGUAGE;
parser
.set_language(&language.into())
.expect("Error loading GraphQL parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());
tree-sitter-graphql
GraphQL grammar for Tree-sitter.
Playground
# Install tree-sitter CLI
cargo install tree-sitter-cli --locked
# Clone this repository and navigate into it
git clone https://github.com/joowani/tree-sitter-graphql && cd tree-sitter-graphql
# Compile the parser
tree-sitter build --wasm
# Start the playground at http://127.0.0.1:8000
tree-sitter playground
References
Credits
The grammar is originally based on bkegley/tree-sitter-graphql and dralletje/tree-sitter-graphql.
Dependencies
~4–280KB