@maximjov/tree-sitter-sql
v0.4.0
Published
SQL grammar for tree-sitter, but it is has more better grammer
Readme
tree-sitter-sql
A general/permissive SQL grammar for tree-sitter adapted by @maximjov for use in pg_lens
Installation
I'm open to feedback & encourage you to open an issue to discuss any features or problems with changes.
For any issues related to non-forked related problems, you can open an issue in the original project by @DerekStride
Step 1: Download the parser files
Using git
git clone https://github.com/DerekStride/tree-sitter-sql.git
cd tree-sitter-sql
git checkout gh-pagesUsing curl
curl -LO https://github.com/DerekStride/tree-sitter-sql/archive/refs/heads/gh-pages.tar.gz
tar -xzf gh-pages.tar.gz
cd tree-sitter-sql-gh-pagesStep 2: Build yourself
Using npm
npm install -g tree-sitter-cli
rm -rf build src/parser.c src/parser.cc src/scanner.o
tree-sitter generate -b --libdir ./build
npm rebuildlink or local install
npm i path_to_reponpm link # in "@maximjov/tree-sitter-sql" root
...
npm link @maximjov/tree-sitter-sql # in other rootStep 2: Compile the Parser (if not building locally)
Using npm
only supporting NPM at the moment, feel free to try methods mentioned in the original project
npm i @maximjov/tree-sitter-sqlDevelopment
See CONTRIBUTING.md for documentation on how to set up the project for development.
Features
For a complete list of features see the the tests
References
- Wikipedia#SQL_syntax - I consulted wikipedia for naming conventions, though I may not have been strict early on in the prototyping.
- Phoenix Language Reference - A reference diagram.
- SQLite's railroad diagram for expr - Another reference diagram.
- Postgresql syntax documentation
- Mariadb syntax documentation
Other projects
- https://github.com/m-novikov/tree-sitter-sql
- https://github.com/tjdevries/tree-sitter-sql
- https://github.com/dhcmrlchtdj/tree-sitter-sqlite
