Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@salvoravida/dt-sql-parser

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salvoravida/dt-sql-parser - npm Package Compare versions

Comparing version 4.0.0-beta.2.7 to 4.0.0-beta.2.9

dist/lib/pgsql/base/PostgreSQLLexerBase.d.ts

2

dist/lib/hive/HiveSqlListener.js

@@ -1,2 +0,2 @@

// Generated from /Users/salvo/dt-sql-parser2/src/grammar/hive/HiveSql.g4 by ANTLR 4.8
// Generated from /Users/ziv/Workspace/dt-sql-parser/src/grammar/hive/HiveSql.g4 by ANTLR 4.8
// jshint ignore: start

@@ -3,0 +3,0 @@ var antlr4 = require('antlr4/index');

@@ -1,2 +0,2 @@

// Generated from /Users/salvo/dt-sql-parser2/src/grammar/hive/HiveSql.g4 by ANTLR 4.8
// Generated from /Users/ziv/Workspace/dt-sql-parser/src/grammar/hive/HiveSql.g4 by ANTLR 4.8
// jshint ignore: start

@@ -3,0 +3,0 @@ var antlr4 = require('antlr4/index');

@@ -1,4 +0,17 @@

const Lexer = require('antlr4').Lexer;
function PlSqlBaseLexer(...args) {
Lexer.call(this, ...args);
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var Lexer = require('antlr4').Lexer;
function PlSqlBaseLexer() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
Lexer.call.apply(Lexer, __spreadArray([this], args, false));
return this;

@@ -9,3 +22,3 @@ }

PlSqlBaseLexer.prototype.IsNewlineAtPos = function (pos) {
const la = this._input.LA(pos);
var la = this._input.LA(pos);
return la == -1 || la == '\n';

@@ -12,0 +25,0 @@ };

@@ -1,4 +0,17 @@

