a structural diff that understands syntax 🟥🟩
 
 
 
 
 
Go to file
Max Novikov 05ebda7cd8
Merge pull request #23 from m-novikov/m-novikov-update-deps
Update dependencies
2022-06-11 08:41:50 +07:00
.github/workflows Verify that generated code is up to date 2022-04-17 13:19:33 +07:00
bindings Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +07:00
docs Update playground 2022-05-15 15:13:13 +07:00
examples Add select subexpressions 2021-06-19 18:19:43 +07:00
queries Fix opclass in indexes 2022-05-15 12:28:16 +07:00
scripts Update prettier config 2021-06-05 15:32:23 +07:00
src Improve intervals support 2022-05-15 14:32:16 +07:00
test Improve intervals support 2022-05-15 14:32:16 +07:00
.editorconfig Add support for update statements 2021-07-03 20:58:07 +07:00
.gitattributes Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +07:00
.gitignore add support for schema 2021-09-24 14:34:15 +07:00
.prettierignore Add joins support 2021-07-04 15:28:54 +07:00
.prettierrc.json Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +07:00
Cargo.lock Update dependencies 2022-06-11 08:37:28 +07:00
Cargo.toml Bump cargo version 2021-06-05 15:54:23 +07:00
LICENSE Add readme license 2021-05-30 15:11:55 +07:00
README.md Add other active projects to readme 2021-07-06 18:01:43 +07:00
binding.gyp Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +07:00
grammar.js Improve intervals support 2022-05-15 14:32:16 +07:00
package-lock.json Update dependencies 2022-06-11 08:37:28 +07:00
package.json Merge branch 'feat/add-support-for-schema' into punctuation 2022-04-17 10:37:27 +07:00

README.md

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

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