Skip to content

merico-dev/tree-sitter-sql

This branch is 64 commits ahead of, 15 commits behind m-novikov/tree-sitter-sql:main.

Folders and files

NameName
Last commit message
Last commit date
Jun 19, 2022
Jun 12, 2022
May 15, 2022
Jun 5, 2022
Jul 24, 2022
Jun 5, 2021
Dec 25, 2024
Mar 27, 2023
Jul 3, 2021
Sep 23, 2021
Jun 11, 2022
Jun 19, 2022
Jul 4, 2021
Sep 23, 2021
Jun 11, 2022
Jun 5, 2021
May 30, 2021
Jun 19, 2022
Jun 12, 2022
Dec 25, 2024
Jun 11, 2022
Jun 19, 2022

Repository files navigation

Node.js CI

SQL syntax for tree-sitter

This project initially focuses on PostgreSQL flavor of SQL

Try it out

You can try out the parser here: Tree Sitter SQL Playground

Development

Install pre-commit and run pre-commit install in the root of this repo. This will ensure that code follows code style of this repo.

File describing grammar is grammar.js

Every time the grammar file changes code generation needs to be run by invoking npm run gen

npm test command automatically performs code generation

Tests files are located in test/corpus

Here is the documentation on test file syntax

Running tests

npm install --also=dev
npm test

Debbuging

  • npm run parse <file.sql> outputs a syntax tree
  • npm run extract-error <file.sql> shows first offending line

Goals

This parser is supposed to be used in text editors. As a result:

  • it's very lax in what it considers valid SQL parse
  • adding extra nodes to have convenient selection anchors is okay

Other projects

About

SQL syntax highlighting for tree-sitter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 92.6%
  • Rust 3.5%
  • Scheme 2.5%
  • Other 1.4%