Skip to content

Commit

Permalink
feat: upgrade trino autocomplete (#247)
Browse files Browse the repository at this point in the history
* feat: upgrade trino autocomplete

* feat: force to include parents in schemaIdentifier, tableIdentifier; fix tests

* fix: update gitignore

* feat: forbid multi-queries in trino

* refactor: make identifier recursive
  • Loading branch information
NikitaShkaruba authored Nov 22, 2024
1 parent d37ba50 commit 350c1d3
Show file tree
Hide file tree
Showing 27 changed files with 5,359 additions and 5,038 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ dist-types

.ds_store

.antlr
.antlr

# Intellij IDES add weird token files that we don't use
**/grammar/*.tokens
14 changes: 11 additions & 3 deletions src/autocomplete/databases/trino/generated/TrinoParser.interp

Large diffs are not rendered by default.

9,387 changes: 4,901 additions & 4,486 deletions src/autocomplete/databases/trino/generated/TrinoParser.ts

Large diffs are not rendered by default.

84 changes: 74 additions & 10 deletions src/autocomplete/databases/trino/generated/TrinoParserVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { AbstractParseTreeVisitor } from "antlr4ng";


import { ParseContext } from "./TrinoParser.js";
import { StatementsContext } from "./TrinoParser.js";
import { StatementDefaultContext } from "./TrinoParser.js";
import { UseContext } from "./TrinoParser.js";
import { UseCatalogContext } from "./TrinoParser.js";
import { CreateCatalogContext } from "./TrinoParser.js";
import { DropCatalogContext } from "./TrinoParser.js";
import { CreateSchemaContext } from "./TrinoParser.js";
Expand Down Expand Up @@ -324,11 +324,20 @@ import { CurrentRoleGrantorContext } from "./TrinoParser.js";
import { UnspecifiedPrincipalContext } from "./TrinoParser.js";
import { UserPrincipalContext } from "./TrinoParser.js";
import { RolePrincipalContext } from "./TrinoParser.js";
import { RolesContext } from "./TrinoParser.js";
import { RoleIdentifierListContext } from "./TrinoParser.js";
import { UnquotedIdentifierContext } from "./TrinoParser.js";
import { QuotedIdentifierContext } from "./TrinoParser.js";
import { BackQuotedIdentifierContext } from "./TrinoParser.js";
import { DigitIdentifierContext } from "./TrinoParser.js";
import { CatalogIdentifierContext } from "./TrinoParser.js";
import { SchemaIdentifierContext } from "./TrinoParser.js";
import { TableIdentifierContext } from "./TrinoParser.js";
import { ViewIdentifierContext } from "./TrinoParser.js";
import { NewSchemaIdentifierContext } from "./TrinoParser.js";
import { NewTableIdentifierContext } from "./TrinoParser.js";
import { NewViewIdentifierContext } from "./TrinoParser.js";
import { RoleIdentifierContext } from "./TrinoParser.js";
import { ConnectorIdentifierContext } from "./TrinoParser.js";
import { DecimalLiteralContext } from "./TrinoParser.js";
import { DoubleLiteralContext } from "./TrinoParser.js";
import { IntegerLiteralContext } from "./TrinoParser.js";
Expand All @@ -351,12 +360,6 @@ export class TrinoParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
* @return the visitor result
*/
visitParse?: (ctx: ParseContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.statements`.
* @param ctx the parse tree
* @return the visitor result
*/
visitStatements?: (ctx: StatementsContext) => Result;
/**
* Visit a parse tree produced by the `statementDefault`
* labeled alternative in `TrinoParser.statement`.
Expand All @@ -371,6 +374,13 @@ export class TrinoParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
* @return the visitor result
*/
visitUse?: (ctx: UseContext) => Result;
/**
* Visit a parse tree produced by the `useCatalog`
* labeled alternative in `TrinoParser.statement`.
* @param ctx the parse tree
* @return the visitor result
*/
visitUseCatalog?: (ctx: UseCatalogContext) => Result;
/**
* Visit a parse tree produced by the `createCatalog`
* labeled alternative in `TrinoParser.statement`.
Expand Down Expand Up @@ -2445,11 +2455,11 @@ export class TrinoParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
*/
visitRolePrincipal?: (ctx: RolePrincipalContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.roles`.
* Visit a parse tree produced by `TrinoParser.roleIdentifierList`.
* @param ctx the parse tree
* @return the visitor result
*/
visitRoles?: (ctx: RolesContext) => Result;
visitRoleIdentifierList?: (ctx: RoleIdentifierListContext) => Result;
/**
* Visit a parse tree produced by the `unquotedIdentifier`
* labeled alternative in `TrinoParser.identifier`.
Expand Down Expand Up @@ -2478,6 +2488,60 @@ export class TrinoParserVisitor<Result> extends AbstractParseTreeVisitor<Result>
* @return the visitor result
*/
visitDigitIdentifier?: (ctx: DigitIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.catalogIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitCatalogIdentifier?: (ctx: CatalogIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.schemaIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSchemaIdentifier?: (ctx: SchemaIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.tableIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitTableIdentifier?: (ctx: TableIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.viewIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitViewIdentifier?: (ctx: ViewIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.newSchemaIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitNewSchemaIdentifier?: (ctx: NewSchemaIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.newTableIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitNewTableIdentifier?: (ctx: NewTableIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.newViewIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitNewViewIdentifier?: (ctx: NewViewIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.roleIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitRoleIdentifier?: (ctx: RoleIdentifierContext) => Result;
/**
* Visit a parse tree produced by `TrinoParser.connectorIdentifier`.
* @param ctx the parse tree
* @return the visitor result
*/
visitConnectorIdentifier?: (ctx: ConnectorIdentifierContext) => Result;
/**
* Visit a parse tree produced by the `decimalLiteral`
* labeled alternative in `TrinoParser.number`.
Expand Down
Loading

0 comments on commit 350c1d3

Please sign in to comment.