UNPKG

dt-sql-parser

Version:

SQL Parsers for BigData, built with antlr4

1,120 lines 1.29 MB
// Generated from dt-sql-parser/src/grammar/trino/TrinoSql.g4 by ANTLR 4.13.1 // @ts-nocheck import * as antlr from "antlr4ng"; import { SQLParserBase } from '../SQLParserBase'; export class TrinoSqlParser extends SQLParserBase { get grammarFileName() { return "TrinoSql.g4"; } get literalNames() { return TrinoSqlParser.literalNames; } get symbolicNames() { return TrinoSqlParser.symbolicNames; } get ruleNames() { return TrinoSqlParser.ruleNames; } get serializedATN() { return TrinoSqlParser._serializedATN; } createFailedPredicateException(predicate, message) { return new antlr.FailedPredicateException(this, predicate, message); } constructor(input) { super(input); this.interpreter = new antlr.ParserATNSimulator(this, TrinoSqlParser._ATN, TrinoSqlParser.decisionsToDFA, new antlr.PredictionContextCache()); } program() { let localContext = new ProgramContext(this.context, this.state); this.enterRule(localContext, 0, TrinoSqlParser.RULE_program); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 313; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 25165826) !== 0) || ((((_la - 37)) & ~0x1F) === 0 && ((1 << (_la - 37)) & 2147550721) !== 0) || ((((_la - 73)) & ~0x1F) === 0 && ((1 << (_la - 73)) & 5243919) !== 0) || _la === 110 || _la === 127 || _la === 169 || ((((_la - 214)) & ~0x1F) === 0 && ((1 << (_la - 214)) & 8921345) !== 0) || ((((_la - 248)) & ~0x1F) === 0 && ((1 << (_la - 248)) & 67113129) !== 0) || ((((_la - 287)) & ~0x1F) === 0 && ((1 << (_la - 287)) & 131587) !== 0)) { { { this.state = 310; this.statements(); } } this.state = 315; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 316; this.match(TrinoSqlParser.EOF); } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } statements() { let localContext = new StatementsContext(this.context, this.state); this.enterRule(localContext, 2, TrinoSqlParser.RULE_statements); try { this.enterOuterAlt(localContext, 1); { this.state = 318; this.singleStatement(); } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } singleStatement() { let localContext = new SingleStatementContext(this.context, this.state); this.enterRule(localContext, 4, TrinoSqlParser.RULE_singleStatement); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 320; this.statement(); this.state = 322; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 325) { { this.state = 321; this.match(TrinoSqlParser.SEMICOLON); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } standaloneExpression() { let localContext = new StandaloneExpressionContext(this.context, this.state); this.enterRule(localContext, 6, TrinoSqlParser.RULE_standaloneExpression); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 324; this.expression(); this.state = 326; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 325) { { this.state = 325; this.match(TrinoSqlParser.SEMICOLON); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } standalonePathSpecification() { let localContext = new StandalonePathSpecificationContext(this.context, this.state); this.enterRule(localContext, 8, TrinoSqlParser.RULE_standalonePathSpecification); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 328; this.pathSpecification(); this.state = 330; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 325) { { this.state = 329; this.match(TrinoSqlParser.SEMICOLON); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } standaloneType() { let localContext = new StandaloneTypeContext(this.context, this.state); this.enterRule(localContext, 10, TrinoSqlParser.RULE_standaloneType); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 332; this.type_(0); this.state = 334; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 325) { { this.state = 333; this.match(TrinoSqlParser.SEMICOLON); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } standaloneRowPattern() { let localContext = new StandaloneRowPatternContext(this.context, this.state); this.enterRule(localContext, 12, TrinoSqlParser.RULE_standaloneRowPattern); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 336; this.rowPattern(0); this.state = 338; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 325) { { this.state = 337; this.match(TrinoSqlParser.SEMICOLON); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } standaloneFunctionSpecification() { let localContext = new StandaloneFunctionSpecificationContext(this.context, this.state); this.enterRule(localContext, 14, TrinoSqlParser.RULE_standaloneFunctionSpecification); try { this.enterOuterAlt(localContext, 1); { this.state = 340; this.functionSpecification(); this.state = 341; this.match(TrinoSqlParser.EOF); } } catch (re) { if (re instanceof antlr.RecognitionException) { localContext.exception = re; this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } statement() { let localContext = new StatementContext(this.context, this.state); this.enterRule(localContext, 16, TrinoSqlParser.RULE_statement); let _la; try { this.state = 1238; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 125, this.context)) { case 1: localContext = new StatementDefaultContext(localContext); this.enterOuterAlt(localContext, 1); { this.state = 343; this.rootQuery(); } break; case 2: localContext = new UseContext(localContext); this.enterOuterAlt(localContext, 2); { this.state = 344; this.match(TrinoSqlParser.KW_USE); this.state = 345; this.schemaRef(); } break; case 3: localContext = new CreateCatalogContext(localContext); this.enterOuterAlt(localContext, 3); { this.state = 346; this.match(TrinoSqlParser.KW_CREATE); this.state = 347; this.match(TrinoSqlParser.KW_CATALOG); this.state = 351; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 6, this.context)) { case 1: { this.state = 348; this.match(TrinoSqlParser.KW_IF); this.state = 349; this.match(TrinoSqlParser.KW_NOT); this.state = 350; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 353; localContext._catalog = this.catalogNameCreate(); this.state = 354; this.match(TrinoSqlParser.KW_USING); this.state = 355; localContext._connectorName = this.identifier(); this.state = 358; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 7, this.context)) { case 1: { this.state = 356; this.match(TrinoSqlParser.KW_COMMENT); this.state = 357; this.string_(); } break; } this.state = 362; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 31) { { this.state = 360; this.match(TrinoSqlParser.KW_AUTHORIZATION); this.state = 361; this.principal(); } } this.state = 366; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context)) { case 1: { this.state = 364; this.match(TrinoSqlParser.KW_WITH); this.state = 365; this.properties(); } break; } } break; case 4: localContext = new DropCatalogContext(localContext); this.enterOuterAlt(localContext, 4); { this.state = 368; this.match(TrinoSqlParser.KW_DROP); this.state = 369; this.match(TrinoSqlParser.KW_CATALOG); this.state = 372; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 10, this.context)) { case 1: { this.state = 370; this.match(TrinoSqlParser.KW_IF); this.state = 371; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 374; localContext._catalog = this.catalogRef(); this.state = 376; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 39 || _la === 229) { { this.state = 375; _la = this.tokenStream.LA(1); if (!(_la === 39 || _la === 229)) { this.errorHandler.recoverInline(this); } else { this.errorHandler.reportMatch(this); this.consume(); } } } } break; case 5: localContext = new CreateSchemaContext(localContext); this.enterOuterAlt(localContext, 5); { this.state = 378; this.match(TrinoSqlParser.KW_CREATE); this.state = 379; this.match(TrinoSqlParser.KW_SCHEMA); this.state = 383; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 12, this.context)) { case 1: { this.state = 380; this.match(TrinoSqlParser.KW_IF); this.state = 381; this.match(TrinoSqlParser.KW_NOT); this.state = 382; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 385; this.schemaNameCreate(); this.state = 388; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 31) { { this.state = 386; this.match(TrinoSqlParser.KW_AUTHORIZATION); this.state = 387; this.principal(); } } this.state = 392; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 14, this.context)) { case 1: { this.state = 390; this.match(TrinoSqlParser.KW_WITH); this.state = 391; this.properties(); } break; } } break; case 6: localContext = new DropSchemaContext(localContext); this.enterOuterAlt(localContext, 6); { this.state = 394; this.match(TrinoSqlParser.KW_DROP); this.state = 395; this.match(TrinoSqlParser.KW_SCHEMA); this.state = 398; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 15, this.context)) { case 1: { this.state = 396; this.match(TrinoSqlParser.KW_IF); this.state = 397; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 400; this.schemaRef(); this.state = 402; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 39 || _la === 229) { { this.state = 401; _la = this.tokenStream.LA(1); if (!(_la === 39 || _la === 229)) { this.errorHandler.recoverInline(this); } else { this.errorHandler.reportMatch(this); this.consume(); } } } } break; case 7: localContext = new RenameSchemaContext(localContext); this.enterOuterAlt(localContext, 7); { this.state = 404; this.match(TrinoSqlParser.KW_ALTER); this.state = 405; this.match(TrinoSqlParser.KW_SCHEMA); this.state = 406; this.schemaRef(); this.state = 407; this.match(TrinoSqlParser.KW_RENAME); this.state = 408; this.match(TrinoSqlParser.KW_TO); this.state = 409; this.schemaNameCreate(); } break; case 8: localContext = new SetSchemaAuthorizationContext(localContext); this.enterOuterAlt(localContext, 8); { this.state = 411; this.match(TrinoSqlParser.KW_ALTER); this.state = 412; this.match(TrinoSqlParser.KW_SCHEMA); this.state = 413; this.schemaRef(); this.state = 414; this.match(TrinoSqlParser.KW_SET); this.state = 415; this.match(TrinoSqlParser.KW_AUTHORIZATION); this.state = 416; this.principal(); } break; case 9: localContext = new CreateTableAsSelectContext(localContext); this.enterOuterAlt(localContext, 9); { this.state = 418; this.match(TrinoSqlParser.KW_CREATE); this.state = 421; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 194) { { this.state = 419; this.match(TrinoSqlParser.KW_OR); this.state = 420; this.match(TrinoSqlParser.KW_REPLACE); } } this.state = 423; this.match(TrinoSqlParser.KW_TABLE); this.state = 427; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 18, this.context)) { case 1: { this.state = 424; this.match(TrinoSqlParser.KW_IF); this.state = 425; this.match(TrinoSqlParser.KW_NOT); this.state = 426; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 429; this.tableNameCreate(); this.state = 431; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 1) { { this.state = 430; this.columnListCreate(); } } this.state = 435; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 46) { { this.state = 433; this.match(TrinoSqlParser.KW_COMMENT); this.state = 434; localContext._comment = this.string_(); } } this.state = 439; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 304) { { this.state = 437; this.match(TrinoSqlParser.KW_WITH); this.state = 438; this.properties(); } } this.state = 441; this.match(TrinoSqlParser.KW_AS); this.state = 447; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 22, this.context)) { case 1: { this.state = 442; this.rootQuery(); } break; case 2: { this.state = 443; this.match(TrinoSqlParser.T__0); this.state = 444; this.rootQuery(); this.state = 445; this.match(TrinoSqlParser.T__1); } break; } this.state = 454; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 24, this.context)) { case 1: { this.state = 449; this.match(TrinoSqlParser.KW_WITH); this.state = 451; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 179) { { this.state = 450; this.match(TrinoSqlParser.KW_NO); } } this.state = 453; this.match(TrinoSqlParser.KW_DATA); } break; } } break; case 10: localContext = new CreateTableContext(localContext); this.enterOuterAlt(localContext, 10); { this.state = 456; this.match(TrinoSqlParser.KW_CREATE); this.state = 459; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 194) { { this.state = 457; this.match(TrinoSqlParser.KW_OR); this.state = 458; this.match(TrinoSqlParser.KW_REPLACE); } } this.state = 461; this.match(TrinoSqlParser.KW_TABLE); this.state = 465; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 26, this.context)) { case 1: { this.state = 462; this.match(TrinoSqlParser.KW_IF); this.state = 463; this.match(TrinoSqlParser.KW_NOT); this.state = 464; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 467; this.tableNameCreate(); this.state = 468; this.match(TrinoSqlParser.T__0); this.state = 469; this.tableElement(); this.state = 474; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 3) { { { this.state = 470; this.match(TrinoSqlParser.T__2); this.state = 471; this.tableElement(); } } this.state = 476; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 477; this.match(TrinoSqlParser.T__1); this.state = 480; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 28, this.context)) { case 1: { this.state = 478; this.match(TrinoSqlParser.KW_COMMENT); this.state = 479; localContext._comment = this.string_(); } break; } this.state = 484; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 29, this.context)) { case 1: { this.state = 482; this.match(TrinoSqlParser.KW_WITH); this.state = 483; this.properties(); } break; } } break; case 11: localContext = new DropTableContext(localContext); this.enterOuterAlt(localContext, 11); { this.state = 486; this.match(TrinoSqlParser.KW_DROP); this.state = 487; this.match(TrinoSqlParser.KW_TABLE); this.state = 490; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 30, this.context)) { case 1: { this.state = 488; this.match(TrinoSqlParser.KW_IF); this.state = 489; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 492; this.tableRef(); } break; case 12: localContext = new InsertIntoContext(localContext); this.enterOuterAlt(localContext, 12); { this.state = 493; this.match(TrinoSqlParser.KW_INSERT); this.state = 494; this.match(TrinoSqlParser.KW_INTO); this.state = 495; this.tableRef(); this.state = 497; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 31, this.context)) { case 1: { this.state = 496; this.columnList(); } break; } this.state = 499; this.rootQuery(); } break; case 13: localContext = new DeleteContext(localContext); this.enterOuterAlt(localContext, 13); { this.state = 501; this.match(TrinoSqlParser.KW_DELETE); this.state = 502; this.match(TrinoSqlParser.KW_FROM); this.state = 503; this.tableRef(); this.state = 505; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 301) { { this.state = 504; this.whereClause(); } } } break; case 14: localContext = new TruncateTableContext(localContext); this.enterOuterAlt(localContext, 14); { this.state = 507; this.match(TrinoSqlParser.KW_TRUNCATE); this.state = 508; this.match(TrinoSqlParser.KW_TABLE); this.state = 509; this.tableRef(); } break; case 15: localContext = new CommentTableContext(localContext); this.enterOuterAlt(localContext, 15); { this.state = 510; this.match(TrinoSqlParser.KW_COMMENT); this.state = 511; this.match(TrinoSqlParser.KW_ON); this.state = 512; this.match(TrinoSqlParser.KW_TABLE); this.state = 513; this.tableRef(); this.state = 514; this.match(TrinoSqlParser.KW_IS); this.state = 517; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case TrinoSqlParser.STRING: case TrinoSqlParser.UNICODE_STRING: { this.state = 515; this.string_(); } break; case TrinoSqlParser.KW_NULL: { this.state = 516; this.match(TrinoSqlParser.KW_NULL); } break; default: throw new antlr.NoViableAltException(this); } } break; case 16: localContext = new CommentViewContext(localContext); this.enterOuterAlt(localContext, 16); { this.state = 519; this.match(TrinoSqlParser.KW_COMMENT); this.state = 520; this.match(TrinoSqlParser.KW_ON); this.state = 521; this.match(TrinoSqlParser.KW_VIEW); this.state = 522; this.viewRef(); this.state = 523; this.match(TrinoSqlParser.KW_IS); this.state = 526; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case TrinoSqlParser.STRING: case TrinoSqlParser.UNICODE_STRING: { this.state = 524; this.string_(); } break; case TrinoSqlParser.KW_NULL: { this.state = 525; this.match(TrinoSqlParser.KW_NULL); } break; default: throw new antlr.NoViableAltException(this); } } break; case 17: localContext = new CommentColumnContext(localContext); this.enterOuterAlt(localContext, 17); { this.state = 528; this.match(TrinoSqlParser.KW_COMMENT); this.state = 529; this.match(TrinoSqlParser.KW_ON); this.state = 530; this.match(TrinoSqlParser.KW_COLUMN); this.state = 531; this.columnRef(); this.state = 532; this.match(TrinoSqlParser.KW_IS); this.state = 535; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case TrinoSqlParser.STRING: case TrinoSqlParser.UNICODE_STRING: { this.state = 533; this.string_(); } break; case TrinoSqlParser.KW_NULL: { this.state = 534; this.match(TrinoSqlParser.KW_NULL); } break; default: throw new antlr.NoViableAltException(this); } } break; case 18: localContext = new RenameTableContext(localContext); this.enterOuterAlt(localContext, 18); { this.state = 537; this.match(TrinoSqlParser.KW_ALTER); this.state = 538; this.match(TrinoSqlParser.KW_TABLE); this.state = 541; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 36, this.context)) { case 1: { this.state = 539; this.match(TrinoSqlParser.KW_IF); this.state = 540; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 543; localContext._from_ = this.tableRef(); this.state = 544; this.match(TrinoSqlParser.KW_RENAME); this.state = 545; this.match(TrinoSqlParser.KW_TO); this.state = 546; localContext._to = this.tableNameCreate(); } break; case 19: localContext = new AddColumnContext(localContext); this.enterOuterAlt(localContext, 19); { this.state = 548; this.match(TrinoSqlParser.KW_ALTER); this.state = 549; this.match(TrinoSqlParser.KW_TABLE); this.state = 552; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 37, this.context)) { case 1: { this.state = 550; this.match(TrinoSqlParser.KW_IF); this.state = 551; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 554; localContext._tableName = this.tableRef(); this.state = 555; this.match(TrinoSqlParser.KW_ADD); this.state = 556; this.match(TrinoSqlParser.KW_COLUMN); this.state = 560; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 38, this.context)) { case 1: { this.state = 557; this.match(TrinoSqlParser.KW_IF); this.state = 558; this.match(TrinoSqlParser.KW_NOT); this.state = 559; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 562; localContext._column = this.columnDefinition(); } break; case 20: localContext = new RenameColumnContext(localContext); this.enterOuterAlt(localContext, 20); { this.state = 564; this.match(TrinoSqlParser.KW_ALTER); this.state = 565; this.match(TrinoSqlParser.KW_TABLE); this.state = 568; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 39, this.context)) { case 1: { this.state = 566; this.match(TrinoSqlParser.KW_IF); this.state = 567; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 570; localContext._tableName = this.tableRef(); this.state = 571; this.match(TrinoSqlParser.KW_RENAME); this.state = 572; this.match(TrinoSqlParser.KW_COLUMN); this.state = 575; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 40, this.context)) { case 1: { this.state = 573; this.match(TrinoSqlParser.KW_IF); this.state = 574; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 577; localContext._from_ = this.columnRef(); this.state = 578; this.match(TrinoSqlParser.KW_TO); this.state = 579; localContext._to = this.columnNameCreate(); } break; case 21: localContext = new DropColumnContext(localContext); this.enterOuterAlt(localContext, 21); { this.state = 581; this.match(TrinoSqlParser.KW_ALTER); this.state = 582; this.match(TrinoSqlParser.KW_TABLE); this.state = 585; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 41, this.context)) { case 1: { this.state = 583; this.match(TrinoSqlParser.KW_IF); this.state = 584; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 587; localContext._tableName = this.tableRef(); this.state = 588; this.match(TrinoSqlParser.KW_DROP); this.state = 589; this.match(TrinoSqlParser.KW_COLUMN); this.state = 592; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 42, this.context)) { case 1: { this.state = 590; this.match(TrinoSqlParser.KW_IF); this.state = 591; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 594; localContext._column = this.columnRef(); } break; case 22: localContext = new SetColumnTypeContext(localContext); this.enterOuterAlt(localContext, 22); { this.state = 596; this.match(TrinoSqlParser.KW_ALTER); this.state = 597; this.match(TrinoSqlParser.KW_TABLE); this.state = 600; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 43, this.context)) { case 1: { this.state = 598; this.match(TrinoSqlParser.KW_IF); this.state = 599; this.match(TrinoSqlParser.KW_EXISTS); } break; } this.state = 602; localContext._tableName = this.tableRef(); this.state = 603; this.match(TrinoSqlParser.KW_ALTER); this.state = 604; this.match(TrinoSqlParser.KW_COLUMN); this.state = 605; localContext._column = this.columnRef(); this.state = 606; this.match(TrinoSqlParser.KW_SET); this.state = 607; this.match(TrinoSqlParser.KW_DATA); this.state = 608; this.match(TrinoSqlParser.KW_TYPE); this.state = 609; this.type_(0); } break