sql-autocomplete-parsers
Advanced tools
Comparing version 1.1.1 to 1.2.0
# Changelog | ||
## [1.2.0](https://github.com/gravity-ui/sql-autocomplete-parsers/compare/v1.1.1...v1.2.0) (2023-06-05) | ||
### Features | ||
* support 'DELETE FROM mytable' for genericAutocompleteParser (65e0c06) | ||
## [1.1.1](https://github.com/gravity-ui/sql-autocomplete-parsers/compare/v1.1.0...v1.1.1) (2023-06-01) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "sql-autocomplete-parsers", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A library that provides autocompletion and errors highlighting for various sql dialects", | ||
@@ -25,3 +25,4 @@ "repository": { | ||
"scripts": { | ||
"setup": "npm install && cd tools/jison && npm install", | ||
"postinstall": "cd src/generator && npm install", | ||
"pretest": "npm run generate", | ||
"test": "jest src/parsing", | ||
@@ -28,0 +29,0 @@ "generate": "cd src/generator && node main.js generic" |
@@ -5,15 +5,25 @@ # About | ||
# Scripts | ||
# Parser theory | ||
- `npm run setup` - Install all dependencies | ||
In order to parse any language, you need a [lexer](https://en.wikipedia.org/wiki/Lexical_analysis) (tokenizer) and a [parser](https://en.wikipedia.org/wiki/Parsing#Parser) (ast builder) | ||
Resources to research: | ||
- Bison grammar specification: https://www.gnu.org/software/bison/manual/html_node/Rules-Syntax.html | ||
- Playlist with the explanation on how parser and lexer work together: https://www.youtube.com/playlist?list=PLIrl0f9NJZy4oOOAVPU6MyRdFjJFGtceu | ||
# How everything works | ||
1. Autocomplete parser source code for different `{dialect}` are defined in `src/parsing/parsers/{dialect}` directories. | ||
2. Lexer configuration is specified in `src/parsing/parsers/{dialect}/jison/sql.jisonlex` file. | ||
3. SQL grammar is specified in `src/parsing/parsers/{dialect}/jison/**/*.jison`. It is placed in multiple files for easier understanding. Test files `*.test.json` are placed nearby. Jison is basically bison, but for javascript. | ||
4. `src/parsing/parsers/{dialect}/jison/structure.json` specifies paths to a lexer, and to all the grammar files. | ||
5. Parser extension (basically the autocomplete features) is specified in `src/parsing/parsers/{dialect}/parser-extension.js`. | ||
6. `src/generator/main.js` concatenates all the jison files into a single big jison file, and runs the jison tool with the specified lexer, then wires everything up with the `parser-extension.js`, generating `src/parsing/parsers/{dialect}/{dialect}AutocompleteParser.js`. | ||
7. The generated file is in plain javascript, so we create a convenient typescript wrapper in `src/parsing/index.ts` with all the types and functions. Our users should include this file in their own projects (for the time being they need to compile it yourself) | ||
# Main scripts | ||
- `npm run generate` - Generate parsers | ||
- `npm run test` - Run tests | ||
# Repository structure | ||
- `src/parsing/index.ts` - api file that you can import in your project. You need to compile it yourself though! | ||
- `src/parsing/parsers/{dialect}/jison/` - contains grammar definitions for {dialect}, from which the parser is built | ||
- `src/parsing/parsers/{dialect}/**/*.test.*` - contains parser tests | ||
- `src/generator/main.js` - tool that builds autocomplete parsers | ||
# Contributing | ||
@@ -20,0 +30,0 @@ |
{ | ||
"name": "parser-generator", | ||
"version": "1.0.0", | ||
"lockfileVersion": 3, | ||
"lockfileVersion": 1, | ||
"requires": true, | ||
"packages": { | ||
"": { | ||
"name": "parser-generator", | ||
"version": "1.0.0", | ||
"license": "ISC", | ||
"dependencies": { | ||
"jison": "https://github.com/JohanAhlen/jison/tarball/ad8e41475e" | ||
} | ||
"dependencies": { | ||
"JSONSelect": { | ||
"version": "0.4.0", | ||
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", | ||
"integrity": "sha512-VRLR3Su35MH+XV2lrvh9O7qWoug/TUyj9tLDjn9rtpUCNnILLrHjgd/tB0KrhugCxUpj3UqoLqfYb3fLJdIQQQ==" | ||
}, | ||
"node_modules/amdefine": { | ||
"JSV": { | ||
"version": "4.0.2", | ||
"resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", | ||
"integrity": "sha512-ZJ6wx9xaKJ3yFUhq5/sk82PJMuUyLk277I8mQeyDgCTjGdjWJIvPfaU5LIXaMuaN2UO1X3kZH4+lgphublZUHw==" | ||
}, | ||
"amdefine": { | ||
"version": "1.0.1", | ||
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", | ||
"integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", | ||
"optional": true, | ||
"engines": { | ||
"node": ">=0.4.2" | ||
} | ||
"optional": true | ||
}, | ||
"node_modules/cjson": { | ||
"cjson": { | ||
"version": "0.3.0", | ||
"resolved": "https://registry.npmjs.org/cjson/-/cjson-0.3.0.tgz", | ||
"integrity": "sha512-bBRQcCIHzI1IVH59fR0bwGrFmi3Btb/JNwM/n401i1DnYgWndpsUBiQRAddLflkZage20A2d25OAWZZk0vBRlA==", | ||
"dependencies": { | ||
"requires": { | ||
"jsonlint": "1.6.0" | ||
}, | ||
"engines": { | ||
"node": ">= 0.3.0" | ||
} | ||
}, | ||
"node_modules/colors": { | ||
"colors": { | ||
"version": "0.5.1", | ||
"resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", | ||
"integrity": "sha512-XjsuUwpDeY98+yz959OlUK6m7mLBM+1MEG5oaenfuQnNnrQk1WvtcvFgN3FNDP3f2NmZ211t0mNEfSEN1h0eIg==", | ||
"engines": { | ||
"node": ">=0.1.90" | ||
} | ||
"integrity": "sha512-XjsuUwpDeY98+yz959OlUK6m7mLBM+1MEG5oaenfuQnNnrQk1WvtcvFgN3FNDP3f2NmZ211t0mNEfSEN1h0eIg==" | ||
}, | ||
"node_modules/ebnf-parser": { | ||
"ebnf-parser": { | ||
"version": "0.1.10", | ||
@@ -48,56 +41,33 @@ "resolved": "https://registry.npmjs.org/ebnf-parser/-/ebnf-parser-0.1.10.tgz", | ||
}, | ||
"node_modules/escodegen": { | ||
"escodegen": { | ||
"version": "1.3.3", | ||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz", | ||
"integrity": "sha512-z9FWgKc48wjMlpzF5ymKS1AF8OIgnKLp9VyN7KbdtyrP/9lndwUFqCtMm+TAJmJf7KJFFYc4cFJfVTTGkKEwsA==", | ||
"dependencies": { | ||
"requires": { | ||
"esprima": "~1.1.1", | ||
"estraverse": "~1.5.0", | ||
"esutils": "~1.0.0" | ||
}, | ||
"bin": { | ||
"escodegen": "bin/escodegen.js", | ||
"esgenerate": "bin/esgenerate.js" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"optionalDependencies": { | ||
"esutils": "~1.0.0", | ||
"source-map": "~0.1.33" | ||
} | ||
}, | ||
"node_modules/esprima": { | ||
"esprima": { | ||
"version": "1.1.1", | ||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.1.1.tgz", | ||
"integrity": "sha512-qxxB994/7NtERxgXdFgLHIs9M6bhLXc6qtUmWZ3L8+gTQ9qaoyki2887P2IqAYsoENyr8SUbTutStDniOHSDHg==", | ||
"bin": { | ||
"esparse": "bin/esparse.js", | ||
"esvalidate": "bin/esvalidate.js" | ||
}, | ||
"engines": { | ||
"node": ">=0.4.0" | ||
} | ||
"integrity": "sha512-qxxB994/7NtERxgXdFgLHIs9M6bhLXc6qtUmWZ3L8+gTQ9qaoyki2887P2IqAYsoENyr8SUbTutStDniOHSDHg==" | ||
}, | ||
"node_modules/estraverse": { | ||
"estraverse": { | ||
"version": "1.5.1", | ||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz", | ||
"integrity": "sha512-FpCjJDfmo3vsc/1zKSeqR5k42tcIhxFIlvq+h9j0fO2q/h2uLKyweq7rYJ+0CoVvrGQOxIS5wyBrW/+vF58BUQ==", | ||
"engines": { | ||
"node": ">=0.4.0" | ||
} | ||
"integrity": "sha512-FpCjJDfmo3vsc/1zKSeqR5k42tcIhxFIlvq+h9j0fO2q/h2uLKyweq7rYJ+0CoVvrGQOxIS5wyBrW/+vF58BUQ==" | ||
}, | ||
"node_modules/esutils": { | ||
"esutils": { | ||
"version": "1.0.0", | ||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-1.0.0.tgz", | ||
"integrity": "sha512-x/iYH53X3quDwfHRz4y8rn4XcEwwCJeWsul9pF1zldMbGtgOtMNBEOuYWwB1EQlK2LRa1fev3YAgym/RElp5Cg==", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
} | ||
"integrity": "sha512-x/iYH53X3quDwfHRz4y8rn4XcEwwCJeWsul9pF1zldMbGtgOtMNBEOuYWwB1EQlK2LRa1fev3YAgym/RElp5Cg==" | ||
}, | ||
"node_modules/jison": { | ||
"version": "0.4.17", | ||
"resolved": "https://github.com/JohanAhlen/jison/tarball/ad8e41475e", | ||
"jison": { | ||
"version": "https://github.com/JohanAhlen/jison/tarball/ad8e41475e", | ||
"integrity": "sha512-kKqzzhj1GaVw5vTDQWV3pvKjJS9v5fheDNyN8h3CLj3mHZhbcw2Kb8iT+wPlpCJhbZ3HIxoVJFbmwg7z+ZvGrg==", | ||
"license": "MIT", | ||
"dependencies": { | ||
"requires": { | ||
"JSONSelect": "0.4.0", | ||
"cjson": "0.3.0", | ||
@@ -108,60 +78,25 @@ "ebnf-parser": "0.1.10", | ||
"jison-lex": "0.3.x", | ||
"JSONSelect": "0.4.0", | ||
"lex-parser": "~0.1.3", | ||
"nomnom": "1.5.2" | ||
}, | ||
"bin": { | ||
"jison": "lib/cli.js" | ||
}, | ||
"engines": { | ||
"node": ">=0.4" | ||
} | ||
}, | ||
"node_modules/jison-lex": { | ||
"jison-lex": { | ||
"version": "0.3.4", | ||
"resolved": "https://registry.npmjs.org/jison-lex/-/jison-lex-0.3.4.tgz", | ||
"integrity": "sha512-EBh5wrXhls1cUwROd5DcDHR1sG7CdsCFSqY1027+YA1RGxz+BX2TDLAhdsQf40YEtFDGoiO0Qm8PpnBl2EzDJw==", | ||
"dependencies": { | ||
"requires": { | ||
"lex-parser": "0.1.x", | ||
"nomnom": "1.5.2" | ||
}, | ||
"bin": { | ||
"jison-lex": "cli.js" | ||
}, | ||
"engines": { | ||
"node": ">=0.4" | ||
} | ||
}, | ||
"node_modules/jsonlint": { | ||
"jsonlint": { | ||
"version": "1.6.0", | ||
"resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.0.tgz", | ||
"integrity": "sha512-x6YLBe6NjdpmIeiklwQOxsZuYj/SOWkT33GlTpaG1UdFGjdWjPcxJ1CWZAX3wA7tarz8E2YHF6KiW5HTapPlXw==", | ||
"dependencies": { | ||
"requires": { | ||
"JSV": ">= 4.0.x", | ||
"nomnom": ">= 1.5.x" | ||
}, | ||
"bin": { | ||
"jsonlint": "lib/cli.js" | ||
}, | ||
"engines": { | ||
"node": ">= 0.6" | ||
} | ||
}, | ||
"node_modules/JSONSelect": { | ||
"version": "0.4.0", | ||
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", | ||
"integrity": "sha512-VRLR3Su35MH+XV2lrvh9O7qWoug/TUyj9tLDjn9rtpUCNnILLrHjgd/tB0KrhugCxUpj3UqoLqfYb3fLJdIQQQ==", | ||
"engines": { | ||
"node": ">=0.4.7" | ||
} | ||
}, | ||
"node_modules/JSV": { | ||
"version": "4.0.2", | ||
"resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", | ||
"integrity": "sha512-ZJ6wx9xaKJ3yFUhq5/sk82PJMuUyLk277I8mQeyDgCTjGdjWJIvPfaU5LIXaMuaN2UO1X3kZH4+lgphublZUHw==", | ||
"engines": { | ||
"node": "*" | ||
} | ||
}, | ||
"node_modules/lex-parser": { | ||
"lex-parser": { | ||
"version": "0.1.4", | ||
@@ -171,16 +106,12 @@ "resolved": "https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz", | ||
}, | ||
"node_modules/nomnom": { | ||
"nomnom": { | ||
"version": "1.5.2", | ||
"resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz", | ||
"integrity": "sha512-fiVbT7BqxiQqjlR9U3FDGOSERFCKoXVCdxV2FwZuNN7/cmJ42iQx35nUFOAFDcyvemu9Adp+IlsCGlKQYLmBKw==", | ||
"deprecated": "Package no longer supported. Contact support@npmjs.com for more info.", | ||
"dependencies": { | ||
"requires": { | ||
"colors": "0.5.x", | ||
"underscore": "1.1.x" | ||
}, | ||
"engines": { | ||
"node": "*" | ||
} | ||
}, | ||
"node_modules/source-map": { | ||
"source-map": { | ||
"version": "0.1.43", | ||
@@ -190,18 +121,12 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", | ||
"optional": true, | ||
"dependencies": { | ||
"requires": { | ||
"amdefine": ">=0.0.4" | ||
}, | ||
"engines": { | ||
"node": ">=0.8.0" | ||
} | ||
}, | ||
"node_modules/underscore": { | ||
"underscore": { | ||
"version": "1.1.7", | ||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz", | ||
"integrity": "sha512-w4QtCHoLBXw1mjofIDoMyexaEdWGMedWNDhlWTtT1V1lCRqi65Pnoygkh6+WRdr+Bm8ldkBNkNeCsXGMlQS9HQ==", | ||
"engines": { | ||
"node": "*" | ||
} | ||
"integrity": "sha512-w4QtCHoLBXw1mjofIDoMyexaEdWGMedWNDhlWTtT1V1lCRqi65Pnoygkh6+WRdr+Bm8ldkBNkNeCsXGMlQS9HQ==" | ||
} | ||
} | ||
} |
@@ -13,2 +13,3 @@ { | ||
"create/create_view.jison", | ||
"delete/delete.jison", | ||
"drop/drop_common.jison", | ||
@@ -15,0 +16,0 @@ "drop/drop_database.jison", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
6438533
651
89380
50
5
70
1
32
19