feat: upgrade antlr4 to 4.12.0 (#88)

This commit is contained in:
Ziv
2023-05-04 10:13:05 +08:00
committed by GitHub
parent c0842b3e07
commit c1c72def30
116 changed files with 552721 additions and 609942 deletions

View File

@ -1,4 +1,4 @@
import { PostgresSQL } from '../../../src/';
import PostgresSQL from '../../../src/parser/pgsql';
describe('PostgresSQL Lexer tests', () => {
const mysqlParser = new PostgresSQL();
@ -7,6 +7,6 @@ describe('PostgresSQL Lexer tests', () => {
const tokens = mysqlParser.getAllTokens(sql);
test('token counts', () => {
expect(tokens.length).toBe(12);
expect(tokens.length - 1).toBe(12);
});
});

View File

@ -1,4 +1,5 @@
import { PostgresSQL, PostgreSQLParserListener } from '../../../src';
import PostgreSQLParserListener from '../../../src/lib/pgsql/PostgreSQLParserListener';
import PostgresSQL from '../../../src/parser/pgsql';
describe('PostgresSQL Listener Tests', () => {
const expectTableName = 'user1';
@ -7,13 +8,11 @@ describe('PostgresSQL Listener Tests', () => {
const parserTree = parser.parse(sql);
console.log('Parser tree string:', parserTree);
test('Listener enterTableName', async () => {
let result = '';
class MyListener extends PostgreSQLParserListener {
// eslint-disable-next-line camelcase
enterTable_ref(ctx): void {
enterTable_ref = (ctx): void => {
result = ctx.getText().toLowerCase();
}
}

View File

@ -1,4 +1,4 @@
import { PostgresSQL } from '../../../src';
import PostgresSQL from "../../../src/parser/pgsql";
describe('Generic SQL Syntax Tests', () => {
const parser = new PostgresSQL();

View File

@ -1,4 +1,5 @@
import { PostgresSQL, PostgreSQLParserVisitor } from '../../../src';
import PostgreSQLParserVisitor from "../../../src/lib/pgsql/PostgreSQLParserVisitor";
import PostgresSQL from "../../../src/parser/pgsql";
describe('Generic SQL Visitor Tests', () => {
const expectTableName = 'user1';
@ -11,11 +12,11 @@ describe('Generic SQL Visitor Tests', () => {
test('Visitor visitTableName', () => {
let result = '';
class MyVisitor extends PostgreSQLParserVisitor {
class MyVisitor extends PostgreSQLParserVisitor<any> {
// eslint-disable-next-line camelcase
visitTable_ref(ctx): void {
visitTable_ref = (ctx): void => {
result = ctx.getText().toLowerCase();
super.visitTable_ref(ctx);
super.visitTable_ref?.(ctx);
}
}
const visitor: any = new MyVisitor();