feat: improve pgsql grammar and add unit tests(#201)
* feat(pgsql: upgrade keywords and refresh them to parser file): pgsql * feat(pgsql: check create table's syntax): pgsql * feat(pgsql: check and update drop syntax): pgsql: check and update drop syntax * feat: pgsql: check create's sql syntax and update g4 file * feat: pgsql:complete other's sql and syntax except select, insert, drop * feat: pgsql: update create, delete, insert, select, update and others' syntax * test: pgsql: update alter's sql * feat: pgsql: update syntax g4 file * feat: pgsql: upgrade keywords to without '_P' in lexer and parser file * docs: pgsql: update copyright and Reference of parser and lexer --------- Co-authored-by: zhaoge <>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,67 +0,0 @@
|
||||
import { Lexer } from "antlr4ts/Lexer";
|
||||
|
||||
|
||||
function isLetter(str) {
|
||||
return str.length === 1 && str.match(/[a-z]/i);
|
||||
}
|
||||
|
||||
export default abstract class PostgreSQLLexerBase extends Lexer {
|
||||
|
||||
tags: string[] = [];
|
||||
_interp: any;
|
||||
|
||||
constructor(input) {
|
||||
super(input);
|
||||
}
|
||||
|
||||
pushTag() {
|
||||
this.tags.push(this.text);
|
||||
}
|
||||
|
||||
isTag() {
|
||||
return this.text === this.tags[this.tags.length - 1];
|
||||
}
|
||||
|
||||
popTag() {
|
||||
this.tags.pop();
|
||||
}
|
||||
|
||||
getInputStream() {
|
||||
return this._input;
|
||||
}
|
||||
checkLA( c) {
|
||||
return this.getInputStream().LA(1) !== c;
|
||||
}
|
||||
|
||||
charIsLetter() {
|
||||
return isLetter(this.getInputStream().LA(-1));
|
||||
}
|
||||
|
||||
HandleNumericFail() {
|
||||
this.getInputStream().seek(this.getInputStream().index - 2);
|
||||
const Integral = 535;
|
||||
this.type = Integral;
|
||||
}
|
||||
|
||||
HandleLessLessGreaterGreater() {
|
||||
const LESS_LESS = 18;
|
||||
const GREATER_GREATER = 19;
|
||||
if (this.text === '<<') this.type = LESS_LESS;
|
||||
if (this.text === '>>') this.type = GREATER_GREATER;
|
||||
}
|
||||
|
||||
UnterminatedBlockCommentDebugAssert() {
|
||||
}
|
||||
|
||||
CheckIfUtf32Letter() {
|
||||
let codePoint = this.getInputStream().LA(-2) << 8 + this.getInputStream().LA(-1);
|
||||
let c;
|
||||
if (codePoint < 0x10000) {
|
||||
c = String.fromCharCode(codePoint);
|
||||
} else {
|
||||
codePoint -= 0x10000;
|
||||
c = String.fromCharCode(codePoint / 0x400 + 0xd800, codePoint % 0x400 + 0xdc00);
|
||||
}
|
||||
return isLetter(c[0]);
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,97 +0,0 @@
|
||||
import { CharStreams, CommonTokenStream, Parser } from 'antlr4ts';
|
||||
import { PostgreSQLLexer } from './PostgreSQLLexer';
|
||||
import { PostgreSQLParser } from './PostgreSQLParser';
|
||||
|
||||
export default abstract class PostgreSQLParserBase extends Parser {
|
||||
constructor( input) {
|
||||
super(input);
|
||||
}
|
||||
|
||||
GetParsedSqlTree( script, line) {
|
||||
const ph = this.getPostgreSQLParser(script);
|
||||
return ph.program();
|
||||
}
|
||||
|
||||
ParseRoutineBody( _localctx) {
|
||||
let lang = null;
|
||||
for (let _i = 0, _a = _localctx.createfunc_opt_item(); _i < _a.length; _i++) {
|
||||
const coi = _a[_i];
|
||||
if (!!coi.LANGUAGE()) {
|
||||
if (!!coi.nonreservedword_or_sconst()) {
|
||||
if (!!coi.nonreservedword_or_sconst().nonreservedword()) {
|
||||
if (!!coi.nonreservedword_or_sconst().nonreservedword().identifier()) {
|
||||
if (!!coi.nonreservedword_or_sconst().nonreservedword().identifier().Identifier()) {
|
||||
lang = coi.nonreservedword_or_sconst().nonreservedword().identifier().Identifier().getText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!lang) return;
|
||||
let func_as = null;
|
||||
for (const a of _localctx.createfunc_opt_item()) {
|
||||
if (!a.func_as()) {
|
||||
func_as = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!func_as) {
|
||||
const txt = this.GetRoutineBodyString(func_as.func_as().sconst(0));
|
||||
const line = func_as.func_as().sconst(0).start.getLine();
|
||||
const ph = this.getPostgreSQLParser(txt);
|
||||
switch (lang) {
|
||||
case 'plpgsql':
|
||||
func_as.func_as().Definition = ph.plsqlroot();
|
||||
break;
|
||||
case 'sql':
|
||||
func_as.func_as().Definition = ph.program();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TrimQuotes( s) {
|
||||
return (!s) ? s : s.substring(1, s.length() - 1);
|
||||
}
|
||||
|
||||
unquote( s) {
|
||||
const slength = s.length();
|
||||
let r = '';
|
||||
let i = 0;
|
||||
while (i < slength) {
|
||||
const c = s.charAt(i);
|
||||
r = r.concat(c);
|
||||
if (c === '\'' && i < slength - 1 && (s.charAt(i + 1) === '\'')) i++;
|
||||
i++;
|
||||
}
|
||||
return r.toString();
|
||||
}
|
||||
|
||||
GetRoutineBodyString( rule) {
|
||||
const anysconst = rule.anysconst();
|
||||
const StringConstant = anysconst.StringConstant();
|
||||
if (null !== StringConstant) return this.unquote(this.TrimQuotes(StringConstant.getText()));
|
||||
const UnicodeEscapeStringConstant = anysconst.UnicodeEscapeStringConstant();
|
||||
if (null !== UnicodeEscapeStringConstant) return this.TrimQuotes(UnicodeEscapeStringConstant.getText());
|
||||
const EscapeStringConstant = anysconst.EscapeStringConstant();
|
||||
if (null !== EscapeStringConstant) return this.TrimQuotes(EscapeStringConstant.getText());
|
||||
let result = '';
|
||||
const dollartext = anysconst.DollarText();
|
||||
for (const s of dollartext) {
|
||||
result += s.getText();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
getPostgreSQLParser( script) {
|
||||
const charStream = CharStreams.fromString(script);
|
||||
const lexer = new PostgreSQLLexer(charStream);
|
||||
const tokens = new CommonTokenStream(lexer);
|
||||
const parser = new PostgreSQLParser(tokens);
|
||||
// lexer.removeErrorListeners();
|
||||
// parser.removeErrorListeners();
|
||||
return parser;
|
||||
}
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
// Generated from /Users/ziv/github.com/dt-sql-parser/src/grammar/pgsql/PostgreSQLParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
|
||||
|
||||
import PostgreSQLParserBase from "./PostgreSQLParserBase";
|
||||
// Generated from /Users/xuxiaoqi/Documents/work/daishu-code/dt-sql-parser/src/grammar/pgsql/PostgreSQLParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
|
||||
|
||||
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
|
||||
@ -103,6 +100,7 @@ import { Copy_generic_opt_arg_listContext } from "./PostgreSQLParser";
|
||||
import { Copy_generic_opt_arg_list_itemContext } from "./PostgreSQLParser";
|
||||
import { CreatestmtContext } from "./PostgreSQLParser";
|
||||
import { OpttempContext } from "./PostgreSQLParser";
|
||||
import { Table_column_listContext } from "./PostgreSQLParser";
|
||||
import { OpttableelementlistContext } from "./PostgreSQLParser";
|
||||
import { OpttypedtableelementlistContext } from "./PostgreSQLParser";
|
||||
import { TableelementlistContext } from "./PostgreSQLParser";
|
||||
@ -115,7 +113,8 @@ import { ColquallistContext } from "./PostgreSQLParser";
|
||||
import { ColconstraintContext } from "./PostgreSQLParser";
|
||||
import { ColconstraintelemContext } from "./PostgreSQLParser";
|
||||
import { Generated_whenContext } from "./PostgreSQLParser";
|
||||
import { ConstraintattrContext } from "./PostgreSQLParser";
|
||||
import { Deferrable_triggerContext } from "./PostgreSQLParser";
|
||||
import { Initially_triggerContext } from "./PostgreSQLParser";
|
||||
import { TablelikeclauseContext } from "./PostgreSQLParser";
|
||||
import { TablelikeoptionlistContext } from "./PostgreSQLParser";
|
||||
import { TablelikeoptionContext } from "./PostgreSQLParser";
|
||||
@ -219,6 +218,8 @@ import { CreateamstmtContext } from "./PostgreSQLParser";
|
||||
import { Am_typeContext } from "./PostgreSQLParser";
|
||||
import { CreatetrigstmtContext } from "./PostgreSQLParser";
|
||||
import { TriggeractiontimeContext } from "./PostgreSQLParser";
|
||||
import { ForeachrowContext } from "./PostgreSQLParser";
|
||||
import { RoworstatmentContext } from "./PostgreSQLParser";
|
||||
import { TriggereventsContext } from "./PostgreSQLParser";
|
||||
import { TriggeroneeventContext } from "./PostgreSQLParser";
|
||||
import { TriggerreferencingContext } from "./PostgreSQLParser";
|
||||
@ -294,6 +295,8 @@ import { Opt_from_inContext } from "./PostgreSQLParser";
|
||||
import { GrantstmtContext } from "./PostgreSQLParser";
|
||||
import { RevokestmtContext } from "./PostgreSQLParser";
|
||||
import { PrivilegesContext } from "./PostgreSQLParser";
|
||||
import { BeforeprivilegeselectlistContext } from "./PostgreSQLParser";
|
||||
import { BeforeprivilegeselectContext } from "./PostgreSQLParser";
|
||||
import { Privilege_listContext } from "./PostgreSQLParser";
|
||||
import { PrivilegeContext } from "./PostgreSQLParser";
|
||||
import { Privilege_targetContext } from "./PostgreSQLParser";
|
||||
@ -324,6 +327,7 @@ import { Opt_classContext } from "./PostgreSQLParser";
|
||||
import { Opt_asc_descContext } from "./PostgreSQLParser";
|
||||
import { Opt_nulls_orderContext } from "./PostgreSQLParser";
|
||||
import { CreatefunctionstmtContext } from "./PostgreSQLParser";
|
||||
import { AttrilistContext } from "./PostgreSQLParser";
|
||||
import { Opt_or_replaceContext } from "./PostgreSQLParser";
|
||||
import { Func_argsContext } from "./PostgreSQLParser";
|
||||
import { Func_args_listContext } from "./PostgreSQLParser";
|
||||
@ -677,6 +681,7 @@ import { Opt_target_listContext } from "./PostgreSQLParser";
|
||||
import { Target_listContext } from "./PostgreSQLParser";
|
||||
import { Target_elContext } from "./PostgreSQLParser";
|
||||
import { Qualified_name_listContext } from "./PostgreSQLParser";
|
||||
import { Table_qualified_nameContext } from "./PostgreSQLParser";
|
||||
import { Qualified_nameContext } from "./PostgreSQLParser";
|
||||
import { Name_listContext } from "./PostgreSQLParser";
|
||||
import { NameContext } from "./PostgreSQLParser";
|
||||
@ -692,10 +697,15 @@ import { SconstContext } from "./PostgreSQLParser";
|
||||
import { AnysconstContext } from "./PostgreSQLParser";
|
||||
import { Opt_uescapeContext } from "./PostgreSQLParser";
|
||||
import { SignediconstContext } from "./PostgreSQLParser";
|
||||
import { GroupnameContext } from "./PostgreSQLParser";
|
||||
import { RoleidContext } from "./PostgreSQLParser";
|
||||
import { RolespecContext } from "./PostgreSQLParser";
|
||||
import { Role_listContext } from "./PostgreSQLParser";
|
||||
import { ColidContext } from "./PostgreSQLParser";
|
||||
import { Index_method_choicesContext } from "./PostgreSQLParser";
|
||||
import { Exclude_elementContext } from "./PostgreSQLParser";
|
||||
import { Index_paramentersContext } from "./PostgreSQLParser";
|
||||
import { WherePredicateContext } from "./PostgreSQLParser";
|
||||
import { Type_function_nameContext } from "./PostgreSQLParser";
|
||||
import { NonreservedwordContext } from "./PostgreSQLParser";
|
||||
import { CollabelContext } from "./PostgreSQLParser";
|
||||
@ -1913,6 +1923,17 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitOpttemp?: (ctx: OpttempContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.table_column_list`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterTable_column_list?: (ctx: Table_column_listContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.table_column_list`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitTable_column_list?: (ctx: Table_column_listContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.opttableelementlist`.
|
||||
* @param ctx the parse tree
|
||||
@ -2046,15 +2067,26 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
exitGenerated_when?: (ctx: Generated_whenContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.constraintattr`.
|
||||
* Enter a parse tree produced by `PostgreSQLParser.deferrable_trigger`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterConstraintattr?: (ctx: ConstraintattrContext) => void;
|
||||
enterDeferrable_trigger?: (ctx: Deferrable_triggerContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.constraintattr`.
|
||||
* Exit a parse tree produced by `PostgreSQLParser.deferrable_trigger`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitConstraintattr?: (ctx: ConstraintattrContext) => void;
|
||||
exitDeferrable_trigger?: (ctx: Deferrable_triggerContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.initially_trigger`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterInitially_trigger?: (ctx: Initially_triggerContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.initially_trigger`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitInitially_trigger?: (ctx: Initially_triggerContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.tablelikeclause`.
|
||||
@ -3189,6 +3221,28 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitTriggeractiontime?: (ctx: TriggeractiontimeContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.foreachrow`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterForeachrow?: (ctx: ForeachrowContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.foreachrow`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitForeachrow?: (ctx: ForeachrowContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.roworstatment`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterRoworstatment?: (ctx: RoworstatmentContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.roworstatment`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitRoworstatment?: (ctx: RoworstatmentContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.triggerevents`.
|
||||
* @param ctx the parse tree
|
||||
@ -4014,6 +4068,28 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitPrivileges?: (ctx: PrivilegesContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.beforeprivilegeselectlist`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterBeforeprivilegeselectlist?: (ctx: BeforeprivilegeselectlistContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.beforeprivilegeselectlist`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitBeforeprivilegeselectlist?: (ctx: BeforeprivilegeselectlistContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.beforeprivilegeselect`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterBeforeprivilegeselect?: (ctx: BeforeprivilegeselectContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.beforeprivilegeselect`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitBeforeprivilegeselect?: (ctx: BeforeprivilegeselectContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.privilege_list`.
|
||||
* @param ctx the parse tree
|
||||
@ -4344,6 +4420,17 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitCreatefunctionstmt?: (ctx: CreatefunctionstmtContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.attrilist`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterAttrilist?: (ctx: AttrilistContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.attrilist`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitAttrilist?: (ctx: AttrilistContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.opt_or_replace`.
|
||||
* @param ctx the parse tree
|
||||
@ -8227,6 +8314,17 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitQualified_name_list?: (ctx: Qualified_name_listContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.table_qualified_name`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterTable_qualified_name?: (ctx: Table_qualified_nameContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.table_qualified_name`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitTable_qualified_name?: (ctx: Table_qualified_nameContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.qualified_name`.
|
||||
* @param ctx the parse tree
|
||||
@ -8392,6 +8490,17 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitSignediconst?: (ctx: SignediconstContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.groupname`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterGroupname?: (ctx: GroupnameContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.groupname`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitGroupname?: (ctx: GroupnameContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.roleid`.
|
||||
* @param ctx the parse tree
|
||||
@ -8436,6 +8545,50 @@ export interface PostgreSQLParserListener extends ParseTreeListener {
|
||||
*/
|
||||
exitColid?: (ctx: ColidContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.index_method_choices`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterIndex_method_choices?: (ctx: Index_method_choicesContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.index_method_choices`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitIndex_method_choices?: (ctx: Index_method_choicesContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.exclude_element`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterExclude_element?: (ctx: Exclude_elementContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.exclude_element`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitExclude_element?: (ctx: Exclude_elementContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.index_paramenters`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterIndex_paramenters?: (ctx: Index_paramentersContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.index_paramenters`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitIndex_paramenters?: (ctx: Index_paramentersContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.wherePredicate`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterWherePredicate?: (ctx: WherePredicateContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `PostgreSQLParser.wherePredicate`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitWherePredicate?: (ctx: WherePredicateContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `PostgreSQLParser.type_function_name`.
|
||||
* @param ctx the parse tree
|
||||
|
@ -1,7 +1,4 @@
|
||||
// Generated from /Users/ziv/github.com/dt-sql-parser/src/grammar/pgsql/PostgreSQLParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
|
||||
|
||||
import PostgreSQLParserBase from "./PostgreSQLParserBase";
|
||||
// Generated from /Users/xuxiaoqi/Documents/work/daishu-code/dt-sql-parser/src/grammar/pgsql/PostgreSQLParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||
|
||||
|
||||
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
||||
@ -103,6 +100,7 @@ import { Copy_generic_opt_arg_listContext } from "./PostgreSQLParser";
|
||||
import { Copy_generic_opt_arg_list_itemContext } from "./PostgreSQLParser";
|
||||
import { CreatestmtContext } from "./PostgreSQLParser";
|
||||
import { OpttempContext } from "./PostgreSQLParser";
|
||||
import { Table_column_listContext } from "./PostgreSQLParser";
|
||||
import { OpttableelementlistContext } from "./PostgreSQLParser";
|
||||
import { OpttypedtableelementlistContext } from "./PostgreSQLParser";
|
||||
import { TableelementlistContext } from "./PostgreSQLParser";
|
||||
@ -115,7 +113,8 @@ import { ColquallistContext } from "./PostgreSQLParser";
|
||||
import { ColconstraintContext } from "./PostgreSQLParser";
|
||||
import { ColconstraintelemContext } from "./PostgreSQLParser";
|
||||
import { Generated_whenContext } from "./PostgreSQLParser";
|
||||
import { ConstraintattrContext } from "./PostgreSQLParser";
|
||||
import { Deferrable_triggerContext } from "./PostgreSQLParser";
|
||||
import { Initially_triggerContext } from "./PostgreSQLParser";
|
||||
import { TablelikeclauseContext } from "./PostgreSQLParser";
|
||||
import { TablelikeoptionlistContext } from "./PostgreSQLParser";
|
||||
import { TablelikeoptionContext } from "./PostgreSQLParser";
|
||||
@ -219,6 +218,8 @@ import { CreateamstmtContext } from "./PostgreSQLParser";
|
||||
import { Am_typeContext } from "./PostgreSQLParser";
|
||||
import { CreatetrigstmtContext } from "./PostgreSQLParser";
|
||||
import { TriggeractiontimeContext } from "./PostgreSQLParser";
|
||||
import { ForeachrowContext } from "./PostgreSQLParser";
|
||||
import { RoworstatmentContext } from "./PostgreSQLParser";
|
||||
import { TriggereventsContext } from "./PostgreSQLParser";
|
||||
import { TriggeroneeventContext } from "./PostgreSQLParser";
|
||||
import { TriggerreferencingContext } from "./PostgreSQLParser";
|
||||
@ -294,6 +295,8 @@ import { Opt_from_inContext } from "./PostgreSQLParser";
|
||||
import { GrantstmtContext } from "./PostgreSQLParser";
|
||||
import { RevokestmtContext } from "./PostgreSQLParser";
|
||||
import { PrivilegesContext } from "./PostgreSQLParser";
|
||||
import { BeforeprivilegeselectlistContext } from "./PostgreSQLParser";
|
||||
import { BeforeprivilegeselectContext } from "./PostgreSQLParser";
|
||||
import { Privilege_listContext } from "./PostgreSQLParser";
|
||||
import { PrivilegeContext } from "./PostgreSQLParser";
|
||||
import { Privilege_targetContext } from "./PostgreSQLParser";
|
||||
@ -324,6 +327,7 @@ import { Opt_classContext } from "./PostgreSQLParser";
|
||||
import { Opt_asc_descContext } from "./PostgreSQLParser";
|
||||
import { Opt_nulls_orderContext } from "./PostgreSQLParser";
|
||||
import { CreatefunctionstmtContext } from "./PostgreSQLParser";
|
||||
import { AttrilistContext } from "./PostgreSQLParser";
|
||||
import { Opt_or_replaceContext } from "./PostgreSQLParser";
|
||||
import { Func_argsContext } from "./PostgreSQLParser";
|
||||
import { Func_args_listContext } from "./PostgreSQLParser";
|
||||
@ -677,6 +681,7 @@ import { Opt_target_listContext } from "./PostgreSQLParser";
|
||||
import { Target_listContext } from "./PostgreSQLParser";
|
||||
import { Target_elContext } from "./PostgreSQLParser";
|
||||
import { Qualified_name_listContext } from "./PostgreSQLParser";
|
||||
import { Table_qualified_nameContext } from "./PostgreSQLParser";
|
||||
import { Qualified_nameContext } from "./PostgreSQLParser";
|
||||
import { Name_listContext } from "./PostgreSQLParser";
|
||||
import { NameContext } from "./PostgreSQLParser";
|
||||
@ -692,10 +697,15 @@ import { SconstContext } from "./PostgreSQLParser";
|
||||
import { AnysconstContext } from "./PostgreSQLParser";
|
||||
import { Opt_uescapeContext } from "./PostgreSQLParser";
|
||||
import { SignediconstContext } from "./PostgreSQLParser";
|
||||
import { GroupnameContext } from "./PostgreSQLParser";
|
||||
import { RoleidContext } from "./PostgreSQLParser";
|
||||
import { RolespecContext } from "./PostgreSQLParser";
|
||||
import { Role_listContext } from "./PostgreSQLParser";
|
||||
import { ColidContext } from "./PostgreSQLParser";
|
||||
import { Index_method_choicesContext } from "./PostgreSQLParser";
|
||||
import { Exclude_elementContext } from "./PostgreSQLParser";
|
||||
import { Index_paramentersContext } from "./PostgreSQLParser";
|
||||
import { WherePredicateContext } from "./PostgreSQLParser";
|
||||
import { Type_function_nameContext } from "./PostgreSQLParser";
|
||||
import { NonreservedwordContext } from "./PostgreSQLParser";
|
||||
import { CollabelContext } from "./PostgreSQLParser";
|
||||
@ -1518,6 +1528,13 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
*/
|
||||
visitOpttemp?: (ctx: OpttempContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.table_column_list`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitTable_column_list?: (ctx: Table_column_listContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.opttableelementlist`.
|
||||
* @param ctx the parse tree
|
||||
@ -1603,11 +1620,18 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
visitGenerated_when?: (ctx: Generated_whenContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.constraintattr`.
|
||||
* Visit a parse tree produced by `PostgreSQLParser.deferrable_trigger`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitConstraintattr?: (ctx: ConstraintattrContext) => Result;
|
||||
visitDeferrable_trigger?: (ctx: Deferrable_triggerContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.initially_trigger`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitInitially_trigger?: (ctx: Initially_triggerContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.tablelikeclause`.
|
||||
@ -2330,6 +2354,20 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
*/
|
||||
visitTriggeractiontime?: (ctx: TriggeractiontimeContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.foreachrow`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitForeachrow?: (ctx: ForeachrowContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.roworstatment`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitRoworstatment?: (ctx: RoworstatmentContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.triggerevents`.
|
||||
* @param ctx the parse tree
|
||||
@ -2855,6 +2893,20 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
*/
|
||||
visitPrivileges?: (ctx: PrivilegesContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.beforeprivilegeselectlist`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitBeforeprivilegeselectlist?: (ctx: BeforeprivilegeselectlistContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.beforeprivilegeselect`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitBeforeprivilegeselect?: (ctx: BeforeprivilegeselectContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.privilege_list`.
|
||||
* @param ctx the parse tree
|
||||
@ -3065,6 +3117,13 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
*/
|
||||
visitCreatefunctionstmt?: (ctx: CreatefunctionstmtContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.attrilist`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitAttrilist?: (ctx: AttrilistContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.opt_or_replace`.
|
||||
* @param ctx the parse tree
|
||||
@ -5536,6 +5595,13 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
*/
|
||||
visitQualified_name_list?: (ctx: Qualified_name_listContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.table_qualified_name`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitTable_qualified_name?: (ctx: Table_qualified_nameContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.qualified_name`.
|
||||
* @param ctx the parse tree
|
||||
@ -5641,6 +5707,13 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
*/
|
||||
visitSignediconst?: (ctx: SignediconstContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.groupname`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitGroupname?: (ctx: GroupnameContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.roleid`.
|
||||
* @param ctx the parse tree
|
||||
@ -5669,6 +5742,34 @@ export interface PostgreSQLParserVisitor<Result> extends ParseTreeVisitor<Result
|
||||
*/
|
||||
visitColid?: (ctx: ColidContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.index_method_choices`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitIndex_method_choices?: (ctx: Index_method_choicesContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.exclude_element`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitExclude_element?: (ctx: Exclude_elementContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.index_paramenters`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitIndex_paramenters?: (ctx: Index_paramentersContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.wherePredicate`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitWherePredicate?: (ctx: WherePredicateContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `PostgreSQLParser.type_function_name`.
|
||||
* @param ctx the parse tree
|
||||
|
Reference in New Issue
Block a user