GitXplorerGitXplorer
m

tree-sitter-sql

public
112 stars
33 forks
37 issues

Commits

List of commits on branch main.
Verified
587f30d184b058450be2a2330878210c5f33b3f9

Merge pull request #76 from hirosassa/remove-cargo-lock

mm-novikov committed 10 months ago
Unverified
74d69f37aca6cf6bda6f81d2b8386609769059bb

update tree-sitter dependency

hhirosassa committed 2 years ago
Unverified
719fd4b1db71f27cc2c3ac10d82e246a0ecc7fff

remove Cargo.lock

hhirosassa committed 2 years ago
Verified
63cd04238b18c7f55987465b3252597da47b6924

Merge pull request #73 from m-novikov/return-autogen

mm-novikov committed 2 years ago
Verified
e326479d563b6ea0239350f4c714d06f46effde6

Disable acceptance tests, files removed from the repo

mm-novikov committed 2 years ago
Verified
66aabda64eda57ca08a608f0854588c60265bf17

Only issue warning when generated files differ as output is not stable

mm-novikov committed 2 years ago

README

The README file for this repository.

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