Fix/export abstract visitor (#237)
* fix: #236 export AbstractParseTreeVisitor * build: set isolatedModules true * feat: import parser about from filters
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { HiveSqlSplitListener } from '../../../src/parser/hive';
|
||||
import { HiveSqlParserListener } from '../../../src/lib/hive/HiveSqlParserListener';
|
||||
import { HiveSQL, HiveSqlSplitListener, HiveSqlParserListener } from '../../filters';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../filters';
|
||||
|
||||
describe('HiveSQL Lexer tests', () => {
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { ProgramContext } from '../../../src/lib/hive/HiveSqlParser';
|
||||
import { HiveSqlParserListener } from '../../../src/lib/hive/HiveSqlParserListener';
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { HiveSQL, HiveSqlParserListener, HiveSqlParserRuleContext } from '../../filters';
|
||||
|
||||
describe('HiveSQL Listener Tests', () => {
|
||||
const parser = new HiveSQL();
|
||||
@ -18,7 +16,10 @@ describe('HiveSQL Listener Tests', () => {
|
||||
}
|
||||
const listenTableName = new MyListener();
|
||||
|
||||
await parser.listen(listenTableName as ParseTreeListener, parseTree as ProgramContext);
|
||||
await parser.listen(
|
||||
listenTableName as ParseTreeListener,
|
||||
parseTree as HiveSqlParserRuleContext.ProgramContext
|
||||
);
|
||||
expect(result).toBe(expectTableName.toUpperCase());
|
||||
});
|
||||
test('Listener enterCreateTable', async () => {
|
||||
@ -32,7 +33,10 @@ describe('HiveSQL Listener Tests', () => {
|
||||
}
|
||||
const listenTableName = new MyListener();
|
||||
|
||||
await parser.listen(listenTableName as ParseTreeListener, parseTree as ProgramContext);
|
||||
await parser.listen(
|
||||
listenTableName as ParseTreeListener,
|
||||
parseTree as HiveSqlParserRuleContext.ProgramContext
|
||||
);
|
||||
expect(result).toBe('DROPTABLETABLE_NAME');
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { CaretPosition, SyntaxContextType, HiveSQL } from '../../../filters';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { CaretPosition, SyntaxContextType, HiveSQL } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { CaretPosition, HiveSQL } from '../../../filters';
|
||||
import { commentOtherLine } from '../../../helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const features = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import HiveSQL from '../../../../src/parser/hive';
|
||||
import { HiveSQL } from '../../../filters';
|
||||
import { readSQL } from '../../../helper';
|
||||
|
||||
const parser = new HiveSQL();
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
|
||||
import { HiveSqlParserVisitor } from '../../../src/lib/hive/HiveSqlParserVisitor';
|
||||
import HiveSQL from '../../../src/parser/hive';
|
||||
import { ProgramContext } from '../../../src/lib/hive/HiveSqlParser';
|
||||
import {
|
||||
HiveSQL,
|
||||
HiveSqlParserVisitor,
|
||||
AbstractParseTreeVisitor,
|
||||
HiveSqlParserRuleContext,
|
||||
} from '../../filters';
|
||||
|
||||
describe('HiveSQL Visitor Tests', () => {
|
||||
const expectTableName = 'dm_gis.dlv_addr_tc_count';
|
||||
@ -25,7 +27,7 @@ describe('HiveSQL Visitor Tests', () => {
|
||||
}
|
||||
|
||||
const visitor = new MyVisitor();
|
||||
visitor.visit(parseTree as ProgramContext);
|
||||
visitor.visit(parseTree as HiveSqlParserRuleContext.ProgramContext);
|
||||
|
||||
expect(result).toBe(expectTableName);
|
||||
});
|
||||
|
Reference in New Issue
Block a user