1 unstable release

new 0.1.0 Apr 30, 2025
0.0.1 Apr 19, 2022

#110 in #tree-sitter-parser

Download history 2/week @ 2025-02-22 1/week @ 2025-03-01 1/week @ 2025-04-12 108/week @ 2025-04-26

109 downloads per month

Custom license

305KB
11K SLoC

C 11K SLoC JavaScript 376 SLoC Rust 32 SLoC // 0.1% comments

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