const Parser = require('antlr4').Parser;
function PlSqlBaseParser(...args) {
Parser.call(this, ...args);
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var Parser = require('antlr4').Parser;
function PlSqlBaseParser() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
Parser.call.apply(Parser, __spreadArray([this], args, false));
this._isVersion10 = false;

@@ -5,0 +18,0 @@ this._isVersion12 = true;

@@ -1,2 +0,2 @@

// Generated from /Users/salvo/dt-sql-parser2/src/grammar/spark/SparkSql.g4 by ANTLR 4.8
// Generated from /Users/ziv/Workspace/dt-sql-parser/src/grammar/spark/SparkSql.g4 by ANTLR 4.8
// jshint ignore: start

@@ -3,0 +3,0 @@ var antlr4 = require('antlr4/index');

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tree_1 = require("antlr4/tree");
const parserErrorListener_1 = require("./parserErrorListener");
var tree_1 = require("antlr4/tree");
var parserErrorListener_1 = require("./parserErrorListener");
/**
* Custom Parser class, subclass needs extends it.
*/
class BasicParser {
parse(input, errorListener) {
const parser = this.createParser(input);
var BasicParser = /** @class */ (function () {
function BasicParser() {
}
BasicParser.prototype.parse = function (input, errorListener) {
var parser = this.createParser(input);
this._parser = parser;
parser.removeErrorListeners();
parser.addErrorListener(new parserErrorListener_1.default(errorListener));
const parserTree = parser.program();
// Note : needed by pgsql
var parserTree = parser.program ? parser.program() : parser.root();
return parserTree;
}
validate(input) {
const lexerError = [];
const syntaxErrors = [];
const parser = this.createParser(input);
};
BasicParser.prototype.validate = function (input) {
var lexerError = [];
var syntaxErrors = [];
var parser = this.createParser(input);
this._parser = parser;
parser.removeErrorListeners();
parser.addErrorListener(new parserErrorListener_1.ParserErrorCollector(syntaxErrors));
parser.program();
// Note : needed by pgsql
if (parser.program) {
parser.program();
}
else {
parser.root();
}
return lexerError.concat(syntaxErrors);
}
};
/**

@@ -36,5 +45,5 @@ * Visit parser tree

*/
getAllTokens(input) {
BasicParser.prototype.getAllTokens = function (input) {
return this.createLexer(input).getAllTokens();
}
};
;

@@ -45,9 +54,9 @@ /**

*/
createParser(input) {
const lexer = this.createLexer(input);
const parser = this.createParserFromLexer(lexer);
BasicParser.prototype.createParser = function (input) {
var lexer = this.createLexer(input);
var parser = this.createParserFromLexer(lexer);
parser.buildParseTrees = true;
this._parser = parser;
return parser;
}
};
/**

@@ -57,8 +66,9 @@ * It convert tree to string, it's convenient to use in unit test.

*/
parserTreeToString(input) {
const parser = this.createParser(input);
BasicParser.prototype.parserTreeToString = function (input) {
var parser = this.createParser(input);
this._parser = parser;
const tree = parser.program();
// Note : needed by pgsql
var tree = parser.program ? parser.program() : parser.root();
return tree.toStringTree(parser.ruleNames);
}
};
/**

@@ -68,5 +78,5 @@ * Get List-like style tree string

*/
toString(parserTree) {
BasicParser.prototype.toString = function (parserTree) {
return parserTree.toStringTree(this._parser.ruleNames);
}
};
/**

@@ -76,7 +86,8 @@ * @param listener Listener instance extends ParserListener

*/
listen(listener, parserTree) {
BasicParser.prototype.listen = function (listener, parserTree) {
tree_1.ParseTreeWalker.DEFAULT.walk(listener, parserTree);
}
}
};
return BasicParser;
}());
exports.default = BasicParser;
//# sourceMappingURL=basicParser.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParserErrorCollector = void 0;
const error_1 = require("antlr4/error");
class ParserErrorCollector extends error_1.ErrorListener {
constructor(error) {
super();
this._errors = error;
var error_1 = require("antlr4/error");
var ParserErrorCollector = /** @class */ (function (_super) {
__extends(ParserErrorCollector, _super);
function ParserErrorCollector(error) {
var _this = _super.call(this) || this;
_this._errors = error;
return _this;
}
syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
let endCol = charPositionInLine + 1;
ParserErrorCollector.prototype.syntaxError = function (recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
var endCol = charPositionInLine + 1;
if (offendingSymbol && offendingSymbol.text !== null) {

@@ -22,12 +39,15 @@ endCol = charPositionInLine + offendingSymbol.text.length;

});
}
}
};
return ParserErrorCollector;
}(error_1.ErrorListener));
exports.ParserErrorCollector = ParserErrorCollector;
class ParserErrorListener extends error_1.ErrorListener {
constructor(errorListener) {
super();
this._errorHandler = errorListener;
var ParserErrorListener = /** @class */ (function (_super) {
__extends(ParserErrorListener, _super);
function ParserErrorListener(errorListener) {
var _this = _super.call(this) || this;
_this._errorHandler = errorListener;
return _this;
}
syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
let endCol = charPositionInLine + 1;
ParserErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
var endCol = charPositionInLine + 1;
if (offendingSymbol && offendingSymbol.text !== null) {

@@ -44,13 +64,14 @@ endCol = charPositionInLine + offendingSymbol.text.length;

}, {
e,
line,
msg,
recognizer,
offendingSymbol,
charPositionInLine,
e: e,
line: line,
msg: msg,
recognizer: recognizer,
offendingSymbol: offendingSymbol,
charPositionInLine: charPositionInLine,
});
}
}
}
};
return ParserErrorListener;
}(error_1.ErrorListener));
exports.default = ParserErrorListener;
//# sourceMappingURL=parserErrorListener.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const antlr4_1 = require("antlr4");
const FlinkSqlLexer_1 = require("../lib/flinksql/FlinkSqlLexer");
const FlinkSqlParser_1 = require("../lib/flinksql/FlinkSqlParser");
const basicParser_1 = require("./common/basicParser");
class FlinkSQL extends basicParser_1.default {
createLexer(input) {
const chars = new antlr4_1.InputStream(input.toUpperCase()); // Some Lexer only support uppercase token, So you need transform
const lexer = new FlinkSqlLexer_1.FlinkSqlLexer(chars);
var antlr4_1 = require("antlr4");
var FlinkSqlLexer_1 = require("../lib/flinksql/FlinkSqlLexer");
var FlinkSqlParser_1 = require("../lib/flinksql/FlinkSqlParser");
var basicParser_1 = require("./common/basicParser");
var FlinkSQL = /** @class */ (function (_super) {
__extends(FlinkSQL, _super);
function FlinkSQL() {
return _super !== null && _super.apply(this, arguments) || this;
}
FlinkSQL.prototype.createLexer = function (input) {
var chars = new antlr4_1.InputStream(input.toUpperCase()); // Some Lexer only support uppercase token, So you need transform
var lexer = new FlinkSqlLexer_1.FlinkSqlLexer(chars);
return lexer;
}
createParserFromLexer(lexer) {
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
};
FlinkSQL.prototype.createParserFromLexer = function (lexer) {
var tokenStream = new antlr4_1.CommonTokenStream(lexer);
return new FlinkSqlParser_1.FlinkSqlParser(tokenStream);
}
}
};
return FlinkSQL;
}(basicParser_1.default));
exports.default = FlinkSQL;
//# sourceMappingURL=flinksql.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const antlr4_1 = require("antlr4");
const SqlLexer_1 = require("../lib/generic/SqlLexer");
const SqlParser_1 = require("../lib/generic/SqlParser");
const basicParser_1 = require("./common/basicParser");
class GenericSQL extends basicParser_1.default {
createLexer(input) {
const chars = new antlr4_1.InputStream(input.toUpperCase()); // Some Lexer only support uppercase token, So you need transform
const lexer = new SqlLexer_1.SqlLexer(chars);
var antlr4_1 = require("antlr4");
var SqlLexer_1 = require("../lib/generic/SqlLexer");
var SqlParser_1 = require("../lib/generic/SqlParser");
var basicParser_1 = require("./common/basicParser");
var GenericSQL = /** @class */ (function (_super) {
__extends(GenericSQL, _super);
function GenericSQL() {
return _super !== null && _super.apply(this, arguments) || this;
}
GenericSQL.prototype.createLexer = function (input) {
var chars = new antlr4_1.InputStream(input.toUpperCase()); // Some Lexer only support uppercase token, So you need transform
var lexer = new SqlLexer_1.SqlLexer(chars);
return lexer;
}
createParserFromLexer(lexer) {
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
};
GenericSQL.prototype.createParserFromLexer = function (lexer) {
var tokenStream = new antlr4_1.CommonTokenStream(lexer);
return new SqlParser_1.SqlParser(tokenStream);
}
}
};
return GenericSQL;
}(basicParser_1.default));
exports.default = GenericSQL;
//# sourceMappingURL=generic.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const antlr4_1 = require("antlr4");
const HiveSqlLexer_1 = require("../lib/hive/HiveSqlLexer");
const HiveSql_1 = require("../lib/hive/HiveSql");
const basicParser_1 = require("./common/basicParser");
class HiveSQL extends basicParser_1.default {
createLexer(input) {
const chars = new antlr4_1.InputStream(input);
const lexer = new HiveSqlLexer_1.HiveSqlLexer(chars);
var antlr4_1 = require("antlr4");
var HiveSqlLexer_1 = require("../lib/hive/HiveSqlLexer");
var HiveSql_1 = require("../lib/hive/HiveSql");
var basicParser_1 = require("./common/basicParser");
var HiveSQL = /** @class */ (function (_super) {
__extends(HiveSQL, _super);
function HiveSQL() {
return _super !== null && _super.apply(this, arguments) || this;
}
HiveSQL.prototype.createLexer = function (input) {
var chars = new antlr4_1.InputStream(input);
var lexer = new HiveSqlLexer_1.HiveSqlLexer(chars);
return lexer;
}
createParserFromLexer(lexer) {
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
};
HiveSQL.prototype.createParserFromLexer = function (lexer) {
var tokenStream = new antlr4_1.CommonTokenStream(lexer);
return new HiveSql_1.HiveSql(tokenStream);
}
}
};
return HiveSQL;
}(basicParser_1.default));
exports.default = HiveSQL;
//# sourceMappingURL=hive.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const antlr4_1 = require("antlr4");
const PostgreSQLLexer_1 = require("../lib/pgsql/PostgreSQLLexer");
const PostgreSQLParser_1 = require("../lib/pgsql/PostgreSQLParser");
const basicParser_1 = require("./common/basicParser");
class PLSQLParser extends basicParser_1.default {
createLexer(input) {
const chars = new antlr4_1.InputStream(input.toUpperCase());
const lexer = new PostgreSQLLexer_1.PostgreSQLLexer(chars);
var antlr4_1 = require("antlr4");
var PostgreSQLLexer_1 = require("../lib/pgsql/PostgreSQLLexer");
var PostgreSQLParser_1 = require("../lib/pgsql/PostgreSQLParser");
var basicParser_1 = require("./common/basicParser");
var PLSQLParser = /** @class */ (function (_super) {
__extends(PLSQLParser, _super);
function PLSQLParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
PLSQLParser.prototype.createLexer = function (input) {
var chars = new antlr4_1.InputStream(input.toUpperCase());
var lexer = new PostgreSQLLexer_1.PostgreSQLLexer(chars);
return lexer;
}
createParserFromLexer(lexer) {
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
};
PLSQLParser.prototype.createParserFromLexer = function (lexer) {
var tokenStream = new antlr4_1.CommonTokenStream(lexer);
return new PostgreSQLParser_1.PostgreSQLParser(tokenStream);
}
}
};
return PLSQLParser;
}(basicParser_1.default));
exports.default = PLSQLParser;
//# sourceMappingURL=pgsql.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const antlr4_1 = require("antlr4");
const PlSqlLexer_1 = require("../lib/plsql/PlSqlLexer");
const PlSqlParser_1 = require("../lib/plsql/PlSqlParser");
const basicParser_1 = require("./common/basicParser");
class PLSQLParser extends basicParser_1.default {
createLexer(input) {
const chars = new antlr4_1.InputStream(input.toUpperCase());
const lexer = new PlSqlLexer_1.PlSqlLexer(chars);
var antlr4_1 = require("antlr4");
var PlSqlLexer_1 = require("../lib/plsql/PlSqlLexer");
var PlSqlParser_1 = require("../lib/plsql/PlSqlParser");
var basicParser_1 = require("./common/basicParser");
var PLSQLParser = /** @class */ (function (_super) {
__extends(PLSQLParser, _super);
function PLSQLParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
PLSQLParser.prototype.createLexer = function (input) {
var chars = new antlr4_1.InputStream(input.toUpperCase());
var lexer = new PlSqlLexer_1.PlSqlLexer(chars);
return lexer;
}
createParserFromLexer(lexer) {
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
};
PLSQLParser.prototype.createParserFromLexer = function (lexer) {
var tokenStream = new antlr4_1.CommonTokenStream(lexer);
return new PlSqlParser_1.PlSqlParser(tokenStream);
}
}
};
return PLSQLParser;
}(basicParser_1.default));
exports.default = PLSQLParser;
//# sourceMappingURL=plsql.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const antlr4_1 = require("antlr4");
const SparkSqlLexer_1 = require("../lib/spark/SparkSqlLexer");
const SparkSqlParser_1 = require("../lib/spark/SparkSqlParser");
const basicParser_1 = require("./common/basicParser");
class SparkSQL extends basicParser_1.default {
createLexer(input) {
const chars = new antlr4_1.InputStream(input.toUpperCase()); // Some Lexer only support uppercase token, So you need transform
const lexer = new SparkSqlLexer_1.SparkSqlLexer(chars);
var antlr4_1 = require("antlr4");
var SparkSqlLexer_1 = require("../lib/spark/SparkSqlLexer");
var SparkSqlParser_1 = require("../lib/spark/SparkSqlParser");
var basicParser_1 = require("./common/basicParser");
var SparkSQL = /** @class */ (function (_super) {
__extends(SparkSQL, _super);
function SparkSQL() {
return _super !== null && _super.apply(this, arguments) || this;
}
SparkSQL.prototype.createLexer = function (input) {
var chars = new antlr4_1.InputStream(input.toUpperCase()); // Some Lexer only support uppercase token, So you need transform
var lexer = new SparkSqlLexer_1.SparkSqlLexer(chars);
return lexer;
}
createParserFromLexer(lexer) {
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
};
SparkSQL.prototype.createParserFromLexer = function (lexer) {
var tokenStream = new antlr4_1.CommonTokenStream(lexer);
return new SparkSqlParser_1.SparkSqlParser(tokenStream);
}
}
};
return SparkSQL;
}(basicParser_1.default));
exports.default = SparkSQL;
//# sourceMappingURL=spark.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lexer = exports.splitSql = exports.cleanSql = void 0;
const token_1 = require("./token");
var token_1 = require("./token");
/**

@@ -11,6 +11,6 @@ * 获取 注释 以及 分隔符 等词法信息

// 记录当前字符的位置
let current = 0;
let line = 1;
var current = 0;
var line = 1;
// 最终的 TokenTypes 结果
const tokens = [];
var tokens = [];
/**

@@ -20,5 +20,5 @@ * 提取 TokenType

// eslint-disable-next-line
const extract = (currentChar, validator, TokenType) => {
let value = '';
const start = current;
var extract = function (currentChar, validator, TokenType) {
var value = '';
var start = current;
while (validator.test(currentChar)) {

@@ -39,5 +39,5 @@ value += currentChar;

*/
const matchFunction = (currentChar, validator) => {
let value = currentChar;
const start = current;
var matchFunction = function (currentChar, validator) {
var value = currentChar;
var start = current;
do {

@@ -52,3 +52,3 @@ if (currentChar === '\n') {

type: token_1.TokenType.FunctionArguments,
value,
value: value,
start: start,

@@ -63,3 +63,3 @@ lineNumber: line,

*/
const matchQuotation = (currentChar, validator, TokenType) => {
var matchQuotation = function (currentChar, validator, TokenType) {
do {

@@ -74,3 +74,3 @@ if (currentChar === '\n') {

while (current < input.length) {
let char = input[current];
var char = input[current];
// 按顺序处理 括号函数 换行符 反引号 单引号 双引号 注释 分号

@@ -104,4 +104,4 @@ // 引号内 可能包含注释包含的符号以及分号 所以优先处理引号里面的内容 去除干扰信息

if (char === '-' && input[current + 1] === '-') {
let value = '';
const start = current;
var value = '';
var start = current;
while (char !== '\n' && current < input.length) {

@@ -113,3 +113,3 @@ value += char;

type: token_1.TokenType.Comment,
value,
value: value,
start: start,

@@ -123,5 +123,5 @@ lineNumber: line,

if (char === '/' && input[current + 1] === '*') {
let value = '';
const start = current;
const startLine = line;
var value = '';
var start = current;
var startLine = line;
while (!(char === '/' && input[current - 1] === '*')) {

@@ -138,3 +138,3 @@ if (char === '\n') {

type: token_1.TokenType.Comment,
value,
value: value,
start: start,

@@ -148,3 +148,3 @@ lineNumber: startLine,

if (token_1.TokenReg.StatementTerminator.test(char)) {
const newToken = extract(char, token_1.TokenReg.StatementTerminator, token_1.TokenType.StatementTerminator);
var newToken = extract(char, token_1.TokenReg.StatementTerminator, token_1.TokenType.StatementTerminator);
tokens.push(newToken);

@@ -163,6 +163,6 @@ continue;

function splitSql(sql) {
const tokens = lexer(sql);
const sqlArr = [];
let startIndex = 0;
tokens.forEach((ele) => {
var tokens = lexer(sql);
var sqlArr = [];
var startIndex = 0;
tokens.forEach(function (ele) {
if (ele.type === token_1.TokenType.StatementTerminator) {

@@ -185,6 +185,6 @@ sqlArr.push(sql.slice(startIndex, ele.end));

sql = sql.trim(); // 删除前后空格
const tokens = lexer(sql);
let resultSql = '';
let startIndex = 0;
tokens.forEach((ele) => {
var tokens = lexer(sql);
var resultSql = '';
var startIndex = 0;
tokens.forEach(function (ele) {
if (ele.type === token_1.TokenType.Comment) {

@@ -191,0 +191,0 @@ resultSql += sql.slice(startIndex, ele.start);

"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -39,11 +40,11 @@ exports.TokenReg = exports.TokenType = void 0;

*/
exports.TokenReg = {
[TokenType.StatementTerminator]: /[;]/,
[TokenType.SingleQuotation]: /['|\']/,
[TokenType.DoubleQuotation]: /["]/,
[TokenType.BackQuotation]: /[`]/,
[TokenType.LeftSmallBracket]: /[(]/,
[TokenType.RightSmallBracket]: /[)]/,
[TokenType.Comma]: /[,]/,
};
exports.TokenReg = (_a = {},
_a[TokenType.StatementTerminator] = /[;]/,
_a[TokenType.SingleQuotation] = /['|\']/,
_a[TokenType.DoubleQuotation] = /["]/,
_a[TokenType.BackQuotation] = /[`]/,
_a[TokenType.LeftSmallBracket] = /[(]/,
_a[TokenType.RightSmallBracket] = /[)]/,
_a[TokenType.Comma] = /[,]/,
_a);
//# sourceMappingURL=token.js.map
{
"name": "@salvoravida/dt-sql-parser",
"version": "4.0.0-beta.2.7",
"version": "4.0.0-beta.2.9",
"description": "SQL Parsers for BigData, built with antlr4",

@@ -5,0 +5,0 @@ "keywords": [

@@ -6,3 +6,3 @@ {

"allowJs":true,
"target": "es6",
"target": "es5",
"module": "commonjs",

@@ -9,0 +9,0 @@ "declaration": true,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc