UNPKG

rhombic

Version:

SQL parsing, lineage extraction and manipulation

35 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WhereVisitor = void 0; const SqlParser_1 = require("../SqlParser"); const getChildrenRange_1 = require("../utils/getChildrenRange"); const Visitor = SqlParser_1.parser.getBaseCstVisitorConstructorWithDefaults(); /** * Visitor to extract information about `WHERE` statement */ class WhereVisitor extends Visitor { constructor() { super(); this.validateVisitor(); } tableExpression(ctx) { // Register end of tableExpression as range as fallback const tableRange = getChildrenRange_1.getChildrenRange(ctx); this.tableRange = { startLine: tableRange.endLine, startColumn: tableRange.endColumn + 1, endColumn: tableRange.endColumn + 1, endLine: tableRange.endLine }; } booleanExpression(ctx) { this.booleanExpressionRange = getChildrenRange_1.getChildrenRange(ctx); this.booleanExpressionNode = ctx; } where(ctx) { this.whereRange = getChildrenRange_1.getChildrenRange(ctx); ctx.booleanExpression.map(i => this.booleanExpression(i.children)); } } exports.WhereVisitor = WhereVisitor; //# sourceMappingURL=WhereVisitor.js.map