Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create an SQL parser #20

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ packages/*/.cache

.last_build

website/build
website/build

*.swp
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"scripts": {
"postinstall": "node scripts/delete-expo-ts && node scripts/postinstall",
"prebuild": "bolt ws run build",
"prebuild:all": "bolt ws run build",
"prebuild": "bolt ws run prebuild",
"prebuild:all": "bolt ws run prebuild",
"build": "node scripts/build-all --only-changed",
"build:all": "node scripts/build-all",
"prerelease": "yarn build:all",
Expand Down Expand Up @@ -69,6 +69,7 @@
"lsr": "^2.0.0",
"mkdirp": "^0.5.1",
"mysql2": "^1.6.4",
"pegjs": "^0.10.0",
"pg-error-constants": "^1.0.0",
"pg-minify": "^0.5.5",
"pg-promise": "^8.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/mysql-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
},
"scripts": {
"schema": "typescript-json-validator src/MySqlConfig.ts MySqlConfig",
"build": "yarn schema"
"prebuild": "yarn schema"
},
"repository": "https://github.com/ForbesLindesay/atdatabases/tree/master/packages/mysql-config",
"bugs": "https://github.com/ForbesLindesay/atdatabases/issues",
"license": "GPL-3.0",
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions packages/pg-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
},
"scripts": {
"schema": "typescript-json-validator src/PgConfig.ts PgConfig",
"build": "yarn schema"
"prebuild": "yarn schema"
},
"repository": "https://github.com/ForbesLindesay/atdatabases/tree/master/packages/pg-config",
"bugs": "https://github.com/ForbesLindesay/atdatabases/issues",
"license": "GPL-3.0",
"publishConfig": {
"access": "public"
}
}
}
2 changes: 1 addition & 1 deletion packages/pg-errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "node build"
"prebuild": "node build"
},
"repository": "https://github.com/ForbesLindesay/atdatabases/tree/master/packages/pg-errors",
"license": "GPL-3.0",
Expand Down
31 changes: 31 additions & 0 deletions packages/sql-parser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@databases/sql-parser",
"version": "0.0.0",
"description": "",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"dependencies": {
"pegjs": "^0.10.0"
},
"devDependencies": {
"mkdirp": "^0.5.1"
},
"scripts": {
"prebuild": "mkdirp lib/",
"build": "yarn build:grammar",
"build:tcl-to-json": "pegjs -o lib/tcl.js src/tcl.pegjs && node src/tcl-to-json",
"build:json-to-peg": "node src/json-to-peg",
"build:peg": "pegjs -o lib/sql.js lib/sql.pegjs",
"test": "node src/test",
"build:grammar": "pegjs -o lib/sql.js src/sql.pegjs && node src/test.js",
"build:grammar:w": "nodemon --watch src --exec \"yarn build:grammar\"",
"_build:grammar": "yarn build:tcl-to-json && yarn build:json-to-peg && yarn build:peg && yarn test",
"_build:grammar:w": "nodemon --watch src/tcl.pegjs --watch src/tcl-to-json.js --watch src/json-to-peg.js --watch src/test.js --exec \"yarn build:grammar\""
},
"repository": "https://github.com/ForbesLindesay/atdatabases/tree/master/packages/sql-parser",
"bugs": "https://github.com/ForbesLindesay/atdatabases/issues",
"license": "GPL-3.0",
"publishConfig": {
"access": "public"
}
}
1 change: 1 addition & 0 deletions packages/sql-parser/src/FoundationGrammar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#_7_17_query_expression
3 changes: 3 additions & 0 deletions packages/sql-parser/src/bubble-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Bubble Generator Data

This is the data used to generate the diagarams for SQLite's documentation. It is in the public domain. I downloaded it from https://www.sqlite.org/docsrc/artifact/3a02e2677d405fbd and it can be found in the art/syntax/bubble-generator-data.tcl file in the documentation source code.
Loading