#tree-sitter #sql-parser #sql #big-query #parser #incremental

tree-sitter-sql-bigquery

BigQuery SQL grammar for the tree-sitter parsing library

27 releases (6 breaking)

0.6.0 Oct 11, 2023
0.4.2 Jul 29, 2023
0.2.0 Feb 6, 2023
0.1.12 Dec 29, 2022
0.0.8 Jun 26, 2022

#138 in Text editors

Download history 4/week @ 2024-01-27 237/week @ 2024-02-03 116/week @ 2024-02-10 66/week @ 2024-02-17 58/week @ 2024-02-24 1/week @ 2024-03-02 71/week @ 2024-03-30 2/week @ 2024-04-06 216/week @ 2024-04-13

289 downloads per month

MIT license

33MB
884K SLoC

C 882K SLoC JavaScript 1.5K SLoC // 0.0% comments C++ 277 SLoC // 0.0% comments Scheme 125 SLoC // 0.0% comments Rust 41 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 SQL 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 = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_sql_bigquery::language()).expect("Error loading SQL grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~2.7–4MB
~71K SLoC