#tree-sitter

tree-sitter-sql-bigquery

BigQuery SQL grammar for the tree-sitter parsing library

30 releases

0.8.0 May 26, 2024
0.6.0 Oct 11, 2023
0.4.2 Jul 29, 2023
0.2.0 Feb 6, 2023
0.0.8 Jun 26, 2022

#941 in Parser implementations

32 downloads per month

MIT license

33MB
888K SLoC

C 886K SLoC JavaScript 2K SLoC // 0.0% comments Scheme 117 SLoC // 0.0% comments Rust 32 SLoC // 0.1% comments

Build/Test

tree-sitter for GoogleSQL (SQL dialect in BigQuery)

GoogleSQL(formerly known as StandardSQL) parser available in many programming language such as Rust, Node and so on. You could try out the demo on Github Pages

References

Development

Running tests

npm install --also=dev
npm test

Debbuging

  • npm run parse <your sql file.sql> outputs a syntax tree

lib.rs:

This crate provides SqlBigquery language support for the tree-sitter parsing library.

Typically, you will use the language function 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();
parser.set_language(&tree_sitter_sql_bigquery::language()).expect("Error loading SqlBigquery grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~2.8–4MB
~74K SLoC