fix: trino validation (#248)

* fix: #246 program does not match standaloneClause

* test: patch unit tests
This commit is contained in:
Hayden
2024-01-16 11:14:03 +08:00
committed by GitHub
parent 30b7f27486
commit 1038a3a828
13 changed files with 3912 additions and 3697 deletions

View File

@ -17,7 +17,6 @@
* Reference: https://github.com/trinodb/trino/blob/385/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4
*/
// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
// $antlr-format spaceBeforeAssignmentOperators false, keepEmptyLinesAtTheStartOfBlocks true
@ -35,7 +34,10 @@ program
statements
: singleStatement
| standaloneExpression
;
standaloneClause
: standaloneExpression
| standalonePathSpecification
| standaloneType
| standaloneRowPattern

File diff suppressed because one or more lines are too long

View File

@ -203,6 +203,7 @@ import { LogicalNotContext } from "./TrinoSqlParser";
import { LogicalBinaryContext } from "./TrinoSqlParser";
import { ProgramContext } from "./TrinoSqlParser";
import { StatementsContext } from "./TrinoSqlParser";
import { StandaloneClauseContext } from "./TrinoSqlParser";
import { SingleStatementContext } from "./TrinoSqlParser";
import { StandaloneExpressionContext } from "./TrinoSqlParser";
import { StandalonePathSpecificationContext } from "./TrinoSqlParser";
@ -2912,6 +2913,17 @@ export interface TrinoSqlListener extends ParseTreeListener {
*/
exitStatements?: (ctx: StatementsContext) => void;
/**
* Enter a parse tree produced by `TrinoSqlParser.standaloneClause`.
* @param ctx the parse tree
*/
enterStandaloneClause?: (ctx: StandaloneClauseContext) => void;
/**
* Exit a parse tree produced by `TrinoSqlParser.standaloneClause`.
* @param ctx the parse tree
*/
exitStandaloneClause?: (ctx: StandaloneClauseContext) => void;
/**
* Enter a parse tree produced by `TrinoSqlParser.singleStatement`.
* @param ctx the parse tree

File diff suppressed because one or more lines are too long

View File

@ -203,6 +203,7 @@ import { LogicalNotContext } from "./TrinoSqlParser";
import { LogicalBinaryContext } from "./TrinoSqlParser";
import { ProgramContext } from "./TrinoSqlParser";
import { StatementsContext } from "./TrinoSqlParser";
import { StandaloneClauseContext } from "./TrinoSqlParser";
import { SingleStatementContext } from "./TrinoSqlParser";
import { StandaloneExpressionContext } from "./TrinoSqlParser";
import { StandalonePathSpecificationContext } from "./TrinoSqlParser";
@ -1917,6 +1918,13 @@ export interface TrinoSqlVisitor<Result> extends ParseTreeVisitor<Result> {
*/
visitStatements?: (ctx: StatementsContext) => Result;
/**
* Visit a parse tree produced by `TrinoSqlParser.standaloneClause`.
* @param ctx the parse tree
* @return the visitor result
*/
visitStandaloneClause?: (ctx: StandaloneClauseContext) => Result;
/**
* Visit a parse tree produced by `TrinoSqlParser.singleStatement`.
* @param ctx the parse tree