From 8f72a5af60b43b7bc59d41f609593ecb9dbff440 Mon Sep 17 00:00:00 2001 From: Hayden Date: Tue, 19 Dec 2023 19:22:27 +0800 Subject: [PATCH] Fix/export abstract visitor (#237) * fix: #236 export AbstractParseTreeVisitor * build: set isolatedModules true * feat: import parser about from filters --- src/index.ts | 58 +++++++++++------ src/lib/index.ts | 23 +++++++ test/common/basicParser.test.ts | 4 +- test/filters/index.ts | 63 +++++++++++++++++++ test/parser/flinksql/benchmark/main.test.ts | 5 +- test/parser/flinksql/errorStrategy.test.ts | 4 +- test/parser/flinksql/lexer.test.ts | 2 +- test/parser/flinksql/listener.test.ts | 14 +++-- .../suggestion/multipleStatement.test.ts | 3 +- .../suggestion/syntaxSuggestion.test.ts | 3 +- .../suggestion/tokenSuggestion.test.ts | 3 +- .../flinksql/syntax/alterStatement.test.ts | 2 +- .../flinksql/syntax/choreStatement.test.ts | 2 +- .../flinksql/syntax/commentStatement.test.ts | 2 +- .../flinksql/syntax/comprehensive.test.ts | 2 +- .../flinksql/syntax/createStatement.test.ts | 2 +- .../flinksql/syntax/describeStatement.test.ts | 2 +- .../flinksql/syntax/dropStatement.test.ts | 2 +- .../syntax/dtAddFileStatement.test.ts | 2 +- .../flinksql/syntax/explainStatement.test.ts | 2 +- .../syntax/expressionStatement.test.ts | 2 +- .../flinksql/syntax/insertStatement.test.ts | 2 +- .../flinksql/syntax/selectStatement.test.ts | 2 +- .../flinksql/syntax/showStatement.test.ts | 2 +- .../flinksql/syntax/useStatement.test.ts | 2 +- test/parser/flinksql/visitor.test.ts | 4 +- test/parser/hive/errorStrategy.test.ts | 4 +- test/parser/hive/lexer.test.ts | 2 +- test/parser/hive/listener.test.ts | 14 +++-- .../hive/suggestion/multipleStatement.test.ts | 3 +- .../hive/suggestion/syntaxSuggestion.test.ts | 3 +- .../hive/suggestion/tokenSuggestion.test.ts | 3 +- .../parser/hive/syntax/abortStatement.test.ts | 2 +- .../parser/hive/syntax/alterStatement.test.ts | 2 +- .../syntax/authorizationStatement.test.ts | 2 +- .../hive/syntax/createStatement.test.ts | 2 +- .../hive/syntax/dataTypesStatement.test.ts | 2 +- test/parser/hive/syntax/delete.test.ts | 2 +- .../hive/syntax/describeStatement.test.ts | 2 +- test/parser/hive/syntax/dropStatement.test.ts | 2 +- .../hive/syntax/exportStatement.test.ts | 2 +- .../hive/syntax/importStatement.test.ts | 2 +- .../hive/syntax/insertStatement.test.ts | 2 +- test/parser/hive/syntax/loadStatement.test.ts | 2 +- test/parser/hive/syntax/merge.test.ts | 2 +- .../hive/syntax/selectStatement.test.ts | 2 +- test/parser/hive/syntax/showStatement.test.ts | 2 +- test/parser/hive/syntax/update.test.ts | 2 +- test/parser/hive/visitor.test.ts | 12 ++-- test/parser/impala/errorStrategy.test.ts | 4 +- test/parser/impala/lexer.test.ts | 2 +- test/parser/impala/listener.test.ts | 6 +- .../suggestion/multipleStatement.test.ts | 3 +- .../suggestion/syntaxSuggestion.test.ts | 3 +- .../impala/suggestion/tokenSuggestion.test.ts | 5 +- .../impala/syntax/alterStatement.test.ts | 2 +- .../impala/syntax/creataStatement.test.ts | 2 +- test/parser/impala/syntax/delete.test.ts | 2 +- .../impala/syntax/dropStatement.test.ts | 2 +- test/parser/impala/syntax/insert.test.ts | 2 +- .../impala/syntax/otherStatement.test.ts | 2 +- test/parser/impala/syntax/refresh.test.ts | 2 +- test/parser/impala/syntax/select.test.ts | 2 +- test/parser/impala/syntax/show.test.ts | 2 +- test/parser/impala/syntax/update.test.ts | 2 +- test/parser/impala/syntax/upsert.test.ts | 2 +- test/parser/impala/visitor.test.ts | 6 +- test/parser/mysql/errorStrategy.test.ts | 5 +- test/parser/mysql/lexer.test.ts | 2 +- test/parser/mysql/listener.test.ts | 5 +- .../suggestion/multipleStatement.test.ts | 3 +- .../mysql/suggestion/syntaxSuggestion.test.ts | 3 +- .../mysql/suggestion/tokenSuggestion.test.ts | 3 +- test/parser/mysql/syntax.test.ts | 2 +- .../mysql/syntax/administration.test.ts | 2 +- test/parser/mysql/syntax/ddl.test.ts | 2 +- test/parser/mysql/syntax/dml.test.ts | 2 +- test/parser/mysql/syntax/other.test.ts | 2 +- test/parser/mysql/visitor.test.ts | 4 +- test/parser/pgsql/errorStrategy.test.ts | 6 +- test/parser/pgsql/lexer.test.ts | 2 +- test/parser/pgsql/listener.test.ts | 4 +- .../suggestion/multipleStatement.test.ts | 5 +- .../pgsql/suggestion/syntaxSuggestion.test.ts | 5 +- .../pgsql/suggestion/tokenSuggestion.test.ts | 3 +- .../pgsql/syntax/alterStatement.test.ts | 4 +- .../pgsql/syntax/createStatement.test.ts | 4 +- .../pgsql/syntax/deleteStatement.test.ts | 4 +- .../parser/pgsql/syntax/dropStatement.test.ts | 4 +- .../pgsql/syntax/insertStatement.test.ts | 4 +- test/parser/pgsql/syntax/others.test.ts | 4 +- .../pgsql/syntax/selectStatement.test.ts | 4 +- .../pgsql/syntax/updateStatement.test.ts | 4 +- test/parser/pgsql/visitor.test.ts | 4 +- test/parser/plsql/lexer.test.ts | 2 +- test/parser/plsql/listener.test.ts | 4 +- test/parser/plsql/syntax.test.ts | 4 +- test/parser/plsql/visitor.test.ts | 4 +- test/parser/spark/errorStrategy.test.ts | 4 +- test/parser/spark/lexer.test.ts | 2 +- test/parser/spark/listener.test.ts | 4 +- .../suggestion/multipleStatement.test.ts | 3 +- .../spark/suggestion/syntaxSuggestion.test.ts | 3 +- .../spark/suggestion/tokenSuggestion.test.ts | 3 +- test/parser/spark/syntax/addStatement.test.ts | 2 +- test/parser/spark/syntax/alert.test.ts | 2 +- .../syntax/analyzeTableStatement.test.ts | 2 +- .../spark/syntax/cacheStatement.test.ts | 2 +- test/parser/spark/syntax/create.test.ts | 2 +- .../spark/syntax/describeStatement.test.ts | 2 +- test/parser/spark/syntax/drop.test.ts | 2 +- .../spark/syntax/insertStatement.test.ts | 2 +- .../spark/syntax/kwMultipleValues.test.ts | 2 +- .../parser/spark/syntax/listStatement.test.ts | 2 +- .../parser/spark/syntax/loadStatement.test.ts | 2 +- .../spark/syntax/refreshStatement.test.ts | 2 +- .../spark/syntax/resetStatement.test.ts | 2 +- .../spark/syntax/selectStatement.test.ts | 2 +- test/parser/spark/syntax/setStatement.test.ts | 2 +- .../parser/spark/syntax/showStatement.test.ts | 2 +- test/parser/spark/syntax/table.test.ts | 2 +- test/parser/spark/syntax/useDatabase.test.ts | 2 +- test/parser/spark/visitor.test.ts | 4 +- test/parser/trinosql/errorStrategy.test.ts | 4 +- test/parser/trinosql/lexer.test.ts | 4 +- test/parser/trinosql/listener.test.ts | 6 +- .../suggestion/multipleStatement.test.ts | 3 +- .../suggestion/syntaxSuggestion.test.ts | 3 +- .../suggestion/tokenSuggestion.test.ts | 3 +- .../trinosql/syntax/alterStatement.test.ts | 2 +- .../trinosql/syntax/analyzeStatement.test.ts | 2 +- .../trinosql/syntax/callStatement.test.ts | 2 +- .../trinosql/syntax/commentStatement.test.ts | 2 +- .../trinosql/syntax/commitStatement.test.ts | 2 +- .../trinosql/syntax/createStatement.test.ts | 2 +- .../syntax/deallocatePrepareStatement.test.ts | 2 +- .../trinosql/syntax/deleteStatement.test.ts | 2 +- .../trinosql/syntax/denyStatement.test.ts | 2 +- .../trinosql/syntax/describeStatement.test.ts | 2 +- .../trinosql/syntax/dropStatement.test.ts | 2 +- .../trinosql/syntax/executeStatement.test.ts | 2 +- .../trinosql/syntax/explainStatement.test.ts | 2 +- .../trinosql/syntax/grantStatement.test.ts | 2 +- .../trinosql/syntax/insertStatement.test.ts | 2 +- .../syntax/matchRecognizeStatement.test.ts | 2 +- test/parser/trinosql/syntax/merge.test.ts | 2 +- .../trinosql/syntax/prepareStatement.test.ts | 2 +- .../refreshMaterializedViewStatement.test.ts | 2 +- .../syntax/resetSessionStatement.test.ts | 2 +- .../trinosql/syntax/revokeStatement.test.ts | 2 +- .../rollbackTransactionStatement.test.ts | 2 +- .../trinosql/syntax/selectStatement.test.ts | 2 +- .../trinosql/syntax/setStatement.test.ts | 2 +- .../trinosql/syntax/showStatement.test.ts | 2 +- .../syntax/startTransactionStatement.test.ts | 2 +- .../syntax/truncateTableStatement.test.ts | 2 +- .../trinosql/syntax/updateStatement.test.ts | 2 +- .../trinosql/syntax/useStatement.test.ts | 2 +- .../trinosql/syntax/valuesStatement.test.ts | 2 +- ...WithRowPatternRecognitionStatement.test.ts | 2 +- test/parser/trinosql/visitor.test.ts | 6 +- tsconfig.json | 6 +- 162 files changed, 327 insertions(+), 277 deletions(-) create mode 100644 src/lib/index.ts create mode 100644 test/filters/index.ts diff --git a/src/index.ts b/src/index.ts index 6aba7aa..0d33296 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,23 +1,45 @@ -export * from './parser'; -export * from './lib/flinksql/FlinkSqlParserListener'; -export * from './lib/flinksql/FlinkSqlParserVisitor'; -export * from './lib/mysql/MySqlParserVisitor'; -export * from './lib/mysql/MySqlParserListener'; -export * from './lib/hive/HiveSqlParserListener'; -export * from './lib/hive/HiveSqlParserVisitor'; -export * from './lib/plsql/PlSqlParserListener'; -export * from './lib/plsql/PlSqlParserVisitor'; -export * from './lib/spark/SparkSqlParserVisitor'; -export * from './lib/spark/SparkSqlParserListener'; -export * from './lib/pgsql/PostgreSQLParserListener'; -export * from './lib/pgsql/PostgreSQLParserVisitor'; -export * from './lib/trinosql/TrinoSqlListener'; -export * from './lib/trinosql/TrinoSqlVisitor'; -export * from './lib/impala/ImpalaSqlParserListener'; -export * from './lib/impala/ImpalaSqlParserVisitor'; +export { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; + +export { + MySQL, + FlinkSQL, + SparkSQL, + HiveSQL, + PostgresSQL, + TrinoSQL, + ImpalaSQL, + PLSQL, +} from './parser'; + +export { + MySqlParserListener, + MySqlParserVisitor, + FlinkSqlParserListener, + FlinkSqlParserVisitor, + SparkSqlParserListener, + SparkSqlParserVisitor, + HiveSqlParserListener, + HiveSqlParserVisitor, + PlSqlParserListener, + PlSqlParserVisitor, + PostgreSQLParserListener, + PostgreSQLParserVisitor, + TrinoSqlListener, + TrinoSqlVisitor, + ImpalaSqlParserListener, + ImpalaSqlParserVisitor, +} from './lib'; + export { SyntaxContextType } from './parser/common/basic-parser-types'; -export type * from './parser/common/basic-parser-types'; +export type { + CaretPosition, + WordRange, + Suggestions, + SyntaxSuggestion, + TextSlice, +} from './parser/common/basic-parser-types'; + export type { SyntaxError, ParseError, ErrorListener } from './parser/common/parseErrorListener'; /** diff --git a/src/lib/index.ts b/src/lib/index.ts new file mode 100644 index 0000000..8275f95 --- /dev/null +++ b/src/lib/index.ts @@ -0,0 +1,23 @@ +export { FlinkSqlParserListener } from './flinksql/FlinkSqlParserListener'; +export { FlinkSqlParserVisitor } from './flinksql/FlinkSqlParserVisitor'; + +export { MySqlParserListener } from './mysql/MySqlParserListener'; +export { MySqlParserVisitor } from './mysql/MySqlParserVisitor'; + +export { HiveSqlParserListener } from './hive/HiveSqlParserListener'; +export { HiveSqlParserVisitor } from './hive/HiveSqlParserVisitor'; + +export { PlSqlParserListener } from './plsql/PlSqlParserListener'; +export { PlSqlParserVisitor } from './plsql/PlSqlParserVisitor'; + +export { SparkSqlParserListener } from './spark/SparkSqlParserListener'; +export { SparkSqlParserVisitor } from './spark/SparkSqlParserVisitor'; + +export { PostgreSQLParserListener } from './pgsql/PostgreSQLParserListener'; +export { PostgreSQLParserVisitor } from './pgsql/PostgreSQLParserVisitor'; + +export { TrinoSqlListener } from './trinosql/TrinoSqlListener'; +export { TrinoSqlVisitor } from './trinosql/TrinoSqlVisitor'; + +export { ImpalaSqlParserListener } from './impala/ImpalaSqlParserListener'; +export { ImpalaSqlParserVisitor } from './impala/ImpalaSqlParserVisitor'; \ No newline at end of file diff --git a/test/common/basicParser.test.ts b/test/common/basicParser.test.ts index 1321023..602cb9b 100644 --- a/test/common/basicParser.test.ts +++ b/test/common/basicParser.test.ts @@ -1,6 +1,4 @@ -import { CommonTokenStream } from 'antlr4ts'; -import { ErrorListener, FlinkSQL } from '../../src'; -import { FlinkSqlLexer } from '../../src/lib/flinksql/FlinkSqlLexer'; +import { CommonTokenStream, ErrorListener, FlinkSQL, FlinkSqlLexer } from '../filters'; describe('BasicParser unit tests', () => { const flinkParser = new FlinkSQL(); diff --git a/test/filters/index.ts b/test/filters/index.ts new file mode 100644 index 0000000..b3a9870 --- /dev/null +++ b/test/filters/index.ts @@ -0,0 +1,63 @@ +/** + * All unit tests should import parser about from this file. + * In this way, the exports of dt-sql-parser in the entry file is guaranteed to be complete. + * + * 单测文件中有关 parser 的导入,都应该从这个文件中导入。 + * 通过这种方式,能保证 dt-sql-parser 的入口文件中的导出完整。 + * + * See this issue https://github.com/DTStack/dt-sql-parser/issues/236. + */ + +export * from '../../src'; + +/** + * Something required by unit test but dt-sql-parser'entry not. + * If you need to add an export to this file, + * consider whether it should be exported in src/index as well. + * + * 一些单测文件需要但是 dt-sql-parser的入口不需要的导出。 + * 如果你需要在这个文件中添加新的导出,请考虑它是否应该在 dt-sql-parser 的入口文件中导出。 + */ +export { CommonTokenStream } from 'antlr4ts'; + +export { ParseTreeWalker, ParseTreeListener } from 'antlr4ts/tree'; + +export { FlinkSqlLexer } from '../../src/lib/flinksql/FlinkSqlLexer'; +export { FlinkSqlParser } from '../../src/lib/flinksql/FlinkSqlParser'; +export * as FlinkSqlParserRuleContext from '../../src/lib/flinksql/FlinkSqlParser'; + +export { MySqlLexer } from '../../src/lib/mysql/MySqlLexer'; +export { MySqlParser } from '../../src/lib/mysql/MySqlParser'; +export * as MySqlParserRuleContext from '../../src/lib/mysql/MySqlParser'; + +export { HiveSqlLexer } from '../../src/lib/hive/HiveSqlLexer'; +export { HiveSqlParser } from '../../src/lib/hive/HiveSqlParser'; +export * as HiveSqlParserRuleContext from '../../src/lib/hive/HiveSqlParser'; + +export { PlSqlLexer } from '../../src/lib/plsql/PlSqlLexer'; +export { PlSqlParser } from '../../src/lib/plsql/PlSqlParser'; +export * as PlSqlParserRuleContext from '../../src/lib/plsql/PlSqlParser'; + +export { SparkSqlLexer } from '../../src/lib/spark/SparkSqlLexer'; +export { SparkSqlParser } from '../../src/lib/spark/SparkSqlParser'; +export * as SparkSQLParserRuleContext from '../../src/lib/spark/SparkSqlParser'; + +export { PostgreSQLLexer } from '../../src/lib/pgsql/PostgreSQLLexer'; +export { PostgreSQLParser } from '../../src/lib/pgsql/PostgreSQLParser'; +export * as PostgreSQLParserRuleContext from '../../src/lib/pgsql/PostgreSQLParser'; + +export { TrinoSqlLexer } from '../../src/lib/trinosql/TrinoSqlLexer'; +export { TrinoSqlParser } from '../../src/lib/trinosql/TrinoSqlParser'; +export * as TrinoSqlParserRuleContext from '../../src/lib/trinosql/TrinoSqlParser'; + +export { ImpalaSqlLexer } from '../../src/lib/impala/ImpalaSqlLexer'; +export { ImpalaSqlParser } from '../../src/lib/impala/ImpalaSqlParser'; +export * as ImpalaSqlParserRuleContext from '../../src/lib/impala/ImpalaSqlParser'; + +export { FlinkSqlSplitListener } from '../../src/parser/flinksql'; +export { MysqlSplitListener } from '../../src/parser/mysql'; +export { HiveSqlSplitListener } from '../../src/parser/hive'; +export { SparkSqlSplitListener } from '../../src/parser/spark'; +export { PgSqlSplitListener } from '../../src/parser/pgsql'; +export { TrinoSqlSplitListener } from '../../src/parser/trinosql'; +export { ImpalaSqlSplitListener } from '../../src/parser/impala'; diff --git a/test/parser/flinksql/benchmark/main.test.ts b/test/parser/flinksql/benchmark/main.test.ts index 2d2a4b3..36dd92a 100644 --- a/test/parser/flinksql/benchmark/main.test.ts +++ b/test/parser/flinksql/benchmark/main.test.ts @@ -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, diff --git a/test/parser/flinksql/errorStrategy.test.ts b/test/parser/flinksql/errorStrategy.test.ts index 203a34e..0a48a51 100644 --- a/test/parser/flinksql/errorStrategy.test.ts +++ b/test/parser/flinksql/errorStrategy.test.ts @@ -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), diff --git a/test/parser/flinksql/lexer.test.ts b/test/parser/flinksql/lexer.test.ts index b2d2048..0c62cb7 100644 --- a/test/parser/flinksql/lexer.test.ts +++ b/test/parser/flinksql/lexer.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../src/parser/flinksql'; +import { FlinkSQL } from '../../filters'; describe('FlinkSQL Lexer tests', () => { const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/listener.test.ts b/test/parser/flinksql/listener.test.ts index 7a5161e..eb65917 100644 --- a/test/parser/flinksql/listener.test.ts +++ b/test/parser/flinksql/listener.test.ts @@ -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(); }; } diff --git a/test/parser/flinksql/suggestion/multipleStatement.test.ts b/test/parser/flinksql/suggestion/multipleStatement.test.ts index 29ed999..6cf13d0 100644 --- a/test/parser/flinksql/suggestion/multipleStatement.test.ts +++ b/test/parser/flinksql/suggestion/multipleStatement.test.ts @@ -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'), diff --git a/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts b/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts index b223fac..3c52664 100644 --- a/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts @@ -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( diff --git a/test/parser/flinksql/suggestion/tokenSuggestion.test.ts b/test/parser/flinksql/suggestion/tokenSuggestion.test.ts index bb47b07..2b99eeb 100644 --- a/test/parser/flinksql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/flinksql/suggestion/tokenSuggestion.test.ts @@ -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'); diff --git a/test/parser/flinksql/syntax/alterStatement.test.ts b/test/parser/flinksql/syntax/alterStatement.test.ts index efe0f94..f3e5e76 100644 --- a/test/parser/flinksql/syntax/alterStatement.test.ts +++ b/test/parser/flinksql/syntax/alterStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/syntax/choreStatement.test.ts b/test/parser/flinksql/syntax/choreStatement.test.ts index e282888..72c5f45 100644 --- a/test/parser/flinksql/syntax/choreStatement.test.ts +++ b/test/parser/flinksql/syntax/choreStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; // 综合测试的 sql 不做切割 diff --git a/test/parser/flinksql/syntax/commentStatement.test.ts b/test/parser/flinksql/syntax/commentStatement.test.ts index 8b3a976..e1424ef 100644 --- a/test/parser/flinksql/syntax/commentStatement.test.ts +++ b/test/parser/flinksql/syntax/commentStatement.test.ts @@ -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 = { diff --git a/test/parser/flinksql/syntax/comprehensive.test.ts b/test/parser/flinksql/syntax/comprehensive.test.ts index 075112a..06388f2 100644 --- a/test/parser/flinksql/syntax/comprehensive.test.ts +++ b/test/parser/flinksql/syntax/comprehensive.test.ts @@ -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 = { diff --git a/test/parser/flinksql/syntax/createStatement.test.ts b/test/parser/flinksql/syntax/createStatement.test.ts index 97e82e5..8024a64 100644 --- a/test/parser/flinksql/syntax/createStatement.test.ts +++ b/test/parser/flinksql/syntax/createStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/syntax/describeStatement.test.ts b/test/parser/flinksql/syntax/describeStatement.test.ts index 6d04fee..4550e07 100644 --- a/test/parser/flinksql/syntax/describeStatement.test.ts +++ b/test/parser/flinksql/syntax/describeStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/syntax/dropStatement.test.ts b/test/parser/flinksql/syntax/dropStatement.test.ts index e25cf73..ee2dd00 100644 --- a/test/parser/flinksql/syntax/dropStatement.test.ts +++ b/test/parser/flinksql/syntax/dropStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/syntax/dtAddFileStatement.test.ts b/test/parser/flinksql/syntax/dtAddFileStatement.test.ts index 01571db..57a4acb 100644 --- a/test/parser/flinksql/syntax/dtAddFileStatement.test.ts +++ b/test/parser/flinksql/syntax/dtAddFileStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/syntax/explainStatement.test.ts b/test/parser/flinksql/syntax/explainStatement.test.ts index 63204b6..e7b9e82 100644 --- a/test/parser/flinksql/syntax/explainStatement.test.ts +++ b/test/parser/flinksql/syntax/explainStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/syntax/expressionStatement.test.ts b/test/parser/flinksql/syntax/expressionStatement.test.ts index 0506cb2..a12d103 100644 --- a/test/parser/flinksql/syntax/expressionStatement.test.ts +++ b/test/parser/flinksql/syntax/expressionStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/syntax/insertStatement.test.ts b/test/parser/flinksql/syntax/insertStatement.test.ts index 5e9bd4d..bd8e1fb 100644 --- a/test/parser/flinksql/syntax/insertStatement.test.ts +++ b/test/parser/flinksql/syntax/insertStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/syntax/selectStatement.test.ts b/test/parser/flinksql/syntax/selectStatement.test.ts index 38fea48..d495132 100644 --- a/test/parser/flinksql/syntax/selectStatement.test.ts +++ b/test/parser/flinksql/syntax/selectStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/syntax/showStatement.test.ts b/test/parser/flinksql/syntax/showStatement.test.ts index 21374ba..64c8138 100644 --- a/test/parser/flinksql/syntax/showStatement.test.ts +++ b/test/parser/flinksql/syntax/showStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/syntax/useStatement.test.ts b/test/parser/flinksql/syntax/useStatement.test.ts index dde9662..7283b94 100644 --- a/test/parser/flinksql/syntax/useStatement.test.ts +++ b/test/parser/flinksql/syntax/useStatement.test.ts @@ -1,4 +1,4 @@ -import FlinkSQL from '../../../../src/parser/flinksql'; +import { FlinkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/flinksql/visitor.test.ts b/test/parser/flinksql/visitor.test.ts index 25ca86c..1894b2b 100644 --- a/test/parser/flinksql/visitor.test.ts +++ b/test/parser/flinksql/visitor.test.ts @@ -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'; diff --git a/test/parser/hive/errorStrategy.test.ts b/test/parser/hive/errorStrategy.test.ts index b56fd23..6dbbc78 100644 --- a/test/parser/hive/errorStrategy.test.ts +++ b/test/parser/hive/errorStrategy.test.ts @@ -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), diff --git a/test/parser/hive/lexer.test.ts b/test/parser/hive/lexer.test.ts index 342c196..74a8553 100644 --- a/test/parser/hive/lexer.test.ts +++ b/test/parser/hive/lexer.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../src/parser/hive'; +import { HiveSQL } from '../../filters'; describe('HiveSQL Lexer tests', () => { const parser = new HiveSQL(); diff --git a/test/parser/hive/listener.test.ts b/test/parser/hive/listener.test.ts index 666c2ac..d309309 100644 --- a/test/parser/hive/listener.test.ts +++ b/test/parser/hive/listener.test.ts @@ -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'); }); diff --git a/test/parser/hive/suggestion/multipleStatement.test.ts b/test/parser/hive/suggestion/multipleStatement.test.ts index 75125e4..97784f6 100644 --- a/test/parser/hive/suggestion/multipleStatement.test.ts +++ b/test/parser/hive/suggestion/multipleStatement.test.ts @@ -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'), diff --git a/test/parser/hive/suggestion/syntaxSuggestion.test.ts b/test/parser/hive/suggestion/syntaxSuggestion.test.ts index d9dee10..0b5480b 100644 --- a/test/parser/hive/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/hive/suggestion/syntaxSuggestion.test.ts @@ -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( diff --git a/test/parser/hive/suggestion/tokenSuggestion.test.ts b/test/parser/hive/suggestion/tokenSuggestion.test.ts index b813f2e..fa4b6ce 100644 --- a/test/parser/hive/suggestion/tokenSuggestion.test.ts +++ b/test/parser/hive/suggestion/tokenSuggestion.test.ts @@ -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'); diff --git a/test/parser/hive/syntax/abortStatement.test.ts b/test/parser/hive/syntax/abortStatement.test.ts index 31f6c67..6cdaef9 100644 --- a/test/parser/hive/syntax/abortStatement.test.ts +++ b/test/parser/hive/syntax/abortStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/alterStatement.test.ts b/test/parser/hive/syntax/alterStatement.test.ts index 50d96f4..666402b 100644 --- a/test/parser/hive/syntax/alterStatement.test.ts +++ b/test/parser/hive/syntax/alterStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/authorizationStatement.test.ts b/test/parser/hive/syntax/authorizationStatement.test.ts index 32e1075..8685c9b 100644 --- a/test/parser/hive/syntax/authorizationStatement.test.ts +++ b/test/parser/hive/syntax/authorizationStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/createStatement.test.ts b/test/parser/hive/syntax/createStatement.test.ts index 968e263..17ac2ae 100644 --- a/test/parser/hive/syntax/createStatement.test.ts +++ b/test/parser/hive/syntax/createStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/dataTypesStatement.test.ts b/test/parser/hive/syntax/dataTypesStatement.test.ts index ba3c54c..60a8cc0 100644 --- a/test/parser/hive/syntax/dataTypesStatement.test.ts +++ b/test/parser/hive/syntax/dataTypesStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/delete.test.ts b/test/parser/hive/syntax/delete.test.ts index 1d93e99..5409753 100644 --- a/test/parser/hive/syntax/delete.test.ts +++ b/test/parser/hive/syntax/delete.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/describeStatement.test.ts b/test/parser/hive/syntax/describeStatement.test.ts index c8434cf..efa77cd 100644 --- a/test/parser/hive/syntax/describeStatement.test.ts +++ b/test/parser/hive/syntax/describeStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/dropStatement.test.ts b/test/parser/hive/syntax/dropStatement.test.ts index 2cc80c3..6ede21d 100644 --- a/test/parser/hive/syntax/dropStatement.test.ts +++ b/test/parser/hive/syntax/dropStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/exportStatement.test.ts b/test/parser/hive/syntax/exportStatement.test.ts index 1a9fd0b..7903993 100644 --- a/test/parser/hive/syntax/exportStatement.test.ts +++ b/test/parser/hive/syntax/exportStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/hive/syntax/importStatement.test.ts b/test/parser/hive/syntax/importStatement.test.ts index 6ba4d58..9921b57 100644 --- a/test/parser/hive/syntax/importStatement.test.ts +++ b/test/parser/hive/syntax/importStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/hive/syntax/insertStatement.test.ts b/test/parser/hive/syntax/insertStatement.test.ts index 08ccb57..dff13d9 100644 --- a/test/parser/hive/syntax/insertStatement.test.ts +++ b/test/parser/hive/syntax/insertStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/loadStatement.test.ts b/test/parser/hive/syntax/loadStatement.test.ts index c6bf872..0cb0457 100644 --- a/test/parser/hive/syntax/loadStatement.test.ts +++ b/test/parser/hive/syntax/loadStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/merge.test.ts b/test/parser/hive/syntax/merge.test.ts index 25ace40..7f6af29 100644 --- a/test/parser/hive/syntax/merge.test.ts +++ b/test/parser/hive/syntax/merge.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/selectStatement.test.ts b/test/parser/hive/syntax/selectStatement.test.ts index 1b202f4..27fb5ba 100644 --- a/test/parser/hive/syntax/selectStatement.test.ts +++ b/test/parser/hive/syntax/selectStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/showStatement.test.ts b/test/parser/hive/syntax/showStatement.test.ts index e0a827a..375e76e 100644 --- a/test/parser/hive/syntax/showStatement.test.ts +++ b/test/parser/hive/syntax/showStatement.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/update.test.ts b/test/parser/hive/syntax/update.test.ts index 0016cff..1ad2a75 100644 --- a/test/parser/hive/syntax/update.test.ts +++ b/test/parser/hive/syntax/update.test.ts @@ -1,4 +1,4 @@ -import HiveSQL from '../../../../src/parser/hive'; +import { HiveSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/visitor.test.ts b/test/parser/hive/visitor.test.ts index d50dd67..d20812a 100644 --- a/test/parser/hive/visitor.test.ts +++ b/test/parser/hive/visitor.test.ts @@ -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); }); diff --git a/test/parser/impala/errorStrategy.test.ts b/test/parser/impala/errorStrategy.test.ts index afacae2..27fa9ee 100644 --- a/test/parser/impala/errorStrategy.test.ts +++ b/test/parser/impala/errorStrategy.test.ts @@ -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), diff --git a/test/parser/impala/lexer.test.ts b/test/parser/impala/lexer.test.ts index 6d2196b..37a6ea9 100644 --- a/test/parser/impala/lexer.test.ts +++ b/test/parser/impala/lexer.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../src/parser/impala'; +import { ImpalaSQL } from '../../filters'; describe('ImpalaSQL Lexer tests', () => { const parser = new ImpalaSQL(); diff --git a/test/parser/impala/listener.test.ts b/test/parser/impala/listener.test.ts index d241433..51b0e28 100644 --- a/test/parser/impala/listener.test.ts +++ b/test/parser/impala/listener.test.ts @@ -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); diff --git a/test/parser/impala/suggestion/multipleStatement.test.ts b/test/parser/impala/suggestion/multipleStatement.test.ts index 9f6a52b..c0d6cb2 100644 --- a/test/parser/impala/suggestion/multipleStatement.test.ts +++ b/test/parser/impala/suggestion/multipleStatement.test.ts @@ -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'), diff --git a/test/parser/impala/suggestion/syntaxSuggestion.test.ts b/test/parser/impala/suggestion/syntaxSuggestion.test.ts index 3a3a04a..cce11fd 100644 --- a/test/parser/impala/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/impala/suggestion/syntaxSuggestion.test.ts @@ -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( diff --git a/test/parser/impala/suggestion/tokenSuggestion.test.ts b/test/parser/impala/suggestion/tokenSuggestion.test.ts index 300b685..540d82f 100644 --- a/test/parser/impala/suggestion/tokenSuggestion.test.ts +++ b/test/parser/impala/suggestion/tokenSuggestion.test.ts @@ -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 = { diff --git a/test/parser/impala/syntax/alterStatement.test.ts b/test/parser/impala/syntax/alterStatement.test.ts index c17bcbe..c894050 100644 --- a/test/parser/impala/syntax/alterStatement.test.ts +++ b/test/parser/impala/syntax/alterStatement.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/creataStatement.test.ts b/test/parser/impala/syntax/creataStatement.test.ts index d5149aa..bfdf7ac 100644 --- a/test/parser/impala/syntax/creataStatement.test.ts +++ b/test/parser/impala/syntax/creataStatement.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/delete.test.ts b/test/parser/impala/syntax/delete.test.ts index 0dd44e6..070c442 100644 --- a/test/parser/impala/syntax/delete.test.ts +++ b/test/parser/impala/syntax/delete.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/dropStatement.test.ts b/test/parser/impala/syntax/dropStatement.test.ts index 28f689c..321a984 100644 --- a/test/parser/impala/syntax/dropStatement.test.ts +++ b/test/parser/impala/syntax/dropStatement.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/insert.test.ts b/test/parser/impala/syntax/insert.test.ts index 425d6be..a2d18ee 100644 --- a/test/parser/impala/syntax/insert.test.ts +++ b/test/parser/impala/syntax/insert.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/otherStatement.test.ts b/test/parser/impala/syntax/otherStatement.test.ts index 1b403f3..793da88 100644 --- a/test/parser/impala/syntax/otherStatement.test.ts +++ b/test/parser/impala/syntax/otherStatement.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/refresh.test.ts b/test/parser/impala/syntax/refresh.test.ts index 2167b4b..fd351fc 100644 --- a/test/parser/impala/syntax/refresh.test.ts +++ b/test/parser/impala/syntax/refresh.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/select.test.ts b/test/parser/impala/syntax/select.test.ts index 44fbcb5..94decb5 100644 --- a/test/parser/impala/syntax/select.test.ts +++ b/test/parser/impala/syntax/select.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/show.test.ts b/test/parser/impala/syntax/show.test.ts index 0a62b7c..81c179a 100644 --- a/test/parser/impala/syntax/show.test.ts +++ b/test/parser/impala/syntax/show.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/update.test.ts b/test/parser/impala/syntax/update.test.ts index c7b77e9..78c757f 100644 --- a/test/parser/impala/syntax/update.test.ts +++ b/test/parser/impala/syntax/update.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/upsert.test.ts b/test/parser/impala/syntax/upsert.test.ts index 5af34e6..0627701 100644 --- a/test/parser/impala/syntax/upsert.test.ts +++ b/test/parser/impala/syntax/upsert.test.ts @@ -1,4 +1,4 @@ -import ImpalaSQL from '../../../../src/parser/impala'; +import { ImpalaSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/visitor.test.ts b/test/parser/impala/visitor.test.ts index 66c4e0d..28576d1 100644 --- a/test/parser/impala/visitor.test.ts +++ b/test/parser/impala/visitor.test.ts @@ -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); diff --git a/test/parser/mysql/errorStrategy.test.ts b/test/parser/mysql/errorStrategy.test.ts index 4dca176..d5c0d9f 100644 --- a/test/parser/mysql/errorStrategy.test.ts +++ b/test/parser/mysql/errorStrategy.test.ts @@ -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), diff --git a/test/parser/mysql/lexer.test.ts b/test/parser/mysql/lexer.test.ts index 403aad2..3bea670 100644 --- a/test/parser/mysql/lexer.test.ts +++ b/test/parser/mysql/lexer.test.ts @@ -1,4 +1,4 @@ -import MySQL from '../../../src/parser/mysql'; +import { MySQL } from '../../filters'; describe('MySQL Lexer tests', () => { const parser = new MySQL(); diff --git a/test/parser/mysql/listener.test.ts b/test/parser/mysql/listener.test.ts index 5f0a528..922d921 100644 --- a/test/parser/mysql/listener.test.ts +++ b/test/parser/mysql/listener.test.ts @@ -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'; diff --git a/test/parser/mysql/suggestion/multipleStatement.test.ts b/test/parser/mysql/suggestion/multipleStatement.test.ts index f62c30a..ae53d46 100644 --- a/test/parser/mysql/suggestion/multipleStatement.test.ts +++ b/test/parser/mysql/suggestion/multipleStatement.test.ts @@ -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'), diff --git a/test/parser/mysql/suggestion/syntaxSuggestion.test.ts b/test/parser/mysql/suggestion/syntaxSuggestion.test.ts index 45d0a9b..3b01d80 100644 --- a/test/parser/mysql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/mysql/suggestion/syntaxSuggestion.test.ts @@ -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( diff --git a/test/parser/mysql/suggestion/tokenSuggestion.test.ts b/test/parser/mysql/suggestion/tokenSuggestion.test.ts index 89a55c7..70d5010 100644 --- a/test/parser/mysql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/mysql/suggestion/tokenSuggestion.test.ts @@ -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'); diff --git a/test/parser/mysql/syntax.test.ts b/test/parser/mysql/syntax.test.ts index 975dc4a..6309c0b 100644 --- a/test/parser/mysql/syntax.test.ts +++ b/test/parser/mysql/syntax.test.ts @@ -1,4 +1,4 @@ -import MySQL from '../../../src/parser/mysql'; +import { MySQL } from '../../filters'; describe('MySQL Syntax Tests', () => { const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/administration.test.ts b/test/parser/mysql/syntax/administration.test.ts index ff11df6..1adfe7b 100644 --- a/test/parser/mysql/syntax/administration.test.ts +++ b/test/parser/mysql/syntax/administration.test.ts @@ -1,4 +1,4 @@ -import MySQL from '../../../../src/parser/mysql'; +import { MySQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/ddl.test.ts b/test/parser/mysql/syntax/ddl.test.ts index 4e2a943..bdde0b5 100644 --- a/test/parser/mysql/syntax/ddl.test.ts +++ b/test/parser/mysql/syntax/ddl.test.ts @@ -1,4 +1,4 @@ -import MySQL from '../../../../src/parser/mysql'; +import { MySQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/dml.test.ts b/test/parser/mysql/syntax/dml.test.ts index 0f81687..e3b2f9f 100644 --- a/test/parser/mysql/syntax/dml.test.ts +++ b/test/parser/mysql/syntax/dml.test.ts @@ -1,4 +1,4 @@ -import MySQL from '../../../../src/parser/mysql'; +import { MySQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/other.test.ts b/test/parser/mysql/syntax/other.test.ts index 7a2b256..d635706 100644 --- a/test/parser/mysql/syntax/other.test.ts +++ b/test/parser/mysql/syntax/other.test.ts @@ -1,4 +1,4 @@ -import MySQL from '../../../../src/parser/mysql'; +import { MySQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/visitor.test.ts b/test/parser/mysql/visitor.test.ts index ac3ebb7..e2f6fb9 100644 --- a/test/parser/mysql/visitor.test.ts +++ b/test/parser/mysql/visitor.test.ts @@ -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'; diff --git a/test/parser/pgsql/errorStrategy.test.ts b/test/parser/pgsql/errorStrategy.test.ts index 049c3ec..0db9878 100644 --- a/test/parser/pgsql/errorStrategy.test.ts +++ b/test/parser/pgsql/errorStrategy.test.ts @@ -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', () => { diff --git a/test/parser/pgsql/lexer.test.ts b/test/parser/pgsql/lexer.test.ts index b330485..71b3ef0 100644 --- a/test/parser/pgsql/lexer.test.ts +++ b/test/parser/pgsql/lexer.test.ts @@ -1,4 +1,4 @@ -import PostgresSQL from '../../../src/parser/pgsql'; +import { PostgresSQL } from '../../filters'; describe('PostgresSQL Lexer tests', () => { const mysqlParser = new PostgresSQL(); diff --git a/test/parser/pgsql/listener.test.ts b/test/parser/pgsql/listener.test.ts index ea76fc6..9962d5e 100644 --- a/test/parser/pgsql/listener.test.ts +++ b/test/parser/pgsql/listener.test.ts @@ -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'; diff --git a/test/parser/pgsql/suggestion/multipleStatement.test.ts b/test/parser/pgsql/suggestion/multipleStatement.test.ts index e9bb21d..e0edadf 100644 --- a/test/parser/pgsql/suggestion/multipleStatement.test.ts +++ b/test/parser/pgsql/suggestion/multipleStatement.test.ts @@ -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 = { diff --git a/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts b/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts index f0e4940..110e538 100644 --- a/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts @@ -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); diff --git a/test/parser/pgsql/suggestion/tokenSuggestion.test.ts b/test/parser/pgsql/suggestion/tokenSuggestion.test.ts index 45cd5e9..e0ca14e 100644 --- a/test/parser/pgsql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/pgsql/suggestion/tokenSuggestion.test.ts @@ -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'); diff --git a/test/parser/pgsql/syntax/alterStatement.test.ts b/test/parser/pgsql/syntax/alterStatement.test.ts index 1db34d9..2d72973 100644 --- a/test/parser/pgsql/syntax/alterStatement.test.ts +++ b/test/parser/pgsql/syntax/alterStatement.test.ts @@ -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'), diff --git a/test/parser/pgsql/syntax/createStatement.test.ts b/test/parser/pgsql/syntax/createStatement.test.ts index 0f0854d..dfea18e 100644 --- a/test/parser/pgsql/syntax/createStatement.test.ts +++ b/test/parser/pgsql/syntax/createStatement.test.ts @@ -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'), diff --git a/test/parser/pgsql/syntax/deleteStatement.test.ts b/test/parser/pgsql/syntax/deleteStatement.test.ts index 30e6717..d0abdf1 100644 --- a/test/parser/pgsql/syntax/deleteStatement.test.ts +++ b/test/parser/pgsql/syntax/deleteStatement.test.ts @@ -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'), diff --git a/test/parser/pgsql/syntax/dropStatement.test.ts b/test/parser/pgsql/syntax/dropStatement.test.ts index f29b079..4062def 100644 --- a/test/parser/pgsql/syntax/dropStatement.test.ts +++ b/test/parser/pgsql/syntax/dropStatement.test.ts @@ -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'), diff --git a/test/parser/pgsql/syntax/insertStatement.test.ts b/test/parser/pgsql/syntax/insertStatement.test.ts index da2e64d..4f0ac53 100644 --- a/test/parser/pgsql/syntax/insertStatement.test.ts +++ b/test/parser/pgsql/syntax/insertStatement.test.ts @@ -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'), diff --git a/test/parser/pgsql/syntax/others.test.ts b/test/parser/pgsql/syntax/others.test.ts index 73d5bba..bd79780 100644 --- a/test/parser/pgsql/syntax/others.test.ts +++ b/test/parser/pgsql/syntax/others.test.ts @@ -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'), diff --git a/test/parser/pgsql/syntax/selectStatement.test.ts b/test/parser/pgsql/syntax/selectStatement.test.ts index af4439c..3a41a48 100644 --- a/test/parser/pgsql/syntax/selectStatement.test.ts +++ b/test/parser/pgsql/syntax/selectStatement.test.ts @@ -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'), diff --git a/test/parser/pgsql/syntax/updateStatement.test.ts b/test/parser/pgsql/syntax/updateStatement.test.ts index ffa03b2..5db974b 100644 --- a/test/parser/pgsql/syntax/updateStatement.test.ts +++ b/test/parser/pgsql/syntax/updateStatement.test.ts @@ -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'), diff --git a/test/parser/pgsql/visitor.test.ts b/test/parser/pgsql/visitor.test.ts index 923e35b..2d3b07e 100644 --- a/test/parser/pgsql/visitor.test.ts +++ b/test/parser/pgsql/visitor.test.ts @@ -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'; diff --git a/test/parser/plsql/lexer.test.ts b/test/parser/plsql/lexer.test.ts index 7f862bc..0c4bce1 100644 --- a/test/parser/plsql/lexer.test.ts +++ b/test/parser/plsql/lexer.test.ts @@ -1,4 +1,4 @@ -import PLSQL from '../../../src/parser/plsql'; +import { PLSQL } from '../../filters'; describe('PLSQL Lexer tests', () => { const parser = new PLSQL(); diff --git a/test/parser/plsql/listener.test.ts b/test/parser/plsql/listener.test.ts index 529f750..5406871 100644 --- a/test/parser/plsql/listener.test.ts +++ b/test/parser/plsql/listener.test.ts @@ -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'; diff --git a/test/parser/plsql/syntax.test.ts b/test/parser/plsql/syntax.test.ts index 8788dc9..c9ac68f 100644 --- a/test/parser/plsql/syntax.test.ts +++ b/test/parser/plsql/syntax.test.ts @@ -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;'; diff --git a/test/parser/plsql/visitor.test.ts b/test/parser/plsql/visitor.test.ts index 7c712e2..d43928d 100644 --- a/test/parser/plsql/visitor.test.ts +++ b/test/parser/plsql/visitor.test.ts @@ -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'; diff --git a/test/parser/spark/errorStrategy.test.ts b/test/parser/spark/errorStrategy.test.ts index d9b2b88..e517de2 100644 --- a/test/parser/spark/errorStrategy.test.ts +++ b/test/parser/spark/errorStrategy.test.ts @@ -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), diff --git a/test/parser/spark/lexer.test.ts b/test/parser/spark/lexer.test.ts index b72ebbd..ac0b6ff 100644 --- a/test/parser/spark/lexer.test.ts +++ b/test/parser/spark/lexer.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../src/parser/spark'; +import { SparkSQL } from '../../filters'; describe('SparkSQL Lexer tests', () => { const parser = new SparkSQL(); diff --git a/test/parser/spark/listener.test.ts b/test/parser/spark/listener.test.ts index 013e4c2..9053df1 100644 --- a/test/parser/spark/listener.test.ts +++ b/test/parser/spark/listener.test.ts @@ -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'; diff --git a/test/parser/spark/suggestion/multipleStatement.test.ts b/test/parser/spark/suggestion/multipleStatement.test.ts index 92270c5..0da2d09 100644 --- a/test/parser/spark/suggestion/multipleStatement.test.ts +++ b/test/parser/spark/suggestion/multipleStatement.test.ts @@ -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'), diff --git a/test/parser/spark/suggestion/syntaxSuggestion.test.ts b/test/parser/spark/suggestion/syntaxSuggestion.test.ts index d1b114e..9953238 100644 --- a/test/parser/spark/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/spark/suggestion/syntaxSuggestion.test.ts @@ -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( diff --git a/test/parser/spark/suggestion/tokenSuggestion.test.ts b/test/parser/spark/suggestion/tokenSuggestion.test.ts index b632f01..7ece95f 100644 --- a/test/parser/spark/suggestion/tokenSuggestion.test.ts +++ b/test/parser/spark/suggestion/tokenSuggestion.test.ts @@ -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'); diff --git a/test/parser/spark/syntax/addStatement.test.ts b/test/parser/spark/syntax/addStatement.test.ts index 5209fdc..d405312 100644 --- a/test/parser/spark/syntax/addStatement.test.ts +++ b/test/parser/spark/syntax/addStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/alert.test.ts b/test/parser/spark/syntax/alert.test.ts index 2799ad4..4a41236 100644 --- a/test/parser/spark/syntax/alert.test.ts +++ b/test/parser/spark/syntax/alert.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/analyzeTableStatement.test.ts b/test/parser/spark/syntax/analyzeTableStatement.test.ts index 8d20759..c2f98e4 100644 --- a/test/parser/spark/syntax/analyzeTableStatement.test.ts +++ b/test/parser/spark/syntax/analyzeTableStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/cacheStatement.test.ts b/test/parser/spark/syntax/cacheStatement.test.ts index a5e8806..088ef1c 100644 --- a/test/parser/spark/syntax/cacheStatement.test.ts +++ b/test/parser/spark/syntax/cacheStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/create.test.ts b/test/parser/spark/syntax/create.test.ts index 7cf3251..b5d72d1 100644 --- a/test/parser/spark/syntax/create.test.ts +++ b/test/parser/spark/syntax/create.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/describeStatement.test.ts b/test/parser/spark/syntax/describeStatement.test.ts index 85bd534..f515554 100644 --- a/test/parser/spark/syntax/describeStatement.test.ts +++ b/test/parser/spark/syntax/describeStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/drop.test.ts b/test/parser/spark/syntax/drop.test.ts index a0209dc..271c7cd 100644 --- a/test/parser/spark/syntax/drop.test.ts +++ b/test/parser/spark/syntax/drop.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/insertStatement.test.ts b/test/parser/spark/syntax/insertStatement.test.ts index 555564b..f7075c2 100644 --- a/test/parser/spark/syntax/insertStatement.test.ts +++ b/test/parser/spark/syntax/insertStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/kwMultipleValues.test.ts b/test/parser/spark/syntax/kwMultipleValues.test.ts index d3fef2e..e5c6638 100644 --- a/test/parser/spark/syntax/kwMultipleValues.test.ts +++ b/test/parser/spark/syntax/kwMultipleValues.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/listStatement.test.ts b/test/parser/spark/syntax/listStatement.test.ts index 515651b..901392e 100644 --- a/test/parser/spark/syntax/listStatement.test.ts +++ b/test/parser/spark/syntax/listStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/loadStatement.test.ts b/test/parser/spark/syntax/loadStatement.test.ts index 15040b7..7f9d67b 100644 --- a/test/parser/spark/syntax/loadStatement.test.ts +++ b/test/parser/spark/syntax/loadStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/refreshStatement.test.ts b/test/parser/spark/syntax/refreshStatement.test.ts index 854d87a..936cecf 100644 --- a/test/parser/spark/syntax/refreshStatement.test.ts +++ b/test/parser/spark/syntax/refreshStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/resetStatement.test.ts b/test/parser/spark/syntax/resetStatement.test.ts index a778abc..9f0311d 100644 --- a/test/parser/spark/syntax/resetStatement.test.ts +++ b/test/parser/spark/syntax/resetStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/selectStatement.test.ts b/test/parser/spark/syntax/selectStatement.test.ts index d39788e..5dd6e6a 100644 --- a/test/parser/spark/syntax/selectStatement.test.ts +++ b/test/parser/spark/syntax/selectStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/setStatement.test.ts b/test/parser/spark/syntax/setStatement.test.ts index d97a8e3..0babd8d 100644 --- a/test/parser/spark/syntax/setStatement.test.ts +++ b/test/parser/spark/syntax/setStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/showStatement.test.ts b/test/parser/spark/syntax/showStatement.test.ts index b6b6cef..d8d2b93 100644 --- a/test/parser/spark/syntax/showStatement.test.ts +++ b/test/parser/spark/syntax/showStatement.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/table.test.ts b/test/parser/spark/syntax/table.test.ts index 0de8b30..945f5be 100644 --- a/test/parser/spark/syntax/table.test.ts +++ b/test/parser/spark/syntax/table.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/useDatabase.test.ts b/test/parser/spark/syntax/useDatabase.test.ts index 717d06c..7841ffa 100644 --- a/test/parser/spark/syntax/useDatabase.test.ts +++ b/test/parser/spark/syntax/useDatabase.test.ts @@ -1,4 +1,4 @@ -import SparkSQL from '../../../../src/parser/spark'; +import { SparkSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/visitor.test.ts b/test/parser/spark/visitor.test.ts index 0300957..f942fe3 100644 --- a/test/parser/spark/visitor.test.ts +++ b/test/parser/spark/visitor.test.ts @@ -1,6 +1,4 @@ -import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; -import { SparkSqlParserVisitor } from '../../../src/lib/spark/SparkSqlParserVisitor'; -import SparkSQL from '../../../src/parser/spark'; +import { SparkSQL, SparkSqlParserVisitor, AbstractParseTreeVisitor } from '../../filters'; describe('Spark SQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/trinosql/errorStrategy.test.ts b/test/parser/trinosql/errorStrategy.test.ts index 9e8a581..63dc11c 100644 --- a/test/parser/trinosql/errorStrategy.test.ts +++ b/test/parser/trinosql/errorStrategy.test.ts @@ -1,6 +1,4 @@ -import TrinoSQL from '../../../src/parser/trinosql'; -import { TrinoSqlSplitListener } from '../../../src/parser/trinosql'; -import { TrinoSqlListener } from '../../../src/lib/trinosql/TrinoSqlListener'; +import { TrinoSQL, TrinoSqlSplitListener, TrinoSqlListener } from '../../filters'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/trinosql/lexer.test.ts b/test/parser/trinosql/lexer.test.ts index be02361..505ac2b 100644 --- a/test/parser/trinosql/lexer.test.ts +++ b/test/parser/trinosql/lexer.test.ts @@ -1,7 +1,7 @@ -import trinoSQL from '../../../src/parser/trinosql'; +import { TrinoSQL } from '../../filters'; describe('trinoSQL Lexer tests', () => { - const parser = new trinoSQL(); + const parser = new TrinoSQL(); const sql = 'SELECT * FROM table1'; const tokens = parser.getAllTokens(sql); diff --git a/test/parser/trinosql/listener.test.ts b/test/parser/trinosql/listener.test.ts index 3ee5097..157e948 100644 --- a/test/parser/trinosql/listener.test.ts +++ b/test/parser/trinosql/listener.test.ts @@ -1,11 +1,9 @@ -import trinoSQL from '../../../src/parser/trinosql'; -import { TrinoSqlListener } from '../../../src/lib/trinosql/TrinoSqlListener'; -import { ParseTreeListener } from 'antlr4ts/tree'; +import { TrinoSQL, TrinoSqlListener, ParseTreeListener } from '../../filters'; describe('trino SQL Listener Tests', () => { const expectTableName = 'user1'; const sql = `select id,name,sex from ${expectTableName};`; - const parser = new trinoSQL(); + const parser = new TrinoSQL(); const parseTree = parser.parse(sql); diff --git a/test/parser/trinosql/suggestion/multipleStatement.test.ts b/test/parser/trinosql/suggestion/multipleStatement.test.ts index 5eedb12..ffff017 100644 --- a/test/parser/trinosql/suggestion/multipleStatement.test.ts +++ b/test/parser/trinosql/suggestion/multipleStatement.test.ts @@ -1,7 +1,6 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types'; -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL, CaretPosition, SyntaxContextType } from '../../../filters'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts b/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts index f8df493..d5fd0c4 100644 --- a/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,6 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types'; -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL, CaretPosition, SyntaxContextType } from '../../../filters'; import { commentOtherLine } from '../../../helper'; const syntaxSql = fs.readFileSync( diff --git a/test/parser/trinosql/suggestion/tokenSuggestion.test.ts b/test/parser/trinosql/suggestion/tokenSuggestion.test.ts index d7143c3..2e24c1a 100644 --- a/test/parser/trinosql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/trinosql/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,6 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition } from '../../../../src/parser/common/basic-parser-types'; -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL, CaretPosition } from '../../../filters'; import { commentOtherLine } from '../../../helper'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/trinosql/syntax/alterStatement.test.ts b/test/parser/trinosql/syntax/alterStatement.test.ts index f2178a4..606247d 100644 --- a/test/parser/trinosql/syntax/alterStatement.test.ts +++ b/test/parser/trinosql/syntax/alterStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/analyzeStatement.test.ts b/test/parser/trinosql/syntax/analyzeStatement.test.ts index 30044a5..36ef875 100644 --- a/test/parser/trinosql/syntax/analyzeStatement.test.ts +++ b/test/parser/trinosql/syntax/analyzeStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/callStatement.test.ts b/test/parser/trinosql/syntax/callStatement.test.ts index ce20dc6..53d7f36 100644 --- a/test/parser/trinosql/syntax/callStatement.test.ts +++ b/test/parser/trinosql/syntax/callStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/commentStatement.test.ts b/test/parser/trinosql/syntax/commentStatement.test.ts index 8ad40de..b0e7edc 100644 --- a/test/parser/trinosql/syntax/commentStatement.test.ts +++ b/test/parser/trinosql/syntax/commentStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/commitStatement.test.ts b/test/parser/trinosql/syntax/commitStatement.test.ts index e0d2d8d..9cca44a 100644 --- a/test/parser/trinosql/syntax/commitStatement.test.ts +++ b/test/parser/trinosql/syntax/commitStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/createStatement.test.ts b/test/parser/trinosql/syntax/createStatement.test.ts index ab3c78f..ba5a330 100644 --- a/test/parser/trinosql/syntax/createStatement.test.ts +++ b/test/parser/trinosql/syntax/createStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts b/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts index e3a71ce..529d6f7 100644 --- a/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts +++ b/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/deleteStatement.test.ts b/test/parser/trinosql/syntax/deleteStatement.test.ts index 8543d6d..1495194 100644 --- a/test/parser/trinosql/syntax/deleteStatement.test.ts +++ b/test/parser/trinosql/syntax/deleteStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/denyStatement.test.ts b/test/parser/trinosql/syntax/denyStatement.test.ts index c322a35..0a6d4d8 100644 --- a/test/parser/trinosql/syntax/denyStatement.test.ts +++ b/test/parser/trinosql/syntax/denyStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/describeStatement.test.ts b/test/parser/trinosql/syntax/describeStatement.test.ts index 8aff3e2..5f555ba 100644 --- a/test/parser/trinosql/syntax/describeStatement.test.ts +++ b/test/parser/trinosql/syntax/describeStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/dropStatement.test.ts b/test/parser/trinosql/syntax/dropStatement.test.ts index 491cb2e..4d66a7c 100644 --- a/test/parser/trinosql/syntax/dropStatement.test.ts +++ b/test/parser/trinosql/syntax/dropStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/executeStatement.test.ts b/test/parser/trinosql/syntax/executeStatement.test.ts index 5ee6c40..70c0356 100644 --- a/test/parser/trinosql/syntax/executeStatement.test.ts +++ b/test/parser/trinosql/syntax/executeStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/explainStatement.test.ts b/test/parser/trinosql/syntax/explainStatement.test.ts index 3561ef4..0507c6c 100644 --- a/test/parser/trinosql/syntax/explainStatement.test.ts +++ b/test/parser/trinosql/syntax/explainStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/grantStatement.test.ts b/test/parser/trinosql/syntax/grantStatement.test.ts index e0d98fa..3d52e33 100644 --- a/test/parser/trinosql/syntax/grantStatement.test.ts +++ b/test/parser/trinosql/syntax/grantStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/insertStatement.test.ts b/test/parser/trinosql/syntax/insertStatement.test.ts index fd537cc..08d7c33 100644 --- a/test/parser/trinosql/syntax/insertStatement.test.ts +++ b/test/parser/trinosql/syntax/insertStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts b/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts index 86bce72..edc83ad 100644 --- a/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts +++ b/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/merge.test.ts b/test/parser/trinosql/syntax/merge.test.ts index 0a14487..4d42810 100644 --- a/test/parser/trinosql/syntax/merge.test.ts +++ b/test/parser/trinosql/syntax/merge.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/prepareStatement.test.ts b/test/parser/trinosql/syntax/prepareStatement.test.ts index 0625754..7dc44fb 100644 --- a/test/parser/trinosql/syntax/prepareStatement.test.ts +++ b/test/parser/trinosql/syntax/prepareStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts b/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts index bec5c55..27f0bcb 100644 --- a/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts +++ b/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/resetSessionStatement.test.ts b/test/parser/trinosql/syntax/resetSessionStatement.test.ts index f963dd3..622fa98 100644 --- a/test/parser/trinosql/syntax/resetSessionStatement.test.ts +++ b/test/parser/trinosql/syntax/resetSessionStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/revokeStatement.test.ts b/test/parser/trinosql/syntax/revokeStatement.test.ts index 175d32e..dbe61a0 100644 --- a/test/parser/trinosql/syntax/revokeStatement.test.ts +++ b/test/parser/trinosql/syntax/revokeStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts b/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts index f3f2eef..6f0709d 100644 --- a/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts +++ b/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/selectStatement.test.ts b/test/parser/trinosql/syntax/selectStatement.test.ts index 4a52c21..0acfd32 100644 --- a/test/parser/trinosql/syntax/selectStatement.test.ts +++ b/test/parser/trinosql/syntax/selectStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/setStatement.test.ts b/test/parser/trinosql/syntax/setStatement.test.ts index 738ff85..c70a626 100644 --- a/test/parser/trinosql/syntax/setStatement.test.ts +++ b/test/parser/trinosql/syntax/setStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/showStatement.test.ts b/test/parser/trinosql/syntax/showStatement.test.ts index b67a74a..b7f2b06 100644 --- a/test/parser/trinosql/syntax/showStatement.test.ts +++ b/test/parser/trinosql/syntax/showStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/startTransactionStatement.test.ts b/test/parser/trinosql/syntax/startTransactionStatement.test.ts index 307ae2b..3cae3a7 100644 --- a/test/parser/trinosql/syntax/startTransactionStatement.test.ts +++ b/test/parser/trinosql/syntax/startTransactionStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/truncateTableStatement.test.ts b/test/parser/trinosql/syntax/truncateTableStatement.test.ts index 0eed71a..4211943 100644 --- a/test/parser/trinosql/syntax/truncateTableStatement.test.ts +++ b/test/parser/trinosql/syntax/truncateTableStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/updateStatement.test.ts b/test/parser/trinosql/syntax/updateStatement.test.ts index a1c6b91..caa5ab0 100644 --- a/test/parser/trinosql/syntax/updateStatement.test.ts +++ b/test/parser/trinosql/syntax/updateStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/useStatement.test.ts b/test/parser/trinosql/syntax/useStatement.test.ts index 91eac50..6b61522 100644 --- a/test/parser/trinosql/syntax/useStatement.test.ts +++ b/test/parser/trinosql/syntax/useStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/valuesStatement.test.ts b/test/parser/trinosql/syntax/valuesStatement.test.ts index e5ae9ea..347babf 100644 --- a/test/parser/trinosql/syntax/valuesStatement.test.ts +++ b/test/parser/trinosql/syntax/valuesStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts b/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts index 153af0d..ddadbed 100644 --- a/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts +++ b/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts @@ -1,4 +1,4 @@ -import TrinoSQL from '../../../../src/parser/trinosql'; +import { TrinoSQL } from '../../../filters'; import { readSQL } from '../../../helper'; const features = { diff --git a/test/parser/trinosql/visitor.test.ts b/test/parser/trinosql/visitor.test.ts index 77a7a06..07c84ad 100644 --- a/test/parser/trinosql/visitor.test.ts +++ b/test/parser/trinosql/visitor.test.ts @@ -1,11 +1,9 @@ -import trinoSQL from '../../../src/parser/trinosql'; -import { TrinoSqlVisitor } from '../../../src/lib/trinosql/TrinoSqlVisitor'; -import { AbstractParseTreeVisitor } from 'antlr4ts/tree'; +import { TrinoSQL, TrinoSqlVisitor, AbstractParseTreeVisitor } from '../../filters'; describe('trino SQL Visitor Tests', () => { const expectTableName = 'user1'; const sql = `select id,name,sex from ${expectTableName};`; - const parser = new trinoSQL(); + const parser = new TrinoSQL(); const parseTree = parser.parse(sql, (error) => { console.log('Parse error:', error); diff --git a/tsconfig.json b/tsconfig.json index 0cec399..cc95f29 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,11 +12,6 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "skipLibCheck": true, - "paths": { - "antlr4": [ - "./node_modules/antlr4/src/antlr4/index" - ] - }, "types": [ "node", "jest" @@ -27,6 +22,7 @@ "./src/typings" ] }, + "isolatedModules": true, "include": [ "./src/**/*" ],