Rename root to program
This commit is contained in:
parent
a15da8e275
commit
f79202a5b7
@ -12,7 +12,7 @@ superClass = PostgreSQLParserBase;
|
||||
@members
|
||||
{
|
||||
}
|
||||
root
|
||||
program
|
||||
: stmtblock EOF
|
||||
;
|
||||
|
||||
|
@ -1115,7 +1115,7 @@ EndDollarStringConstant
|
||||
AfterEscapeStringConstantWithNewlineMode_Continued
|
||||
|
||||
rule names:
|
||||
root
|
||||
program
|
||||
plsqlroot
|
||||
stmtblock
|
||||
stmtmulti
|
||||
|
@ -7771,7 +7771,7 @@ var symbolicNames = [ null, "Dollar", "OPEN_PAREN", "CLOSE_PAREN", "OPEN_BRACKET
|
||||
"AfterEscapeStringConstantWithNewlineMode_NotContinued",
|
||||
"DollarText", "EndDollarStringConstant", "AfterEscapeStringConstantWithNewlineMode_Continued" ];
|
||||
|
||||
var ruleNames = [ "root", "plsqlroot", "stmtblock", "stmtmulti", "stmt",
|
||||
var ruleNames = [ "program", "plsqlroot", "stmtblock", "stmtmulti", "stmt",
|
||||
"plsqlconsolecommand", "callstmt", "createrolestmt",
|
||||
"opt_with", "optrolelist", "alteroptrolelist", "alteroptroleelem",
|
||||
"createoptroleelem", "createuserstmt", "alterrolestmt",
|
||||
@ -8588,7 +8588,7 @@ PostgreSQLParser.DollarText = 553;
|
||||
PostgreSQLParser.EndDollarStringConstant = 554;
|
||||
PostgreSQLParser.AfterEscapeStringConstantWithNewlineMode_Continued = 555;
|
||||
|
||||
PostgreSQLParser.RULE_root = 0;
|
||||
PostgreSQLParser.RULE_program = 0;
|
||||
PostgreSQLParser.RULE_plsqlroot = 1;
|
||||
PostgreSQLParser.RULE_stmtblock = 2;
|
||||
PostgreSQLParser.RULE_stmtmulti = 3;
|
||||
@ -9394,7 +9394,7 @@ PostgreSQLParser.RULE_make_execsql_stmt = 802;
|
||||
PostgreSQLParser.RULE_opt_returning_clause_into = 803;
|
||||
|
||||
|
||||
function RootContext(parser, parent, invokingState) {
|
||||
function ProgramContext(parser, parent, invokingState) {
|
||||
if(parent===undefined) {
|
||||
parent = null;
|
||||
}
|
||||
@ -9403,36 +9403,36 @@ function RootContext(parser, parent, invokingState) {
|
||||
}
|
||||
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
||||
this.parser = parser;
|
||||
this.ruleIndex = PostgreSQLParser.RULE_root;
|
||||
this.ruleIndex = PostgreSQLParser.RULE_program;
|
||||
return this;
|
||||
}
|
||||
|
||||
RootContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
||||
RootContext.prototype.constructor = RootContext;
|
||||
ProgramContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
||||
ProgramContext.prototype.constructor = ProgramContext;
|
||||
|
||||
RootContext.prototype.stmtblock = function() {
|
||||
ProgramContext.prototype.stmtblock = function() {
|
||||
return this.getTypedRuleContext(StmtblockContext,0);
|
||||
};
|
||||
|
||||
RootContext.prototype.EOF = function() {
|
||||
ProgramContext.prototype.EOF = function() {
|
||||
return this.getToken(PostgreSQLParser.EOF, 0);
|
||||
};
|
||||
|
||||
RootContext.prototype.enterRule = function(listener) {
|
||||
ProgramContext.prototype.enterRule = function(listener) {
|
||||
if(listener instanceof PostgreSQLParserListener ) {
|
||||
listener.enterRoot(this);
|
||||
listener.enterProgram(this);
|
||||
}
|
||||
};
|
||||
|
||||
RootContext.prototype.exitRule = function(listener) {
|
||||
ProgramContext.prototype.exitRule = function(listener) {
|
||||
if(listener instanceof PostgreSQLParserListener ) {
|
||||
listener.exitRoot(this);
|
||||
listener.exitProgram(this);
|
||||
}
|
||||
};
|
||||
|
||||
RootContext.prototype.accept = function(visitor) {
|
||||
ProgramContext.prototype.accept = function(visitor) {
|
||||
if ( visitor instanceof PostgreSQLParserVisitor ) {
|
||||
return visitor.visitRoot(this);
|
||||
return visitor.visitProgram(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
@ -9441,12 +9441,12 @@ RootContext.prototype.accept = function(visitor) {
|
||||
|
||||
|
||||
|
||||
PostgreSQLParser.RootContext = RootContext;
|
||||
PostgreSQLParser.ProgramContext = ProgramContext;
|
||||
|
||||
PostgreSQLParser.prototype.root = function() {
|
||||
PostgreSQLParser.prototype.program = function() {
|
||||
|
||||
var localctx = new RootContext(this, this._ctx, this.state);
|
||||
this.enterRule(localctx, 0, PostgreSQLParser.RULE_root);
|
||||
var localctx = new ProgramContext(this, this._ctx, this.state);
|
||||
this.enterRule(localctx, 0, PostgreSQLParser.RULE_program);
|
||||
try {
|
||||
this.enterOuterAlt(localctx, 1);
|
||||
this.state = 1608;
|
||||
|
@ -11,12 +11,12 @@ function PostgreSQLParserListener() {
|
||||
PostgreSQLParserListener.prototype = Object.create(antlr4.tree.ParseTreeListener.prototype);
|
||||
PostgreSQLParserListener.prototype.constructor = PostgreSQLParserListener;
|
||||
|
||||
// Enter a parse tree produced by PostgreSQLParser#root.
|
||||
PostgreSQLParserListener.prototype.enterRoot = function(ctx) {
|
||||
// Enter a parse tree produced by PostgreSQLParser#program.
|
||||
PostgreSQLParserListener.prototype.enterProgram = function(ctx) {
|
||||
};
|
||||
|
||||
// Exit a parse tree produced by PostgreSQLParser#root.
|
||||
PostgreSQLParserListener.prototype.exitRoot = function(ctx) {
|
||||
// Exit a parse tree produced by PostgreSQLParser#program.
|
||||
PostgreSQLParserListener.prototype.exitProgram = function(ctx) {
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,8 +12,8 @@ function PostgreSQLParserVisitor() {
|
||||
PostgreSQLParserVisitor.prototype = Object.create(antlr4.tree.ParseTreeVisitor.prototype);
|
||||
PostgreSQLParserVisitor.prototype.constructor = PostgreSQLParserVisitor;
|
||||
|
||||
// Visit a parse tree produced by PostgreSQLParser#root.
|
||||
PostgreSQLParserVisitor.prototype.visitRoot = function(ctx) {
|
||||
// Visit a parse tree produced by PostgreSQLParser#program.
|
||||
PostgreSQLParserVisitor.prototype.visitProgram = function(ctx) {
|
||||
return this.visitChildren(ctx);
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@ export class PostgreSQLParserBase extends antlr4.Parser {
|
||||
|
||||
GetParsedSqlTree( script, line) {
|
||||
const ph = this.getPostgreSQLParser(script);
|
||||
return ph.root();
|
||||
return ph.program();
|
||||
}
|
||||
|
||||
ParseRoutineBody( _localctx) {
|
||||
@ -58,7 +58,7 @@ export class PostgreSQLParserBase extends antlr4.Parser {
|
||||
func_as.func_as().Definition = ph.plsqlroot();
|
||||
break;
|
||||
case 'sql':
|
||||
func_as.func_as().Definition = ph.root();
|
||||
func_as.func_as().Definition = ph.program();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ export default abstract class BasicParser<C = any> {
|
||||
parser.removeErrorListeners();
|
||||
parser.addErrorListener(new ParserErrorListener(errorListener));
|
||||
|
||||
// Note : needed by pgsql
|
||||
const parserTree = parser.program? parser.program() : parser.root();
|
||||
const parserTree = parser.program();
|
||||
|
||||
return parserTree;
|
||||
}
|
||||
@ -38,12 +37,7 @@ export default abstract class BasicParser<C = any> {
|
||||
parser.removeErrorListeners();
|
||||
parser.addErrorListener(new ParserErrorCollector(syntaxErrors));
|
||||
|
||||
// Note : needed by pgsql
|
||||
if (parser.program) {
|
||||
parser.program();
|
||||
} else {
|
||||
parser.root();
|
||||
}
|
||||
|
||||
return lexerError.concat(syntaxErrors);
|
||||
}
|
||||
@ -95,8 +89,7 @@ export default abstract class BasicParser<C = any> {
|
||||
const parser = this.createParser(input);
|
||||
this._parser = parser;
|
||||
|
||||
// Note : needed by pgsql
|
||||
const tree = parser.program? parser.program() : parser.root();
|
||||
const tree = parser.program();
|
||||
return tree.toStringTree(parser.ruleNames);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user