Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit d641e6d

Browse files
committed
A lot of cleanup and refactoring utility funcs.
Got rid of a bunch of unused code, cleaned up the utility functions, moved the utilities back into the grammar.pegjs file to avoid the extra magic of injecting the import statement into the built parser. Fixed the binary expression logic to properly handle cases such as: ``` sql SELECT * FROM t where -1 * (2 + 3); SELECT * FROM t where 3 + 4 * 5 > 20; SELECT * FROM t where v1 = ((v2 * 5) - v3); ``` Updated SQL in specs to contain correct ASTs for specs related to expression grouping. Should have broken this into several commits but the changes are too intertwined to easily break apart now. Refs #20 Refs #3
1 parent 8df7990 commit d641e6d

17 files changed

+774
-675
lines changed

Gruntfile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ module.exports = function(grunt) {
107107
concat: {
108108
options: {
109109
stripBanners: true,
110-
// This imports the utilities used by the parser
111-
banner: "\nimport * as util from './parser-util';\n\nconst ",
112110
// This exports the compiled parser
111+
banner: "\nconst ",
113112
footer: "\nexport default parser.parse;"
114113
},
115114
build: {

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
* sqlite-parser
33
*/
44
import parser from './lib/parser';
5-
import {isFunc} from './lib/parser-util';
65
import Tracer from './lib/tracer';
76

87
export default function sqliteParser(source, callback) {
98
const t = Tracer();
10-
const isAsync = isFunc(callback);
9+
const isAsync = typeof callback === 'function';
1110
const opts = { 'tracer': t };
1211
// Async
1312
if (isAsync) {

0 commit comments

Comments
 (0)