rhombic
Version:
SQL parsing, lineage extraction and manipulation
189 lines • 7.62 kB
TypeScript
import { Lexer, CstParser, IParserConfig } from "chevrotain";
export declare const SqlLexer: Lexer;
declare class SqlParser extends CstParser {
constructor(serializedGrammar: IParserConfig["serializedGrammar"]);
/**
* statement:
* query
*/
statement: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* query:
* values
* | WITH withItem [ , withItem ]* query
* | {
* select
* | selectWithoutFrom
* | query UNION [ ALL | DISTINCT ] query
* | query EXCEPT [ ALL | DISTINCT ] query
* | query MINUS [ ALL | DISTINCT ] query
* | query INTERSECT [ ALL | DISTINCT ] query
* }
* [ ORDER BY orderItem [, orderItem ]* ]
* [ LIMIT [ start, ] { count | ALL } ]
* [ OFFSET start { ROW | ROWS } ]
* [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
*/
query: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* expression:
* valueExpression
* | null
*/
expression: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
cast: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
orderBy: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* type:
* typeName
* [ collectionsTypeName ]*
*
* typeName:
* sqlTypeName
*/
type: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* <value expression> ::=
* <numeric value expression>
* | <string value expression>
* | <datetime value expression>
* | <interval value expression>
* | <boolean value expression>
* | <user-defined type value expression>
* | <row value expression>
* | <reference value expression>
* | <collection value expression>
*
* https://github.com/ronsavage/SQL/blob/master/sql-2003-2.bnf
*/
valueExpression: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
booleanExpression: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
booleanExpressionValue: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* orderItem:
* expression [ ASC | DESC ] [ NULLS FIRST | NULLS LAST ]
*/
orderItem: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* select:
* SELECT [ STREAM ] [ ALL | DISTINCT ]
* { projectionItem [, projectionItem ]* }
* FROM tableExpression [ AS tableAlias ]
* [ WHERE booleanExpression ]
* [ GROUP BY { groupItem [, groupItem ]* } ]
* [ HAVING booleanExpression ]
* [ WINDOW windowName AS windowSpec [, windowName AS windowSpec ]* ]
*
*/
select: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* Group by statement
*/
groupBy: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* Where statement
*/
where: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* projectionItems:
* projectionItem [, projectionItem ]*
*/
projectionItems: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* projectionItem:
* expression [ [ AS ] columnAlias ]
* | tableAlias . *
* | *
*/
projectionItem: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* tableExpression:
* tableReference [, tableReference ]*
* | tableExpression [ NATURAL ] [ INNER | (( LEFT | RIGHT | FULL ) [ OUTER ]) ] JOIN tableExpression [ joinCondition ]
* | tableExpression CROSS JOIN tableExpression
* | tableExpression [ CROSS | OUTER ] APPLY tableExpression
*/
tableExpression: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* joinCondition:
* ON booleanExpression
* | USING '(' column [, column ]* ')'
*/
joinCondition: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* tableReference:
* tablePrimary
* [ FOR SYSTEM_TIME AS OF expression ]
* [ matchRecognize ]
* [ [ AS ] alias [ '(' columnAlias [, columnAlias ]* ')' ] ]
*
*/
tableReference: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* tablePrimary:
* [ [ catalogName . ] schemaName . ] tableName
* '(' TABLE [ [ catalogName . ] schemaName . ] tableName ')'
* | tablePrimary [ EXTEND ] '(' columnDecl [, columnDecl ]* ')'
* | [ LATERAL ] '(' query ')'
* | UNNEST '(' expression ')' [ WITH ORDINALITY ]
* | [ LATERAL ] TABLE '(' [ SPECIFIC ] functionName '(' expression [, expression ]* ')' ')'
*/
tablePrimary: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* columnPrimary:
* [ [ [ catalogName . ] schemaName . ] tableName . ] columnName
*/
columnPrimary: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* columnDecl:
* column type [ NOT NULL ]
*/
columnDecl: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* values:
* VALUES expression [, expression ]*
*/
values: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* groupItem:
* expression
* | '(' ')'
* | '(' expression [, expression ]* ')'
* | CUBE '(' expression [, expression ]* ')'
* | ROLLUP '(' expression [, expression ]* ')'
* | GROUPING SETS '(' groupItem [, groupItem ]* ')'
*/
groupItem: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* window:
* windowName
* | windowSpec
*/
window: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
/**
* windowSpec:
* '('
* [ windowName ]
* [ ORDER BY orderItem [, orderItem ]* ]
* [ PARTITION BY expression [, expression ]* ]
* [
* RANGE numericOrIntervalExpression { PRECEDING | FOLLOWING }
* | ROWS numericExpression { PRECEDING | FOLLOWING }
* ]
* ')'
*/
windowSpec: (idxInCallingRule?: number | undefined, ...args: any[]) => import("chevrotain").CstNode;
}
export declare const parser: SqlParser;
export declare function parseSql(statement: string): {
cst: import("chevrotain").CstNode;
lexErrors: import("chevrotain").ILexingError[];
parseErrors: import("chevrotain").IRecognitionException[];
};
export declare function parseFilter(filter: string): {
cst: import("chevrotain").CstNode;
lexErrors: import("chevrotain").ILexingError[];
parseErrors: import("chevrotain").IRecognitionException[];
};
export {};
//# sourceMappingURL=SqlParser.d.ts.map