a structural diff that understands syntax 🟥🟩
 
 
 
 
 
Go to file
Maksim Novikov f6d7384cee
Use lowercase sql in bindings. Closes: #1
2021-09-23 20:56:48 +07:00
.github/workflows Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +07:00
bindings Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +07:00
docs Expand function hints support 2021-07-04 16:20:20 +07:00
examples Add select subexpressions 2021-06-19 18:19:43 +07:00
queries Add set statement 2021-07-04 16:03:05 +07:00
scripts Update prettier config 2021-06-05 15:32:23 +07:00
src Add array element access operation 2021-07-04 16:25:12 +07:00
test Add array element access operation 2021-07-04 16:25:12 +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 update highlight test 2021-07-03 21:05:08 +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 Cargo.lock 2021-06-06 13:42:31 +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 Use replace instead of replaceAll 2021-07-04 17:29:20 +07:00
package-lock.json Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +07:00
package.json Use lowercase sql in bindings. Closes: #1 2021-09-23 20:56:48 +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