diff --git a/lib/parser.js b/lib/parser.js index 89bfa65..27c3d4f 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -7,10 +7,13 @@ const filter = require("./filter"); const astCache = new Cache(); +/** + * 生成ast + */ function parse(sql) { const cleanSql = filter.cleanSql(sql); - console.log(cleanSql) let ast = astCache.get(cleanSql); + if (ast) { return ast } else { @@ -21,9 +24,9 @@ function parse(sql) { } /** - * sql sql - * type 语法类型。默认hive - * return 返回解析对象 + * 自动补全提示 + * @param {(string | Array)} sql + * @param {string} [type="hive"] */ function parseSyntax(sql, type) { if (typeof type == "undefined") { @@ -40,8 +43,8 @@ function parseSyntax(sql, type) { /** * 自动补全提示 - * @param {(string | array)} sql - * @param {string=} type + * @param {(string | Array)} sql + * @param {string} [type="hive"] */ function parserSql(sql, type) { if (typeof type == "undefined") {