Fix/export abstract visitor (#237)
* fix: #236 export AbstractParseTreeVisitor * build: set isolatedModules true * feat: import parser about from filters
This commit is contained in:
@ -1,7 +1,4 @@
|
||||
import path from 'path';
|
||||
import { writeFileSync } from 'node:fs';
|
||||
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import {
|
||||
readSQL,
|
||||
benchmark,
|
||||
|
@ -1,6 +1,4 @@
|
||||
import FlinkSQL from '../../../src/parser/flinksql';
|
||||
import { FlinkSqlSplitListener } from '../../../src/parser/flinksql';
|
||||
import { FlinkSqlParserListener } from '../../../src/lib/flinksql/FlinkSqlParserListener';
|
||||
import { FlinkSQL, FlinkSqlSplitListener, FlinkSqlParserListener } from '../../filters';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../filters';
|
||||
|
||||
describe('FlinkSQL Lexer tests', () => {
|
||||
const parser = new FlinkSQL();
|
||||
|
@ -1,7 +1,9 @@
|
||||
import FlinkSQL from '../../../src/parser/flinksql';
|
||||
import { FlinkSqlParserListener } from '../../../src/lib/flinksql/FlinkSqlParserListener';
|
||||
import { TableExpressionContext } from '../../../src/lib/flinksql/FlinkSqlParser';
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import {
|
||||
FlinkSQL,
|
||||
FlinkSqlParserListener,
|
||||
FlinkSqlParserRuleContext,
|
||||
ParseTreeListener,
|
||||
} from '../../filters';
|
||||
|
||||
describe('Flink SQL Listener Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
@ -13,7 +15,9 @@ describe('Flink SQL Listener Tests', () => {
|
||||
test('Listener enterTableName', async () => {
|
||||
let result = '';
|
||||
class MyListener implements FlinkSqlParserListener {
|
||||
enterTableExpression = (ctx: TableExpressionContext): void => {
|
||||
enterTableExpression = (
|
||||
ctx: FlinkSqlParserRuleContext.TableExpressionContext
|
||||
): void => {
|
||||
result = ctx.text.toLowerCase();
|
||||
};
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { CaretPosition, SyntaxContextType, FlinkSQL } from '../../../filters';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { CaretPosition, SyntaxContextType, FlinkSQL } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL, CaretPosition } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
// 综合测试的 sql 不做切割
|
||||
|
@ -1,6 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
|
||||
// 注释 sql 不做切割
|
||||
const features = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
|
||||
// 综合测试的 sql 不做切割
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new FlinkSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new FlinkSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new FlinkSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||
import { FlinkSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,6 +1,4 @@
|
||||
import FlinkSQL from '../../../src/parser/flinksql';
|
||||
import { FlinkSqlParserVisitor } from '../../../src/lib/flinksql/FlinkSqlParserVisitor';
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree';
|
||||
import { FlinkSQL, AbstractParseTreeVisitor, FlinkSqlParserVisitor } from '../../filters';
|
||||
|
||||
describe('Flink SQL Visitor Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,6 +1,4 @@
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { HiveSqlSplitListener } from '../../../src/parser/hive';
|
||||
import { HiveSqlParserListener } from '../../../src/lib/hive/HiveSqlParserListener';
|
||||
import { HiveSQL, HiveSqlSplitListener, HiveSqlParserListener } from '../../filters';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../filters';
|
||||
|
||||
describe('HiveSQL Lexer tests', () => {
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { ProgramContext } from '../../../src/lib/hive/HiveSqlParser';
|
||||
import { HiveSqlParserListener } from '../../../src/lib/hive/HiveSqlParserListener';
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { HiveSQL, HiveSqlParserListener, HiveSqlParserRuleContext } from '../../filters';
|
||||
|
||||
describe('HiveSQL Listener Tests', () => {
|
||||
const parser = new HiveSQL();
|
||||
@ -18,7 +16,10 @@ describe('HiveSQL Listener Tests', () => {
|
||||
}
|
||||
const listenTableName = new MyListener();
|
||||
|
||||
await parser.listen(listenTableName as ParseTreeListener, parseTree as ProgramContext);
|
||||
await parser.listen(
|
||||
listenTableName as ParseTreeListener,
|
||||
parseTree as HiveSqlParserRuleContext.ProgramContext
|
||||
);
|
||||
expect(result).toBe(expectTableName.toUpperCase());
|
||||
});
|
||||
test('Listener enterCreateTable', async () => {
|
||||
@ -32,7 +33,10 @@ describe('HiveSQL Listener Tests', () => {
|
||||
}
|
||||
const listenTableName = new MyListener();
|
||||
|
||||
await parser.listen(listenTableName as ParseTreeListener, parseTree as ProgramContext);
|
||||
await parser.listen(
|
||||
listenTableName as ParseTreeListener,
|
||||
parseTree as HiveSqlParserRuleContext.ProgramContext
|
||||
);
|
||||
expect(result).toBe('DROPTABLETABLE_NAME');
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { CaretPosition, SyntaxContextType, HiveSQL } from '../../../filters';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { CaretPosition, SyntaxContextType, HiveSQL } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { CaretPosition, HiveSQL } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
|
||||
import { HiveSqlParserVisitor } from '../../../src/lib/hive/HiveSqlParserVisitor';
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { ProgramContext } from '../../../src/lib/hive/HiveSqlParser';
|
||||
import {
|
||||
HiveSQL,
|
||||
HiveSqlParserVisitor,
|
||||
AbstractParseTreeVisitor,
|
||||
HiveSqlParserRuleContext,
|
||||
} from '../../filters';
|
||||
|
||||
describe('HiveSQL Visitor Tests', () => {
|
||||
const expectTableName = 'dm_gis.dlv_addr_tc_count';
|
||||
@ -25,7 +27,7 @@ describe('HiveSQL Visitor Tests', () => {
|
||||
}
|
||||
|
||||
const visitor = new MyVisitor();
|
||||
visitor.visit(parseTree as ProgramContext);
|
||||
visitor.visit(parseTree as HiveSqlParserRuleContext.ProgramContext);
|
||||
|
||||
expect(result).toBe(expectTableName);
|
||||
});
|
||||
|
@ -1,6 +1,4 @@
|
||||
import ImpalaSQL from '../../../src/parser/impala';
|
||||
import { ImpalaSqlSplitListener } from '../../../src/parser/impala';
|
||||
import { ImpalaSqlParserListener } from '../../../src/lib/impala/ImpalaSqlParserListener';
|
||||
import { ImpalaSQL, ImpalaSqlSplitListener, ImpalaSqlParserListener } from '../../filters';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../filters';
|
||||
|
||||
describe('ImpalaSQL Lexer tests', () => {
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,11 +1,9 @@
|
||||
import impalaSQL from '../../../src/parser/impala';
|
||||
import { ImpalaSqlParserListener } from '../../../src/lib/impala/ImpalaSqlParserListener';
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { ImpalaSQL, ImpalaSqlParserListener, ParseTreeListener } from '../../filters';
|
||||
|
||||
describe('impala SQL Listener Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
const sql = `select id,name,sex from ${expectTableName};`;
|
||||
const parser = new impalaSQL();
|
||||
const parser = new ImpalaSQL();
|
||||
|
||||
const parseTree = parser.parse(sql);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL, CaretPosition, SyntaxContextType } from '../../../filters';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL, CaretPosition, SyntaxContextType } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
|
@ -1,13 +1,12 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||
import impalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL, CaretPosition } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
||||
describe('Impala SQL Token Suggestion', () => {
|
||||
const parser = new impalaSQL();
|
||||
const parser = new ImpalaSQL();
|
||||
|
||||
test('After ALTER', () => {
|
||||
const pos: CaretPosition = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import ImpalaSQL from '../../../../src/parser/impala';
|
||||
import { ImpalaSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new ImpalaSQL();
|
||||
|
@ -1,11 +1,9 @@
|
||||
import impalaSQL from '../../../src/parser/impala';
|
||||
import { ImpalaSqlParserVisitor } from '../../../src/lib/impala/ImpalaSqlParserVisitor';
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree';
|
||||
import { ImpalaSQL, ImpalaSqlParserVisitor, AbstractParseTreeVisitor } from '../../filters';
|
||||
|
||||
describe('impala SQL Visitor Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
const sql = `select id,name,sex from ${expectTableName};`;
|
||||
const parser = new impalaSQL();
|
||||
const parser = new ImpalaSQL();
|
||||
|
||||
const parseTree = parser.parse(sql, (error) => {
|
||||
console.log('Parse error:', error);
|
||||
|
@ -1,6 +1,5 @@
|
||||
import MySQL from '../../../src/parser/mysql';
|
||||
import { MysqlSplitListener } from '../../../src/parser/mysql';
|
||||
import { MySqlParserListener } from '../../../src/lib/mysql/MySqlParserListener';
|
||||
import { MySQL } from '../../filters';
|
||||
import { MysqlSplitListener, MySqlParserListener } from '../../filters';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import MySQL from '../../../src/parser/mysql';
|
||||
import { MySQL } from '../../filters';
|
||||
|
||||
describe('MySQL Lexer tests', () => {
|
||||
const parser = new MySQL();
|
||||
|
@ -1,6 +1,5 @@
|
||||
import MySQL from '../../../src/parser/mysql';
|
||||
import { MySqlParserListener } from '../../../src/lib/mysql/MySqlParserListener';
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { MySQL } from '../../filters';
|
||||
import { MySqlParserListener, ParseTreeListener } from '../../filters';
|
||||
|
||||
describe('MySQL Listener Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import MySQL from '../../../../src/parser/mysql';
|
||||
import { MySQL, CaretPosition, SyntaxContextType } from '../../../filters';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import MySQL from '../../../../src/parser/mysql';
|
||||
import { MySQL, CaretPosition, SyntaxContextType } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||
import MySQL from '../../../../src/parser/mysql';
|
||||
import { MySQL, CaretPosition } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
@ -1,4 +1,4 @@
|
||||
import MySQL from '../../../src/parser/mysql';
|
||||
import { MySQL } from '../../filters';
|
||||
|
||||
describe('MySQL Syntax Tests', () => {
|
||||
const parser = new MySQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import MySQL from '../../../../src/parser/mysql';
|
||||
import { MySQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new MySQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import MySQL from '../../../../src/parser/mysql';
|
||||
import { MySQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new MySQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import MySQL from '../../../../src/parser/mysql';
|
||||
import { MySQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new MySQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import MySQL from '../../../../src/parser/mysql';
|
||||
import { MySQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new MySQL();
|
||||
|
@ -1,6 +1,4 @@
|
||||
import MySQL from '../../../src/parser/mysql';
|
||||
import { MySqlParserVisitor } from '../../../src/lib/mysql/MySqlParserVisitor';
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree';
|
||||
import { MySQL, MySqlParserVisitor, AbstractParseTreeVisitor } from '../../filters';
|
||||
|
||||
describe('MySQL Visitor Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,6 +1,4 @@
|
||||
import PgSQL from '../../../src/parser/pgsql';
|
||||
import { PgSqlSplitListener } from '../../../src/parser/pgsql';
|
||||
import { PostgreSQLParserListener } from '../../../src/lib/pgsql/PostgreSQLParserListener';
|
||||
import { PostgresSQL, PgSqlSplitListener, PostgreSQLParserListener } from '../../filters';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
@ -9,7 +7,7 @@ const validSQL2 = 'SELECT * FROM tb;';
|
||||
const inValidSQL = 'CREATE TABLE';
|
||||
|
||||
describe('PgSQL ErrorStrategy test', () => {
|
||||
const pgSQL = new PgSQL();
|
||||
const pgSQL = new PostgresSQL();
|
||||
|
||||
// TODO: handle unexpected case
|
||||
// test('begin inValid', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import PostgresSQL from '../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../filters';
|
||||
|
||||
describe('PostgresSQL Lexer tests', () => {
|
||||
const mysqlParser = new PostgresSQL();
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { PostgreSQLParserListener } from '../../../src/lib/pgsql/PostgreSQLParserListener';
|
||||
import PostgresSQL from '../../../src/parser/pgsql';
|
||||
import { PostgresSQL, PostgreSQLParserListener, ParseTreeListener } from '../../filters';
|
||||
|
||||
describe('PostgresSQL Listener Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { CaretPosition, SyntaxContextType, PostgresSQL } from '../../../filters';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
@ -9,7 +8,7 @@ const syntaxSql = fs.readFileSync(
|
||||
);
|
||||
|
||||
describe('PgSQL Multiple Statements Syntax Suggestion', () => {
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
test('Create table ', () => {
|
||||
const pos: CaretPosition = {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL, CaretPosition, SyntaxContextType } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
@ -10,7 +9,7 @@ const syntaxSql = fs.readFileSync(
|
||||
);
|
||||
|
||||
describe('Postgre SQL Syntax Suggestion', () => {
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
test('Validate Syntax SQL', () => {
|
||||
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||
import PostgresSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL, CaretPosition } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
alters: readSQL(__dirname, 'alter.sql'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
creates: readSQL(__dirname, 'create.sql'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
deletes: readSQL(__dirname, 'delete.sql'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
drops: readSQL(__dirname, 'drop.sql'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
inserts: readSQL(__dirname, 'insert.sql'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
others: readSQL(__dirname, 'others.sql'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
selects: readSQL(__dirname, 'select.sql'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PgSQL from '../../../../src/parser/pgsql';
|
||||
import { PostgresSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new PgSQL();
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
updates: readSQL(__dirname, 'update.sql'),
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
|
||||
import { PostgreSQLParserVisitor } from '../../../src/lib/pgsql/PostgreSQLParserVisitor';
|
||||
import PostgresSQL from '../../../src/parser/pgsql';
|
||||
import { PostgresSQL, AbstractParseTreeVisitor, PostgreSQLParserVisitor } from '../../filters';
|
||||
|
||||
describe('MySQL Visitor Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import PLSQL from '../../../src/parser/plsql';
|
||||
import { PLSQL } from '../../filters';
|
||||
|
||||
describe('PLSQL Lexer tests', () => {
|
||||
const parser = new PLSQL();
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { PlSqlParserListener } from '../../../src/lib/plsql/PlSqlParserListener';
|
||||
import PLSQL from '../../../src/parser/plsql';
|
||||
import { PLSQL, PlSqlParserListener, ParseTreeListener } from '../../filters';
|
||||
|
||||
describe('PLSQL Listener Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PLSQLParser from '../../../src/parser/plsql';
|
||||
import { PLSQL } from '../../filters';
|
||||
|
||||
describe('PLSQL Syntax Tests', () => {
|
||||
const parser = new PLSQLParser();
|
||||
const parser = new PLSQL();
|
||||
|
||||
test('Test simple select Statement', () => {
|
||||
const sql = 'select id,name from user1;';
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
|
||||
import { PlSqlParserVisitor } from '../../../src/lib/plsql/PlSqlParserVisitor';
|
||||
import PLSQL from '../../../src/parser/plsql';
|
||||
import { PLSQL, AbstractParseTreeVisitor, PlSqlParserVisitor } from '../../filters';
|
||||
|
||||
describe('PLSQL Visitor Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,6 +1,4 @@
|
||||
import SparkSQL from '../../../src/parser/spark';
|
||||
import { SparkSqlSplitListener } from '../../../src/parser/spark';
|
||||
import { SparkSqlParserListener } from '../../../src/lib/spark/SparkSqlParserListener';
|
||||
import { SparkSQL, SparkSqlSplitListener, SparkSqlParserListener } from '../../filters';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import SparkSQL from '../../../src/parser/spark';
|
||||
import { SparkSQL } from '../../filters';
|
||||
|
||||
describe('SparkSQL Lexer tests', () => {
|
||||
const parser = new SparkSQL();
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { SparkSqlParserListener } from '../../../src/lib/spark/SparkSqlParserListener';
|
||||
import SparkSQL from '../../../src/parser/spark';
|
||||
import { SparkSQL, ParseTreeListener, SparkSqlParserListener } from '../../filters';
|
||||
|
||||
describe('Spark SQL Listener Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import SparkSQL from '../../../../src/parser/spark';
|
||||
import { SparkSQL, CaretPosition, SyntaxContextType } from '../../../filters';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import SparkSQL from '../../../../src/parser/spark';
|
||||
import { SparkSQL, CaretPosition, SyntaxContextType } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||
import SparkSQL from '../../../../src/parser/spark';
|
||||
import { SparkSQL, CaretPosition } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user