diff --git a/README-zh_CN.md b/README-zh_CN.md index da261dfe..39c12e62 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -26,6 +26,7 @@ dt-sql-parser 是一个基于 [ANTLR4](https://github.com/antlr/antlr4) 开发 - PostgreSQL - Trino - Impala +- GenericSQL > 提示:当前所有的 SQL Parser 是 `Typescript` 语言版本,如果有需要,可以尝试编译 Grammar 文件到其他目标语言。 @@ -51,7 +52,7 @@ yarn add dt-sql-parser ## 使用 在开始使用前,需要先了解基本用法。`dt-sql-parser` 为不同类型的 SQL 分别提供相应的 SQL 类: ```typescript -import { MySQL, FlinkSQL, SparkSQL, HiveSQL, PostgreSQL, TrinoSQL, ImpalaSQL } from 'dt-sql-parser'; +import { MySQL, FlinkSQL, SparkSQL, HiveSQL, PostgreSQL, TrinoSQL, ImpalaSQL, GenericSQL } from 'dt-sql-parser'; ``` 在使用语法校验,自动补全等功能之前,需要先实例化对应 SQL 类,以 `MySQL` 为例: diff --git a/README.md b/README.md index 9e1c30da..37aba125 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Additionally, it provides advanced features such as **SQL Validation**, **Code C - PostgreSQL - Trino - Impala +- GenericSQL >[!TIP] >This project is the default for Typescript target, also you can try to compile it to other languages if you need. @@ -53,7 +54,7 @@ yarn add dt-sql-parser ## Usage We recommend learning the fundamentals usage before continuing. The dt-sql-parser library provides SQL classes for different types of SQL. ```javascript -import { MySQL, FlinkSQL, SparkSQL, HiveSQL, PostgreSQL, TrinoSQL, ImpalaSQL } from 'dt-sql-parser'; +import { MySQL, FlinkSQL, SparkSQL, HiveSQL, PostgreSQL, TrinoSQL, ImpalaSQL, GenericSQL } from 'dt-sql-parser'; ``` Before using syntax validation, code completion, and other features, it is necessary to instantiate the Parser of the relevant SQL type. diff --git a/src/grammar/generic/GenericSql.g4 b/src/grammar/generic/GenericSql.g4 new file mode 100644 index 00000000..d77090e6 --- /dev/null +++ b/src/grammar/generic/GenericSql.g4 @@ -0,0 +1,894 @@ +/** + * GenericSql.g4 + * 基于 Trino 裁剪,只保留核心 DML 和 DDL 语法 + */ + +// $antlr-format alignTrailingComments true, columnLimit 160, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false +// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging +// $antlr-format spaceBeforeAssignmentOperators false, keepEmptyLinesAtTheStartOfBlocks true + +grammar GenericSql; + +options { + caseInsensitive= true; + superClass= SQLParserBase; +} + +@header { +import { SQLParserBase } from '../SQLParserBase'; +} + +tokens { + DELIMITER +} + +// 入口规则 +program + : statements* EOF + ; + +statements + : singleStatement + ; + +singleStatement + : statement SEMICOLON? + ; + +// 语句规则 +statement + : queryStatement # statementDefault + | insertStatement # insert + | updateStatement # update + | deleteStatement # delete + | createTableStatement # createTable + | alterTableStatement # alterTable + | dropTableStatement # dropTable + ; + +// SELECT 语句 +queryStatement + : withClause? queryNoWith + ; + +withClause + : KW_WITH KW_RECURSIVE? namedQuery (',' namedQuery)* + ; + +namedQuery + : name=identifier KW_AS '(' queryStatement ')' + ; + +queryNoWith + : queryTerm ((KW_UNION | KW_INTERSECT | KW_EXCEPT) KW_ALL? queryTerm)* + ; + +queryTerm + : queryPrimary + ; + +queryPrimary + : querySpecification + | '(' queryStatement ')' + ; + +querySpecification + : KW_SELECT setQuantifier? selectItem (',' selectItem)* fromClause? whereClause? groupByClause? havingClause? orderByClause? limitClause? + ; + +setQuantifier + : KW_DISTINCT + | KW_ALL + ; + +selectItem + : expression (KW_AS? identifier)? + | qualifiedName '.' ASTERISK + | ASTERISK + ; + +fromClause + : KW_FROM relation (',' relation)* + ; + +relation + : left=relation joinType KW_JOIN right=relation KW_ON condition=expression # joinRelation + | aliasedRelation # simpleRelation + ; + +joinType + : KW_INNER? + | KW_LEFT KW_OUTER? + | KW_RIGHT KW_OUTER? + | KW_FULL KW_OUTER? + | KW_CROSS + ; + +aliasedRelation + : relationPrimary (KW_AS? identifier)? + ; + +relationPrimary + : tableName # tableNameRelation + | '(' queryStatement ')' # subqueryRelation + ; + +whereClause + : KW_WHERE expression + ; + +groupByClause + : KW_GROUP KW_BY setQuantifier? expression (',' expression)* + ; + +havingClause + : KW_HAVING expression + ; + +orderByClause + : KW_ORDER KW_BY sortItem (',' sortItem)* + ; + +sortItem + : expression ordering=(KW_ASC | KW_DESC)? (KW_NULLS nullOrdering=(KW_FIRST | KW_LAST))? + ; + +limitClause + : KW_LIMIT limit=expression (KW_OFFSET offset=expression)? + ; + +// INSERT 语句 +insertStatement + : KW_INSERT KW_INTO tableName columnList? queryStatement + ; + +columnList + : '(' columnRef (',' columnRef)* ')' + ; + +// UPDATE 语句 +updateStatement + : KW_UPDATE tableName KW_SET updateAssignment (',' updateAssignment)* whereClause? + ; + +updateAssignment + : columnRef EQ expression + ; + +// DELETE 语句 +deleteStatement + : KW_DELETE KW_FROM tableName whereClause? + ; + +// CREATE TABLE 语句 +createTableStatement + : KW_CREATE KW_TABLE (KW_IF KW_NOT KW_EXISTS)? tableNameCreate '(' tableElement (',' tableElement)* ')' ( + KW_WITH properties + )? + ; + +tableElement + : columnDefinition + | tableConstraint + ; + +columnDefinition + : columnRef dataType (KW_NOT KW_NULL)? (KW_DEFAULT expression)? (KW_PRIMARY KW_KEY)? + ; + +tableConstraint + : (KW_CONSTRAINT identifier)? ( + KW_PRIMARY KW_KEY '(' columnRef (',' columnRef)* ')' + | KW_UNIQUE '(' columnRef (',' columnRef)* ')' + | KW_CHECK '(' expression ')' + | KW_FOREIGN KW_KEY '(' columnRef (',' columnRef)* ')' KW_REFERENCES tableName '(' columnRef ( + ',' columnRef + )* ')' + ) + ; + +// ALTER TABLE 语句 +alterTableStatement + : KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName ( + KW_ADD KW_COLUMN (KW_IF KW_NOT KW_EXISTS)? columnDefinition + | KW_DROP KW_COLUMN (KW_IF KW_EXISTS)? columnRef + | KW_RENAME KW_TO tableNameCreate + | KW_ALTER KW_COLUMN columnRef KW_SET KW_DEFAULT expression + | KW_ALTER KW_COLUMN columnRef KW_DROP KW_DEFAULT + ) + ; + +// DROP TABLE 语句 +dropTableStatement + : KW_DROP KW_TABLE (KW_IF KW_EXISTS)? tableName + ; + +// 表达式规则 +expression + : booleanExpression + ; + +booleanExpression + : predicatedExpression # predicated + | KW_NOT booleanExpression # notExpression + | left=booleanExpression KW_AND right=booleanExpression # andExpression + | left=booleanExpression KW_OR right=booleanExpression # orExpression + ; + +predicatedExpression + : valueExpression predicate? + ; + +predicate + : comparisonOperator right=valueExpression # comparisonPredicate + | KW_NOT? KW_IN '(' expression (',' expression)* ')' # inPredicate + | KW_NOT? KW_IN '(' queryStatement ')' # inSubqueryPredicate + | KW_NOT? KW_BETWEEN lower=valueExpression KW_AND upper=valueExpression # betweenPredicate + | KW_NOT? KW_LIKE pattern=valueExpression (KW_ESCAPE escape=valueExpression)? # likePredicate + | KW_IS KW_NOT? KW_NULL # nullPredicate + | KW_IS KW_NOT? KW_DISTINCT KW_FROM right=valueExpression # distinctFromPredicate + ; + +comparisonOperator + : EQ + | NEQ + | LT + | LTE + | GT + | GTE + ; + +valueExpression + : primaryExpression # valueExpressionDefault + | operator=(MINUS | PLUS) valueExpression # arithmeticUnary + | left=valueExpression operator=(ASTERISK | SLASH | PERCENT) right=valueExpression # arithmeticBinary + | left=valueExpression operator=(PLUS | MINUS) right=valueExpression # arithmeticBinary + | left=valueExpression CONCAT right=valueExpression # concatenation + ; + +primaryExpression + : literal # literalExpression + | qualifiedName '(' (setQuantifier? expression (',' expression)*)? ')' # functionCall + | KW_CASE whenClause+ (KW_ELSE expression)? KW_END # searchedCaseExpression + | KW_CASE expression whenClause+ (KW_ELSE expression)? KW_END # simpleCaseExpression + | KW_CAST '(' expression KW_AS dataType ')' # castExpression + | KW_COALESCE '(' expression (',' expression)* ')' # coalesceExpression + | KW_NULLIF '(' valueExpression ',' valueExpression ')' # nullIfExpression + | '(' expression ')' # parenthesizedExpression + | KW_EXISTS '(' queryStatement ')' # existsExpression + | subqueryExpression # subqueryExpressionDefault + | qualifiedName # columnReference + ; + +whenClause + : KW_WHEN condition=expression KW_THEN result=expression + ; + +subqueryExpression + : '(' queryStatement ')' + ; + +// 数据类型 +dataType + : KW_BOOLEAN + | KW_TINYINT + | KW_SMALLINT + | KW_INT + | KW_INTEGER + | KW_BIGINT + | KW_FLOAT + | KW_DOUBLE + | KW_DECIMAL ('(' precision=INTEGER_VALUE (',' scale=INTEGER_VALUE)? ')')? + | KW_NUMERIC ('(' precision=INTEGER_VALUE (',' scale=INTEGER_VALUE)? ')')? + | KW_VARCHAR ('(' maxLength=INTEGER_VALUE ')')? + | KW_CHAR ('(' length=INTEGER_VALUE ')')? + | KW_TEXT + | KW_DATE + | KW_TIME + | KW_TIMESTAMP + | KW_BINARY + | KW_VARBINARY + ; + +// 属性 +properties + : '(' property (',' property)* ')' + ; + +property + : identifier EQ literal + ; + +// 字面量 +literal + : KW_NULL # nullLiteral + | KW_TRUE # booleanLiteral + | KW_FALSE # booleanLiteral + | INTEGER_VALUE # integerLiteral + | DECIMAL_VALUE # decimalLiteral + | DOUBLE_VALUE # doubleLiteral + | STRING # stringLiteral + | BINARY_LITERAL # binaryLiteral + ; + +// 标识符 +identifier + : IDENTIFIER + | DIGIT_IDENTIFIER + | QUOTED_IDENTIFIER + | BACKQUOTED_IDENTIFIER + | nonReserved + ; + +qualifiedName + : identifier ('.' identifier)* + ; + +columnRef + : identifier + ; + +tableName + : qualifiedName + ; + +tableNameCreate + : qualifiedName + ; + +// 非保留关键字 — 可以用作标识符的关键字 +// 核心结构关键字 (SELECT, FROM, WHERE, CREATE, TABLE, INSERT, UPDATE, DELETE, DROP, ALTER, SET 等) 是保留的,不能用作标识符 +nonReserved + : KW_ADD + | KW_ALL + | KW_ASC + | KW_BIGINT + | KW_BINARY + | KW_BOOLEAN + | KW_BY + | KW_CHAR + | KW_COALESCE + | KW_COLUMN + | KW_CROSS + | KW_DATE + | KW_DECIMAL + | KW_DEFAULT + | KW_DESC + | KW_DOUBLE + | KW_FALSE + | KW_FIRST + | KW_FLOAT + | KW_FULL + | KW_IF + | KW_INT + | KW_INTEGER + | KW_KEY + | KW_LAST + | KW_LEFT + | KW_LIMIT + | KW_NULLIF + | KW_NULLS + | KW_NUMERIC + | KW_OFFSET + | KW_OUTER + | KW_RIGHT + | KW_SMALLINT + | KW_TEXT + | KW_TIME + | KW_TIMESTAMP + | KW_TINYINT + | KW_TO + | KW_TRUE + | KW_UNIQUE + | KW_VARCHAR + | KW_VARBINARY + ; + +// 关键字定义 +KW_ADD + : 'ADD' + ; + +KW_ALL + : 'ALL' + ; + +KW_ALTER + : 'ALTER' + ; + +KW_AND + : 'AND' + ; + +KW_AS + : 'AS' + ; + +KW_ASC + : 'ASC' + ; + +KW_BETWEEN + : 'BETWEEN' + ; + +KW_BIGINT + : 'BIGINT' + ; + +KW_BINARY + : 'BINARY' + ; + +KW_BOOLEAN + : 'BOOLEAN' + ; + +KW_BY + : 'BY' + ; + +KW_CASE + : 'CASE' + ; + +KW_CAST + : 'CAST' + ; + +KW_CHAR + : 'CHAR' + ; + +KW_CHECK + : 'CHECK' + ; + +KW_COALESCE + : 'COALESCE' + ; + +KW_COLUMN + : 'COLUMN' + ; + +KW_CONSTRAINT + : 'CONSTRAINT' + ; + +KW_CREATE + : 'CREATE' + ; + +KW_CROSS + : 'CROSS' + ; + +KW_DATE + : 'DATE' + ; + +KW_DECIMAL + : 'DECIMAL' + ; + +KW_DEFAULT + : 'DEFAULT' + ; + +KW_DELETE + : 'DELETE' + ; + +KW_DESC + : 'DESC' + ; + +KW_DISTINCT + : 'DISTINCT' + ; + +KW_DOUBLE + : 'DOUBLE' + ; + +KW_DROP + : 'DROP' + ; + +KW_ELSE + : 'ELSE' + ; + +KW_END + : 'END' + ; + +KW_ESCAPE + : 'ESCAPE' + ; + +KW_EXCEPT + : 'EXCEPT' + ; + +KW_EXISTS + : 'EXISTS' + ; + +KW_FALSE + : 'FALSE' + ; + +KW_FIRST + : 'FIRST' + ; + +KW_FLOAT + : 'FLOAT' + ; + +KW_FOREIGN + : 'FOREIGN' + ; + +KW_FROM + : 'FROM' + ; + +KW_FULL + : 'FULL' + ; + +KW_GROUP + : 'GROUP' + ; + +KW_HAVING + : 'HAVING' + ; + +KW_IF + : 'IF' + ; + +KW_IN + : 'IN' + ; + +KW_INNER + : 'INNER' + ; + +KW_INSERT + : 'INSERT' + ; + +KW_INT + : 'INT' + ; + +KW_INTEGER + : 'INTEGER' + ; + +KW_INTERSECT + : 'INTERSECT' + ; + +KW_INTO + : 'INTO' + ; + +KW_IS + : 'IS' + ; + +KW_JOIN + : 'JOIN' + ; + +KW_KEY + : 'KEY' + ; + +KW_LAST + : 'LAST' + ; + +KW_LEFT + : 'LEFT' + ; + +KW_LIKE + : 'LIKE' + ; + +KW_LIMIT + : 'LIMIT' + ; + +KW_NOT + : 'NOT' + ; + +KW_NULL + : 'NULL' + ; + +KW_NULLIF + : 'NULLIF' + ; + +KW_NULLS + : 'NULLS' + ; + +KW_NUMERIC + : 'NUMERIC' + ; + +KW_OFFSET + : 'OFFSET' + ; + +KW_ON + : 'ON' + ; + +KW_OR + : 'OR' + ; + +KW_ORDER + : 'ORDER' + ; + +KW_OUTER + : 'OUTER' + ; + +KW_PRIMARY + : 'PRIMARY' + ; + +KW_RECURSIVE + : 'RECURSIVE' + ; + +KW_REFERENCES + : 'REFERENCES' + ; + +KW_RENAME + : 'RENAME' + ; + +KW_RIGHT + : 'RIGHT' + ; + +KW_SELECT + : 'SELECT' + ; + +KW_SET + : 'SET' + ; + +KW_SMALLINT + : 'SMALLINT' + ; + +KW_TABLE + : 'TABLE' + ; + +KW_TEXT + : 'TEXT' + ; + +KW_THEN + : 'THEN' + ; + +KW_TIME + : 'TIME' + ; + +KW_TIMESTAMP + : 'TIMESTAMP' + ; + +KW_TINYINT + : 'TINYINT' + ; + +KW_TO + : 'TO' + ; + +KW_TRUE + : 'TRUE' + ; + +KW_UNION + : 'UNION' + ; + +KW_UNIQUE + : 'UNIQUE' + ; + +KW_UPDATE + : 'UPDATE' + ; + +KW_VARCHAR + : 'VARCHAR' + ; + +KW_VARBINARY + : 'VARBINARY' + ; + +KW_WHEN + : 'WHEN' + ; + +KW_WHERE + : 'WHERE' + ; + +KW_WITH + : 'WITH' + ; + +// 运算符 +EQ + : '=' + ; + +NEQ + : '<>' + | '!=' + ; + +LT + : '<' + ; + +LTE + : '<=' + ; + +GT + : '>' + ; + +GTE + : '>=' + ; + +PLUS + : '+' + ; + +MINUS + : '-' + ; + +ASTERISK + : '*' + ; + +SLASH + : '/' + ; + +PERCENT + : '%' + ; + +CONCAT + : '||' + ; + +QUESTION_MARK + : '?' + ; + +SEMICOLON + : ';' + ; + +// 字面量 +STRING + : '\'' (~'\'' | '\'\'')* '\'' + ; + +BINARY_LITERAL + : 'X\'' (~'\'')* '\'' + ; + +INTEGER_VALUE + : DECIMAL_INTEGER + | HEXADECIMAL_INTEGER + | OCTAL_INTEGER + | BINARY_INTEGER + ; + +DECIMAL_VALUE + : DECIMAL_INTEGER '.' DECIMAL_INTEGER? + | '.' DECIMAL_INTEGER + ; + +DOUBLE_VALUE + : DIGIT+ ('.' DIGIT*)? EXPONENT + | '.' DIGIT+ EXPONENT + ; + +// 标识符 +IDENTIFIER + : (LETTER | '_') (LETTER | DIGIT | '_')* + ; + +DIGIT_IDENTIFIER + : DIGIT (LETTER | DIGIT | '_')+ + ; + +QUOTED_IDENTIFIER + : '"' (~'"' | '""')* '"' + ; + +BACKQUOTED_IDENTIFIER + : '`' (~'`' | '``')* '`' + ; + +// 片段规则 +fragment DECIMAL_INTEGER + : DIGIT ('_'? DIGIT)* + ; + +fragment HEXADECIMAL_INTEGER + : '0X' ('_'? (DIGIT | [A-F]))+ + ; + +fragment OCTAL_INTEGER + : '0O' ('_'? [0-7])+ + ; + +fragment BINARY_INTEGER + : '0B' ('_'? [01])+ + ; + +fragment EXPONENT + : 'E' [+-]? DIGIT+ + ; + +fragment DIGIT + : [0-9] + ; + +fragment LETTER + : [A-Z] + ; + +// 注释和空白 +LINE_COMMENT + : '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN) + ; + +BRACKETED_COMMENT + : '/*' .*? '*/' -> channel(HIDDEN) + ; + +WHITE_SPACE + : (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN) + ; + +// 未识别字符 +UNRECOGNIZED + : . + ; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 75cef682..5f55a9cf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,13 @@ -export { MySQL, FlinkSQL, SparkSQL, HiveSQL, PostgreSQL, TrinoSQL, ImpalaSQL } from './parser'; +export { + MySQL, + FlinkSQL, + SparkSQL, + HiveSQL, + PostgreSQL, + TrinoSQL, + ImpalaSQL, + GenericSQL, +} from './parser'; export { MySqlParserListener, @@ -15,6 +24,8 @@ export { TrinoSqlVisitor, ImpalaSqlParserListener, ImpalaSqlParserVisitor, + GenericSqlListener, + GenericSqlVisitor, } from './lib'; export { EntityContextType } from './parser/common/types'; @@ -27,6 +38,8 @@ export type { WordRange, TextSlice } from './parser/common/textAndWord'; export type { SyntaxError, ParseError, ErrorListener } from './parser/common/parseErrorListener'; +export type { GenericSQLOptions } from './parser/generic'; + export type { StmtContext, EntityContext, diff --git a/src/lib/generic/GenericSql.interp b/src/lib/generic/GenericSql.interp new file mode 100644 index 00000000..89b4dae7 --- /dev/null +++ b/src/lib/generic/GenericSql.interp @@ -0,0 +1,309 @@ +token literal names: +null +',' +'(' +')' +'.' +'ADD' +'ALL' +'ALTER' +'AND' +'AS' +'ASC' +'BETWEEN' +'BIGINT' +'BINARY' +'BOOLEAN' +'BY' +'CASE' +'CAST' +'CHAR' +'CHECK' +'COALESCE' +'COLUMN' +'CONSTRAINT' +'CREATE' +'CROSS' +'DATE' +'DECIMAL' +'DEFAULT' +'DELETE' +'DESC' +'DISTINCT' +'DOUBLE' +'DROP' +'ELSE' +'END' +'ESCAPE' +'EXCEPT' +'EXISTS' +'FALSE' +'FIRST' +'FLOAT' +'FOREIGN' +'FROM' +'FULL' +'GROUP' +'HAVING' +'IF' +'IN' +'INNER' +'INSERT' +'INT' +'INTEGER' +'INTERSECT' +'INTO' +'IS' +'JOIN' +'KEY' +'LAST' +'LEFT' +'LIKE' +'LIMIT' +'NOT' +'NULL' +'NULLIF' +'NULLS' +'NUMERIC' +'OFFSET' +'ON' +'OR' +'ORDER' +'OUTER' +'PRIMARY' +'RECURSIVE' +'REFERENCES' +'RENAME' +'RIGHT' +'SELECT' +'SET' +'SMALLINT' +'TABLE' +'TEXT' +'THEN' +'TIME' +'TIMESTAMP' +'TINYINT' +'TO' +'TRUE' +'UNION' +'UNIQUE' +'UPDATE' +'VARCHAR' +'VARBINARY' +'WHEN' +'WHERE' +'WITH' +'=' +null +'<' +'<=' +'>' +'>=' +'+' +'-' +'*' +'/' +'%' +'||' +'?' +';' +null +null +null +null +null +null +null +null +null +null +null +null +null +null + +token symbolic names: +null +null +null +null +null +KW_ADD +KW_ALL +KW_ALTER +KW_AND +KW_AS +KW_ASC +KW_BETWEEN +KW_BIGINT +KW_BINARY +KW_BOOLEAN +KW_BY +KW_CASE +KW_CAST +KW_CHAR +KW_CHECK +KW_COALESCE +KW_COLUMN +KW_CONSTRAINT +KW_CREATE +KW_CROSS +KW_DATE +KW_DECIMAL +KW_DEFAULT +KW_DELETE +KW_DESC +KW_DISTINCT +KW_DOUBLE +KW_DROP +KW_ELSE +KW_END +KW_ESCAPE +KW_EXCEPT +KW_EXISTS +KW_FALSE +KW_FIRST +KW_FLOAT +KW_FOREIGN +KW_FROM +KW_FULL +KW_GROUP +KW_HAVING +KW_IF +KW_IN +KW_INNER +KW_INSERT +KW_INT +KW_INTEGER +KW_INTERSECT +KW_INTO +KW_IS +KW_JOIN +KW_KEY +KW_LAST +KW_LEFT +KW_LIKE +KW_LIMIT +KW_NOT +KW_NULL +KW_NULLIF +KW_NULLS +KW_NUMERIC +KW_OFFSET +KW_ON +KW_OR +KW_ORDER +KW_OUTER +KW_PRIMARY +KW_RECURSIVE +KW_REFERENCES +KW_RENAME +KW_RIGHT +KW_SELECT +KW_SET +KW_SMALLINT +KW_TABLE +KW_TEXT +KW_THEN +KW_TIME +KW_TIMESTAMP +KW_TINYINT +KW_TO +KW_TRUE +KW_UNION +KW_UNIQUE +KW_UPDATE +KW_VARCHAR +KW_VARBINARY +KW_WHEN +KW_WHERE +KW_WITH +EQ +NEQ +LT +LTE +GT +GTE +PLUS +MINUS +ASTERISK +SLASH +PERCENT +CONCAT +QUESTION_MARK +SEMICOLON +STRING +BINARY_LITERAL +INTEGER_VALUE +DECIMAL_VALUE +DOUBLE_VALUE +IDENTIFIER +DIGIT_IDENTIFIER +QUOTED_IDENTIFIER +BACKQUOTED_IDENTIFIER +LINE_COMMENT +BRACKETED_COMMENT +WHITE_SPACE +UNRECOGNIZED +DELIMITER + +rule names: +program +statements +singleStatement +statement +queryStatement +withClause +namedQuery +queryNoWith +queryTerm +queryPrimary +querySpecification +setQuantifier +selectItem +fromClause +relation +joinType +aliasedRelation +relationPrimary +whereClause +groupByClause +havingClause +orderByClause +sortItem +limitClause +insertStatement +columnList +updateStatement +updateAssignment +deleteStatement +createTableStatement +tableElement +columnDefinition +tableConstraint +alterTableStatement +dropTableStatement +expression +booleanExpression +predicatedExpression +predicate +comparisonOperator +valueExpression +primaryExpression +whenClause +subqueryExpression +dataType +properties +property +literal +identifier +qualifiedName +columnRef +tableName +tableNameCreate +nonReserved + + +atn: +[4, 1, 122, 801, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 1, 0, 5, 0, 110, 8, 0, 10, 0, 12, 0, 113, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 3, 2, 121, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 130, 8, 3, 1, 4, 3, 4, 133, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 139, 8, 5, 1, 5, 1, 5, 1, 5, 5, 5, 144, 8, 5, 10, 5, 12, 5, 147, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 3, 7, 158, 8, 7, 1, 7, 5, 7, 161, 8, 7, 10, 7, 12, 7, 164, 9, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 173, 8, 9, 1, 10, 1, 10, 3, 10, 177, 8, 10, 1, 10, 1, 10, 1, 10, 5, 10, 182, 8, 10, 10, 10, 12, 10, 185, 9, 10, 1, 10, 3, 10, 188, 8, 10, 1, 10, 3, 10, 191, 8, 10, 1, 10, 3, 10, 194, 8, 10, 1, 10, 3, 10, 197, 8, 10, 1, 10, 3, 10, 200, 8, 10, 1, 10, 3, 10, 203, 8, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 209, 8, 12, 1, 12, 3, 12, 212, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 219, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 225, 8, 13, 10, 13, 12, 13, 228, 9, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 240, 8, 14, 10, 14, 12, 14, 243, 9, 14, 1, 15, 3, 15, 246, 8, 15, 1, 15, 1, 15, 3, 15, 250, 8, 15, 1, 15, 1, 15, 3, 15, 254, 8, 15, 1, 15, 1, 15, 3, 15, 258, 8, 15, 1, 15, 3, 15, 261, 8, 15, 1, 16, 1, 16, 3, 16, 265, 8, 16, 1, 16, 3, 16, 268, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 275, 8, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 3, 19, 283, 8, 19, 1, 19, 1, 19, 1, 19, 5, 19, 288, 8, 19, 10, 19, 12, 19, 291, 9, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 301, 8, 21, 10, 21, 12, 21, 304, 9, 21, 1, 22, 1, 22, 3, 22, 308, 8, 22, 1, 22, 1, 22, 3, 22, 312, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 318, 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 324, 8, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 332, 8, 25, 10, 25, 12, 25, 335, 9, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 345, 8, 26, 10, 26, 12, 26, 348, 9, 26, 1, 26, 3, 26, 351, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 361, 8, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 368, 8, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 5, 29, 375, 8, 29, 10, 29, 12, 29, 378, 9, 29, 1, 29, 1, 29, 1, 29, 3, 29, 383, 8, 29, 1, 30, 1, 30, 3, 30, 387, 8, 30, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 393, 8, 31, 1, 31, 1, 31, 3, 31, 397, 8, 31, 1, 31, 1, 31, 3, 31, 401, 8, 31, 1, 32, 1, 32, 3, 32, 405, 8, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 413, 8, 32, 10, 32, 12, 32, 416, 9, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 425, 8, 32, 10, 32, 12, 32, 428, 9, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 443, 8, 32, 10, 32, 12, 32, 446, 9, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 455, 8, 32, 10, 32, 12, 32, 458, 9, 32, 1, 32, 1, 32, 3, 32, 462, 8, 32, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 468, 8, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 476, 8, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 483, 8, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 502, 8, 33, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 508, 8, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 3, 36, 518, 8, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 5, 36, 526, 8, 36, 10, 36, 12, 36, 529, 9, 36, 1, 37, 1, 37, 3, 37, 533, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 539, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 546, 8, 38, 10, 38, 12, 38, 549, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 554, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 562, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 570, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 576, 8, 38, 1, 38, 1, 38, 3, 38, 580, 8, 38, 1, 38, 1, 38, 1, 38, 3, 38, 585, 8, 38, 1, 38, 1, 38, 1, 38, 3, 38, 590, 8, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 3, 40, 598, 8, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 5, 40, 609, 8, 40, 10, 40, 12, 40, 612, 9, 40, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 618, 8, 41, 1, 41, 1, 41, 1, 41, 5, 41, 623, 8, 41, 10, 41, 12, 41, 626, 9, 41, 3, 41, 628, 8, 41, 1, 41, 1, 41, 1, 41, 1, 41, 4, 41, 634, 8, 41, 11, 41, 12, 41, 635, 1, 41, 1, 41, 3, 41, 640, 8, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 4, 41, 647, 8, 41, 11, 41, 12, 41, 648, 1, 41, 1, 41, 3, 41, 653, 8, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 5, 41, 669, 8, 41, 10, 41, 12, 41, 672, 9, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 694, 8, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 718, 8, 44, 1, 44, 3, 44, 721, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 728, 8, 44, 1, 44, 3, 44, 731, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 737, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 743, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 751, 8, 44, 1, 45, 1, 45, 1, 45, 1, 45, 5, 45, 757, 8, 45, 10, 45, 12, 45, 760, 9, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 3, 47, 776, 8, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 783, 8, 48, 1, 49, 1, 49, 1, 49, 5, 49, 788, 8, 49, 10, 49, 12, 49, 791, 9, 49, 1, 50, 1, 50, 1, 51, 1, 51, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 0, 3, 28, 72, 80, 54, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 0, 8, 3, 0, 36, 36, 52, 52, 87, 87, 2, 0, 6, 6, 30, 30, 2, 0, 10, 10, 29, 29, 2, 0, 39, 39, 57, 57, 1, 0, 95, 100, 1, 0, 101, 102, 1, 0, 103, 105, 22, 0, 5, 6, 10, 10, 12, 15, 18, 18, 20, 21, 24, 27, 29, 29, 31, 31, 38, 40, 43, 43, 46, 46, 50, 51, 56, 58, 60, 60, 63, 66, 70, 70, 75, 75, 78, 78, 80, 80, 82, 86, 88, 88, 90, 91, 895, 0, 111, 1, 0, 0, 0, 2, 116, 1, 0, 0, 0, 4, 118, 1, 0, 0, 0, 6, 129, 1, 0, 0, 0, 8, 132, 1, 0, 0, 0, 10, 136, 1, 0, 0, 0, 12, 148, 1, 0, 0, 0, 14, 154, 1, 0, 0, 0, 16, 165, 1, 0, 0, 0, 18, 172, 1, 0, 0, 0, 20, 174, 1, 0, 0, 0, 22, 204, 1, 0, 0, 0, 24, 218, 1, 0, 0, 0, 26, 220, 1, 0, 0, 0, 28, 229, 1, 0, 0, 0, 30, 260, 1, 0, 0, 0, 32, 262, 1, 0, 0, 0, 34, 274, 1, 0, 0, 0, 36, 276, 1, 0, 0, 0, 38, 279, 1, 0, 0, 0, 40, 292, 1, 0, 0, 0, 42, 295, 1, 0, 0, 0, 44, 305, 1, 0, 0, 0, 46, 313, 1, 0, 0, 0, 48, 319, 1, 0, 0, 0, 50, 327, 1, 0, 0, 0, 52, 338, 1, 0, 0, 0, 54, 352, 1, 0, 0, 0, 56, 356, 1, 0, 0, 0, 58, 362, 1, 0, 0, 0, 60, 386, 1, 0, 0, 0, 62, 388, 1, 0, 0, 0, 64, 404, 1, 0, 0, 0, 66, 463, 1, 0, 0, 0, 68, 503, 1, 0, 0, 0, 70, 511, 1, 0, 0, 0, 72, 517, 1, 0, 0, 0, 74, 530, 1, 0, 0, 0, 76, 589, 1, 0, 0, 0, 78, 591, 1, 0, 0, 0, 80, 597, 1, 0, 0, 0, 82, 693, 1, 0, 0, 0, 84, 695, 1, 0, 0, 0, 86, 700, 1, 0, 0, 0, 88, 750, 1, 0, 0, 0, 90, 752, 1, 0, 0, 0, 92, 763, 1, 0, 0, 0, 94, 775, 1, 0, 0, 0, 96, 782, 1, 0, 0, 0, 98, 784, 1, 0, 0, 0, 100, 792, 1, 0, 0, 0, 102, 794, 1, 0, 0, 0, 104, 796, 1, 0, 0, 0, 106, 798, 1, 0, 0, 0, 108, 110, 3, 2, 1, 0, 109, 108, 1, 0, 0, 0, 110, 113, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 114, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 114, 115, 5, 0, 0, 1, 115, 1, 1, 0, 0, 0, 116, 117, 3, 4, 2, 0, 117, 3, 1, 0, 0, 0, 118, 120, 3, 6, 3, 0, 119, 121, 5, 108, 0, 0, 120, 119, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 5, 1, 0, 0, 0, 122, 130, 3, 8, 4, 0, 123, 130, 3, 48, 24, 0, 124, 130, 3, 52, 26, 0, 125, 130, 3, 56, 28, 0, 126, 130, 3, 58, 29, 0, 127, 130, 3, 66, 33, 0, 128, 130, 3, 68, 34, 0, 129, 122, 1, 0, 0, 0, 129, 123, 1, 0, 0, 0, 129, 124, 1, 0, 0, 0, 129, 125, 1, 0, 0, 0, 129, 126, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 129, 128, 1, 0, 0, 0, 130, 7, 1, 0, 0, 0, 131, 133, 3, 10, 5, 0, 132, 131, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 135, 3, 14, 7, 0, 135, 9, 1, 0, 0, 0, 136, 138, 5, 94, 0, 0, 137, 139, 5, 72, 0, 0, 138, 137, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 145, 3, 12, 6, 0, 141, 142, 5, 1, 0, 0, 142, 144, 3, 12, 6, 0, 143, 141, 1, 0, 0, 0, 144, 147, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 11, 1, 0, 0, 0, 147, 145, 1, 0, 0, 0, 148, 149, 3, 96, 48, 0, 149, 150, 5, 9, 0, 0, 150, 151, 5, 2, 0, 0, 151, 152, 3, 8, 4, 0, 152, 153, 5, 3, 0, 0, 153, 13, 1, 0, 0, 0, 154, 162, 3, 16, 8, 0, 155, 157, 7, 0, 0, 0, 156, 158, 5, 6, 0, 0, 157, 156, 1, 0, 0, 0, 157, 158, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 161, 3, 16, 8, 0, 160, 155, 1, 0, 0, 0, 161, 164, 1, 0, 0, 0, 162, 160, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 15, 1, 0, 0, 0, 164, 162, 1, 0, 0, 0, 165, 166, 3, 18, 9, 0, 166, 17, 1, 0, 0, 0, 167, 173, 3, 20, 10, 0, 168, 169, 5, 2, 0, 0, 169, 170, 3, 8, 4, 0, 170, 171, 5, 3, 0, 0, 171, 173, 1, 0, 0, 0, 172, 167, 1, 0, 0, 0, 172, 168, 1, 0, 0, 0, 173, 19, 1, 0, 0, 0, 174, 176, 5, 76, 0, 0, 175, 177, 3, 22, 11, 0, 176, 175, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 178, 1, 0, 0, 0, 178, 183, 3, 24, 12, 0, 179, 180, 5, 1, 0, 0, 180, 182, 3, 24, 12, 0, 181, 179, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 187, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 188, 3, 26, 13, 0, 187, 186, 1, 0, 0, 0, 187, 188, 1, 0, 0, 0, 188, 190, 1, 0, 0, 0, 189, 191, 3, 36, 18, 0, 190, 189, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 191, 193, 1, 0, 0, 0, 192, 194, 3, 38, 19, 0, 193, 192, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 196, 1, 0, 0, 0, 195, 197, 3, 40, 20, 0, 196, 195, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 199, 1, 0, 0, 0, 198, 200, 3, 42, 21, 0, 199, 198, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 202, 1, 0, 0, 0, 201, 203, 3, 46, 23, 0, 202, 201, 1, 0, 0, 0, 202, 203, 1, 0, 0, 0, 203, 21, 1, 0, 0, 0, 204, 205, 7, 1, 0, 0, 205, 23, 1, 0, 0, 0, 206, 211, 3, 70, 35, 0, 207, 209, 5, 9, 0, 0, 208, 207, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 212, 3, 96, 48, 0, 211, 208, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 219, 1, 0, 0, 0, 213, 214, 3, 98, 49, 0, 214, 215, 5, 4, 0, 0, 215, 216, 5, 103, 0, 0, 216, 219, 1, 0, 0, 0, 217, 219, 5, 103, 0, 0, 218, 206, 1, 0, 0, 0, 218, 213, 1, 0, 0, 0, 218, 217, 1, 0, 0, 0, 219, 25, 1, 0, 0, 0, 220, 221, 5, 42, 0, 0, 221, 226, 3, 28, 14, 0, 222, 223, 5, 1, 0, 0, 223, 225, 3, 28, 14, 0, 224, 222, 1, 0, 0, 0, 225, 228, 1, 0, 0, 0, 226, 224, 1, 0, 0, 0, 226, 227, 1, 0, 0, 0, 227, 27, 1, 0, 0, 0, 228, 226, 1, 0, 0, 0, 229, 230, 6, 14, -1, 0, 230, 231, 3, 32, 16, 0, 231, 241, 1, 0, 0, 0, 232, 233, 10, 2, 0, 0, 233, 234, 3, 30, 15, 0, 234, 235, 5, 55, 0, 0, 235, 236, 3, 28, 14, 0, 236, 237, 5, 67, 0, 0, 237, 238, 3, 70, 35, 0, 238, 240, 1, 0, 0, 0, 239, 232, 1, 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, 0, 242, 29, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 246, 5, 48, 0, 0, 245, 244, 1, 0, 0, 0, 245, 246, 1, 0, 0, 0, 246, 261, 1, 0, 0, 0, 247, 249, 5, 58, 0, 0, 248, 250, 5, 70, 0, 0, 249, 248, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 261, 1, 0, 0, 0, 251, 253, 5, 75, 0, 0, 252, 254, 5, 70, 0, 0, 253, 252, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254, 261, 1, 0, 0, 0, 255, 257, 5, 43, 0, 0, 256, 258, 5, 70, 0, 0, 257, 256, 1, 0, 0, 0, 257, 258, 1, 0, 0, 0, 258, 261, 1, 0, 0, 0, 259, 261, 5, 24, 0, 0, 260, 245, 1, 0, 0, 0, 260, 247, 1, 0, 0, 0, 260, 251, 1, 0, 0, 0, 260, 255, 1, 0, 0, 0, 260, 259, 1, 0, 0, 0, 261, 31, 1, 0, 0, 0, 262, 267, 3, 34, 17, 0, 263, 265, 5, 9, 0, 0, 264, 263, 1, 0, 0, 0, 264, 265, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 268, 3, 96, 48, 0, 267, 264, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 33, 1, 0, 0, 0, 269, 275, 3, 102, 51, 0, 270, 271, 5, 2, 0, 0, 271, 272, 3, 8, 4, 0, 272, 273, 5, 3, 0, 0, 273, 275, 1, 0, 0, 0, 274, 269, 1, 0, 0, 0, 274, 270, 1, 0, 0, 0, 275, 35, 1, 0, 0, 0, 276, 277, 5, 93, 0, 0, 277, 278, 3, 70, 35, 0, 278, 37, 1, 0, 0, 0, 279, 280, 5, 44, 0, 0, 280, 282, 5, 15, 0, 0, 281, 283, 3, 22, 11, 0, 282, 281, 1, 0, 0, 0, 282, 283, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 289, 3, 70, 35, 0, 285, 286, 5, 1, 0, 0, 286, 288, 3, 70, 35, 0, 287, 285, 1, 0, 0, 0, 288, 291, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 289, 290, 1, 0, 0, 0, 290, 39, 1, 0, 0, 0, 291, 289, 1, 0, 0, 0, 292, 293, 5, 45, 0, 0, 293, 294, 3, 70, 35, 0, 294, 41, 1, 0, 0, 0, 295, 296, 5, 69, 0, 0, 296, 297, 5, 15, 0, 0, 297, 302, 3, 44, 22, 0, 298, 299, 5, 1, 0, 0, 299, 301, 3, 44, 22, 0, 300, 298, 1, 0, 0, 0, 301, 304, 1, 0, 0, 0, 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 43, 1, 0, 0, 0, 304, 302, 1, 0, 0, 0, 305, 307, 3, 70, 35, 0, 306, 308, 7, 2, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 311, 1, 0, 0, 0, 309, 310, 5, 64, 0, 0, 310, 312, 7, 3, 0, 0, 311, 309, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 45, 1, 0, 0, 0, 313, 314, 5, 60, 0, 0, 314, 317, 3, 70, 35, 0, 315, 316, 5, 66, 0, 0, 316, 318, 3, 70, 35, 0, 317, 315, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 47, 1, 0, 0, 0, 319, 320, 5, 49, 0, 0, 320, 321, 5, 53, 0, 0, 321, 323, 3, 102, 51, 0, 322, 324, 3, 50, 25, 0, 323, 322, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 325, 1, 0, 0, 0, 325, 326, 3, 8, 4, 0, 326, 49, 1, 0, 0, 0, 327, 328, 5, 2, 0, 0, 328, 333, 3, 100, 50, 0, 329, 330, 5, 1, 0, 0, 330, 332, 3, 100, 50, 0, 331, 329, 1, 0, 0, 0, 332, 335, 1, 0, 0, 0, 333, 331, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, 334, 336, 1, 0, 0, 0, 335, 333, 1, 0, 0, 0, 336, 337, 5, 3, 0, 0, 337, 51, 1, 0, 0, 0, 338, 339, 5, 89, 0, 0, 339, 340, 3, 102, 51, 0, 340, 341, 5, 77, 0, 0, 341, 346, 3, 54, 27, 0, 342, 343, 5, 1, 0, 0, 343, 345, 3, 54, 27, 0, 344, 342, 1, 0, 0, 0, 345, 348, 1, 0, 0, 0, 346, 344, 1, 0, 0, 0, 346, 347, 1, 0, 0, 0, 347, 350, 1, 0, 0, 0, 348, 346, 1, 0, 0, 0, 349, 351, 3, 36, 18, 0, 350, 349, 1, 0, 0, 0, 350, 351, 1, 0, 0, 0, 351, 53, 1, 0, 0, 0, 352, 353, 3, 100, 50, 0, 353, 354, 5, 95, 0, 0, 354, 355, 3, 70, 35, 0, 355, 55, 1, 0, 0, 0, 356, 357, 5, 28, 0, 0, 357, 358, 5, 42, 0, 0, 358, 360, 3, 102, 51, 0, 359, 361, 3, 36, 18, 0, 360, 359, 1, 0, 0, 0, 360, 361, 1, 0, 0, 0, 361, 57, 1, 0, 0, 0, 362, 363, 5, 23, 0, 0, 363, 367, 5, 79, 0, 0, 364, 365, 5, 46, 0, 0, 365, 366, 5, 61, 0, 0, 366, 368, 5, 37, 0, 0, 367, 364, 1, 0, 0, 0, 367, 368, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 370, 3, 104, 52, 0, 370, 371, 5, 2, 0, 0, 371, 376, 3, 60, 30, 0, 372, 373, 5, 1, 0, 0, 373, 375, 3, 60, 30, 0, 374, 372, 1, 0, 0, 0, 375, 378, 1, 0, 0, 0, 376, 374, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, 377, 379, 1, 0, 0, 0, 378, 376, 1, 0, 0, 0, 379, 382, 5, 3, 0, 0, 380, 381, 5, 94, 0, 0, 381, 383, 3, 90, 45, 0, 382, 380, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 59, 1, 0, 0, 0, 384, 387, 3, 62, 31, 0, 385, 387, 3, 64, 32, 0, 386, 384, 1, 0, 0, 0, 386, 385, 1, 0, 0, 0, 387, 61, 1, 0, 0, 0, 388, 389, 3, 100, 50, 0, 389, 392, 3, 88, 44, 0, 390, 391, 5, 61, 0, 0, 391, 393, 5, 62, 0, 0, 392, 390, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 396, 1, 0, 0, 0, 394, 395, 5, 27, 0, 0, 395, 397, 3, 70, 35, 0, 396, 394, 1, 0, 0, 0, 396, 397, 1, 0, 0, 0, 397, 400, 1, 0, 0, 0, 398, 399, 5, 71, 0, 0, 399, 401, 5, 56, 0, 0, 400, 398, 1, 0, 0, 0, 400, 401, 1, 0, 0, 0, 401, 63, 1, 0, 0, 0, 402, 403, 5, 22, 0, 0, 403, 405, 3, 96, 48, 0, 404, 402, 1, 0, 0, 0, 404, 405, 1, 0, 0, 0, 405, 461, 1, 0, 0, 0, 406, 407, 5, 71, 0, 0, 407, 408, 5, 56, 0, 0, 408, 409, 5, 2, 0, 0, 409, 414, 3, 100, 50, 0, 410, 411, 5, 1, 0, 0, 411, 413, 3, 100, 50, 0, 412, 410, 1, 0, 0, 0, 413, 416, 1, 0, 0, 0, 414, 412, 1, 0, 0, 0, 414, 415, 1, 0, 0, 0, 415, 417, 1, 0, 0, 0, 416, 414, 1, 0, 0, 0, 417, 418, 5, 3, 0, 0, 418, 462, 1, 0, 0, 0, 419, 420, 5, 88, 0, 0, 420, 421, 5, 2, 0, 0, 421, 426, 3, 100, 50, 0, 422, 423, 5, 1, 0, 0, 423, 425, 3, 100, 50, 0, 424, 422, 1, 0, 0, 0, 425, 428, 1, 0, 0, 0, 426, 424, 1, 0, 0, 0, 426, 427, 1, 0, 0, 0, 427, 429, 1, 0, 0, 0, 428, 426, 1, 0, 0, 0, 429, 430, 5, 3, 0, 0, 430, 462, 1, 0, 0, 0, 431, 432, 5, 19, 0, 0, 432, 433, 5, 2, 0, 0, 433, 434, 3, 70, 35, 0, 434, 435, 5, 3, 0, 0, 435, 462, 1, 0, 0, 0, 436, 437, 5, 41, 0, 0, 437, 438, 5, 56, 0, 0, 438, 439, 5, 2, 0, 0, 439, 444, 3, 100, 50, 0, 440, 441, 5, 1, 0, 0, 441, 443, 3, 100, 50, 0, 442, 440, 1, 0, 0, 0, 443, 446, 1, 0, 0, 0, 444, 442, 1, 0, 0, 0, 444, 445, 1, 0, 0, 0, 445, 447, 1, 0, 0, 0, 446, 444, 1, 0, 0, 0, 447, 448, 5, 3, 0, 0, 448, 449, 5, 73, 0, 0, 449, 450, 3, 102, 51, 0, 450, 451, 5, 2, 0, 0, 451, 456, 3, 100, 50, 0, 452, 453, 5, 1, 0, 0, 453, 455, 3, 100, 50, 0, 454, 452, 1, 0, 0, 0, 455, 458, 1, 0, 0, 0, 456, 454, 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, 459, 1, 0, 0, 0, 458, 456, 1, 0, 0, 0, 459, 460, 5, 3, 0, 0, 460, 462, 1, 0, 0, 0, 461, 406, 1, 0, 0, 0, 461, 419, 1, 0, 0, 0, 461, 431, 1, 0, 0, 0, 461, 436, 1, 0, 0, 0, 462, 65, 1, 0, 0, 0, 463, 464, 5, 7, 0, 0, 464, 467, 5, 79, 0, 0, 465, 466, 5, 46, 0, 0, 466, 468, 5, 37, 0, 0, 467, 465, 1, 0, 0, 0, 467, 468, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 501, 3, 102, 51, 0, 470, 471, 5, 5, 0, 0, 471, 475, 5, 21, 0, 0, 472, 473, 5, 46, 0, 0, 473, 474, 5, 61, 0, 0, 474, 476, 5, 37, 0, 0, 475, 472, 1, 0, 0, 0, 475, 476, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 502, 3, 62, 31, 0, 478, 479, 5, 32, 0, 0, 479, 482, 5, 21, 0, 0, 480, 481, 5, 46, 0, 0, 481, 483, 5, 37, 0, 0, 482, 480, 1, 0, 0, 0, 482, 483, 1, 0, 0, 0, 483, 484, 1, 0, 0, 0, 484, 502, 3, 100, 50, 0, 485, 486, 5, 74, 0, 0, 486, 487, 5, 85, 0, 0, 487, 502, 3, 104, 52, 0, 488, 489, 5, 7, 0, 0, 489, 490, 5, 21, 0, 0, 490, 491, 3, 100, 50, 0, 491, 492, 5, 77, 0, 0, 492, 493, 5, 27, 0, 0, 493, 494, 3, 70, 35, 0, 494, 502, 1, 0, 0, 0, 495, 496, 5, 7, 0, 0, 496, 497, 5, 21, 0, 0, 497, 498, 3, 100, 50, 0, 498, 499, 5, 32, 0, 0, 499, 500, 5, 27, 0, 0, 500, 502, 1, 0, 0, 0, 501, 470, 1, 0, 0, 0, 501, 478, 1, 0, 0, 0, 501, 485, 1, 0, 0, 0, 501, 488, 1, 0, 0, 0, 501, 495, 1, 0, 0, 0, 502, 67, 1, 0, 0, 0, 503, 504, 5, 32, 0, 0, 504, 507, 5, 79, 0, 0, 505, 506, 5, 46, 0, 0, 506, 508, 5, 37, 0, 0, 507, 505, 1, 0, 0, 0, 507, 508, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 510, 3, 102, 51, 0, 510, 69, 1, 0, 0, 0, 511, 512, 3, 72, 36, 0, 512, 71, 1, 0, 0, 0, 513, 514, 6, 36, -1, 0, 514, 518, 3, 74, 37, 0, 515, 516, 5, 61, 0, 0, 516, 518, 3, 72, 36, 3, 517, 513, 1, 0, 0, 0, 517, 515, 1, 0, 0, 0, 518, 527, 1, 0, 0, 0, 519, 520, 10, 2, 0, 0, 520, 521, 5, 8, 0, 0, 521, 526, 3, 72, 36, 3, 522, 523, 10, 1, 0, 0, 523, 524, 5, 68, 0, 0, 524, 526, 3, 72, 36, 2, 525, 519, 1, 0, 0, 0, 525, 522, 1, 0, 0, 0, 526, 529, 1, 0, 0, 0, 527, 525, 1, 0, 0, 0, 527, 528, 1, 0, 0, 0, 528, 73, 1, 0, 0, 0, 529, 527, 1, 0, 0, 0, 530, 532, 3, 80, 40, 0, 531, 533, 3, 76, 38, 0, 532, 531, 1, 0, 0, 0, 532, 533, 1, 0, 0, 0, 533, 75, 1, 0, 0, 0, 534, 535, 3, 78, 39, 0, 535, 536, 3, 80, 40, 0, 536, 590, 1, 0, 0, 0, 537, 539, 5, 61, 0, 0, 538, 537, 1, 0, 0, 0, 538, 539, 1, 0, 0, 0, 539, 540, 1, 0, 0, 0, 540, 541, 5, 47, 0, 0, 541, 542, 5, 2, 0, 0, 542, 547, 3, 70, 35, 0, 543, 544, 5, 1, 0, 0, 544, 546, 3, 70, 35, 0, 545, 543, 1, 0, 0, 0, 546, 549, 1, 0, 0, 0, 547, 545, 1, 0, 0, 0, 547, 548, 1, 0, 0, 0, 548, 550, 1, 0, 0, 0, 549, 547, 1, 0, 0, 0, 550, 551, 5, 3, 0, 0, 551, 590, 1, 0, 0, 0, 552, 554, 5, 61, 0, 0, 553, 552, 1, 0, 0, 0, 553, 554, 1, 0, 0, 0, 554, 555, 1, 0, 0, 0, 555, 556, 5, 47, 0, 0, 556, 557, 5, 2, 0, 0, 557, 558, 3, 8, 4, 0, 558, 559, 5, 3, 0, 0, 559, 590, 1, 0, 0, 0, 560, 562, 5, 61, 0, 0, 561, 560, 1, 0, 0, 0, 561, 562, 1, 0, 0, 0, 562, 563, 1, 0, 0, 0, 563, 564, 5, 11, 0, 0, 564, 565, 3, 80, 40, 0, 565, 566, 5, 8, 0, 0, 566, 567, 3, 80, 40, 0, 567, 590, 1, 0, 0, 0, 568, 570, 5, 61, 0, 0, 569, 568, 1, 0, 0, 0, 569, 570, 1, 0, 0, 0, 570, 571, 1, 0, 0, 0, 571, 572, 5, 59, 0, 0, 572, 575, 3, 80, 40, 0, 573, 574, 5, 35, 0, 0, 574, 576, 3, 80, 40, 0, 575, 573, 1, 0, 0, 0, 575, 576, 1, 0, 0, 0, 576, 590, 1, 0, 0, 0, 577, 579, 5, 54, 0, 0, 578, 580, 5, 61, 0, 0, 579, 578, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 581, 1, 0, 0, 0, 581, 590, 5, 62, 0, 0, 582, 584, 5, 54, 0, 0, 583, 585, 5, 61, 0, 0, 584, 583, 1, 0, 0, 0, 584, 585, 1, 0, 0, 0, 585, 586, 1, 0, 0, 0, 586, 587, 5, 30, 0, 0, 587, 588, 5, 42, 0, 0, 588, 590, 3, 80, 40, 0, 589, 534, 1, 0, 0, 0, 589, 538, 1, 0, 0, 0, 589, 553, 1, 0, 0, 0, 589, 561, 1, 0, 0, 0, 589, 569, 1, 0, 0, 0, 589, 577, 1, 0, 0, 0, 589, 582, 1, 0, 0, 0, 590, 77, 1, 0, 0, 0, 591, 592, 7, 4, 0, 0, 592, 79, 1, 0, 0, 0, 593, 594, 6, 40, -1, 0, 594, 598, 3, 82, 41, 0, 595, 596, 7, 5, 0, 0, 596, 598, 3, 80, 40, 4, 597, 593, 1, 0, 0, 0, 597, 595, 1, 0, 0, 0, 598, 610, 1, 0, 0, 0, 599, 600, 10, 3, 0, 0, 600, 601, 7, 6, 0, 0, 601, 609, 3, 80, 40, 4, 602, 603, 10, 2, 0, 0, 603, 604, 7, 5, 0, 0, 604, 609, 3, 80, 40, 3, 605, 606, 10, 1, 0, 0, 606, 607, 5, 106, 0, 0, 607, 609, 3, 80, 40, 2, 608, 599, 1, 0, 0, 0, 608, 602, 1, 0, 0, 0, 608, 605, 1, 0, 0, 0, 609, 612, 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 81, 1, 0, 0, 0, 612, 610, 1, 0, 0, 0, 613, 694, 3, 94, 47, 0, 614, 615, 3, 98, 49, 0, 615, 627, 5, 2, 0, 0, 616, 618, 3, 22, 11, 0, 617, 616, 1, 0, 0, 0, 617, 618, 1, 0, 0, 0, 618, 619, 1, 0, 0, 0, 619, 624, 3, 70, 35, 0, 620, 621, 5, 1, 0, 0, 621, 623, 3, 70, 35, 0, 622, 620, 1, 0, 0, 0, 623, 626, 1, 0, 0, 0, 624, 622, 1, 0, 0, 0, 624, 625, 1, 0, 0, 0, 625, 628, 1, 0, 0, 0, 626, 624, 1, 0, 0, 0, 627, 617, 1, 0, 0, 0, 627, 628, 1, 0, 0, 0, 628, 629, 1, 0, 0, 0, 629, 630, 5, 3, 0, 0, 630, 694, 1, 0, 0, 0, 631, 633, 5, 16, 0, 0, 632, 634, 3, 84, 42, 0, 633, 632, 1, 0, 0, 0, 634, 635, 1, 0, 0, 0, 635, 633, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 639, 1, 0, 0, 0, 637, 638, 5, 33, 0, 0, 638, 640, 3, 70, 35, 0, 639, 637, 1, 0, 0, 0, 639, 640, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 642, 5, 34, 0, 0, 642, 694, 1, 0, 0, 0, 643, 644, 5, 16, 0, 0, 644, 646, 3, 70, 35, 0, 645, 647, 3, 84, 42, 0, 646, 645, 1, 0, 0, 0, 647, 648, 1, 0, 0, 0, 648, 646, 1, 0, 0, 0, 648, 649, 1, 0, 0, 0, 649, 652, 1, 0, 0, 0, 650, 651, 5, 33, 0, 0, 651, 653, 3, 70, 35, 0, 652, 650, 1, 0, 0, 0, 652, 653, 1, 0, 0, 0, 653, 654, 1, 0, 0, 0, 654, 655, 5, 34, 0, 0, 655, 694, 1, 0, 0, 0, 656, 657, 5, 17, 0, 0, 657, 658, 5, 2, 0, 0, 658, 659, 3, 70, 35, 0, 659, 660, 5, 9, 0, 0, 660, 661, 3, 88, 44, 0, 661, 662, 5, 3, 0, 0, 662, 694, 1, 0, 0, 0, 663, 664, 5, 20, 0, 0, 664, 665, 5, 2, 0, 0, 665, 670, 3, 70, 35, 0, 666, 667, 5, 1, 0, 0, 667, 669, 3, 70, 35, 0, 668, 666, 1, 0, 0, 0, 669, 672, 1, 0, 0, 0, 670, 668, 1, 0, 0, 0, 670, 671, 1, 0, 0, 0, 671, 673, 1, 0, 0, 0, 672, 670, 1, 0, 0, 0, 673, 674, 5, 3, 0, 0, 674, 694, 1, 0, 0, 0, 675, 676, 5, 63, 0, 0, 676, 677, 5, 2, 0, 0, 677, 678, 3, 80, 40, 0, 678, 679, 5, 1, 0, 0, 679, 680, 3, 80, 40, 0, 680, 681, 5, 3, 0, 0, 681, 694, 1, 0, 0, 0, 682, 683, 5, 2, 0, 0, 683, 684, 3, 70, 35, 0, 684, 685, 5, 3, 0, 0, 685, 694, 1, 0, 0, 0, 686, 687, 5, 37, 0, 0, 687, 688, 5, 2, 0, 0, 688, 689, 3, 8, 4, 0, 689, 690, 5, 3, 0, 0, 690, 694, 1, 0, 0, 0, 691, 694, 3, 86, 43, 0, 692, 694, 3, 98, 49, 0, 693, 613, 1, 0, 0, 0, 693, 614, 1, 0, 0, 0, 693, 631, 1, 0, 0, 0, 693, 643, 1, 0, 0, 0, 693, 656, 1, 0, 0, 0, 693, 663, 1, 0, 0, 0, 693, 675, 1, 0, 0, 0, 693, 682, 1, 0, 0, 0, 693, 686, 1, 0, 0, 0, 693, 691, 1, 0, 0, 0, 693, 692, 1, 0, 0, 0, 694, 83, 1, 0, 0, 0, 695, 696, 5, 92, 0, 0, 696, 697, 3, 70, 35, 0, 697, 698, 5, 81, 0, 0, 698, 699, 3, 70, 35, 0, 699, 85, 1, 0, 0, 0, 700, 701, 5, 2, 0, 0, 701, 702, 3, 8, 4, 0, 702, 703, 5, 3, 0, 0, 703, 87, 1, 0, 0, 0, 704, 751, 5, 14, 0, 0, 705, 751, 5, 84, 0, 0, 706, 751, 5, 78, 0, 0, 707, 751, 5, 50, 0, 0, 708, 751, 5, 51, 0, 0, 709, 751, 5, 12, 0, 0, 710, 751, 5, 40, 0, 0, 711, 751, 5, 31, 0, 0, 712, 720, 5, 26, 0, 0, 713, 714, 5, 2, 0, 0, 714, 717, 5, 111, 0, 0, 715, 716, 5, 1, 0, 0, 716, 718, 5, 111, 0, 0, 717, 715, 1, 0, 0, 0, 717, 718, 1, 0, 0, 0, 718, 719, 1, 0, 0, 0, 719, 721, 5, 3, 0, 0, 720, 713, 1, 0, 0, 0, 720, 721, 1, 0, 0, 0, 721, 751, 1, 0, 0, 0, 722, 730, 5, 65, 0, 0, 723, 724, 5, 2, 0, 0, 724, 727, 5, 111, 0, 0, 725, 726, 5, 1, 0, 0, 726, 728, 5, 111, 0, 0, 727, 725, 1, 0, 0, 0, 727, 728, 1, 0, 0, 0, 728, 729, 1, 0, 0, 0, 729, 731, 5, 3, 0, 0, 730, 723, 1, 0, 0, 0, 730, 731, 1, 0, 0, 0, 731, 751, 1, 0, 0, 0, 732, 736, 5, 90, 0, 0, 733, 734, 5, 2, 0, 0, 734, 735, 5, 111, 0, 0, 735, 737, 5, 3, 0, 0, 736, 733, 1, 0, 0, 0, 736, 737, 1, 0, 0, 0, 737, 751, 1, 0, 0, 0, 738, 742, 5, 18, 0, 0, 739, 740, 5, 2, 0, 0, 740, 741, 5, 111, 0, 0, 741, 743, 5, 3, 0, 0, 742, 739, 1, 0, 0, 0, 742, 743, 1, 0, 0, 0, 743, 751, 1, 0, 0, 0, 744, 751, 5, 80, 0, 0, 745, 751, 5, 25, 0, 0, 746, 751, 5, 82, 0, 0, 747, 751, 5, 83, 0, 0, 748, 751, 5, 13, 0, 0, 749, 751, 5, 91, 0, 0, 750, 704, 1, 0, 0, 0, 750, 705, 1, 0, 0, 0, 750, 706, 1, 0, 0, 0, 750, 707, 1, 0, 0, 0, 750, 708, 1, 0, 0, 0, 750, 709, 1, 0, 0, 0, 750, 710, 1, 0, 0, 0, 750, 711, 1, 0, 0, 0, 750, 712, 1, 0, 0, 0, 750, 722, 1, 0, 0, 0, 750, 732, 1, 0, 0, 0, 750, 738, 1, 0, 0, 0, 750, 744, 1, 0, 0, 0, 750, 745, 1, 0, 0, 0, 750, 746, 1, 0, 0, 0, 750, 747, 1, 0, 0, 0, 750, 748, 1, 0, 0, 0, 750, 749, 1, 0, 0, 0, 751, 89, 1, 0, 0, 0, 752, 753, 5, 2, 0, 0, 753, 758, 3, 92, 46, 0, 754, 755, 5, 1, 0, 0, 755, 757, 3, 92, 46, 0, 756, 754, 1, 0, 0, 0, 757, 760, 1, 0, 0, 0, 758, 756, 1, 0, 0, 0, 758, 759, 1, 0, 0, 0, 759, 761, 1, 0, 0, 0, 760, 758, 1, 0, 0, 0, 761, 762, 5, 3, 0, 0, 762, 91, 1, 0, 0, 0, 763, 764, 3, 96, 48, 0, 764, 765, 5, 95, 0, 0, 765, 766, 3, 94, 47, 0, 766, 93, 1, 0, 0, 0, 767, 776, 5, 62, 0, 0, 768, 776, 5, 86, 0, 0, 769, 776, 5, 38, 0, 0, 770, 776, 5, 111, 0, 0, 771, 776, 5, 112, 0, 0, 772, 776, 5, 113, 0, 0, 773, 776, 5, 109, 0, 0, 774, 776, 5, 110, 0, 0, 775, 767, 1, 0, 0, 0, 775, 768, 1, 0, 0, 0, 775, 769, 1, 0, 0, 0, 775, 770, 1, 0, 0, 0, 775, 771, 1, 0, 0, 0, 775, 772, 1, 0, 0, 0, 775, 773, 1, 0, 0, 0, 775, 774, 1, 0, 0, 0, 776, 95, 1, 0, 0, 0, 777, 783, 5, 114, 0, 0, 778, 783, 5, 115, 0, 0, 779, 783, 5, 116, 0, 0, 780, 783, 5, 117, 0, 0, 781, 783, 3, 106, 53, 0, 782, 777, 1, 0, 0, 0, 782, 778, 1, 0, 0, 0, 782, 779, 1, 0, 0, 0, 782, 780, 1, 0, 0, 0, 782, 781, 1, 0, 0, 0, 783, 97, 1, 0, 0, 0, 784, 789, 3, 96, 48, 0, 785, 786, 5, 4, 0, 0, 786, 788, 3, 96, 48, 0, 787, 785, 1, 0, 0, 0, 788, 791, 1, 0, 0, 0, 789, 787, 1, 0, 0, 0, 789, 790, 1, 0, 0, 0, 790, 99, 1, 0, 0, 0, 791, 789, 1, 0, 0, 0, 792, 793, 3, 96, 48, 0, 793, 101, 1, 0, 0, 0, 794, 795, 3, 98, 49, 0, 795, 103, 1, 0, 0, 0, 796, 797, 3, 98, 49, 0, 797, 105, 1, 0, 0, 0, 798, 799, 7, 7, 0, 0, 799, 107, 1, 0, 0, 0, 95, 111, 120, 129, 132, 138, 145, 157, 162, 172, 176, 183, 187, 190, 193, 196, 199, 202, 208, 211, 218, 226, 241, 245, 249, 253, 257, 260, 264, 267, 274, 282, 289, 302, 307, 311, 317, 323, 333, 346, 350, 360, 367, 376, 382, 386, 392, 396, 400, 404, 414, 426, 444, 456, 461, 467, 475, 482, 501, 507, 517, 525, 527, 532, 538, 547, 553, 561, 569, 575, 579, 584, 589, 597, 608, 610, 617, 624, 627, 635, 639, 648, 652, 670, 693, 717, 720, 727, 730, 736, 742, 750, 758, 775, 782, 789] \ No newline at end of file diff --git a/src/lib/generic/GenericSql.tokens b/src/lib/generic/GenericSql.tokens new file mode 100644 index 00000000..0eaa3913 --- /dev/null +++ b/src/lib/generic/GenericSql.tokens @@ -0,0 +1,229 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +KW_ADD=5 +KW_ALL=6 +KW_ALTER=7 +KW_AND=8 +KW_AS=9 +KW_ASC=10 +KW_BETWEEN=11 +KW_BIGINT=12 +KW_BINARY=13 +KW_BOOLEAN=14 +KW_BY=15 +KW_CASE=16 +KW_CAST=17 +KW_CHAR=18 +KW_CHECK=19 +KW_COALESCE=20 +KW_COLUMN=21 +KW_CONSTRAINT=22 +KW_CREATE=23 +KW_CROSS=24 +KW_DATE=25 +KW_DECIMAL=26 +KW_DEFAULT=27 +KW_DELETE=28 +KW_DESC=29 +KW_DISTINCT=30 +KW_DOUBLE=31 +KW_DROP=32 +KW_ELSE=33 +KW_END=34 +KW_ESCAPE=35 +KW_EXCEPT=36 +KW_EXISTS=37 +KW_FALSE=38 +KW_FIRST=39 +KW_FLOAT=40 +KW_FOREIGN=41 +KW_FROM=42 +KW_FULL=43 +KW_GROUP=44 +KW_HAVING=45 +KW_IF=46 +KW_IN=47 +KW_INNER=48 +KW_INSERT=49 +KW_INT=50 +KW_INTEGER=51 +KW_INTERSECT=52 +KW_INTO=53 +KW_IS=54 +KW_JOIN=55 +KW_KEY=56 +KW_LAST=57 +KW_LEFT=58 +KW_LIKE=59 +KW_LIMIT=60 +KW_NOT=61 +KW_NULL=62 +KW_NULLIF=63 +KW_NULLS=64 +KW_NUMERIC=65 +KW_OFFSET=66 +KW_ON=67 +KW_OR=68 +KW_ORDER=69 +KW_OUTER=70 +KW_PRIMARY=71 +KW_RECURSIVE=72 +KW_REFERENCES=73 +KW_RENAME=74 +KW_RIGHT=75 +KW_SELECT=76 +KW_SET=77 +KW_SMALLINT=78 +KW_TABLE=79 +KW_TEXT=80 +KW_THEN=81 +KW_TIME=82 +KW_TIMESTAMP=83 +KW_TINYINT=84 +KW_TO=85 +KW_TRUE=86 +KW_UNION=87 +KW_UNIQUE=88 +KW_UPDATE=89 +KW_VARCHAR=90 +KW_VARBINARY=91 +KW_WHEN=92 +KW_WHERE=93 +KW_WITH=94 +EQ=95 +NEQ=96 +LT=97 +LTE=98 +GT=99 +GTE=100 +PLUS=101 +MINUS=102 +ASTERISK=103 +SLASH=104 +PERCENT=105 +CONCAT=106 +QUESTION_MARK=107 +SEMICOLON=108 +STRING=109 +BINARY_LITERAL=110 +INTEGER_VALUE=111 +DECIMAL_VALUE=112 +DOUBLE_VALUE=113 +IDENTIFIER=114 +DIGIT_IDENTIFIER=115 +QUOTED_IDENTIFIER=116 +BACKQUOTED_IDENTIFIER=117 +LINE_COMMENT=118 +BRACKETED_COMMENT=119 +WHITE_SPACE=120 +UNRECOGNIZED=121 +DELIMITER=122 +','=1 +'('=2 +')'=3 +'.'=4 +'ADD'=5 +'ALL'=6 +'ALTER'=7 +'AND'=8 +'AS'=9 +'ASC'=10 +'BETWEEN'=11 +'BIGINT'=12 +'BINARY'=13 +'BOOLEAN'=14 +'BY'=15 +'CASE'=16 +'CAST'=17 +'CHAR'=18 +'CHECK'=19 +'COALESCE'=20 +'COLUMN'=21 +'CONSTRAINT'=22 +'CREATE'=23 +'CROSS'=24 +'DATE'=25 +'DECIMAL'=26 +'DEFAULT'=27 +'DELETE'=28 +'DESC'=29 +'DISTINCT'=30 +'DOUBLE'=31 +'DROP'=32 +'ELSE'=33 +'END'=34 +'ESCAPE'=35 +'EXCEPT'=36 +'EXISTS'=37 +'FALSE'=38 +'FIRST'=39 +'FLOAT'=40 +'FOREIGN'=41 +'FROM'=42 +'FULL'=43 +'GROUP'=44 +'HAVING'=45 +'IF'=46 +'IN'=47 +'INNER'=48 +'INSERT'=49 +'INT'=50 +'INTEGER'=51 +'INTERSECT'=52 +'INTO'=53 +'IS'=54 +'JOIN'=55 +'KEY'=56 +'LAST'=57 +'LEFT'=58 +'LIKE'=59 +'LIMIT'=60 +'NOT'=61 +'NULL'=62 +'NULLIF'=63 +'NULLS'=64 +'NUMERIC'=65 +'OFFSET'=66 +'ON'=67 +'OR'=68 +'ORDER'=69 +'OUTER'=70 +'PRIMARY'=71 +'RECURSIVE'=72 +'REFERENCES'=73 +'RENAME'=74 +'RIGHT'=75 +'SELECT'=76 +'SET'=77 +'SMALLINT'=78 +'TABLE'=79 +'TEXT'=80 +'THEN'=81 +'TIME'=82 +'TIMESTAMP'=83 +'TINYINT'=84 +'TO'=85 +'TRUE'=86 +'UNION'=87 +'UNIQUE'=88 +'UPDATE'=89 +'VARCHAR'=90 +'VARBINARY'=91 +'WHEN'=92 +'WHERE'=93 +'WITH'=94 +'='=95 +'<'=97 +'<='=98 +'>'=99 +'>='=100 +'+'=101 +'-'=102 +'*'=103 +'/'=104 +'%'=105 +'||'=106 +'?'=107 +';'=108 diff --git a/src/lib/generic/GenericSqlLexer.interp b/src/lib/generic/GenericSqlLexer.interp new file mode 100644 index 00000000..06bcbfcc --- /dev/null +++ b/src/lib/generic/GenericSqlLexer.interp @@ -0,0 +1,387 @@ +token literal names: +null +',' +'(' +')' +'.' +'ADD' +'ALL' +'ALTER' +'AND' +'AS' +'ASC' +'BETWEEN' +'BIGINT' +'BINARY' +'BOOLEAN' +'BY' +'CASE' +'CAST' +'CHAR' +'CHECK' +'COALESCE' +'COLUMN' +'CONSTRAINT' +'CREATE' +'CROSS' +'DATE' +'DECIMAL' +'DEFAULT' +'DELETE' +'DESC' +'DISTINCT' +'DOUBLE' +'DROP' +'ELSE' +'END' +'ESCAPE' +'EXCEPT' +'EXISTS' +'FALSE' +'FIRST' +'FLOAT' +'FOREIGN' +'FROM' +'FULL' +'GROUP' +'HAVING' +'IF' +'IN' +'INNER' +'INSERT' +'INT' +'INTEGER' +'INTERSECT' +'INTO' +'IS' +'JOIN' +'KEY' +'LAST' +'LEFT' +'LIKE' +'LIMIT' +'NOT' +'NULL' +'NULLIF' +'NULLS' +'NUMERIC' +'OFFSET' +'ON' +'OR' +'ORDER' +'OUTER' +'PRIMARY' +'RECURSIVE' +'REFERENCES' +'RENAME' +'RIGHT' +'SELECT' +'SET' +'SMALLINT' +'TABLE' +'TEXT' +'THEN' +'TIME' +'TIMESTAMP' +'TINYINT' +'TO' +'TRUE' +'UNION' +'UNIQUE' +'UPDATE' +'VARCHAR' +'VARBINARY' +'WHEN' +'WHERE' +'WITH' +'=' +null +'<' +'<=' +'>' +'>=' +'+' +'-' +'*' +'/' +'%' +'||' +'?' +';' +null +null +null +null +null +null +null +null +null +null +null +null +null + +token symbolic names: +null +null +null +null +null +KW_ADD +KW_ALL +KW_ALTER +KW_AND +KW_AS +KW_ASC +KW_BETWEEN +KW_BIGINT +KW_BINARY +KW_BOOLEAN +KW_BY +KW_CASE +KW_CAST +KW_CHAR +KW_CHECK +KW_COALESCE +KW_COLUMN +KW_CONSTRAINT +KW_CREATE +KW_CROSS +KW_DATE +KW_DECIMAL +KW_DEFAULT +KW_DELETE +KW_DESC +KW_DISTINCT +KW_DOUBLE +KW_DROP +KW_ELSE +KW_END +KW_ESCAPE +KW_EXCEPT +KW_EXISTS +KW_FALSE +KW_FIRST +KW_FLOAT +KW_FOREIGN +KW_FROM +KW_FULL +KW_GROUP +KW_HAVING +KW_IF +KW_IN +KW_INNER +KW_INSERT +KW_INT +KW_INTEGER +KW_INTERSECT +KW_INTO +KW_IS +KW_JOIN +KW_KEY +KW_LAST +KW_LEFT +KW_LIKE +KW_LIMIT +KW_NOT +KW_NULL +KW_NULLIF +KW_NULLS +KW_NUMERIC +KW_OFFSET +KW_ON +KW_OR +KW_ORDER +KW_OUTER +KW_PRIMARY +KW_RECURSIVE +KW_REFERENCES +KW_RENAME +KW_RIGHT +KW_SELECT +KW_SET +KW_SMALLINT +KW_TABLE +KW_TEXT +KW_THEN +KW_TIME +KW_TIMESTAMP +KW_TINYINT +KW_TO +KW_TRUE +KW_UNION +KW_UNIQUE +KW_UPDATE +KW_VARCHAR +KW_VARBINARY +KW_WHEN +KW_WHERE +KW_WITH +EQ +NEQ +LT +LTE +GT +GTE +PLUS +MINUS +ASTERISK +SLASH +PERCENT +CONCAT +QUESTION_MARK +SEMICOLON +STRING +BINARY_LITERAL +INTEGER_VALUE +DECIMAL_VALUE +DOUBLE_VALUE +IDENTIFIER +DIGIT_IDENTIFIER +QUOTED_IDENTIFIER +BACKQUOTED_IDENTIFIER +LINE_COMMENT +BRACKETED_COMMENT +WHITE_SPACE +UNRECOGNIZED + +rule names: +T__0 +T__1 +T__2 +T__3 +KW_ADD +KW_ALL +KW_ALTER +KW_AND +KW_AS +KW_ASC +KW_BETWEEN +KW_BIGINT +KW_BINARY +KW_BOOLEAN +KW_BY +KW_CASE +KW_CAST +KW_CHAR +KW_CHECK +KW_COALESCE +KW_COLUMN +KW_CONSTRAINT +KW_CREATE +KW_CROSS +KW_DATE +KW_DECIMAL +KW_DEFAULT +KW_DELETE +KW_DESC +KW_DISTINCT +KW_DOUBLE +KW_DROP +KW_ELSE +KW_END +KW_ESCAPE +KW_EXCEPT +KW_EXISTS +KW_FALSE +KW_FIRST +KW_FLOAT +KW_FOREIGN +KW_FROM +KW_FULL +KW_GROUP +KW_HAVING +KW_IF +KW_IN +KW_INNER +KW_INSERT +KW_INT +KW_INTEGER +KW_INTERSECT +KW_INTO +KW_IS +KW_JOIN +KW_KEY +KW_LAST +KW_LEFT +KW_LIKE +KW_LIMIT +KW_NOT +KW_NULL +KW_NULLIF +KW_NULLS +KW_NUMERIC +KW_OFFSET +KW_ON +KW_OR +KW_ORDER +KW_OUTER +KW_PRIMARY +KW_RECURSIVE +KW_REFERENCES +KW_RENAME +KW_RIGHT +KW_SELECT +KW_SET +KW_SMALLINT +KW_TABLE +KW_TEXT +KW_THEN +KW_TIME +KW_TIMESTAMP +KW_TINYINT +KW_TO +KW_TRUE +KW_UNION +KW_UNIQUE +KW_UPDATE +KW_VARCHAR +KW_VARBINARY +KW_WHEN +KW_WHERE +KW_WITH +EQ +NEQ +LT +LTE +GT +GTE +PLUS +MINUS +ASTERISK +SLASH +PERCENT +CONCAT +QUESTION_MARK +SEMICOLON +STRING +BINARY_LITERAL +INTEGER_VALUE +DECIMAL_VALUE +DOUBLE_VALUE +IDENTIFIER +DIGIT_IDENTIFIER +QUOTED_IDENTIFIER +BACKQUOTED_IDENTIFIER +DECIMAL_INTEGER +HEXADECIMAL_INTEGER +OCTAL_INTEGER +BINARY_INTEGER +EXPONENT +DIGIT +LETTER +LINE_COMMENT +BRACKETED_COMMENT +WHITE_SPACE +UNRECOGNIZED + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 121, 1050, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 3, 95, 821, 8, 95, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 101, 1, 101, 1, 102, 1, 102, 1, 103, 1, 103, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 5, 108, 854, 8, 108, 10, 108, 12, 108, 857, 9, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 5, 109, 865, 8, 109, 10, 109, 12, 109, 868, 9, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 3, 110, 876, 8, 110, 1, 111, 1, 111, 1, 111, 3, 111, 881, 8, 111, 1, 111, 1, 111, 3, 111, 885, 8, 111, 1, 112, 4, 112, 888, 8, 112, 11, 112, 12, 112, 889, 1, 112, 1, 112, 5, 112, 894, 8, 112, 10, 112, 12, 112, 897, 9, 112, 3, 112, 899, 8, 112, 1, 112, 1, 112, 1, 112, 1, 112, 4, 112, 905, 8, 112, 11, 112, 12, 112, 906, 1, 112, 1, 112, 3, 112, 911, 8, 112, 1, 113, 1, 113, 3, 113, 915, 8, 113, 1, 113, 1, 113, 1, 113, 5, 113, 920, 8, 113, 10, 113, 12, 113, 923, 9, 113, 1, 114, 1, 114, 1, 114, 1, 114, 4, 114, 929, 8, 114, 11, 114, 12, 114, 930, 1, 115, 1, 115, 1, 115, 1, 115, 5, 115, 937, 8, 115, 10, 115, 12, 115, 940, 9, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 5, 116, 948, 8, 116, 10, 116, 12, 116, 951, 9, 116, 1, 116, 1, 116, 1, 117, 1, 117, 3, 117, 957, 8, 117, 1, 117, 5, 117, 960, 8, 117, 10, 117, 12, 117, 963, 9, 117, 1, 118, 1, 118, 1, 118, 1, 118, 3, 118, 969, 8, 118, 1, 118, 1, 118, 3, 118, 973, 8, 118, 4, 118, 975, 8, 118, 11, 118, 12, 118, 976, 1, 119, 1, 119, 1, 119, 1, 119, 3, 119, 983, 8, 119, 1, 119, 4, 119, 986, 8, 119, 11, 119, 12, 119, 987, 1, 120, 1, 120, 1, 120, 1, 120, 3, 120, 994, 8, 120, 1, 120, 4, 120, 997, 8, 120, 11, 120, 12, 120, 998, 1, 121, 1, 121, 3, 121, 1003, 8, 121, 1, 121, 4, 121, 1006, 8, 121, 11, 121, 12, 121, 1007, 1, 122, 1, 122, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 5, 124, 1018, 8, 124, 10, 124, 12, 124, 1021, 9, 124, 1, 124, 3, 124, 1024, 8, 124, 1, 124, 3, 124, 1027, 8, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 5, 125, 1035, 8, 125, 10, 125, 12, 125, 1038, 9, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 1036, 0, 128, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, 231, 116, 233, 117, 235, 0, 237, 0, 239, 0, 241, 0, 243, 0, 245, 0, 247, 0, 249, 118, 251, 119, 253, 120, 255, 121, 1, 0, 36, 2, 0, 65, 65, 97, 97, 2, 0, 68, 68, 100, 100, 2, 0, 76, 76, 108, 108, 2, 0, 84, 84, 116, 116, 2, 0, 69, 69, 101, 101, 2, 0, 82, 82, 114, 114, 2, 0, 78, 78, 110, 110, 2, 0, 83, 83, 115, 115, 2, 0, 67, 67, 99, 99, 2, 0, 66, 66, 98, 98, 2, 0, 87, 87, 119, 119, 2, 0, 73, 73, 105, 105, 2, 0, 71, 71, 103, 103, 2, 0, 89, 89, 121, 121, 2, 0, 79, 79, 111, 111, 2, 0, 72, 72, 104, 104, 2, 0, 75, 75, 107, 107, 2, 0, 85, 85, 117, 117, 2, 0, 77, 77, 109, 109, 2, 0, 70, 70, 102, 102, 2, 0, 80, 80, 112, 112, 2, 0, 88, 88, 120, 120, 2, 0, 86, 86, 118, 118, 2, 0, 74, 74, 106, 106, 2, 0, 81, 81, 113, 113, 1, 0, 39, 39, 1, 0, 34, 34, 1, 0, 96, 96, 2, 0, 65, 70, 97, 102, 1, 0, 48, 55, 1, 0, 48, 49, 2, 0, 43, 43, 45, 45, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 2, 0, 10, 10, 13, 13, 3, 0, 9, 10, 13, 13, 32, 32, 1082, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 1, 257, 1, 0, 0, 0, 3, 259, 1, 0, 0, 0, 5, 261, 1, 0, 0, 0, 7, 263, 1, 0, 0, 0, 9, 265, 1, 0, 0, 0, 11, 269, 1, 0, 0, 0, 13, 273, 1, 0, 0, 0, 15, 279, 1, 0, 0, 0, 17, 283, 1, 0, 0, 0, 19, 286, 1, 0, 0, 0, 21, 290, 1, 0, 0, 0, 23, 298, 1, 0, 0, 0, 25, 305, 1, 0, 0, 0, 27, 312, 1, 0, 0, 0, 29, 320, 1, 0, 0, 0, 31, 323, 1, 0, 0, 0, 33, 328, 1, 0, 0, 0, 35, 333, 1, 0, 0, 0, 37, 338, 1, 0, 0, 0, 39, 344, 1, 0, 0, 0, 41, 353, 1, 0, 0, 0, 43, 360, 1, 0, 0, 0, 45, 371, 1, 0, 0, 0, 47, 378, 1, 0, 0, 0, 49, 384, 1, 0, 0, 0, 51, 389, 1, 0, 0, 0, 53, 397, 1, 0, 0, 0, 55, 405, 1, 0, 0, 0, 57, 412, 1, 0, 0, 0, 59, 417, 1, 0, 0, 0, 61, 426, 1, 0, 0, 0, 63, 433, 1, 0, 0, 0, 65, 438, 1, 0, 0, 0, 67, 443, 1, 0, 0, 0, 69, 447, 1, 0, 0, 0, 71, 454, 1, 0, 0, 0, 73, 461, 1, 0, 0, 0, 75, 468, 1, 0, 0, 0, 77, 474, 1, 0, 0, 0, 79, 480, 1, 0, 0, 0, 81, 486, 1, 0, 0, 0, 83, 494, 1, 0, 0, 0, 85, 499, 1, 0, 0, 0, 87, 504, 1, 0, 0, 0, 89, 510, 1, 0, 0, 0, 91, 517, 1, 0, 0, 0, 93, 520, 1, 0, 0, 0, 95, 523, 1, 0, 0, 0, 97, 529, 1, 0, 0, 0, 99, 536, 1, 0, 0, 0, 101, 540, 1, 0, 0, 0, 103, 548, 1, 0, 0, 0, 105, 558, 1, 0, 0, 0, 107, 563, 1, 0, 0, 0, 109, 566, 1, 0, 0, 0, 111, 571, 1, 0, 0, 0, 113, 575, 1, 0, 0, 0, 115, 580, 1, 0, 0, 0, 117, 585, 1, 0, 0, 0, 119, 590, 1, 0, 0, 0, 121, 596, 1, 0, 0, 0, 123, 600, 1, 0, 0, 0, 125, 605, 1, 0, 0, 0, 127, 612, 1, 0, 0, 0, 129, 618, 1, 0, 0, 0, 131, 626, 1, 0, 0, 0, 133, 633, 1, 0, 0, 0, 135, 636, 1, 0, 0, 0, 137, 639, 1, 0, 0, 0, 139, 645, 1, 0, 0, 0, 141, 651, 1, 0, 0, 0, 143, 659, 1, 0, 0, 0, 145, 669, 1, 0, 0, 0, 147, 680, 1, 0, 0, 0, 149, 687, 1, 0, 0, 0, 151, 693, 1, 0, 0, 0, 153, 700, 1, 0, 0, 0, 155, 704, 1, 0, 0, 0, 157, 713, 1, 0, 0, 0, 159, 719, 1, 0, 0, 0, 161, 724, 1, 0, 0, 0, 163, 729, 1, 0, 0, 0, 165, 734, 1, 0, 0, 0, 167, 744, 1, 0, 0, 0, 169, 752, 1, 0, 0, 0, 171, 755, 1, 0, 0, 0, 173, 760, 1, 0, 0, 0, 175, 766, 1, 0, 0, 0, 177, 773, 1, 0, 0, 0, 179, 780, 1, 0, 0, 0, 181, 788, 1, 0, 0, 0, 183, 798, 1, 0, 0, 0, 185, 803, 1, 0, 0, 0, 187, 809, 1, 0, 0, 0, 189, 814, 1, 0, 0, 0, 191, 820, 1, 0, 0, 0, 193, 822, 1, 0, 0, 0, 195, 824, 1, 0, 0, 0, 197, 827, 1, 0, 0, 0, 199, 829, 1, 0, 0, 0, 201, 832, 1, 0, 0, 0, 203, 834, 1, 0, 0, 0, 205, 836, 1, 0, 0, 0, 207, 838, 1, 0, 0, 0, 209, 840, 1, 0, 0, 0, 211, 842, 1, 0, 0, 0, 213, 845, 1, 0, 0, 0, 215, 847, 1, 0, 0, 0, 217, 849, 1, 0, 0, 0, 219, 860, 1, 0, 0, 0, 221, 875, 1, 0, 0, 0, 223, 884, 1, 0, 0, 0, 225, 910, 1, 0, 0, 0, 227, 914, 1, 0, 0, 0, 229, 924, 1, 0, 0, 0, 231, 932, 1, 0, 0, 0, 233, 943, 1, 0, 0, 0, 235, 954, 1, 0, 0, 0, 237, 964, 1, 0, 0, 0, 239, 978, 1, 0, 0, 0, 241, 989, 1, 0, 0, 0, 243, 1000, 1, 0, 0, 0, 245, 1009, 1, 0, 0, 0, 247, 1011, 1, 0, 0, 0, 249, 1013, 1, 0, 0, 0, 251, 1030, 1, 0, 0, 0, 253, 1044, 1, 0, 0, 0, 255, 1048, 1, 0, 0, 0, 257, 258, 5, 44, 0, 0, 258, 2, 1, 0, 0, 0, 259, 260, 5, 40, 0, 0, 260, 4, 1, 0, 0, 0, 261, 262, 5, 41, 0, 0, 262, 6, 1, 0, 0, 0, 263, 264, 5, 46, 0, 0, 264, 8, 1, 0, 0, 0, 265, 266, 7, 0, 0, 0, 266, 267, 7, 1, 0, 0, 267, 268, 7, 1, 0, 0, 268, 10, 1, 0, 0, 0, 269, 270, 7, 0, 0, 0, 270, 271, 7, 2, 0, 0, 271, 272, 7, 2, 0, 0, 272, 12, 1, 0, 0, 0, 273, 274, 7, 0, 0, 0, 274, 275, 7, 2, 0, 0, 275, 276, 7, 3, 0, 0, 276, 277, 7, 4, 0, 0, 277, 278, 7, 5, 0, 0, 278, 14, 1, 0, 0, 0, 279, 280, 7, 0, 0, 0, 280, 281, 7, 6, 0, 0, 281, 282, 7, 1, 0, 0, 282, 16, 1, 0, 0, 0, 283, 284, 7, 0, 0, 0, 284, 285, 7, 7, 0, 0, 285, 18, 1, 0, 0, 0, 286, 287, 7, 0, 0, 0, 287, 288, 7, 7, 0, 0, 288, 289, 7, 8, 0, 0, 289, 20, 1, 0, 0, 0, 290, 291, 7, 9, 0, 0, 291, 292, 7, 4, 0, 0, 292, 293, 7, 3, 0, 0, 293, 294, 7, 10, 0, 0, 294, 295, 7, 4, 0, 0, 295, 296, 7, 4, 0, 0, 296, 297, 7, 6, 0, 0, 297, 22, 1, 0, 0, 0, 298, 299, 7, 9, 0, 0, 299, 300, 7, 11, 0, 0, 300, 301, 7, 12, 0, 0, 301, 302, 7, 11, 0, 0, 302, 303, 7, 6, 0, 0, 303, 304, 7, 3, 0, 0, 304, 24, 1, 0, 0, 0, 305, 306, 7, 9, 0, 0, 306, 307, 7, 11, 0, 0, 307, 308, 7, 6, 0, 0, 308, 309, 7, 0, 0, 0, 309, 310, 7, 5, 0, 0, 310, 311, 7, 13, 0, 0, 311, 26, 1, 0, 0, 0, 312, 313, 7, 9, 0, 0, 313, 314, 7, 14, 0, 0, 314, 315, 7, 14, 0, 0, 315, 316, 7, 2, 0, 0, 316, 317, 7, 4, 0, 0, 317, 318, 7, 0, 0, 0, 318, 319, 7, 6, 0, 0, 319, 28, 1, 0, 0, 0, 320, 321, 7, 9, 0, 0, 321, 322, 7, 13, 0, 0, 322, 30, 1, 0, 0, 0, 323, 324, 7, 8, 0, 0, 324, 325, 7, 0, 0, 0, 325, 326, 7, 7, 0, 0, 326, 327, 7, 4, 0, 0, 327, 32, 1, 0, 0, 0, 328, 329, 7, 8, 0, 0, 329, 330, 7, 0, 0, 0, 330, 331, 7, 7, 0, 0, 331, 332, 7, 3, 0, 0, 332, 34, 1, 0, 0, 0, 333, 334, 7, 8, 0, 0, 334, 335, 7, 15, 0, 0, 335, 336, 7, 0, 0, 0, 336, 337, 7, 5, 0, 0, 337, 36, 1, 0, 0, 0, 338, 339, 7, 8, 0, 0, 339, 340, 7, 15, 0, 0, 340, 341, 7, 4, 0, 0, 341, 342, 7, 8, 0, 0, 342, 343, 7, 16, 0, 0, 343, 38, 1, 0, 0, 0, 344, 345, 7, 8, 0, 0, 345, 346, 7, 14, 0, 0, 346, 347, 7, 0, 0, 0, 347, 348, 7, 2, 0, 0, 348, 349, 7, 4, 0, 0, 349, 350, 7, 7, 0, 0, 350, 351, 7, 8, 0, 0, 351, 352, 7, 4, 0, 0, 352, 40, 1, 0, 0, 0, 353, 354, 7, 8, 0, 0, 354, 355, 7, 14, 0, 0, 355, 356, 7, 2, 0, 0, 356, 357, 7, 17, 0, 0, 357, 358, 7, 18, 0, 0, 358, 359, 7, 6, 0, 0, 359, 42, 1, 0, 0, 0, 360, 361, 7, 8, 0, 0, 361, 362, 7, 14, 0, 0, 362, 363, 7, 6, 0, 0, 363, 364, 7, 7, 0, 0, 364, 365, 7, 3, 0, 0, 365, 366, 7, 5, 0, 0, 366, 367, 7, 0, 0, 0, 367, 368, 7, 11, 0, 0, 368, 369, 7, 6, 0, 0, 369, 370, 7, 3, 0, 0, 370, 44, 1, 0, 0, 0, 371, 372, 7, 8, 0, 0, 372, 373, 7, 5, 0, 0, 373, 374, 7, 4, 0, 0, 374, 375, 7, 0, 0, 0, 375, 376, 7, 3, 0, 0, 376, 377, 7, 4, 0, 0, 377, 46, 1, 0, 0, 0, 378, 379, 7, 8, 0, 0, 379, 380, 7, 5, 0, 0, 380, 381, 7, 14, 0, 0, 381, 382, 7, 7, 0, 0, 382, 383, 7, 7, 0, 0, 383, 48, 1, 0, 0, 0, 384, 385, 7, 1, 0, 0, 385, 386, 7, 0, 0, 0, 386, 387, 7, 3, 0, 0, 387, 388, 7, 4, 0, 0, 388, 50, 1, 0, 0, 0, 389, 390, 7, 1, 0, 0, 390, 391, 7, 4, 0, 0, 391, 392, 7, 8, 0, 0, 392, 393, 7, 11, 0, 0, 393, 394, 7, 18, 0, 0, 394, 395, 7, 0, 0, 0, 395, 396, 7, 2, 0, 0, 396, 52, 1, 0, 0, 0, 397, 398, 7, 1, 0, 0, 398, 399, 7, 4, 0, 0, 399, 400, 7, 19, 0, 0, 400, 401, 7, 0, 0, 0, 401, 402, 7, 17, 0, 0, 402, 403, 7, 2, 0, 0, 403, 404, 7, 3, 0, 0, 404, 54, 1, 0, 0, 0, 405, 406, 7, 1, 0, 0, 406, 407, 7, 4, 0, 0, 407, 408, 7, 2, 0, 0, 408, 409, 7, 4, 0, 0, 409, 410, 7, 3, 0, 0, 410, 411, 7, 4, 0, 0, 411, 56, 1, 0, 0, 0, 412, 413, 7, 1, 0, 0, 413, 414, 7, 4, 0, 0, 414, 415, 7, 7, 0, 0, 415, 416, 7, 8, 0, 0, 416, 58, 1, 0, 0, 0, 417, 418, 7, 1, 0, 0, 418, 419, 7, 11, 0, 0, 419, 420, 7, 7, 0, 0, 420, 421, 7, 3, 0, 0, 421, 422, 7, 11, 0, 0, 422, 423, 7, 6, 0, 0, 423, 424, 7, 8, 0, 0, 424, 425, 7, 3, 0, 0, 425, 60, 1, 0, 0, 0, 426, 427, 7, 1, 0, 0, 427, 428, 7, 14, 0, 0, 428, 429, 7, 17, 0, 0, 429, 430, 7, 9, 0, 0, 430, 431, 7, 2, 0, 0, 431, 432, 7, 4, 0, 0, 432, 62, 1, 0, 0, 0, 433, 434, 7, 1, 0, 0, 434, 435, 7, 5, 0, 0, 435, 436, 7, 14, 0, 0, 436, 437, 7, 20, 0, 0, 437, 64, 1, 0, 0, 0, 438, 439, 7, 4, 0, 0, 439, 440, 7, 2, 0, 0, 440, 441, 7, 7, 0, 0, 441, 442, 7, 4, 0, 0, 442, 66, 1, 0, 0, 0, 443, 444, 7, 4, 0, 0, 444, 445, 7, 6, 0, 0, 445, 446, 7, 1, 0, 0, 446, 68, 1, 0, 0, 0, 447, 448, 7, 4, 0, 0, 448, 449, 7, 7, 0, 0, 449, 450, 7, 8, 0, 0, 450, 451, 7, 0, 0, 0, 451, 452, 7, 20, 0, 0, 452, 453, 7, 4, 0, 0, 453, 70, 1, 0, 0, 0, 454, 455, 7, 4, 0, 0, 455, 456, 7, 21, 0, 0, 456, 457, 7, 8, 0, 0, 457, 458, 7, 4, 0, 0, 458, 459, 7, 20, 0, 0, 459, 460, 7, 3, 0, 0, 460, 72, 1, 0, 0, 0, 461, 462, 7, 4, 0, 0, 462, 463, 7, 21, 0, 0, 463, 464, 7, 11, 0, 0, 464, 465, 7, 7, 0, 0, 465, 466, 7, 3, 0, 0, 466, 467, 7, 7, 0, 0, 467, 74, 1, 0, 0, 0, 468, 469, 7, 19, 0, 0, 469, 470, 7, 0, 0, 0, 470, 471, 7, 2, 0, 0, 471, 472, 7, 7, 0, 0, 472, 473, 7, 4, 0, 0, 473, 76, 1, 0, 0, 0, 474, 475, 7, 19, 0, 0, 475, 476, 7, 11, 0, 0, 476, 477, 7, 5, 0, 0, 477, 478, 7, 7, 0, 0, 478, 479, 7, 3, 0, 0, 479, 78, 1, 0, 0, 0, 480, 481, 7, 19, 0, 0, 481, 482, 7, 2, 0, 0, 482, 483, 7, 14, 0, 0, 483, 484, 7, 0, 0, 0, 484, 485, 7, 3, 0, 0, 485, 80, 1, 0, 0, 0, 486, 487, 7, 19, 0, 0, 487, 488, 7, 14, 0, 0, 488, 489, 7, 5, 0, 0, 489, 490, 7, 4, 0, 0, 490, 491, 7, 11, 0, 0, 491, 492, 7, 12, 0, 0, 492, 493, 7, 6, 0, 0, 493, 82, 1, 0, 0, 0, 494, 495, 7, 19, 0, 0, 495, 496, 7, 5, 0, 0, 496, 497, 7, 14, 0, 0, 497, 498, 7, 18, 0, 0, 498, 84, 1, 0, 0, 0, 499, 500, 7, 19, 0, 0, 500, 501, 7, 17, 0, 0, 501, 502, 7, 2, 0, 0, 502, 503, 7, 2, 0, 0, 503, 86, 1, 0, 0, 0, 504, 505, 7, 12, 0, 0, 505, 506, 7, 5, 0, 0, 506, 507, 7, 14, 0, 0, 507, 508, 7, 17, 0, 0, 508, 509, 7, 20, 0, 0, 509, 88, 1, 0, 0, 0, 510, 511, 7, 15, 0, 0, 511, 512, 7, 0, 0, 0, 512, 513, 7, 22, 0, 0, 513, 514, 7, 11, 0, 0, 514, 515, 7, 6, 0, 0, 515, 516, 7, 12, 0, 0, 516, 90, 1, 0, 0, 0, 517, 518, 7, 11, 0, 0, 518, 519, 7, 19, 0, 0, 519, 92, 1, 0, 0, 0, 520, 521, 7, 11, 0, 0, 521, 522, 7, 6, 0, 0, 522, 94, 1, 0, 0, 0, 523, 524, 7, 11, 0, 0, 524, 525, 7, 6, 0, 0, 525, 526, 7, 6, 0, 0, 526, 527, 7, 4, 0, 0, 527, 528, 7, 5, 0, 0, 528, 96, 1, 0, 0, 0, 529, 530, 7, 11, 0, 0, 530, 531, 7, 6, 0, 0, 531, 532, 7, 7, 0, 0, 532, 533, 7, 4, 0, 0, 533, 534, 7, 5, 0, 0, 534, 535, 7, 3, 0, 0, 535, 98, 1, 0, 0, 0, 536, 537, 7, 11, 0, 0, 537, 538, 7, 6, 0, 0, 538, 539, 7, 3, 0, 0, 539, 100, 1, 0, 0, 0, 540, 541, 7, 11, 0, 0, 541, 542, 7, 6, 0, 0, 542, 543, 7, 3, 0, 0, 543, 544, 7, 4, 0, 0, 544, 545, 7, 12, 0, 0, 545, 546, 7, 4, 0, 0, 546, 547, 7, 5, 0, 0, 547, 102, 1, 0, 0, 0, 548, 549, 7, 11, 0, 0, 549, 550, 7, 6, 0, 0, 550, 551, 7, 3, 0, 0, 551, 552, 7, 4, 0, 0, 552, 553, 7, 5, 0, 0, 553, 554, 7, 7, 0, 0, 554, 555, 7, 4, 0, 0, 555, 556, 7, 8, 0, 0, 556, 557, 7, 3, 0, 0, 557, 104, 1, 0, 0, 0, 558, 559, 7, 11, 0, 0, 559, 560, 7, 6, 0, 0, 560, 561, 7, 3, 0, 0, 561, 562, 7, 14, 0, 0, 562, 106, 1, 0, 0, 0, 563, 564, 7, 11, 0, 0, 564, 565, 7, 7, 0, 0, 565, 108, 1, 0, 0, 0, 566, 567, 7, 23, 0, 0, 567, 568, 7, 14, 0, 0, 568, 569, 7, 11, 0, 0, 569, 570, 7, 6, 0, 0, 570, 110, 1, 0, 0, 0, 571, 572, 7, 16, 0, 0, 572, 573, 7, 4, 0, 0, 573, 574, 7, 13, 0, 0, 574, 112, 1, 0, 0, 0, 575, 576, 7, 2, 0, 0, 576, 577, 7, 0, 0, 0, 577, 578, 7, 7, 0, 0, 578, 579, 7, 3, 0, 0, 579, 114, 1, 0, 0, 0, 580, 581, 7, 2, 0, 0, 581, 582, 7, 4, 0, 0, 582, 583, 7, 19, 0, 0, 583, 584, 7, 3, 0, 0, 584, 116, 1, 0, 0, 0, 585, 586, 7, 2, 0, 0, 586, 587, 7, 11, 0, 0, 587, 588, 7, 16, 0, 0, 588, 589, 7, 4, 0, 0, 589, 118, 1, 0, 0, 0, 590, 591, 7, 2, 0, 0, 591, 592, 7, 11, 0, 0, 592, 593, 7, 18, 0, 0, 593, 594, 7, 11, 0, 0, 594, 595, 7, 3, 0, 0, 595, 120, 1, 0, 0, 0, 596, 597, 7, 6, 0, 0, 597, 598, 7, 14, 0, 0, 598, 599, 7, 3, 0, 0, 599, 122, 1, 0, 0, 0, 600, 601, 7, 6, 0, 0, 601, 602, 7, 17, 0, 0, 602, 603, 7, 2, 0, 0, 603, 604, 7, 2, 0, 0, 604, 124, 1, 0, 0, 0, 605, 606, 7, 6, 0, 0, 606, 607, 7, 17, 0, 0, 607, 608, 7, 2, 0, 0, 608, 609, 7, 2, 0, 0, 609, 610, 7, 11, 0, 0, 610, 611, 7, 19, 0, 0, 611, 126, 1, 0, 0, 0, 612, 613, 7, 6, 0, 0, 613, 614, 7, 17, 0, 0, 614, 615, 7, 2, 0, 0, 615, 616, 7, 2, 0, 0, 616, 617, 7, 7, 0, 0, 617, 128, 1, 0, 0, 0, 618, 619, 7, 6, 0, 0, 619, 620, 7, 17, 0, 0, 620, 621, 7, 18, 0, 0, 621, 622, 7, 4, 0, 0, 622, 623, 7, 5, 0, 0, 623, 624, 7, 11, 0, 0, 624, 625, 7, 8, 0, 0, 625, 130, 1, 0, 0, 0, 626, 627, 7, 14, 0, 0, 627, 628, 7, 19, 0, 0, 628, 629, 7, 19, 0, 0, 629, 630, 7, 7, 0, 0, 630, 631, 7, 4, 0, 0, 631, 632, 7, 3, 0, 0, 632, 132, 1, 0, 0, 0, 633, 634, 7, 14, 0, 0, 634, 635, 7, 6, 0, 0, 635, 134, 1, 0, 0, 0, 636, 637, 7, 14, 0, 0, 637, 638, 7, 5, 0, 0, 638, 136, 1, 0, 0, 0, 639, 640, 7, 14, 0, 0, 640, 641, 7, 5, 0, 0, 641, 642, 7, 1, 0, 0, 642, 643, 7, 4, 0, 0, 643, 644, 7, 5, 0, 0, 644, 138, 1, 0, 0, 0, 645, 646, 7, 14, 0, 0, 646, 647, 7, 17, 0, 0, 647, 648, 7, 3, 0, 0, 648, 649, 7, 4, 0, 0, 649, 650, 7, 5, 0, 0, 650, 140, 1, 0, 0, 0, 651, 652, 7, 20, 0, 0, 652, 653, 7, 5, 0, 0, 653, 654, 7, 11, 0, 0, 654, 655, 7, 18, 0, 0, 655, 656, 7, 0, 0, 0, 656, 657, 7, 5, 0, 0, 657, 658, 7, 13, 0, 0, 658, 142, 1, 0, 0, 0, 659, 660, 7, 5, 0, 0, 660, 661, 7, 4, 0, 0, 661, 662, 7, 8, 0, 0, 662, 663, 7, 17, 0, 0, 663, 664, 7, 5, 0, 0, 664, 665, 7, 7, 0, 0, 665, 666, 7, 11, 0, 0, 666, 667, 7, 22, 0, 0, 667, 668, 7, 4, 0, 0, 668, 144, 1, 0, 0, 0, 669, 670, 7, 5, 0, 0, 670, 671, 7, 4, 0, 0, 671, 672, 7, 19, 0, 0, 672, 673, 7, 4, 0, 0, 673, 674, 7, 5, 0, 0, 674, 675, 7, 4, 0, 0, 675, 676, 7, 6, 0, 0, 676, 677, 7, 8, 0, 0, 677, 678, 7, 4, 0, 0, 678, 679, 7, 7, 0, 0, 679, 146, 1, 0, 0, 0, 680, 681, 7, 5, 0, 0, 681, 682, 7, 4, 0, 0, 682, 683, 7, 6, 0, 0, 683, 684, 7, 0, 0, 0, 684, 685, 7, 18, 0, 0, 685, 686, 7, 4, 0, 0, 686, 148, 1, 0, 0, 0, 687, 688, 7, 5, 0, 0, 688, 689, 7, 11, 0, 0, 689, 690, 7, 12, 0, 0, 690, 691, 7, 15, 0, 0, 691, 692, 7, 3, 0, 0, 692, 150, 1, 0, 0, 0, 693, 694, 7, 7, 0, 0, 694, 695, 7, 4, 0, 0, 695, 696, 7, 2, 0, 0, 696, 697, 7, 4, 0, 0, 697, 698, 7, 8, 0, 0, 698, 699, 7, 3, 0, 0, 699, 152, 1, 0, 0, 0, 700, 701, 7, 7, 0, 0, 701, 702, 7, 4, 0, 0, 702, 703, 7, 3, 0, 0, 703, 154, 1, 0, 0, 0, 704, 705, 7, 7, 0, 0, 705, 706, 7, 18, 0, 0, 706, 707, 7, 0, 0, 0, 707, 708, 7, 2, 0, 0, 708, 709, 7, 2, 0, 0, 709, 710, 7, 11, 0, 0, 710, 711, 7, 6, 0, 0, 711, 712, 7, 3, 0, 0, 712, 156, 1, 0, 0, 0, 713, 714, 7, 3, 0, 0, 714, 715, 7, 0, 0, 0, 715, 716, 7, 9, 0, 0, 716, 717, 7, 2, 0, 0, 717, 718, 7, 4, 0, 0, 718, 158, 1, 0, 0, 0, 719, 720, 7, 3, 0, 0, 720, 721, 7, 4, 0, 0, 721, 722, 7, 21, 0, 0, 722, 723, 7, 3, 0, 0, 723, 160, 1, 0, 0, 0, 724, 725, 7, 3, 0, 0, 725, 726, 7, 15, 0, 0, 726, 727, 7, 4, 0, 0, 727, 728, 7, 6, 0, 0, 728, 162, 1, 0, 0, 0, 729, 730, 7, 3, 0, 0, 730, 731, 7, 11, 0, 0, 731, 732, 7, 18, 0, 0, 732, 733, 7, 4, 0, 0, 733, 164, 1, 0, 0, 0, 734, 735, 7, 3, 0, 0, 735, 736, 7, 11, 0, 0, 736, 737, 7, 18, 0, 0, 737, 738, 7, 4, 0, 0, 738, 739, 7, 7, 0, 0, 739, 740, 7, 3, 0, 0, 740, 741, 7, 0, 0, 0, 741, 742, 7, 18, 0, 0, 742, 743, 7, 20, 0, 0, 743, 166, 1, 0, 0, 0, 744, 745, 7, 3, 0, 0, 745, 746, 7, 11, 0, 0, 746, 747, 7, 6, 0, 0, 747, 748, 7, 13, 0, 0, 748, 749, 7, 11, 0, 0, 749, 750, 7, 6, 0, 0, 750, 751, 7, 3, 0, 0, 751, 168, 1, 0, 0, 0, 752, 753, 7, 3, 0, 0, 753, 754, 7, 14, 0, 0, 754, 170, 1, 0, 0, 0, 755, 756, 7, 3, 0, 0, 756, 757, 7, 5, 0, 0, 757, 758, 7, 17, 0, 0, 758, 759, 7, 4, 0, 0, 759, 172, 1, 0, 0, 0, 760, 761, 7, 17, 0, 0, 761, 762, 7, 6, 0, 0, 762, 763, 7, 11, 0, 0, 763, 764, 7, 14, 0, 0, 764, 765, 7, 6, 0, 0, 765, 174, 1, 0, 0, 0, 766, 767, 7, 17, 0, 0, 767, 768, 7, 6, 0, 0, 768, 769, 7, 11, 0, 0, 769, 770, 7, 24, 0, 0, 770, 771, 7, 17, 0, 0, 771, 772, 7, 4, 0, 0, 772, 176, 1, 0, 0, 0, 773, 774, 7, 17, 0, 0, 774, 775, 7, 20, 0, 0, 775, 776, 7, 1, 0, 0, 776, 777, 7, 0, 0, 0, 777, 778, 7, 3, 0, 0, 778, 779, 7, 4, 0, 0, 779, 178, 1, 0, 0, 0, 780, 781, 7, 22, 0, 0, 781, 782, 7, 0, 0, 0, 782, 783, 7, 5, 0, 0, 783, 784, 7, 8, 0, 0, 784, 785, 7, 15, 0, 0, 785, 786, 7, 0, 0, 0, 786, 787, 7, 5, 0, 0, 787, 180, 1, 0, 0, 0, 788, 789, 7, 22, 0, 0, 789, 790, 7, 0, 0, 0, 790, 791, 7, 5, 0, 0, 791, 792, 7, 9, 0, 0, 792, 793, 7, 11, 0, 0, 793, 794, 7, 6, 0, 0, 794, 795, 7, 0, 0, 0, 795, 796, 7, 5, 0, 0, 796, 797, 7, 13, 0, 0, 797, 182, 1, 0, 0, 0, 798, 799, 7, 10, 0, 0, 799, 800, 7, 15, 0, 0, 800, 801, 7, 4, 0, 0, 801, 802, 7, 6, 0, 0, 802, 184, 1, 0, 0, 0, 803, 804, 7, 10, 0, 0, 804, 805, 7, 15, 0, 0, 805, 806, 7, 4, 0, 0, 806, 807, 7, 5, 0, 0, 807, 808, 7, 4, 0, 0, 808, 186, 1, 0, 0, 0, 809, 810, 7, 10, 0, 0, 810, 811, 7, 11, 0, 0, 811, 812, 7, 3, 0, 0, 812, 813, 7, 15, 0, 0, 813, 188, 1, 0, 0, 0, 814, 815, 5, 61, 0, 0, 815, 190, 1, 0, 0, 0, 816, 817, 5, 60, 0, 0, 817, 821, 5, 62, 0, 0, 818, 819, 5, 33, 0, 0, 819, 821, 5, 61, 0, 0, 820, 816, 1, 0, 0, 0, 820, 818, 1, 0, 0, 0, 821, 192, 1, 0, 0, 0, 822, 823, 5, 60, 0, 0, 823, 194, 1, 0, 0, 0, 824, 825, 5, 60, 0, 0, 825, 826, 5, 61, 0, 0, 826, 196, 1, 0, 0, 0, 827, 828, 5, 62, 0, 0, 828, 198, 1, 0, 0, 0, 829, 830, 5, 62, 0, 0, 830, 831, 5, 61, 0, 0, 831, 200, 1, 0, 0, 0, 832, 833, 5, 43, 0, 0, 833, 202, 1, 0, 0, 0, 834, 835, 5, 45, 0, 0, 835, 204, 1, 0, 0, 0, 836, 837, 5, 42, 0, 0, 837, 206, 1, 0, 0, 0, 838, 839, 5, 47, 0, 0, 839, 208, 1, 0, 0, 0, 840, 841, 5, 37, 0, 0, 841, 210, 1, 0, 0, 0, 842, 843, 5, 124, 0, 0, 843, 844, 5, 124, 0, 0, 844, 212, 1, 0, 0, 0, 845, 846, 5, 63, 0, 0, 846, 214, 1, 0, 0, 0, 847, 848, 5, 59, 0, 0, 848, 216, 1, 0, 0, 0, 849, 855, 5, 39, 0, 0, 850, 854, 8, 25, 0, 0, 851, 852, 5, 39, 0, 0, 852, 854, 5, 39, 0, 0, 853, 850, 1, 0, 0, 0, 853, 851, 1, 0, 0, 0, 854, 857, 1, 0, 0, 0, 855, 853, 1, 0, 0, 0, 855, 856, 1, 0, 0, 0, 856, 858, 1, 0, 0, 0, 857, 855, 1, 0, 0, 0, 858, 859, 5, 39, 0, 0, 859, 218, 1, 0, 0, 0, 860, 861, 7, 21, 0, 0, 861, 862, 5, 39, 0, 0, 862, 866, 1, 0, 0, 0, 863, 865, 8, 25, 0, 0, 864, 863, 1, 0, 0, 0, 865, 868, 1, 0, 0, 0, 866, 864, 1, 0, 0, 0, 866, 867, 1, 0, 0, 0, 867, 869, 1, 0, 0, 0, 868, 866, 1, 0, 0, 0, 869, 870, 5, 39, 0, 0, 870, 220, 1, 0, 0, 0, 871, 876, 3, 235, 117, 0, 872, 876, 3, 237, 118, 0, 873, 876, 3, 239, 119, 0, 874, 876, 3, 241, 120, 0, 875, 871, 1, 0, 0, 0, 875, 872, 1, 0, 0, 0, 875, 873, 1, 0, 0, 0, 875, 874, 1, 0, 0, 0, 876, 222, 1, 0, 0, 0, 877, 878, 3, 235, 117, 0, 878, 880, 5, 46, 0, 0, 879, 881, 3, 235, 117, 0, 880, 879, 1, 0, 0, 0, 880, 881, 1, 0, 0, 0, 881, 885, 1, 0, 0, 0, 882, 883, 5, 46, 0, 0, 883, 885, 3, 235, 117, 0, 884, 877, 1, 0, 0, 0, 884, 882, 1, 0, 0, 0, 885, 224, 1, 0, 0, 0, 886, 888, 3, 245, 122, 0, 887, 886, 1, 0, 0, 0, 888, 889, 1, 0, 0, 0, 889, 887, 1, 0, 0, 0, 889, 890, 1, 0, 0, 0, 890, 898, 1, 0, 0, 0, 891, 895, 5, 46, 0, 0, 892, 894, 3, 245, 122, 0, 893, 892, 1, 0, 0, 0, 894, 897, 1, 0, 0, 0, 895, 893, 1, 0, 0, 0, 895, 896, 1, 0, 0, 0, 896, 899, 1, 0, 0, 0, 897, 895, 1, 0, 0, 0, 898, 891, 1, 0, 0, 0, 898, 899, 1, 0, 0, 0, 899, 900, 1, 0, 0, 0, 900, 901, 3, 243, 121, 0, 901, 911, 1, 0, 0, 0, 902, 904, 5, 46, 0, 0, 903, 905, 3, 245, 122, 0, 904, 903, 1, 0, 0, 0, 905, 906, 1, 0, 0, 0, 906, 904, 1, 0, 0, 0, 906, 907, 1, 0, 0, 0, 907, 908, 1, 0, 0, 0, 908, 909, 3, 243, 121, 0, 909, 911, 1, 0, 0, 0, 910, 887, 1, 0, 0, 0, 910, 902, 1, 0, 0, 0, 911, 226, 1, 0, 0, 0, 912, 915, 3, 247, 123, 0, 913, 915, 5, 95, 0, 0, 914, 912, 1, 0, 0, 0, 914, 913, 1, 0, 0, 0, 915, 921, 1, 0, 0, 0, 916, 920, 3, 247, 123, 0, 917, 920, 3, 245, 122, 0, 918, 920, 5, 95, 0, 0, 919, 916, 1, 0, 0, 0, 919, 917, 1, 0, 0, 0, 919, 918, 1, 0, 0, 0, 920, 923, 1, 0, 0, 0, 921, 919, 1, 0, 0, 0, 921, 922, 1, 0, 0, 0, 922, 228, 1, 0, 0, 0, 923, 921, 1, 0, 0, 0, 924, 928, 3, 245, 122, 0, 925, 929, 3, 247, 123, 0, 926, 929, 3, 245, 122, 0, 927, 929, 5, 95, 0, 0, 928, 925, 1, 0, 0, 0, 928, 926, 1, 0, 0, 0, 928, 927, 1, 0, 0, 0, 929, 930, 1, 0, 0, 0, 930, 928, 1, 0, 0, 0, 930, 931, 1, 0, 0, 0, 931, 230, 1, 0, 0, 0, 932, 938, 5, 34, 0, 0, 933, 937, 8, 26, 0, 0, 934, 935, 5, 34, 0, 0, 935, 937, 5, 34, 0, 0, 936, 933, 1, 0, 0, 0, 936, 934, 1, 0, 0, 0, 937, 940, 1, 0, 0, 0, 938, 936, 1, 0, 0, 0, 938, 939, 1, 0, 0, 0, 939, 941, 1, 0, 0, 0, 940, 938, 1, 0, 0, 0, 941, 942, 5, 34, 0, 0, 942, 232, 1, 0, 0, 0, 943, 949, 5, 96, 0, 0, 944, 948, 8, 27, 0, 0, 945, 946, 5, 96, 0, 0, 946, 948, 5, 96, 0, 0, 947, 944, 1, 0, 0, 0, 947, 945, 1, 0, 0, 0, 948, 951, 1, 0, 0, 0, 949, 947, 1, 0, 0, 0, 949, 950, 1, 0, 0, 0, 950, 952, 1, 0, 0, 0, 951, 949, 1, 0, 0, 0, 952, 953, 5, 96, 0, 0, 953, 234, 1, 0, 0, 0, 954, 961, 3, 245, 122, 0, 955, 957, 5, 95, 0, 0, 956, 955, 1, 0, 0, 0, 956, 957, 1, 0, 0, 0, 957, 958, 1, 0, 0, 0, 958, 960, 3, 245, 122, 0, 959, 956, 1, 0, 0, 0, 960, 963, 1, 0, 0, 0, 961, 959, 1, 0, 0, 0, 961, 962, 1, 0, 0, 0, 962, 236, 1, 0, 0, 0, 963, 961, 1, 0, 0, 0, 964, 965, 5, 48, 0, 0, 965, 966, 7, 21, 0, 0, 966, 974, 1, 0, 0, 0, 967, 969, 5, 95, 0, 0, 968, 967, 1, 0, 0, 0, 968, 969, 1, 0, 0, 0, 969, 972, 1, 0, 0, 0, 970, 973, 3, 245, 122, 0, 971, 973, 7, 28, 0, 0, 972, 970, 1, 0, 0, 0, 972, 971, 1, 0, 0, 0, 973, 975, 1, 0, 0, 0, 974, 968, 1, 0, 0, 0, 975, 976, 1, 0, 0, 0, 976, 974, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 238, 1, 0, 0, 0, 978, 979, 5, 48, 0, 0, 979, 980, 7, 14, 0, 0, 980, 985, 1, 0, 0, 0, 981, 983, 5, 95, 0, 0, 982, 981, 1, 0, 0, 0, 982, 983, 1, 0, 0, 0, 983, 984, 1, 0, 0, 0, 984, 986, 7, 29, 0, 0, 985, 982, 1, 0, 0, 0, 986, 987, 1, 0, 0, 0, 987, 985, 1, 0, 0, 0, 987, 988, 1, 0, 0, 0, 988, 240, 1, 0, 0, 0, 989, 990, 5, 48, 0, 0, 990, 991, 7, 9, 0, 0, 991, 996, 1, 0, 0, 0, 992, 994, 5, 95, 0, 0, 993, 992, 1, 0, 0, 0, 993, 994, 1, 0, 0, 0, 994, 995, 1, 0, 0, 0, 995, 997, 7, 30, 0, 0, 996, 993, 1, 0, 0, 0, 997, 998, 1, 0, 0, 0, 998, 996, 1, 0, 0, 0, 998, 999, 1, 0, 0, 0, 999, 242, 1, 0, 0, 0, 1000, 1002, 7, 4, 0, 0, 1001, 1003, 7, 31, 0, 0, 1002, 1001, 1, 0, 0, 0, 1002, 1003, 1, 0, 0, 0, 1003, 1005, 1, 0, 0, 0, 1004, 1006, 3, 245, 122, 0, 1005, 1004, 1, 0, 0, 0, 1006, 1007, 1, 0, 0, 0, 1007, 1005, 1, 0, 0, 0, 1007, 1008, 1, 0, 0, 0, 1008, 244, 1, 0, 0, 0, 1009, 1010, 7, 32, 0, 0, 1010, 246, 1, 0, 0, 0, 1011, 1012, 7, 33, 0, 0, 1012, 248, 1, 0, 0, 0, 1013, 1014, 5, 45, 0, 0, 1014, 1015, 5, 45, 0, 0, 1015, 1019, 1, 0, 0, 0, 1016, 1018, 8, 34, 0, 0, 1017, 1016, 1, 0, 0, 0, 1018, 1021, 1, 0, 0, 0, 1019, 1017, 1, 0, 0, 0, 1019, 1020, 1, 0, 0, 0, 1020, 1023, 1, 0, 0, 0, 1021, 1019, 1, 0, 0, 0, 1022, 1024, 5, 13, 0, 0, 1023, 1022, 1, 0, 0, 0, 1023, 1024, 1, 0, 0, 0, 1024, 1026, 1, 0, 0, 0, 1025, 1027, 5, 10, 0, 0, 1026, 1025, 1, 0, 0, 0, 1026, 1027, 1, 0, 0, 0, 1027, 1028, 1, 0, 0, 0, 1028, 1029, 6, 124, 0, 0, 1029, 250, 1, 0, 0, 0, 1030, 1031, 5, 47, 0, 0, 1031, 1032, 5, 42, 0, 0, 1032, 1036, 1, 0, 0, 0, 1033, 1035, 9, 0, 0, 0, 1034, 1033, 1, 0, 0, 0, 1035, 1038, 1, 0, 0, 0, 1036, 1037, 1, 0, 0, 0, 1036, 1034, 1, 0, 0, 0, 1037, 1039, 1, 0, 0, 0, 1038, 1036, 1, 0, 0, 0, 1039, 1040, 5, 42, 0, 0, 1040, 1041, 5, 47, 0, 0, 1041, 1042, 1, 0, 0, 0, 1042, 1043, 6, 125, 0, 0, 1043, 252, 1, 0, 0, 0, 1044, 1045, 7, 35, 0, 0, 1045, 1046, 1, 0, 0, 0, 1046, 1047, 6, 126, 0, 0, 1047, 254, 1, 0, 0, 0, 1048, 1049, 9, 0, 0, 0, 1049, 256, 1, 0, 0, 0, 37, 0, 820, 853, 855, 866, 875, 880, 884, 889, 895, 898, 906, 910, 914, 919, 921, 928, 930, 936, 938, 947, 949, 956, 961, 968, 972, 976, 982, 987, 993, 998, 1002, 1007, 1019, 1023, 1026, 1036, 1, 0, 1, 0] \ No newline at end of file diff --git a/src/lib/generic/GenericSqlLexer.tokens b/src/lib/generic/GenericSqlLexer.tokens new file mode 100644 index 00000000..f323837b --- /dev/null +++ b/src/lib/generic/GenericSqlLexer.tokens @@ -0,0 +1,228 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +KW_ADD=5 +KW_ALL=6 +KW_ALTER=7 +KW_AND=8 +KW_AS=9 +KW_ASC=10 +KW_BETWEEN=11 +KW_BIGINT=12 +KW_BINARY=13 +KW_BOOLEAN=14 +KW_BY=15 +KW_CASE=16 +KW_CAST=17 +KW_CHAR=18 +KW_CHECK=19 +KW_COALESCE=20 +KW_COLUMN=21 +KW_CONSTRAINT=22 +KW_CREATE=23 +KW_CROSS=24 +KW_DATE=25 +KW_DECIMAL=26 +KW_DEFAULT=27 +KW_DELETE=28 +KW_DESC=29 +KW_DISTINCT=30 +KW_DOUBLE=31 +KW_DROP=32 +KW_ELSE=33 +KW_END=34 +KW_ESCAPE=35 +KW_EXCEPT=36 +KW_EXISTS=37 +KW_FALSE=38 +KW_FIRST=39 +KW_FLOAT=40 +KW_FOREIGN=41 +KW_FROM=42 +KW_FULL=43 +KW_GROUP=44 +KW_HAVING=45 +KW_IF=46 +KW_IN=47 +KW_INNER=48 +KW_INSERT=49 +KW_INT=50 +KW_INTEGER=51 +KW_INTERSECT=52 +KW_INTO=53 +KW_IS=54 +KW_JOIN=55 +KW_KEY=56 +KW_LAST=57 +KW_LEFT=58 +KW_LIKE=59 +KW_LIMIT=60 +KW_NOT=61 +KW_NULL=62 +KW_NULLIF=63 +KW_NULLS=64 +KW_NUMERIC=65 +KW_OFFSET=66 +KW_ON=67 +KW_OR=68 +KW_ORDER=69 +KW_OUTER=70 +KW_PRIMARY=71 +KW_RECURSIVE=72 +KW_REFERENCES=73 +KW_RENAME=74 +KW_RIGHT=75 +KW_SELECT=76 +KW_SET=77 +KW_SMALLINT=78 +KW_TABLE=79 +KW_TEXT=80 +KW_THEN=81 +KW_TIME=82 +KW_TIMESTAMP=83 +KW_TINYINT=84 +KW_TO=85 +KW_TRUE=86 +KW_UNION=87 +KW_UNIQUE=88 +KW_UPDATE=89 +KW_VARCHAR=90 +KW_VARBINARY=91 +KW_WHEN=92 +KW_WHERE=93 +KW_WITH=94 +EQ=95 +NEQ=96 +LT=97 +LTE=98 +GT=99 +GTE=100 +PLUS=101 +MINUS=102 +ASTERISK=103 +SLASH=104 +PERCENT=105 +CONCAT=106 +QUESTION_MARK=107 +SEMICOLON=108 +STRING=109 +BINARY_LITERAL=110 +INTEGER_VALUE=111 +DECIMAL_VALUE=112 +DOUBLE_VALUE=113 +IDENTIFIER=114 +DIGIT_IDENTIFIER=115 +QUOTED_IDENTIFIER=116 +BACKQUOTED_IDENTIFIER=117 +LINE_COMMENT=118 +BRACKETED_COMMENT=119 +WHITE_SPACE=120 +UNRECOGNIZED=121 +','=1 +'('=2 +')'=3 +'.'=4 +'ADD'=5 +'ALL'=6 +'ALTER'=7 +'AND'=8 +'AS'=9 +'ASC'=10 +'BETWEEN'=11 +'BIGINT'=12 +'BINARY'=13 +'BOOLEAN'=14 +'BY'=15 +'CASE'=16 +'CAST'=17 +'CHAR'=18 +'CHECK'=19 +'COALESCE'=20 +'COLUMN'=21 +'CONSTRAINT'=22 +'CREATE'=23 +'CROSS'=24 +'DATE'=25 +'DECIMAL'=26 +'DEFAULT'=27 +'DELETE'=28 +'DESC'=29 +'DISTINCT'=30 +'DOUBLE'=31 +'DROP'=32 +'ELSE'=33 +'END'=34 +'ESCAPE'=35 +'EXCEPT'=36 +'EXISTS'=37 +'FALSE'=38 +'FIRST'=39 +'FLOAT'=40 +'FOREIGN'=41 +'FROM'=42 +'FULL'=43 +'GROUP'=44 +'HAVING'=45 +'IF'=46 +'IN'=47 +'INNER'=48 +'INSERT'=49 +'INT'=50 +'INTEGER'=51 +'INTERSECT'=52 +'INTO'=53 +'IS'=54 +'JOIN'=55 +'KEY'=56 +'LAST'=57 +'LEFT'=58 +'LIKE'=59 +'LIMIT'=60 +'NOT'=61 +'NULL'=62 +'NULLIF'=63 +'NULLS'=64 +'NUMERIC'=65 +'OFFSET'=66 +'ON'=67 +'OR'=68 +'ORDER'=69 +'OUTER'=70 +'PRIMARY'=71 +'RECURSIVE'=72 +'REFERENCES'=73 +'RENAME'=74 +'RIGHT'=75 +'SELECT'=76 +'SET'=77 +'SMALLINT'=78 +'TABLE'=79 +'TEXT'=80 +'THEN'=81 +'TIME'=82 +'TIMESTAMP'=83 +'TINYINT'=84 +'TO'=85 +'TRUE'=86 +'UNION'=87 +'UNIQUE'=88 +'UPDATE'=89 +'VARCHAR'=90 +'VARBINARY'=91 +'WHEN'=92 +'WHERE'=93 +'WITH'=94 +'='=95 +'<'=97 +'<='=98 +'>'=99 +'>='=100 +'+'=101 +'-'=102 +'*'=103 +'/'=104 +'%'=105 +'||'=106 +'?'=107 +';'=108 diff --git a/src/lib/generic/GenericSqlLexer.ts b/src/lib/generic/GenericSqlLexer.ts new file mode 100644 index 00000000..fbb68a15 --- /dev/null +++ b/src/lib/generic/GenericSqlLexer.ts @@ -0,0 +1,631 @@ +// Generated from dt-sql-parser/src/grammar/generic/GenericSql.g4 by ANTLR 4.13.1 + +// @ts-nocheck + +import * as antlr from "antlr4ng"; +import { Token } from "antlr4ng"; + + +import { SQLParserBase } from '../SQLParserBase'; + + +export class GenericSqlLexer extends antlr.Lexer { + public static readonly T__0 = 1; + public static readonly T__1 = 2; + public static readonly T__2 = 3; + public static readonly T__3 = 4; + public static readonly KW_ADD = 5; + public static readonly KW_ALL = 6; + public static readonly KW_ALTER = 7; + public static readonly KW_AND = 8; + public static readonly KW_AS = 9; + public static readonly KW_ASC = 10; + public static readonly KW_BETWEEN = 11; + public static readonly KW_BIGINT = 12; + public static readonly KW_BINARY = 13; + public static readonly KW_BOOLEAN = 14; + public static readonly KW_BY = 15; + public static readonly KW_CASE = 16; + public static readonly KW_CAST = 17; + public static readonly KW_CHAR = 18; + public static readonly KW_CHECK = 19; + public static readonly KW_COALESCE = 20; + public static readonly KW_COLUMN = 21; + public static readonly KW_CONSTRAINT = 22; + public static readonly KW_CREATE = 23; + public static readonly KW_CROSS = 24; + public static readonly KW_DATE = 25; + public static readonly KW_DECIMAL = 26; + public static readonly KW_DEFAULT = 27; + public static readonly KW_DELETE = 28; + public static readonly KW_DESC = 29; + public static readonly KW_DISTINCT = 30; + public static readonly KW_DOUBLE = 31; + public static readonly KW_DROP = 32; + public static readonly KW_ELSE = 33; + public static readonly KW_END = 34; + public static readonly KW_ESCAPE = 35; + public static readonly KW_EXCEPT = 36; + public static readonly KW_EXISTS = 37; + public static readonly KW_FALSE = 38; + public static readonly KW_FIRST = 39; + public static readonly KW_FLOAT = 40; + public static readonly KW_FOREIGN = 41; + public static readonly KW_FROM = 42; + public static readonly KW_FULL = 43; + public static readonly KW_GROUP = 44; + public static readonly KW_HAVING = 45; + public static readonly KW_IF = 46; + public static readonly KW_IN = 47; + public static readonly KW_INNER = 48; + public static readonly KW_INSERT = 49; + public static readonly KW_INT = 50; + public static readonly KW_INTEGER = 51; + public static readonly KW_INTERSECT = 52; + public static readonly KW_INTO = 53; + public static readonly KW_IS = 54; + public static readonly KW_JOIN = 55; + public static readonly KW_KEY = 56; + public static readonly KW_LAST = 57; + public static readonly KW_LEFT = 58; + public static readonly KW_LIKE = 59; + public static readonly KW_LIMIT = 60; + public static readonly KW_NOT = 61; + public static readonly KW_NULL = 62; + public static readonly KW_NULLIF = 63; + public static readonly KW_NULLS = 64; + public static readonly KW_NUMERIC = 65; + public static readonly KW_OFFSET = 66; + public static readonly KW_ON = 67; + public static readonly KW_OR = 68; + public static readonly KW_ORDER = 69; + public static readonly KW_OUTER = 70; + public static readonly KW_PRIMARY = 71; + public static readonly KW_RECURSIVE = 72; + public static readonly KW_REFERENCES = 73; + public static readonly KW_RENAME = 74; + public static readonly KW_RIGHT = 75; + public static readonly KW_SELECT = 76; + public static readonly KW_SET = 77; + public static readonly KW_SMALLINT = 78; + public static readonly KW_TABLE = 79; + public static readonly KW_TEXT = 80; + public static readonly KW_THEN = 81; + public static readonly KW_TIME = 82; + public static readonly KW_TIMESTAMP = 83; + public static readonly KW_TINYINT = 84; + public static readonly KW_TO = 85; + public static readonly KW_TRUE = 86; + public static readonly KW_UNION = 87; + public static readonly KW_UNIQUE = 88; + public static readonly KW_UPDATE = 89; + public static readonly KW_VARCHAR = 90; + public static readonly KW_VARBINARY = 91; + public static readonly KW_WHEN = 92; + public static readonly KW_WHERE = 93; + public static readonly KW_WITH = 94; + public static readonly EQ = 95; + public static readonly NEQ = 96; + public static readonly LT = 97; + public static readonly LTE = 98; + public static readonly GT = 99; + public static readonly GTE = 100; + public static readonly PLUS = 101; + public static readonly MINUS = 102; + public static readonly ASTERISK = 103; + public static readonly SLASH = 104; + public static readonly PERCENT = 105; + public static readonly CONCAT = 106; + public static readonly QUESTION_MARK = 107; + public static readonly SEMICOLON = 108; + public static readonly STRING = 109; + public static readonly BINARY_LITERAL = 110; + public static readonly INTEGER_VALUE = 111; + public static readonly DECIMAL_VALUE = 112; + public static readonly DOUBLE_VALUE = 113; + public static readonly IDENTIFIER = 114; + public static readonly DIGIT_IDENTIFIER = 115; + public static readonly QUOTED_IDENTIFIER = 116; + public static readonly BACKQUOTED_IDENTIFIER = 117; + public static readonly LINE_COMMENT = 118; + public static readonly BRACKETED_COMMENT = 119; + public static readonly WHITE_SPACE = 120; + public static readonly UNRECOGNIZED = 121; + + public static readonly channelNames = [ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + ]; + + public static readonly literalNames = [ + null, "','", "'('", "')'", "'.'", "'ADD'", "'ALL'", "'ALTER'", "'AND'", + "'AS'", "'ASC'", "'BETWEEN'", "'BIGINT'", "'BINARY'", "'BOOLEAN'", + "'BY'", "'CASE'", "'CAST'", "'CHAR'", "'CHECK'", "'COALESCE'", "'COLUMN'", + "'CONSTRAINT'", "'CREATE'", "'CROSS'", "'DATE'", "'DECIMAL'", "'DEFAULT'", + "'DELETE'", "'DESC'", "'DISTINCT'", "'DOUBLE'", "'DROP'", "'ELSE'", + "'END'", "'ESCAPE'", "'EXCEPT'", "'EXISTS'", "'FALSE'", "'FIRST'", + "'FLOAT'", "'FOREIGN'", "'FROM'", "'FULL'", "'GROUP'", "'HAVING'", + "'IF'", "'IN'", "'INNER'", "'INSERT'", "'INT'", "'INTEGER'", "'INTERSECT'", + "'INTO'", "'IS'", "'JOIN'", "'KEY'", "'LAST'", "'LEFT'", "'LIKE'", + "'LIMIT'", "'NOT'", "'NULL'", "'NULLIF'", "'NULLS'", "'NUMERIC'", + "'OFFSET'", "'ON'", "'OR'", "'ORDER'", "'OUTER'", "'PRIMARY'", "'RECURSIVE'", + "'REFERENCES'", "'RENAME'", "'RIGHT'", "'SELECT'", "'SET'", "'SMALLINT'", + "'TABLE'", "'TEXT'", "'THEN'", "'TIME'", "'TIMESTAMP'", "'TINYINT'", + "'TO'", "'TRUE'", "'UNION'", "'UNIQUE'", "'UPDATE'", "'VARCHAR'", + "'VARBINARY'", "'WHEN'", "'WHERE'", "'WITH'", "'='", null, "'<'", + "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'||'", + "'?'", "';'" + ]; + + public static readonly symbolicNames = [ + null, null, null, null, null, "KW_ADD", "KW_ALL", "KW_ALTER", "KW_AND", + "KW_AS", "KW_ASC", "KW_BETWEEN", "KW_BIGINT", "KW_BINARY", "KW_BOOLEAN", + "KW_BY", "KW_CASE", "KW_CAST", "KW_CHAR", "KW_CHECK", "KW_COALESCE", + "KW_COLUMN", "KW_CONSTRAINT", "KW_CREATE", "KW_CROSS", "KW_DATE", + "KW_DECIMAL", "KW_DEFAULT", "KW_DELETE", "KW_DESC", "KW_DISTINCT", + "KW_DOUBLE", "KW_DROP", "KW_ELSE", "KW_END", "KW_ESCAPE", "KW_EXCEPT", + "KW_EXISTS", "KW_FALSE", "KW_FIRST", "KW_FLOAT", "KW_FOREIGN", "KW_FROM", + "KW_FULL", "KW_GROUP", "KW_HAVING", "KW_IF", "KW_IN", "KW_INNER", + "KW_INSERT", "KW_INT", "KW_INTEGER", "KW_INTERSECT", "KW_INTO", + "KW_IS", "KW_JOIN", "KW_KEY", "KW_LAST", "KW_LEFT", "KW_LIKE", "KW_LIMIT", + "KW_NOT", "KW_NULL", "KW_NULLIF", "KW_NULLS", "KW_NUMERIC", "KW_OFFSET", + "KW_ON", "KW_OR", "KW_ORDER", "KW_OUTER", "KW_PRIMARY", "KW_RECURSIVE", + "KW_REFERENCES", "KW_RENAME", "KW_RIGHT", "KW_SELECT", "KW_SET", + "KW_SMALLINT", "KW_TABLE", "KW_TEXT", "KW_THEN", "KW_TIME", "KW_TIMESTAMP", + "KW_TINYINT", "KW_TO", "KW_TRUE", "KW_UNION", "KW_UNIQUE", "KW_UPDATE", + "KW_VARCHAR", "KW_VARBINARY", "KW_WHEN", "KW_WHERE", "KW_WITH", + "EQ", "NEQ", "LT", "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", + "SLASH", "PERCENT", "CONCAT", "QUESTION_MARK", "SEMICOLON", "STRING", + "BINARY_LITERAL", "INTEGER_VALUE", "DECIMAL_VALUE", "DOUBLE_VALUE", + "IDENTIFIER", "DIGIT_IDENTIFIER", "QUOTED_IDENTIFIER", "BACKQUOTED_IDENTIFIER", + "LINE_COMMENT", "BRACKETED_COMMENT", "WHITE_SPACE", "UNRECOGNIZED" + ]; + + public static readonly modeNames = [ + "DEFAULT_MODE", + ]; + + public static readonly ruleNames = [ + "T__0", "T__1", "T__2", "T__3", "KW_ADD", "KW_ALL", "KW_ALTER", + "KW_AND", "KW_AS", "KW_ASC", "KW_BETWEEN", "KW_BIGINT", "KW_BINARY", + "KW_BOOLEAN", "KW_BY", "KW_CASE", "KW_CAST", "KW_CHAR", "KW_CHECK", + "KW_COALESCE", "KW_COLUMN", "KW_CONSTRAINT", "KW_CREATE", "KW_CROSS", + "KW_DATE", "KW_DECIMAL", "KW_DEFAULT", "KW_DELETE", "KW_DESC", "KW_DISTINCT", + "KW_DOUBLE", "KW_DROP", "KW_ELSE", "KW_END", "KW_ESCAPE", "KW_EXCEPT", + "KW_EXISTS", "KW_FALSE", "KW_FIRST", "KW_FLOAT", "KW_FOREIGN", "KW_FROM", + "KW_FULL", "KW_GROUP", "KW_HAVING", "KW_IF", "KW_IN", "KW_INNER", + "KW_INSERT", "KW_INT", "KW_INTEGER", "KW_INTERSECT", "KW_INTO", + "KW_IS", "KW_JOIN", "KW_KEY", "KW_LAST", "KW_LEFT", "KW_LIKE", "KW_LIMIT", + "KW_NOT", "KW_NULL", "KW_NULLIF", "KW_NULLS", "KW_NUMERIC", "KW_OFFSET", + "KW_ON", "KW_OR", "KW_ORDER", "KW_OUTER", "KW_PRIMARY", "KW_RECURSIVE", + "KW_REFERENCES", "KW_RENAME", "KW_RIGHT", "KW_SELECT", "KW_SET", + "KW_SMALLINT", "KW_TABLE", "KW_TEXT", "KW_THEN", "KW_TIME", "KW_TIMESTAMP", + "KW_TINYINT", "KW_TO", "KW_TRUE", "KW_UNION", "KW_UNIQUE", "KW_UPDATE", + "KW_VARCHAR", "KW_VARBINARY", "KW_WHEN", "KW_WHERE", "KW_WITH", + "EQ", "NEQ", "LT", "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", + "SLASH", "PERCENT", "CONCAT", "QUESTION_MARK", "SEMICOLON", "STRING", + "BINARY_LITERAL", "INTEGER_VALUE", "DECIMAL_VALUE", "DOUBLE_VALUE", + "IDENTIFIER", "DIGIT_IDENTIFIER", "QUOTED_IDENTIFIER", "BACKQUOTED_IDENTIFIER", + "DECIMAL_INTEGER", "HEXADECIMAL_INTEGER", "OCTAL_INTEGER", "BINARY_INTEGER", + "EXPONENT", "DIGIT", "LETTER", "LINE_COMMENT", "BRACKETED_COMMENT", + "WHITE_SPACE", "UNRECOGNIZED", + ]; + + + public constructor(input: antlr.CharStream) { + super(input); + this.interpreter = new antlr.LexerATNSimulator(this, GenericSqlLexer._ATN, GenericSqlLexer.decisionsToDFA, new antlr.PredictionContextCache()); + } + + public get grammarFileName(): string { return "GenericSql.g4"; } + + public get literalNames(): (string | null)[] { return GenericSqlLexer.literalNames; } + public get symbolicNames(): (string | null)[] { return GenericSqlLexer.symbolicNames; } + public get ruleNames(): string[] { return GenericSqlLexer.ruleNames; } + + public get serializedATN(): number[] { return GenericSqlLexer._serializedATN; } + + public get channelNames(): string[] { return GenericSqlLexer.channelNames; } + + public get modeNames(): string[] { return GenericSqlLexer.modeNames; } + + public static readonly _serializedATN: number[] = [ + 4,0,121,1050,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7, + 5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12, + 2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19, + 7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25, + 2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32, + 7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38, + 2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45, + 7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51, + 2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58, + 7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64, + 2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71, + 7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77, + 2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84, + 7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90, + 2,91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97, + 7,97,2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103, + 7,103,2,104,7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108, + 2,109,7,109,2,110,7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114, + 7,114,2,115,7,115,2,116,7,116,2,117,7,117,2,118,7,118,2,119,7,119, + 2,120,7,120,2,121,7,121,2,122,7,122,2,123,7,123,2,124,7,124,2,125, + 7,125,2,126,7,126,2,127,7,127,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1, + 4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1, + 7,1,7,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10, + 1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12, + 1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14, + 1,14,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17, + 1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19, + 1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,21, + 1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,22,1,22,1,22, + 1,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,23,1,24,1,24,1,24, + 1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,26,1,26,1,26, + 1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,28, + 1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,29, + 1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,32, + 1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,1,35,1,35,1,35,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36, + 1,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38, + 1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40, + 1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,42, + 1,43,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44, + 1,45,1,45,1,45,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,47,1,48, + 1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,50,1,50,1,50, + 1,50,1,50,1,50,1,50,1,50,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51, + 1,51,1,51,1,52,1,52,1,52,1,52,1,52,1,53,1,53,1,53,1,54,1,54,1,54, + 1,54,1,54,1,55,1,55,1,55,1,55,1,56,1,56,1,56,1,56,1,56,1,57,1,57, + 1,57,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,59,1,59,1,59,1,59,1,59, + 1,59,1,60,1,60,1,60,1,60,1,61,1,61,1,61,1,61,1,61,1,62,1,62,1,62, + 1,62,1,62,1,62,1,62,1,63,1,63,1,63,1,63,1,63,1,63,1,64,1,64,1,64, + 1,64,1,64,1,64,1,64,1,64,1,65,1,65,1,65,1,65,1,65,1,65,1,65,1,66, + 1,66,1,66,1,67,1,67,1,67,1,68,1,68,1,68,1,68,1,68,1,68,1,69,1,69, + 1,69,1,69,1,69,1,69,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,71, + 1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,72,1,72,1,72,1,72, + 1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,73,1,73,1,73,1,73,1,73,1,73, + 1,73,1,74,1,74,1,74,1,74,1,74,1,74,1,75,1,75,1,75,1,75,1,75,1,75, + 1,75,1,76,1,76,1,76,1,76,1,77,1,77,1,77,1,77,1,77,1,77,1,77,1,77, + 1,77,1,78,1,78,1,78,1,78,1,78,1,78,1,79,1,79,1,79,1,79,1,79,1,80, + 1,80,1,80,1,80,1,80,1,81,1,81,1,81,1,81,1,81,1,82,1,82,1,82,1,82, + 1,82,1,82,1,82,1,82,1,82,1,82,1,83,1,83,1,83,1,83,1,83,1,83,1,83, + 1,83,1,84,1,84,1,84,1,85,1,85,1,85,1,85,1,85,1,86,1,86,1,86,1,86, + 1,86,1,86,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,88,1,88,1,88,1,88, + 1,88,1,88,1,88,1,89,1,89,1,89,1,89,1,89,1,89,1,89,1,89,1,90,1,90, + 1,90,1,90,1,90,1,90,1,90,1,90,1,90,1,90,1,91,1,91,1,91,1,91,1,91, + 1,92,1,92,1,92,1,92,1,92,1,92,1,93,1,93,1,93,1,93,1,93,1,94,1,94, + 1,95,1,95,1,95,1,95,3,95,821,8,95,1,96,1,96,1,97,1,97,1,97,1,98, + 1,98,1,99,1,99,1,99,1,100,1,100,1,101,1,101,1,102,1,102,1,103,1, + 103,1,104,1,104,1,105,1,105,1,105,1,106,1,106,1,107,1,107,1,108, + 1,108,1,108,1,108,5,108,854,8,108,10,108,12,108,857,9,108,1,108, + 1,108,1,109,1,109,1,109,1,109,5,109,865,8,109,10,109,12,109,868, + 9,109,1,109,1,109,1,110,1,110,1,110,1,110,3,110,876,8,110,1,111, + 1,111,1,111,3,111,881,8,111,1,111,1,111,3,111,885,8,111,1,112,4, + 112,888,8,112,11,112,12,112,889,1,112,1,112,5,112,894,8,112,10,112, + 12,112,897,9,112,3,112,899,8,112,1,112,1,112,1,112,1,112,4,112,905, + 8,112,11,112,12,112,906,1,112,1,112,3,112,911,8,112,1,113,1,113, + 3,113,915,8,113,1,113,1,113,1,113,5,113,920,8,113,10,113,12,113, + 923,9,113,1,114,1,114,1,114,1,114,4,114,929,8,114,11,114,12,114, + 930,1,115,1,115,1,115,1,115,5,115,937,8,115,10,115,12,115,940,9, + 115,1,115,1,115,1,116,1,116,1,116,1,116,5,116,948,8,116,10,116,12, + 116,951,9,116,1,116,1,116,1,117,1,117,3,117,957,8,117,1,117,5,117, + 960,8,117,10,117,12,117,963,9,117,1,118,1,118,1,118,1,118,3,118, + 969,8,118,1,118,1,118,3,118,973,8,118,4,118,975,8,118,11,118,12, + 118,976,1,119,1,119,1,119,1,119,3,119,983,8,119,1,119,4,119,986, + 8,119,11,119,12,119,987,1,120,1,120,1,120,1,120,3,120,994,8,120, + 1,120,4,120,997,8,120,11,120,12,120,998,1,121,1,121,3,121,1003,8, + 121,1,121,4,121,1006,8,121,11,121,12,121,1007,1,122,1,122,1,123, + 1,123,1,124,1,124,1,124,1,124,5,124,1018,8,124,10,124,12,124,1021, + 9,124,1,124,3,124,1024,8,124,1,124,3,124,1027,8,124,1,124,1,124, + 1,125,1,125,1,125,1,125,5,125,1035,8,125,10,125,12,125,1038,9,125, + 1,125,1,125,1,125,1,125,1,125,1,126,1,126,1,126,1,126,1,127,1,127, + 1,1036,0,128,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11, + 23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22, + 45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33, + 67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44, + 89,45,91,46,93,47,95,48,97,49,99,50,101,51,103,52,105,53,107,54, + 109,55,111,56,113,57,115,58,117,59,119,60,121,61,123,62,125,63,127, + 64,129,65,131,66,133,67,135,68,137,69,139,70,141,71,143,72,145,73, + 147,74,149,75,151,76,153,77,155,78,157,79,159,80,161,81,163,82,165, + 83,167,84,169,85,171,86,173,87,175,88,177,89,179,90,181,91,183,92, + 185,93,187,94,189,95,191,96,193,97,195,98,197,99,199,100,201,101, + 203,102,205,103,207,104,209,105,211,106,213,107,215,108,217,109, + 219,110,221,111,223,112,225,113,227,114,229,115,231,116,233,117, + 235,0,237,0,239,0,241,0,243,0,245,0,247,0,249,118,251,119,253,120, + 255,121,1,0,36,2,0,65,65,97,97,2,0,68,68,100,100,2,0,76,76,108,108, + 2,0,84,84,116,116,2,0,69,69,101,101,2,0,82,82,114,114,2,0,78,78, + 110,110,2,0,83,83,115,115,2,0,67,67,99,99,2,0,66,66,98,98,2,0,87, + 87,119,119,2,0,73,73,105,105,2,0,71,71,103,103,2,0,89,89,121,121, + 2,0,79,79,111,111,2,0,72,72,104,104,2,0,75,75,107,107,2,0,85,85, + 117,117,2,0,77,77,109,109,2,0,70,70,102,102,2,0,80,80,112,112,2, + 0,88,88,120,120,2,0,86,86,118,118,2,0,74,74,106,106,2,0,81,81,113, + 113,1,0,39,39,1,0,34,34,1,0,96,96,2,0,65,70,97,102,1,0,48,55,1,0, + 48,49,2,0,43,43,45,45,1,0,48,57,2,0,65,90,97,122,2,0,10,10,13,13, + 3,0,9,10,13,13,32,32,1082,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0, + 7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17, + 1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27, + 1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37, + 1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47, + 1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57, + 1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67, + 1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77, + 1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87, + 1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97, + 1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0, + 107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0, + 0,0,0,117,1,0,0,0,0,119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125, + 1,0,0,0,0,127,1,0,0,0,0,129,1,0,0,0,0,131,1,0,0,0,0,133,1,0,0,0, + 0,135,1,0,0,0,0,137,1,0,0,0,0,139,1,0,0,0,0,141,1,0,0,0,0,143,1, + 0,0,0,0,145,1,0,0,0,0,147,1,0,0,0,0,149,1,0,0,0,0,151,1,0,0,0,0, + 153,1,0,0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0,0,0,0,161,1,0, + 0,0,0,163,1,0,0,0,0,165,1,0,0,0,0,167,1,0,0,0,0,169,1,0,0,0,0,171, + 1,0,0,0,0,173,1,0,0,0,0,175,1,0,0,0,0,177,1,0,0,0,0,179,1,0,0,0, + 0,181,1,0,0,0,0,183,1,0,0,0,0,185,1,0,0,0,0,187,1,0,0,0,0,189,1, + 0,0,0,0,191,1,0,0,0,0,193,1,0,0,0,0,195,1,0,0,0,0,197,1,0,0,0,0, + 199,1,0,0,0,0,201,1,0,0,0,0,203,1,0,0,0,0,205,1,0,0,0,0,207,1,0, + 0,0,0,209,1,0,0,0,0,211,1,0,0,0,0,213,1,0,0,0,0,215,1,0,0,0,0,217, + 1,0,0,0,0,219,1,0,0,0,0,221,1,0,0,0,0,223,1,0,0,0,0,225,1,0,0,0, + 0,227,1,0,0,0,0,229,1,0,0,0,0,231,1,0,0,0,0,233,1,0,0,0,0,249,1, + 0,0,0,0,251,1,0,0,0,0,253,1,0,0,0,0,255,1,0,0,0,1,257,1,0,0,0,3, + 259,1,0,0,0,5,261,1,0,0,0,7,263,1,0,0,0,9,265,1,0,0,0,11,269,1,0, + 0,0,13,273,1,0,0,0,15,279,1,0,0,0,17,283,1,0,0,0,19,286,1,0,0,0, + 21,290,1,0,0,0,23,298,1,0,0,0,25,305,1,0,0,0,27,312,1,0,0,0,29,320, + 1,0,0,0,31,323,1,0,0,0,33,328,1,0,0,0,35,333,1,0,0,0,37,338,1,0, + 0,0,39,344,1,0,0,0,41,353,1,0,0,0,43,360,1,0,0,0,45,371,1,0,0,0, + 47,378,1,0,0,0,49,384,1,0,0,0,51,389,1,0,0,0,53,397,1,0,0,0,55,405, + 1,0,0,0,57,412,1,0,0,0,59,417,1,0,0,0,61,426,1,0,0,0,63,433,1,0, + 0,0,65,438,1,0,0,0,67,443,1,0,0,0,69,447,1,0,0,0,71,454,1,0,0,0, + 73,461,1,0,0,0,75,468,1,0,0,0,77,474,1,0,0,0,79,480,1,0,0,0,81,486, + 1,0,0,0,83,494,1,0,0,0,85,499,1,0,0,0,87,504,1,0,0,0,89,510,1,0, + 0,0,91,517,1,0,0,0,93,520,1,0,0,0,95,523,1,0,0,0,97,529,1,0,0,0, + 99,536,1,0,0,0,101,540,1,0,0,0,103,548,1,0,0,0,105,558,1,0,0,0,107, + 563,1,0,0,0,109,566,1,0,0,0,111,571,1,0,0,0,113,575,1,0,0,0,115, + 580,1,0,0,0,117,585,1,0,0,0,119,590,1,0,0,0,121,596,1,0,0,0,123, + 600,1,0,0,0,125,605,1,0,0,0,127,612,1,0,0,0,129,618,1,0,0,0,131, + 626,1,0,0,0,133,633,1,0,0,0,135,636,1,0,0,0,137,639,1,0,0,0,139, + 645,1,0,0,0,141,651,1,0,0,0,143,659,1,0,0,0,145,669,1,0,0,0,147, + 680,1,0,0,0,149,687,1,0,0,0,151,693,1,0,0,0,153,700,1,0,0,0,155, + 704,1,0,0,0,157,713,1,0,0,0,159,719,1,0,0,0,161,724,1,0,0,0,163, + 729,1,0,0,0,165,734,1,0,0,0,167,744,1,0,0,0,169,752,1,0,0,0,171, + 755,1,0,0,0,173,760,1,0,0,0,175,766,1,0,0,0,177,773,1,0,0,0,179, + 780,1,0,0,0,181,788,1,0,0,0,183,798,1,0,0,0,185,803,1,0,0,0,187, + 809,1,0,0,0,189,814,1,0,0,0,191,820,1,0,0,0,193,822,1,0,0,0,195, + 824,1,0,0,0,197,827,1,0,0,0,199,829,1,0,0,0,201,832,1,0,0,0,203, + 834,1,0,0,0,205,836,1,0,0,0,207,838,1,0,0,0,209,840,1,0,0,0,211, + 842,1,0,0,0,213,845,1,0,0,0,215,847,1,0,0,0,217,849,1,0,0,0,219, + 860,1,0,0,0,221,875,1,0,0,0,223,884,1,0,0,0,225,910,1,0,0,0,227, + 914,1,0,0,0,229,924,1,0,0,0,231,932,1,0,0,0,233,943,1,0,0,0,235, + 954,1,0,0,0,237,964,1,0,0,0,239,978,1,0,0,0,241,989,1,0,0,0,243, + 1000,1,0,0,0,245,1009,1,0,0,0,247,1011,1,0,0,0,249,1013,1,0,0,0, + 251,1030,1,0,0,0,253,1044,1,0,0,0,255,1048,1,0,0,0,257,258,5,44, + 0,0,258,2,1,0,0,0,259,260,5,40,0,0,260,4,1,0,0,0,261,262,5,41,0, + 0,262,6,1,0,0,0,263,264,5,46,0,0,264,8,1,0,0,0,265,266,7,0,0,0,266, + 267,7,1,0,0,267,268,7,1,0,0,268,10,1,0,0,0,269,270,7,0,0,0,270,271, + 7,2,0,0,271,272,7,2,0,0,272,12,1,0,0,0,273,274,7,0,0,0,274,275,7, + 2,0,0,275,276,7,3,0,0,276,277,7,4,0,0,277,278,7,5,0,0,278,14,1,0, + 0,0,279,280,7,0,0,0,280,281,7,6,0,0,281,282,7,1,0,0,282,16,1,0,0, + 0,283,284,7,0,0,0,284,285,7,7,0,0,285,18,1,0,0,0,286,287,7,0,0,0, + 287,288,7,7,0,0,288,289,7,8,0,0,289,20,1,0,0,0,290,291,7,9,0,0,291, + 292,7,4,0,0,292,293,7,3,0,0,293,294,7,10,0,0,294,295,7,4,0,0,295, + 296,7,4,0,0,296,297,7,6,0,0,297,22,1,0,0,0,298,299,7,9,0,0,299,300, + 7,11,0,0,300,301,7,12,0,0,301,302,7,11,0,0,302,303,7,6,0,0,303,304, + 7,3,0,0,304,24,1,0,0,0,305,306,7,9,0,0,306,307,7,11,0,0,307,308, + 7,6,0,0,308,309,7,0,0,0,309,310,7,5,0,0,310,311,7,13,0,0,311,26, + 1,0,0,0,312,313,7,9,0,0,313,314,7,14,0,0,314,315,7,14,0,0,315,316, + 7,2,0,0,316,317,7,4,0,0,317,318,7,0,0,0,318,319,7,6,0,0,319,28,1, + 0,0,0,320,321,7,9,0,0,321,322,7,13,0,0,322,30,1,0,0,0,323,324,7, + 8,0,0,324,325,7,0,0,0,325,326,7,7,0,0,326,327,7,4,0,0,327,32,1,0, + 0,0,328,329,7,8,0,0,329,330,7,0,0,0,330,331,7,7,0,0,331,332,7,3, + 0,0,332,34,1,0,0,0,333,334,7,8,0,0,334,335,7,15,0,0,335,336,7,0, + 0,0,336,337,7,5,0,0,337,36,1,0,0,0,338,339,7,8,0,0,339,340,7,15, + 0,0,340,341,7,4,0,0,341,342,7,8,0,0,342,343,7,16,0,0,343,38,1,0, + 0,0,344,345,7,8,0,0,345,346,7,14,0,0,346,347,7,0,0,0,347,348,7,2, + 0,0,348,349,7,4,0,0,349,350,7,7,0,0,350,351,7,8,0,0,351,352,7,4, + 0,0,352,40,1,0,0,0,353,354,7,8,0,0,354,355,7,14,0,0,355,356,7,2, + 0,0,356,357,7,17,0,0,357,358,7,18,0,0,358,359,7,6,0,0,359,42,1,0, + 0,0,360,361,7,8,0,0,361,362,7,14,0,0,362,363,7,6,0,0,363,364,7,7, + 0,0,364,365,7,3,0,0,365,366,7,5,0,0,366,367,7,0,0,0,367,368,7,11, + 0,0,368,369,7,6,0,0,369,370,7,3,0,0,370,44,1,0,0,0,371,372,7,8,0, + 0,372,373,7,5,0,0,373,374,7,4,0,0,374,375,7,0,0,0,375,376,7,3,0, + 0,376,377,7,4,0,0,377,46,1,0,0,0,378,379,7,8,0,0,379,380,7,5,0,0, + 380,381,7,14,0,0,381,382,7,7,0,0,382,383,7,7,0,0,383,48,1,0,0,0, + 384,385,7,1,0,0,385,386,7,0,0,0,386,387,7,3,0,0,387,388,7,4,0,0, + 388,50,1,0,0,0,389,390,7,1,0,0,390,391,7,4,0,0,391,392,7,8,0,0,392, + 393,7,11,0,0,393,394,7,18,0,0,394,395,7,0,0,0,395,396,7,2,0,0,396, + 52,1,0,0,0,397,398,7,1,0,0,398,399,7,4,0,0,399,400,7,19,0,0,400, + 401,7,0,0,0,401,402,7,17,0,0,402,403,7,2,0,0,403,404,7,3,0,0,404, + 54,1,0,0,0,405,406,7,1,0,0,406,407,7,4,0,0,407,408,7,2,0,0,408,409, + 7,4,0,0,409,410,7,3,0,0,410,411,7,4,0,0,411,56,1,0,0,0,412,413,7, + 1,0,0,413,414,7,4,0,0,414,415,7,7,0,0,415,416,7,8,0,0,416,58,1,0, + 0,0,417,418,7,1,0,0,418,419,7,11,0,0,419,420,7,7,0,0,420,421,7,3, + 0,0,421,422,7,11,0,0,422,423,7,6,0,0,423,424,7,8,0,0,424,425,7,3, + 0,0,425,60,1,0,0,0,426,427,7,1,0,0,427,428,7,14,0,0,428,429,7,17, + 0,0,429,430,7,9,0,0,430,431,7,2,0,0,431,432,7,4,0,0,432,62,1,0,0, + 0,433,434,7,1,0,0,434,435,7,5,0,0,435,436,7,14,0,0,436,437,7,20, + 0,0,437,64,1,0,0,0,438,439,7,4,0,0,439,440,7,2,0,0,440,441,7,7,0, + 0,441,442,7,4,0,0,442,66,1,0,0,0,443,444,7,4,0,0,444,445,7,6,0,0, + 445,446,7,1,0,0,446,68,1,0,0,0,447,448,7,4,0,0,448,449,7,7,0,0,449, + 450,7,8,0,0,450,451,7,0,0,0,451,452,7,20,0,0,452,453,7,4,0,0,453, + 70,1,0,0,0,454,455,7,4,0,0,455,456,7,21,0,0,456,457,7,8,0,0,457, + 458,7,4,0,0,458,459,7,20,0,0,459,460,7,3,0,0,460,72,1,0,0,0,461, + 462,7,4,0,0,462,463,7,21,0,0,463,464,7,11,0,0,464,465,7,7,0,0,465, + 466,7,3,0,0,466,467,7,7,0,0,467,74,1,0,0,0,468,469,7,19,0,0,469, + 470,7,0,0,0,470,471,7,2,0,0,471,472,7,7,0,0,472,473,7,4,0,0,473, + 76,1,0,0,0,474,475,7,19,0,0,475,476,7,11,0,0,476,477,7,5,0,0,477, + 478,7,7,0,0,478,479,7,3,0,0,479,78,1,0,0,0,480,481,7,19,0,0,481, + 482,7,2,0,0,482,483,7,14,0,0,483,484,7,0,0,0,484,485,7,3,0,0,485, + 80,1,0,0,0,486,487,7,19,0,0,487,488,7,14,0,0,488,489,7,5,0,0,489, + 490,7,4,0,0,490,491,7,11,0,0,491,492,7,12,0,0,492,493,7,6,0,0,493, + 82,1,0,0,0,494,495,7,19,0,0,495,496,7,5,0,0,496,497,7,14,0,0,497, + 498,7,18,0,0,498,84,1,0,0,0,499,500,7,19,0,0,500,501,7,17,0,0,501, + 502,7,2,0,0,502,503,7,2,0,0,503,86,1,0,0,0,504,505,7,12,0,0,505, + 506,7,5,0,0,506,507,7,14,0,0,507,508,7,17,0,0,508,509,7,20,0,0,509, + 88,1,0,0,0,510,511,7,15,0,0,511,512,7,0,0,0,512,513,7,22,0,0,513, + 514,7,11,0,0,514,515,7,6,0,0,515,516,7,12,0,0,516,90,1,0,0,0,517, + 518,7,11,0,0,518,519,7,19,0,0,519,92,1,0,0,0,520,521,7,11,0,0,521, + 522,7,6,0,0,522,94,1,0,0,0,523,524,7,11,0,0,524,525,7,6,0,0,525, + 526,7,6,0,0,526,527,7,4,0,0,527,528,7,5,0,0,528,96,1,0,0,0,529,530, + 7,11,0,0,530,531,7,6,0,0,531,532,7,7,0,0,532,533,7,4,0,0,533,534, + 7,5,0,0,534,535,7,3,0,0,535,98,1,0,0,0,536,537,7,11,0,0,537,538, + 7,6,0,0,538,539,7,3,0,0,539,100,1,0,0,0,540,541,7,11,0,0,541,542, + 7,6,0,0,542,543,7,3,0,0,543,544,7,4,0,0,544,545,7,12,0,0,545,546, + 7,4,0,0,546,547,7,5,0,0,547,102,1,0,0,0,548,549,7,11,0,0,549,550, + 7,6,0,0,550,551,7,3,0,0,551,552,7,4,0,0,552,553,7,5,0,0,553,554, + 7,7,0,0,554,555,7,4,0,0,555,556,7,8,0,0,556,557,7,3,0,0,557,104, + 1,0,0,0,558,559,7,11,0,0,559,560,7,6,0,0,560,561,7,3,0,0,561,562, + 7,14,0,0,562,106,1,0,0,0,563,564,7,11,0,0,564,565,7,7,0,0,565,108, + 1,0,0,0,566,567,7,23,0,0,567,568,7,14,0,0,568,569,7,11,0,0,569,570, + 7,6,0,0,570,110,1,0,0,0,571,572,7,16,0,0,572,573,7,4,0,0,573,574, + 7,13,0,0,574,112,1,0,0,0,575,576,7,2,0,0,576,577,7,0,0,0,577,578, + 7,7,0,0,578,579,7,3,0,0,579,114,1,0,0,0,580,581,7,2,0,0,581,582, + 7,4,0,0,582,583,7,19,0,0,583,584,7,3,0,0,584,116,1,0,0,0,585,586, + 7,2,0,0,586,587,7,11,0,0,587,588,7,16,0,0,588,589,7,4,0,0,589,118, + 1,0,0,0,590,591,7,2,0,0,591,592,7,11,0,0,592,593,7,18,0,0,593,594, + 7,11,0,0,594,595,7,3,0,0,595,120,1,0,0,0,596,597,7,6,0,0,597,598, + 7,14,0,0,598,599,7,3,0,0,599,122,1,0,0,0,600,601,7,6,0,0,601,602, + 7,17,0,0,602,603,7,2,0,0,603,604,7,2,0,0,604,124,1,0,0,0,605,606, + 7,6,0,0,606,607,7,17,0,0,607,608,7,2,0,0,608,609,7,2,0,0,609,610, + 7,11,0,0,610,611,7,19,0,0,611,126,1,0,0,0,612,613,7,6,0,0,613,614, + 7,17,0,0,614,615,7,2,0,0,615,616,7,2,0,0,616,617,7,7,0,0,617,128, + 1,0,0,0,618,619,7,6,0,0,619,620,7,17,0,0,620,621,7,18,0,0,621,622, + 7,4,0,0,622,623,7,5,0,0,623,624,7,11,0,0,624,625,7,8,0,0,625,130, + 1,0,0,0,626,627,7,14,0,0,627,628,7,19,0,0,628,629,7,19,0,0,629,630, + 7,7,0,0,630,631,7,4,0,0,631,632,7,3,0,0,632,132,1,0,0,0,633,634, + 7,14,0,0,634,635,7,6,0,0,635,134,1,0,0,0,636,637,7,14,0,0,637,638, + 7,5,0,0,638,136,1,0,0,0,639,640,7,14,0,0,640,641,7,5,0,0,641,642, + 7,1,0,0,642,643,7,4,0,0,643,644,7,5,0,0,644,138,1,0,0,0,645,646, + 7,14,0,0,646,647,7,17,0,0,647,648,7,3,0,0,648,649,7,4,0,0,649,650, + 7,5,0,0,650,140,1,0,0,0,651,652,7,20,0,0,652,653,7,5,0,0,653,654, + 7,11,0,0,654,655,7,18,0,0,655,656,7,0,0,0,656,657,7,5,0,0,657,658, + 7,13,0,0,658,142,1,0,0,0,659,660,7,5,0,0,660,661,7,4,0,0,661,662, + 7,8,0,0,662,663,7,17,0,0,663,664,7,5,0,0,664,665,7,7,0,0,665,666, + 7,11,0,0,666,667,7,22,0,0,667,668,7,4,0,0,668,144,1,0,0,0,669,670, + 7,5,0,0,670,671,7,4,0,0,671,672,7,19,0,0,672,673,7,4,0,0,673,674, + 7,5,0,0,674,675,7,4,0,0,675,676,7,6,0,0,676,677,7,8,0,0,677,678, + 7,4,0,0,678,679,7,7,0,0,679,146,1,0,0,0,680,681,7,5,0,0,681,682, + 7,4,0,0,682,683,7,6,0,0,683,684,7,0,0,0,684,685,7,18,0,0,685,686, + 7,4,0,0,686,148,1,0,0,0,687,688,7,5,0,0,688,689,7,11,0,0,689,690, + 7,12,0,0,690,691,7,15,0,0,691,692,7,3,0,0,692,150,1,0,0,0,693,694, + 7,7,0,0,694,695,7,4,0,0,695,696,7,2,0,0,696,697,7,4,0,0,697,698, + 7,8,0,0,698,699,7,3,0,0,699,152,1,0,0,0,700,701,7,7,0,0,701,702, + 7,4,0,0,702,703,7,3,0,0,703,154,1,0,0,0,704,705,7,7,0,0,705,706, + 7,18,0,0,706,707,7,0,0,0,707,708,7,2,0,0,708,709,7,2,0,0,709,710, + 7,11,0,0,710,711,7,6,0,0,711,712,7,3,0,0,712,156,1,0,0,0,713,714, + 7,3,0,0,714,715,7,0,0,0,715,716,7,9,0,0,716,717,7,2,0,0,717,718, + 7,4,0,0,718,158,1,0,0,0,719,720,7,3,0,0,720,721,7,4,0,0,721,722, + 7,21,0,0,722,723,7,3,0,0,723,160,1,0,0,0,724,725,7,3,0,0,725,726, + 7,15,0,0,726,727,7,4,0,0,727,728,7,6,0,0,728,162,1,0,0,0,729,730, + 7,3,0,0,730,731,7,11,0,0,731,732,7,18,0,0,732,733,7,4,0,0,733,164, + 1,0,0,0,734,735,7,3,0,0,735,736,7,11,0,0,736,737,7,18,0,0,737,738, + 7,4,0,0,738,739,7,7,0,0,739,740,7,3,0,0,740,741,7,0,0,0,741,742, + 7,18,0,0,742,743,7,20,0,0,743,166,1,0,0,0,744,745,7,3,0,0,745,746, + 7,11,0,0,746,747,7,6,0,0,747,748,7,13,0,0,748,749,7,11,0,0,749,750, + 7,6,0,0,750,751,7,3,0,0,751,168,1,0,0,0,752,753,7,3,0,0,753,754, + 7,14,0,0,754,170,1,0,0,0,755,756,7,3,0,0,756,757,7,5,0,0,757,758, + 7,17,0,0,758,759,7,4,0,0,759,172,1,0,0,0,760,761,7,17,0,0,761,762, + 7,6,0,0,762,763,7,11,0,0,763,764,7,14,0,0,764,765,7,6,0,0,765,174, + 1,0,0,0,766,767,7,17,0,0,767,768,7,6,0,0,768,769,7,11,0,0,769,770, + 7,24,0,0,770,771,7,17,0,0,771,772,7,4,0,0,772,176,1,0,0,0,773,774, + 7,17,0,0,774,775,7,20,0,0,775,776,7,1,0,0,776,777,7,0,0,0,777,778, + 7,3,0,0,778,779,7,4,0,0,779,178,1,0,0,0,780,781,7,22,0,0,781,782, + 7,0,0,0,782,783,7,5,0,0,783,784,7,8,0,0,784,785,7,15,0,0,785,786, + 7,0,0,0,786,787,7,5,0,0,787,180,1,0,0,0,788,789,7,22,0,0,789,790, + 7,0,0,0,790,791,7,5,0,0,791,792,7,9,0,0,792,793,7,11,0,0,793,794, + 7,6,0,0,794,795,7,0,0,0,795,796,7,5,0,0,796,797,7,13,0,0,797,182, + 1,0,0,0,798,799,7,10,0,0,799,800,7,15,0,0,800,801,7,4,0,0,801,802, + 7,6,0,0,802,184,1,0,0,0,803,804,7,10,0,0,804,805,7,15,0,0,805,806, + 7,4,0,0,806,807,7,5,0,0,807,808,7,4,0,0,808,186,1,0,0,0,809,810, + 7,10,0,0,810,811,7,11,0,0,811,812,7,3,0,0,812,813,7,15,0,0,813,188, + 1,0,0,0,814,815,5,61,0,0,815,190,1,0,0,0,816,817,5,60,0,0,817,821, + 5,62,0,0,818,819,5,33,0,0,819,821,5,61,0,0,820,816,1,0,0,0,820,818, + 1,0,0,0,821,192,1,0,0,0,822,823,5,60,0,0,823,194,1,0,0,0,824,825, + 5,60,0,0,825,826,5,61,0,0,826,196,1,0,0,0,827,828,5,62,0,0,828,198, + 1,0,0,0,829,830,5,62,0,0,830,831,5,61,0,0,831,200,1,0,0,0,832,833, + 5,43,0,0,833,202,1,0,0,0,834,835,5,45,0,0,835,204,1,0,0,0,836,837, + 5,42,0,0,837,206,1,0,0,0,838,839,5,47,0,0,839,208,1,0,0,0,840,841, + 5,37,0,0,841,210,1,0,0,0,842,843,5,124,0,0,843,844,5,124,0,0,844, + 212,1,0,0,0,845,846,5,63,0,0,846,214,1,0,0,0,847,848,5,59,0,0,848, + 216,1,0,0,0,849,855,5,39,0,0,850,854,8,25,0,0,851,852,5,39,0,0,852, + 854,5,39,0,0,853,850,1,0,0,0,853,851,1,0,0,0,854,857,1,0,0,0,855, + 853,1,0,0,0,855,856,1,0,0,0,856,858,1,0,0,0,857,855,1,0,0,0,858, + 859,5,39,0,0,859,218,1,0,0,0,860,861,7,21,0,0,861,862,5,39,0,0,862, + 866,1,0,0,0,863,865,8,25,0,0,864,863,1,0,0,0,865,868,1,0,0,0,866, + 864,1,0,0,0,866,867,1,0,0,0,867,869,1,0,0,0,868,866,1,0,0,0,869, + 870,5,39,0,0,870,220,1,0,0,0,871,876,3,235,117,0,872,876,3,237,118, + 0,873,876,3,239,119,0,874,876,3,241,120,0,875,871,1,0,0,0,875,872, + 1,0,0,0,875,873,1,0,0,0,875,874,1,0,0,0,876,222,1,0,0,0,877,878, + 3,235,117,0,878,880,5,46,0,0,879,881,3,235,117,0,880,879,1,0,0,0, + 880,881,1,0,0,0,881,885,1,0,0,0,882,883,5,46,0,0,883,885,3,235,117, + 0,884,877,1,0,0,0,884,882,1,0,0,0,885,224,1,0,0,0,886,888,3,245, + 122,0,887,886,1,0,0,0,888,889,1,0,0,0,889,887,1,0,0,0,889,890,1, + 0,0,0,890,898,1,0,0,0,891,895,5,46,0,0,892,894,3,245,122,0,893,892, + 1,0,0,0,894,897,1,0,0,0,895,893,1,0,0,0,895,896,1,0,0,0,896,899, + 1,0,0,0,897,895,1,0,0,0,898,891,1,0,0,0,898,899,1,0,0,0,899,900, + 1,0,0,0,900,901,3,243,121,0,901,911,1,0,0,0,902,904,5,46,0,0,903, + 905,3,245,122,0,904,903,1,0,0,0,905,906,1,0,0,0,906,904,1,0,0,0, + 906,907,1,0,0,0,907,908,1,0,0,0,908,909,3,243,121,0,909,911,1,0, + 0,0,910,887,1,0,0,0,910,902,1,0,0,0,911,226,1,0,0,0,912,915,3,247, + 123,0,913,915,5,95,0,0,914,912,1,0,0,0,914,913,1,0,0,0,915,921,1, + 0,0,0,916,920,3,247,123,0,917,920,3,245,122,0,918,920,5,95,0,0,919, + 916,1,0,0,0,919,917,1,0,0,0,919,918,1,0,0,0,920,923,1,0,0,0,921, + 919,1,0,0,0,921,922,1,0,0,0,922,228,1,0,0,0,923,921,1,0,0,0,924, + 928,3,245,122,0,925,929,3,247,123,0,926,929,3,245,122,0,927,929, + 5,95,0,0,928,925,1,0,0,0,928,926,1,0,0,0,928,927,1,0,0,0,929,930, + 1,0,0,0,930,928,1,0,0,0,930,931,1,0,0,0,931,230,1,0,0,0,932,938, + 5,34,0,0,933,937,8,26,0,0,934,935,5,34,0,0,935,937,5,34,0,0,936, + 933,1,0,0,0,936,934,1,0,0,0,937,940,1,0,0,0,938,936,1,0,0,0,938, + 939,1,0,0,0,939,941,1,0,0,0,940,938,1,0,0,0,941,942,5,34,0,0,942, + 232,1,0,0,0,943,949,5,96,0,0,944,948,8,27,0,0,945,946,5,96,0,0,946, + 948,5,96,0,0,947,944,1,0,0,0,947,945,1,0,0,0,948,951,1,0,0,0,949, + 947,1,0,0,0,949,950,1,0,0,0,950,952,1,0,0,0,951,949,1,0,0,0,952, + 953,5,96,0,0,953,234,1,0,0,0,954,961,3,245,122,0,955,957,5,95,0, + 0,956,955,1,0,0,0,956,957,1,0,0,0,957,958,1,0,0,0,958,960,3,245, + 122,0,959,956,1,0,0,0,960,963,1,0,0,0,961,959,1,0,0,0,961,962,1, + 0,0,0,962,236,1,0,0,0,963,961,1,0,0,0,964,965,5,48,0,0,965,966,7, + 21,0,0,966,974,1,0,0,0,967,969,5,95,0,0,968,967,1,0,0,0,968,969, + 1,0,0,0,969,972,1,0,0,0,970,973,3,245,122,0,971,973,7,28,0,0,972, + 970,1,0,0,0,972,971,1,0,0,0,973,975,1,0,0,0,974,968,1,0,0,0,975, + 976,1,0,0,0,976,974,1,0,0,0,976,977,1,0,0,0,977,238,1,0,0,0,978, + 979,5,48,0,0,979,980,7,14,0,0,980,985,1,0,0,0,981,983,5,95,0,0,982, + 981,1,0,0,0,982,983,1,0,0,0,983,984,1,0,0,0,984,986,7,29,0,0,985, + 982,1,0,0,0,986,987,1,0,0,0,987,985,1,0,0,0,987,988,1,0,0,0,988, + 240,1,0,0,0,989,990,5,48,0,0,990,991,7,9,0,0,991,996,1,0,0,0,992, + 994,5,95,0,0,993,992,1,0,0,0,993,994,1,0,0,0,994,995,1,0,0,0,995, + 997,7,30,0,0,996,993,1,0,0,0,997,998,1,0,0,0,998,996,1,0,0,0,998, + 999,1,0,0,0,999,242,1,0,0,0,1000,1002,7,4,0,0,1001,1003,7,31,0,0, + 1002,1001,1,0,0,0,1002,1003,1,0,0,0,1003,1005,1,0,0,0,1004,1006, + 3,245,122,0,1005,1004,1,0,0,0,1006,1007,1,0,0,0,1007,1005,1,0,0, + 0,1007,1008,1,0,0,0,1008,244,1,0,0,0,1009,1010,7,32,0,0,1010,246, + 1,0,0,0,1011,1012,7,33,0,0,1012,248,1,0,0,0,1013,1014,5,45,0,0,1014, + 1015,5,45,0,0,1015,1019,1,0,0,0,1016,1018,8,34,0,0,1017,1016,1,0, + 0,0,1018,1021,1,0,0,0,1019,1017,1,0,0,0,1019,1020,1,0,0,0,1020,1023, + 1,0,0,0,1021,1019,1,0,0,0,1022,1024,5,13,0,0,1023,1022,1,0,0,0,1023, + 1024,1,0,0,0,1024,1026,1,0,0,0,1025,1027,5,10,0,0,1026,1025,1,0, + 0,0,1026,1027,1,0,0,0,1027,1028,1,0,0,0,1028,1029,6,124,0,0,1029, + 250,1,0,0,0,1030,1031,5,47,0,0,1031,1032,5,42,0,0,1032,1036,1,0, + 0,0,1033,1035,9,0,0,0,1034,1033,1,0,0,0,1035,1038,1,0,0,0,1036,1037, + 1,0,0,0,1036,1034,1,0,0,0,1037,1039,1,0,0,0,1038,1036,1,0,0,0,1039, + 1040,5,42,0,0,1040,1041,5,47,0,0,1041,1042,1,0,0,0,1042,1043,6,125, + 0,0,1043,252,1,0,0,0,1044,1045,7,35,0,0,1045,1046,1,0,0,0,1046,1047, + 6,126,0,0,1047,254,1,0,0,0,1048,1049,9,0,0,0,1049,256,1,0,0,0,37, + 0,820,853,855,866,875,880,884,889,895,898,906,910,914,919,921,928, + 930,936,938,947,949,956,961,968,972,976,982,987,993,998,1002,1007, + 1019,1023,1026,1036,1,0,1,0 + ]; + + private static __ATN: antlr.ATN; + public static get _ATN(): antlr.ATN { + if (!GenericSqlLexer.__ATN) { + GenericSqlLexer.__ATN = new antlr.ATNDeserializer().deserialize(GenericSqlLexer._serializedATN); + } + + return GenericSqlLexer.__ATN; + } + + + private static readonly vocabulary = new antlr.Vocabulary(GenericSqlLexer.literalNames, GenericSqlLexer.symbolicNames, []); + + public override get vocabulary(): antlr.Vocabulary { + return GenericSqlLexer.vocabulary; + } + + private static readonly decisionsToDFA = GenericSqlLexer._ATN.decisionToState.map( (ds: antlr.DecisionState, index: number) => new antlr.DFA(ds, index) ); +} \ No newline at end of file diff --git a/src/lib/generic/GenericSqlListener.ts b/src/lib/generic/GenericSqlListener.ts new file mode 100644 index 00000000..13444e23 --- /dev/null +++ b/src/lib/generic/GenericSqlListener.ts @@ -0,0 +1,1102 @@ +// Generated from dt-sql-parser/src/grammar/generic/GenericSql.g4 by ANTLR 4.13.1 + +// @ts-nocheck + +import { ErrorNode, ParseTreeListener, ParserRuleContext, TerminalNode } from "antlr4ng"; + + +import { SQLParserBase } from '../SQLParserBase'; + + +import { ProgramContext } from "./GenericSqlParser.js"; +import { StatementsContext } from "./GenericSqlParser.js"; +import { SingleStatementContext } from "./GenericSqlParser.js"; +import { StatementDefaultContext } from "./GenericSqlParser.js"; +import { InsertContext } from "./GenericSqlParser.js"; +import { UpdateContext } from "./GenericSqlParser.js"; +import { DeleteContext } from "./GenericSqlParser.js"; +import { CreateTableContext } from "./GenericSqlParser.js"; +import { AlterTableContext } from "./GenericSqlParser.js"; +import { DropTableContext } from "./GenericSqlParser.js"; +import { QueryStatementContext } from "./GenericSqlParser.js"; +import { WithClauseContext } from "./GenericSqlParser.js"; +import { NamedQueryContext } from "./GenericSqlParser.js"; +import { QueryNoWithContext } from "./GenericSqlParser.js"; +import { QueryTermContext } from "./GenericSqlParser.js"; +import { QueryPrimaryContext } from "./GenericSqlParser.js"; +import { QuerySpecificationContext } from "./GenericSqlParser.js"; +import { SetQuantifierContext } from "./GenericSqlParser.js"; +import { SelectItemContext } from "./GenericSqlParser.js"; +import { FromClauseContext } from "./GenericSqlParser.js"; +import { SimpleRelationContext } from "./GenericSqlParser.js"; +import { JoinRelationContext } from "./GenericSqlParser.js"; +import { JoinTypeContext } from "./GenericSqlParser.js"; +import { AliasedRelationContext } from "./GenericSqlParser.js"; +import { TableNameRelationContext } from "./GenericSqlParser.js"; +import { SubqueryRelationContext } from "./GenericSqlParser.js"; +import { WhereClauseContext } from "./GenericSqlParser.js"; +import { GroupByClauseContext } from "./GenericSqlParser.js"; +import { HavingClauseContext } from "./GenericSqlParser.js"; +import { OrderByClauseContext } from "./GenericSqlParser.js"; +import { SortItemContext } from "./GenericSqlParser.js"; +import { LimitClauseContext } from "./GenericSqlParser.js"; +import { InsertStatementContext } from "./GenericSqlParser.js"; +import { ColumnListContext } from "./GenericSqlParser.js"; +import { UpdateStatementContext } from "./GenericSqlParser.js"; +import { UpdateAssignmentContext } from "./GenericSqlParser.js"; +import { DeleteStatementContext } from "./GenericSqlParser.js"; +import { CreateTableStatementContext } from "./GenericSqlParser.js"; +import { TableElementContext } from "./GenericSqlParser.js"; +import { ColumnDefinitionContext } from "./GenericSqlParser.js"; +import { TableConstraintContext } from "./GenericSqlParser.js"; +import { AlterTableStatementContext } from "./GenericSqlParser.js"; +import { DropTableStatementContext } from "./GenericSqlParser.js"; +import { ExpressionContext } from "./GenericSqlParser.js"; +import { OrExpressionContext } from "./GenericSqlParser.js"; +import { AndExpressionContext } from "./GenericSqlParser.js"; +import { PredicatedContext } from "./GenericSqlParser.js"; +import { NotExpressionContext } from "./GenericSqlParser.js"; +import { PredicatedExpressionContext } from "./GenericSqlParser.js"; +import { ComparisonPredicateContext } from "./GenericSqlParser.js"; +import { InPredicateContext } from "./GenericSqlParser.js"; +import { InSubqueryPredicateContext } from "./GenericSqlParser.js"; +import { BetweenPredicateContext } from "./GenericSqlParser.js"; +import { LikePredicateContext } from "./GenericSqlParser.js"; +import { NullPredicateContext } from "./GenericSqlParser.js"; +import { DistinctFromPredicateContext } from "./GenericSqlParser.js"; +import { ComparisonOperatorContext } from "./GenericSqlParser.js"; +import { ValueExpressionDefaultContext } from "./GenericSqlParser.js"; +import { ConcatenationContext } from "./GenericSqlParser.js"; +import { ArithmeticBinaryContext } from "./GenericSqlParser.js"; +import { ArithmeticUnaryContext } from "./GenericSqlParser.js"; +import { LiteralExpressionContext } from "./GenericSqlParser.js"; +import { FunctionCallContext } from "./GenericSqlParser.js"; +import { SearchedCaseExpressionContext } from "./GenericSqlParser.js"; +import { SimpleCaseExpressionContext } from "./GenericSqlParser.js"; +import { CastExpressionContext } from "./GenericSqlParser.js"; +import { CoalesceExpressionContext } from "./GenericSqlParser.js"; +import { NullIfExpressionContext } from "./GenericSqlParser.js"; +import { ParenthesizedExpressionContext } from "./GenericSqlParser.js"; +import { ExistsExpressionContext } from "./GenericSqlParser.js"; +import { SubqueryExpressionDefaultContext } from "./GenericSqlParser.js"; +import { ColumnReferenceContext } from "./GenericSqlParser.js"; +import { WhenClauseContext } from "./GenericSqlParser.js"; +import { SubqueryExpressionContext } from "./GenericSqlParser.js"; +import { DataTypeContext } from "./GenericSqlParser.js"; +import { PropertiesContext } from "./GenericSqlParser.js"; +import { PropertyContext } from "./GenericSqlParser.js"; +import { NullLiteralContext } from "./GenericSqlParser.js"; +import { BooleanLiteralContext } from "./GenericSqlParser.js"; +import { IntegerLiteralContext } from "./GenericSqlParser.js"; +import { DecimalLiteralContext } from "./GenericSqlParser.js"; +import { DoubleLiteralContext } from "./GenericSqlParser.js"; +import { StringLiteralContext } from "./GenericSqlParser.js"; +import { BinaryLiteralContext } from "./GenericSqlParser.js"; +import { IdentifierContext } from "./GenericSqlParser.js"; +import { QualifiedNameContext } from "./GenericSqlParser.js"; +import { ColumnRefContext } from "./GenericSqlParser.js"; +import { TableNameContext } from "./GenericSqlParser.js"; +import { TableNameCreateContext } from "./GenericSqlParser.js"; +import { NonReservedContext } from "./GenericSqlParser.js"; + + +/** + * This interface defines a complete listener for a parse tree produced by + * `GenericSqlParser`. + */ +export class GenericSqlListener implements ParseTreeListener { + /** + * Enter a parse tree produced by `GenericSqlParser.program`. + * @param ctx the parse tree + */ + enterProgram?: (ctx: ProgramContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.program`. + * @param ctx the parse tree + */ + exitProgram?: (ctx: ProgramContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.statements`. + * @param ctx the parse tree + */ + enterStatements?: (ctx: StatementsContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.statements`. + * @param ctx the parse tree + */ + exitStatements?: (ctx: StatementsContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.singleStatement`. + * @param ctx the parse tree + */ + enterSingleStatement?: (ctx: SingleStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.singleStatement`. + * @param ctx the parse tree + */ + exitSingleStatement?: (ctx: SingleStatementContext) => void; + /** + * Enter a parse tree produced by the `statementDefault` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + enterStatementDefault?: (ctx: StatementDefaultContext) => void; + /** + * Exit a parse tree produced by the `statementDefault` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + exitStatementDefault?: (ctx: StatementDefaultContext) => void; + /** + * Enter a parse tree produced by the `insert` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + enterInsert?: (ctx: InsertContext) => void; + /** + * Exit a parse tree produced by the `insert` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + exitInsert?: (ctx: InsertContext) => void; + /** + * Enter a parse tree produced by the `update` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + enterUpdate?: (ctx: UpdateContext) => void; + /** + * Exit a parse tree produced by the `update` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + exitUpdate?: (ctx: UpdateContext) => void; + /** + * Enter a parse tree produced by the `delete` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + enterDelete?: (ctx: DeleteContext) => void; + /** + * Exit a parse tree produced by the `delete` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + exitDelete?: (ctx: DeleteContext) => void; + /** + * Enter a parse tree produced by the `createTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + enterCreateTable?: (ctx: CreateTableContext) => void; + /** + * Exit a parse tree produced by the `createTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + exitCreateTable?: (ctx: CreateTableContext) => void; + /** + * Enter a parse tree produced by the `alterTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + enterAlterTable?: (ctx: AlterTableContext) => void; + /** + * Exit a parse tree produced by the `alterTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + exitAlterTable?: (ctx: AlterTableContext) => void; + /** + * Enter a parse tree produced by the `dropTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + enterDropTable?: (ctx: DropTableContext) => void; + /** + * Exit a parse tree produced by the `dropTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + */ + exitDropTable?: (ctx: DropTableContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.queryStatement`. + * @param ctx the parse tree + */ + enterQueryStatement?: (ctx: QueryStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.queryStatement`. + * @param ctx the parse tree + */ + exitQueryStatement?: (ctx: QueryStatementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.withClause`. + * @param ctx the parse tree + */ + enterWithClause?: (ctx: WithClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.withClause`. + * @param ctx the parse tree + */ + exitWithClause?: (ctx: WithClauseContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.namedQuery`. + * @param ctx the parse tree + */ + enterNamedQuery?: (ctx: NamedQueryContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.namedQuery`. + * @param ctx the parse tree + */ + exitNamedQuery?: (ctx: NamedQueryContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.queryNoWith`. + * @param ctx the parse tree + */ + enterQueryNoWith?: (ctx: QueryNoWithContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.queryNoWith`. + * @param ctx the parse tree + */ + exitQueryNoWith?: (ctx: QueryNoWithContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.queryTerm`. + * @param ctx the parse tree + */ + enterQueryTerm?: (ctx: QueryTermContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.queryTerm`. + * @param ctx the parse tree + */ + exitQueryTerm?: (ctx: QueryTermContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.queryPrimary`. + * @param ctx the parse tree + */ + enterQueryPrimary?: (ctx: QueryPrimaryContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.queryPrimary`. + * @param ctx the parse tree + */ + exitQueryPrimary?: (ctx: QueryPrimaryContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.querySpecification`. + * @param ctx the parse tree + */ + enterQuerySpecification?: (ctx: QuerySpecificationContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.querySpecification`. + * @param ctx the parse tree + */ + exitQuerySpecification?: (ctx: QuerySpecificationContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.setQuantifier`. + * @param ctx the parse tree + */ + enterSetQuantifier?: (ctx: SetQuantifierContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.setQuantifier`. + * @param ctx the parse tree + */ + exitSetQuantifier?: (ctx: SetQuantifierContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.selectItem`. + * @param ctx the parse tree + */ + enterSelectItem?: (ctx: SelectItemContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.selectItem`. + * @param ctx the parse tree + */ + exitSelectItem?: (ctx: SelectItemContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.fromClause`. + * @param ctx the parse tree + */ + enterFromClause?: (ctx: FromClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.fromClause`. + * @param ctx the parse tree + */ + exitFromClause?: (ctx: FromClauseContext) => void; + /** + * Enter a parse tree produced by the `simpleRelation` + * labeled alternative in `GenericSqlParser.relation`. + * @param ctx the parse tree + */ + enterSimpleRelation?: (ctx: SimpleRelationContext) => void; + /** + * Exit a parse tree produced by the `simpleRelation` + * labeled alternative in `GenericSqlParser.relation`. + * @param ctx the parse tree + */ + exitSimpleRelation?: (ctx: SimpleRelationContext) => void; + /** + * Enter a parse tree produced by the `joinRelation` + * labeled alternative in `GenericSqlParser.relation`. + * @param ctx the parse tree + */ + enterJoinRelation?: (ctx: JoinRelationContext) => void; + /** + * Exit a parse tree produced by the `joinRelation` + * labeled alternative in `GenericSqlParser.relation`. + * @param ctx the parse tree + */ + exitJoinRelation?: (ctx: JoinRelationContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.joinType`. + * @param ctx the parse tree + */ + enterJoinType?: (ctx: JoinTypeContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.joinType`. + * @param ctx the parse tree + */ + exitJoinType?: (ctx: JoinTypeContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.aliasedRelation`. + * @param ctx the parse tree + */ + enterAliasedRelation?: (ctx: AliasedRelationContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.aliasedRelation`. + * @param ctx the parse tree + */ + exitAliasedRelation?: (ctx: AliasedRelationContext) => void; + /** + * Enter a parse tree produced by the `tableNameRelation` + * labeled alternative in `GenericSqlParser.relationPrimary`. + * @param ctx the parse tree + */ + enterTableNameRelation?: (ctx: TableNameRelationContext) => void; + /** + * Exit a parse tree produced by the `tableNameRelation` + * labeled alternative in `GenericSqlParser.relationPrimary`. + * @param ctx the parse tree + */ + exitTableNameRelation?: (ctx: TableNameRelationContext) => void; + /** + * Enter a parse tree produced by the `subqueryRelation` + * labeled alternative in `GenericSqlParser.relationPrimary`. + * @param ctx the parse tree + */ + enterSubqueryRelation?: (ctx: SubqueryRelationContext) => void; + /** + * Exit a parse tree produced by the `subqueryRelation` + * labeled alternative in `GenericSqlParser.relationPrimary`. + * @param ctx the parse tree + */ + exitSubqueryRelation?: (ctx: SubqueryRelationContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.whereClause`. + * @param ctx the parse tree + */ + enterWhereClause?: (ctx: WhereClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.whereClause`. + * @param ctx the parse tree + */ + exitWhereClause?: (ctx: WhereClauseContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.groupByClause`. + * @param ctx the parse tree + */ + enterGroupByClause?: (ctx: GroupByClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.groupByClause`. + * @param ctx the parse tree + */ + exitGroupByClause?: (ctx: GroupByClauseContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.havingClause`. + * @param ctx the parse tree + */ + enterHavingClause?: (ctx: HavingClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.havingClause`. + * @param ctx the parse tree + */ + exitHavingClause?: (ctx: HavingClauseContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.orderByClause`. + * @param ctx the parse tree + */ + enterOrderByClause?: (ctx: OrderByClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.orderByClause`. + * @param ctx the parse tree + */ + exitOrderByClause?: (ctx: OrderByClauseContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.sortItem`. + * @param ctx the parse tree + */ + enterSortItem?: (ctx: SortItemContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.sortItem`. + * @param ctx the parse tree + */ + exitSortItem?: (ctx: SortItemContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.limitClause`. + * @param ctx the parse tree + */ + enterLimitClause?: (ctx: LimitClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.limitClause`. + * @param ctx the parse tree + */ + exitLimitClause?: (ctx: LimitClauseContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.insertStatement`. + * @param ctx the parse tree + */ + enterInsertStatement?: (ctx: InsertStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.insertStatement`. + * @param ctx the parse tree + */ + exitInsertStatement?: (ctx: InsertStatementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.columnList`. + * @param ctx the parse tree + */ + enterColumnList?: (ctx: ColumnListContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.columnList`. + * @param ctx the parse tree + */ + exitColumnList?: (ctx: ColumnListContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.updateStatement`. + * @param ctx the parse tree + */ + enterUpdateStatement?: (ctx: UpdateStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.updateStatement`. + * @param ctx the parse tree + */ + exitUpdateStatement?: (ctx: UpdateStatementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.updateAssignment`. + * @param ctx the parse tree + */ + enterUpdateAssignment?: (ctx: UpdateAssignmentContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.updateAssignment`. + * @param ctx the parse tree + */ + exitUpdateAssignment?: (ctx: UpdateAssignmentContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.deleteStatement`. + * @param ctx the parse tree + */ + enterDeleteStatement?: (ctx: DeleteStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.deleteStatement`. + * @param ctx the parse tree + */ + exitDeleteStatement?: (ctx: DeleteStatementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.createTableStatement`. + * @param ctx the parse tree + */ + enterCreateTableStatement?: (ctx: CreateTableStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.createTableStatement`. + * @param ctx the parse tree + */ + exitCreateTableStatement?: (ctx: CreateTableStatementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.tableElement`. + * @param ctx the parse tree + */ + enterTableElement?: (ctx: TableElementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.tableElement`. + * @param ctx the parse tree + */ + exitTableElement?: (ctx: TableElementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.columnDefinition`. + * @param ctx the parse tree + */ + enterColumnDefinition?: (ctx: ColumnDefinitionContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.columnDefinition`. + * @param ctx the parse tree + */ + exitColumnDefinition?: (ctx: ColumnDefinitionContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.tableConstraint`. + * @param ctx the parse tree + */ + enterTableConstraint?: (ctx: TableConstraintContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.tableConstraint`. + * @param ctx the parse tree + */ + exitTableConstraint?: (ctx: TableConstraintContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.alterTableStatement`. + * @param ctx the parse tree + */ + enterAlterTableStatement?: (ctx: AlterTableStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.alterTableStatement`. + * @param ctx the parse tree + */ + exitAlterTableStatement?: (ctx: AlterTableStatementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.dropTableStatement`. + * @param ctx the parse tree + */ + enterDropTableStatement?: (ctx: DropTableStatementContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.dropTableStatement`. + * @param ctx the parse tree + */ + exitDropTableStatement?: (ctx: DropTableStatementContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.expression`. + * @param ctx the parse tree + */ + enterExpression?: (ctx: ExpressionContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.expression`. + * @param ctx the parse tree + */ + exitExpression?: (ctx: ExpressionContext) => void; + /** + * Enter a parse tree produced by the `orExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + enterOrExpression?: (ctx: OrExpressionContext) => void; + /** + * Exit a parse tree produced by the `orExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + exitOrExpression?: (ctx: OrExpressionContext) => void; + /** + * Enter a parse tree produced by the `andExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + enterAndExpression?: (ctx: AndExpressionContext) => void; + /** + * Exit a parse tree produced by the `andExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + exitAndExpression?: (ctx: AndExpressionContext) => void; + /** + * Enter a parse tree produced by the `predicated` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + enterPredicated?: (ctx: PredicatedContext) => void; + /** + * Exit a parse tree produced by the `predicated` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + exitPredicated?: (ctx: PredicatedContext) => void; + /** + * Enter a parse tree produced by the `notExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + enterNotExpression?: (ctx: NotExpressionContext) => void; + /** + * Exit a parse tree produced by the `notExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + */ + exitNotExpression?: (ctx: NotExpressionContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.predicatedExpression`. + * @param ctx the parse tree + */ + enterPredicatedExpression?: (ctx: PredicatedExpressionContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.predicatedExpression`. + * @param ctx the parse tree + */ + exitPredicatedExpression?: (ctx: PredicatedExpressionContext) => void; + /** + * Enter a parse tree produced by the `comparisonPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + enterComparisonPredicate?: (ctx: ComparisonPredicateContext) => void; + /** + * Exit a parse tree produced by the `comparisonPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + exitComparisonPredicate?: (ctx: ComparisonPredicateContext) => void; + /** + * Enter a parse tree produced by the `inPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + enterInPredicate?: (ctx: InPredicateContext) => void; + /** + * Exit a parse tree produced by the `inPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + exitInPredicate?: (ctx: InPredicateContext) => void; + /** + * Enter a parse tree produced by the `inSubqueryPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + enterInSubqueryPredicate?: (ctx: InSubqueryPredicateContext) => void; + /** + * Exit a parse tree produced by the `inSubqueryPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + exitInSubqueryPredicate?: (ctx: InSubqueryPredicateContext) => void; + /** + * Enter a parse tree produced by the `betweenPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + enterBetweenPredicate?: (ctx: BetweenPredicateContext) => void; + /** + * Exit a parse tree produced by the `betweenPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + exitBetweenPredicate?: (ctx: BetweenPredicateContext) => void; + /** + * Enter a parse tree produced by the `likePredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + enterLikePredicate?: (ctx: LikePredicateContext) => void; + /** + * Exit a parse tree produced by the `likePredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + exitLikePredicate?: (ctx: LikePredicateContext) => void; + /** + * Enter a parse tree produced by the `nullPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + enterNullPredicate?: (ctx: NullPredicateContext) => void; + /** + * Exit a parse tree produced by the `nullPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + exitNullPredicate?: (ctx: NullPredicateContext) => void; + /** + * Enter a parse tree produced by the `distinctFromPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + enterDistinctFromPredicate?: (ctx: DistinctFromPredicateContext) => void; + /** + * Exit a parse tree produced by the `distinctFromPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + */ + exitDistinctFromPredicate?: (ctx: DistinctFromPredicateContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.comparisonOperator`. + * @param ctx the parse tree + */ + enterComparisonOperator?: (ctx: ComparisonOperatorContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.comparisonOperator`. + * @param ctx the parse tree + */ + exitComparisonOperator?: (ctx: ComparisonOperatorContext) => void; + /** + * Enter a parse tree produced by the `valueExpressionDefault` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + enterValueExpressionDefault?: (ctx: ValueExpressionDefaultContext) => void; + /** + * Exit a parse tree produced by the `valueExpressionDefault` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + exitValueExpressionDefault?: (ctx: ValueExpressionDefaultContext) => void; + /** + * Enter a parse tree produced by the `concatenation` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + enterConcatenation?: (ctx: ConcatenationContext) => void; + /** + * Exit a parse tree produced by the `concatenation` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + exitConcatenation?: (ctx: ConcatenationContext) => void; + /** + * Enter a parse tree produced by the `arithmeticBinary` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + enterArithmeticBinary?: (ctx: ArithmeticBinaryContext) => void; + /** + * Exit a parse tree produced by the `arithmeticBinary` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + exitArithmeticBinary?: (ctx: ArithmeticBinaryContext) => void; + /** + * Enter a parse tree produced by the `arithmeticUnary` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + enterArithmeticUnary?: (ctx: ArithmeticUnaryContext) => void; + /** + * Exit a parse tree produced by the `arithmeticUnary` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + */ + exitArithmeticUnary?: (ctx: ArithmeticUnaryContext) => void; + /** + * Enter a parse tree produced by the `literalExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterLiteralExpression?: (ctx: LiteralExpressionContext) => void; + /** + * Exit a parse tree produced by the `literalExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitLiteralExpression?: (ctx: LiteralExpressionContext) => void; + /** + * Enter a parse tree produced by the `functionCall` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterFunctionCall?: (ctx: FunctionCallContext) => void; + /** + * Exit a parse tree produced by the `functionCall` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitFunctionCall?: (ctx: FunctionCallContext) => void; + /** + * Enter a parse tree produced by the `searchedCaseExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterSearchedCaseExpression?: (ctx: SearchedCaseExpressionContext) => void; + /** + * Exit a parse tree produced by the `searchedCaseExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitSearchedCaseExpression?: (ctx: SearchedCaseExpressionContext) => void; + /** + * Enter a parse tree produced by the `simpleCaseExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterSimpleCaseExpression?: (ctx: SimpleCaseExpressionContext) => void; + /** + * Exit a parse tree produced by the `simpleCaseExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitSimpleCaseExpression?: (ctx: SimpleCaseExpressionContext) => void; + /** + * Enter a parse tree produced by the `castExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterCastExpression?: (ctx: CastExpressionContext) => void; + /** + * Exit a parse tree produced by the `castExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitCastExpression?: (ctx: CastExpressionContext) => void; + /** + * Enter a parse tree produced by the `coalesceExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterCoalesceExpression?: (ctx: CoalesceExpressionContext) => void; + /** + * Exit a parse tree produced by the `coalesceExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitCoalesceExpression?: (ctx: CoalesceExpressionContext) => void; + /** + * Enter a parse tree produced by the `nullIfExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterNullIfExpression?: (ctx: NullIfExpressionContext) => void; + /** + * Exit a parse tree produced by the `nullIfExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitNullIfExpression?: (ctx: NullIfExpressionContext) => void; + /** + * Enter a parse tree produced by the `parenthesizedExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void; + /** + * Exit a parse tree produced by the `parenthesizedExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void; + /** + * Enter a parse tree produced by the `existsExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterExistsExpression?: (ctx: ExistsExpressionContext) => void; + /** + * Exit a parse tree produced by the `existsExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitExistsExpression?: (ctx: ExistsExpressionContext) => void; + /** + * Enter a parse tree produced by the `subqueryExpressionDefault` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterSubqueryExpressionDefault?: (ctx: SubqueryExpressionDefaultContext) => void; + /** + * Exit a parse tree produced by the `subqueryExpressionDefault` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitSubqueryExpressionDefault?: (ctx: SubqueryExpressionDefaultContext) => void; + /** + * Enter a parse tree produced by the `columnReference` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + enterColumnReference?: (ctx: ColumnReferenceContext) => void; + /** + * Exit a parse tree produced by the `columnReference` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + */ + exitColumnReference?: (ctx: ColumnReferenceContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.whenClause`. + * @param ctx the parse tree + */ + enterWhenClause?: (ctx: WhenClauseContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.whenClause`. + * @param ctx the parse tree + */ + exitWhenClause?: (ctx: WhenClauseContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.subqueryExpression`. + * @param ctx the parse tree + */ + enterSubqueryExpression?: (ctx: SubqueryExpressionContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.subqueryExpression`. + * @param ctx the parse tree + */ + exitSubqueryExpression?: (ctx: SubqueryExpressionContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.dataType`. + * @param ctx the parse tree + */ + enterDataType?: (ctx: DataTypeContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.dataType`. + * @param ctx the parse tree + */ + exitDataType?: (ctx: DataTypeContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.properties`. + * @param ctx the parse tree + */ + enterProperties?: (ctx: PropertiesContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.properties`. + * @param ctx the parse tree + */ + exitProperties?: (ctx: PropertiesContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.property`. + * @param ctx the parse tree + */ + enterProperty?: (ctx: PropertyContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.property`. + * @param ctx the parse tree + */ + exitProperty?: (ctx: PropertyContext) => void; + /** + * Enter a parse tree produced by the `nullLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + enterNullLiteral?: (ctx: NullLiteralContext) => void; + /** + * Exit a parse tree produced by the `nullLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + exitNullLiteral?: (ctx: NullLiteralContext) => void; + /** + * Enter a parse tree produced by the `booleanLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + enterBooleanLiteral?: (ctx: BooleanLiteralContext) => void; + /** + * Exit a parse tree produced by the `booleanLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + exitBooleanLiteral?: (ctx: BooleanLiteralContext) => void; + /** + * Enter a parse tree produced by the `integerLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + enterIntegerLiteral?: (ctx: IntegerLiteralContext) => void; + /** + * Exit a parse tree produced by the `integerLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + exitIntegerLiteral?: (ctx: IntegerLiteralContext) => void; + /** + * Enter a parse tree produced by the `decimalLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + enterDecimalLiteral?: (ctx: DecimalLiteralContext) => void; + /** + * Exit a parse tree produced by the `decimalLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + exitDecimalLiteral?: (ctx: DecimalLiteralContext) => void; + /** + * Enter a parse tree produced by the `doubleLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + enterDoubleLiteral?: (ctx: DoubleLiteralContext) => void; + /** + * Exit a parse tree produced by the `doubleLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + exitDoubleLiteral?: (ctx: DoubleLiteralContext) => void; + /** + * Enter a parse tree produced by the `stringLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + enterStringLiteral?: (ctx: StringLiteralContext) => void; + /** + * Exit a parse tree produced by the `stringLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + exitStringLiteral?: (ctx: StringLiteralContext) => void; + /** + * Enter a parse tree produced by the `binaryLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + enterBinaryLiteral?: (ctx: BinaryLiteralContext) => void; + /** + * Exit a parse tree produced by the `binaryLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + */ + exitBinaryLiteral?: (ctx: BinaryLiteralContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.identifier`. + * @param ctx the parse tree + */ + enterIdentifier?: (ctx: IdentifierContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.identifier`. + * @param ctx the parse tree + */ + exitIdentifier?: (ctx: IdentifierContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.qualifiedName`. + * @param ctx the parse tree + */ + enterQualifiedName?: (ctx: QualifiedNameContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.qualifiedName`. + * @param ctx the parse tree + */ + exitQualifiedName?: (ctx: QualifiedNameContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.columnRef`. + * @param ctx the parse tree + */ + enterColumnRef?: (ctx: ColumnRefContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.columnRef`. + * @param ctx the parse tree + */ + exitColumnRef?: (ctx: ColumnRefContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.tableName`. + * @param ctx the parse tree + */ + enterTableName?: (ctx: TableNameContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.tableName`. + * @param ctx the parse tree + */ + exitTableName?: (ctx: TableNameContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.tableNameCreate`. + * @param ctx the parse tree + */ + enterTableNameCreate?: (ctx: TableNameCreateContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.tableNameCreate`. + * @param ctx the parse tree + */ + exitTableNameCreate?: (ctx: TableNameCreateContext) => void; + /** + * Enter a parse tree produced by `GenericSqlParser.nonReserved`. + * @param ctx the parse tree + */ + enterNonReserved?: (ctx: NonReservedContext) => void; + /** + * Exit a parse tree produced by `GenericSqlParser.nonReserved`. + * @param ctx the parse tree + */ + exitNonReserved?: (ctx: NonReservedContext) => void; + + visitTerminal(node: TerminalNode): void {} + visitErrorNode(node: ErrorNode): void {} + enterEveryRule(node: ParserRuleContext): void {} + exitEveryRule(node: ParserRuleContext): void {} +} + diff --git a/src/lib/generic/GenericSqlParser.ts b/src/lib/generic/GenericSqlParser.ts new file mode 100644 index 00000000..89004fa8 --- /dev/null +++ b/src/lib/generic/GenericSqlParser.ts @@ -0,0 +1,7808 @@ +// Generated from dt-sql-parser/src/grammar/generic/GenericSql.g4 by ANTLR 4.13.1 + +// @ts-nocheck + +import * as antlr from "antlr4ng"; +import { Token } from "antlr4ng"; + +import { GenericSqlListener } from "./GenericSqlListener.js"; +import { GenericSqlVisitor } from "./GenericSqlVisitor.js"; + +// for running tests with parameters, TODO: discuss strategy for typed parameters in CI +// eslint-disable-next-line no-unused-vars +type int = number; + + +import { SQLParserBase } from '../SQLParserBase'; + + +export class GenericSqlParser extends SQLParserBase { + public static readonly T__0 = 1; + public static readonly T__1 = 2; + public static readonly T__2 = 3; + public static readonly T__3 = 4; + public static readonly KW_ADD = 5; + public static readonly KW_ALL = 6; + public static readonly KW_ALTER = 7; + public static readonly KW_AND = 8; + public static readonly KW_AS = 9; + public static readonly KW_ASC = 10; + public static readonly KW_BETWEEN = 11; + public static readonly KW_BIGINT = 12; + public static readonly KW_BINARY = 13; + public static readonly KW_BOOLEAN = 14; + public static readonly KW_BY = 15; + public static readonly KW_CASE = 16; + public static readonly KW_CAST = 17; + public static readonly KW_CHAR = 18; + public static readonly KW_CHECK = 19; + public static readonly KW_COALESCE = 20; + public static readonly KW_COLUMN = 21; + public static readonly KW_CONSTRAINT = 22; + public static readonly KW_CREATE = 23; + public static readonly KW_CROSS = 24; + public static readonly KW_DATE = 25; + public static readonly KW_DECIMAL = 26; + public static readonly KW_DEFAULT = 27; + public static readonly KW_DELETE = 28; + public static readonly KW_DESC = 29; + public static readonly KW_DISTINCT = 30; + public static readonly KW_DOUBLE = 31; + public static readonly KW_DROP = 32; + public static readonly KW_ELSE = 33; + public static readonly KW_END = 34; + public static readonly KW_ESCAPE = 35; + public static readonly KW_EXCEPT = 36; + public static readonly KW_EXISTS = 37; + public static readonly KW_FALSE = 38; + public static readonly KW_FIRST = 39; + public static readonly KW_FLOAT = 40; + public static readonly KW_FOREIGN = 41; + public static readonly KW_FROM = 42; + public static readonly KW_FULL = 43; + public static readonly KW_GROUP = 44; + public static readonly KW_HAVING = 45; + public static readonly KW_IF = 46; + public static readonly KW_IN = 47; + public static readonly KW_INNER = 48; + public static readonly KW_INSERT = 49; + public static readonly KW_INT = 50; + public static readonly KW_INTEGER = 51; + public static readonly KW_INTERSECT = 52; + public static readonly KW_INTO = 53; + public static readonly KW_IS = 54; + public static readonly KW_JOIN = 55; + public static readonly KW_KEY = 56; + public static readonly KW_LAST = 57; + public static readonly KW_LEFT = 58; + public static readonly KW_LIKE = 59; + public static readonly KW_LIMIT = 60; + public static readonly KW_NOT = 61; + public static readonly KW_NULL = 62; + public static readonly KW_NULLIF = 63; + public static readonly KW_NULLS = 64; + public static readonly KW_NUMERIC = 65; + public static readonly KW_OFFSET = 66; + public static readonly KW_ON = 67; + public static readonly KW_OR = 68; + public static readonly KW_ORDER = 69; + public static readonly KW_OUTER = 70; + public static readonly KW_PRIMARY = 71; + public static readonly KW_RECURSIVE = 72; + public static readonly KW_REFERENCES = 73; + public static readonly KW_RENAME = 74; + public static readonly KW_RIGHT = 75; + public static readonly KW_SELECT = 76; + public static readonly KW_SET = 77; + public static readonly KW_SMALLINT = 78; + public static readonly KW_TABLE = 79; + public static readonly KW_TEXT = 80; + public static readonly KW_THEN = 81; + public static readonly KW_TIME = 82; + public static readonly KW_TIMESTAMP = 83; + public static readonly KW_TINYINT = 84; + public static readonly KW_TO = 85; + public static readonly KW_TRUE = 86; + public static readonly KW_UNION = 87; + public static readonly KW_UNIQUE = 88; + public static readonly KW_UPDATE = 89; + public static readonly KW_VARCHAR = 90; + public static readonly KW_VARBINARY = 91; + public static readonly KW_WHEN = 92; + public static readonly KW_WHERE = 93; + public static readonly KW_WITH = 94; + public static readonly EQ = 95; + public static readonly NEQ = 96; + public static readonly LT = 97; + public static readonly LTE = 98; + public static readonly GT = 99; + public static readonly GTE = 100; + public static readonly PLUS = 101; + public static readonly MINUS = 102; + public static readonly ASTERISK = 103; + public static readonly SLASH = 104; + public static readonly PERCENT = 105; + public static readonly CONCAT = 106; + public static readonly QUESTION_MARK = 107; + public static readonly SEMICOLON = 108; + public static readonly STRING = 109; + public static readonly BINARY_LITERAL = 110; + public static readonly INTEGER_VALUE = 111; + public static readonly DECIMAL_VALUE = 112; + public static readonly DOUBLE_VALUE = 113; + public static readonly IDENTIFIER = 114; + public static readonly DIGIT_IDENTIFIER = 115; + public static readonly QUOTED_IDENTIFIER = 116; + public static readonly BACKQUOTED_IDENTIFIER = 117; + public static readonly LINE_COMMENT = 118; + public static readonly BRACKETED_COMMENT = 119; + public static readonly WHITE_SPACE = 120; + public static readonly UNRECOGNIZED = 121; + public static readonly DELIMITER = 122; + public static readonly RULE_program = 0; + public static readonly RULE_statements = 1; + public static readonly RULE_singleStatement = 2; + public static readonly RULE_statement = 3; + public static readonly RULE_queryStatement = 4; + public static readonly RULE_withClause = 5; + public static readonly RULE_namedQuery = 6; + public static readonly RULE_queryNoWith = 7; + public static readonly RULE_queryTerm = 8; + public static readonly RULE_queryPrimary = 9; + public static readonly RULE_querySpecification = 10; + public static readonly RULE_setQuantifier = 11; + public static readonly RULE_selectItem = 12; + public static readonly RULE_fromClause = 13; + public static readonly RULE_relation = 14; + public static readonly RULE_joinType = 15; + public static readonly RULE_aliasedRelation = 16; + public static readonly RULE_relationPrimary = 17; + public static readonly RULE_whereClause = 18; + public static readonly RULE_groupByClause = 19; + public static readonly RULE_havingClause = 20; + public static readonly RULE_orderByClause = 21; + public static readonly RULE_sortItem = 22; + public static readonly RULE_limitClause = 23; + public static readonly RULE_insertStatement = 24; + public static readonly RULE_columnList = 25; + public static readonly RULE_updateStatement = 26; + public static readonly RULE_updateAssignment = 27; + public static readonly RULE_deleteStatement = 28; + public static readonly RULE_createTableStatement = 29; + public static readonly RULE_tableElement = 30; + public static readonly RULE_columnDefinition = 31; + public static readonly RULE_tableConstraint = 32; + public static readonly RULE_alterTableStatement = 33; + public static readonly RULE_dropTableStatement = 34; + public static readonly RULE_expression = 35; + public static readonly RULE_booleanExpression = 36; + public static readonly RULE_predicatedExpression = 37; + public static readonly RULE_predicate = 38; + public static readonly RULE_comparisonOperator = 39; + public static readonly RULE_valueExpression = 40; + public static readonly RULE_primaryExpression = 41; + public static readonly RULE_whenClause = 42; + public static readonly RULE_subqueryExpression = 43; + public static readonly RULE_dataType = 44; + public static readonly RULE_properties = 45; + public static readonly RULE_property = 46; + public static readonly RULE_literal = 47; + public static readonly RULE_identifier = 48; + public static readonly RULE_qualifiedName = 49; + public static readonly RULE_columnRef = 50; + public static readonly RULE_tableName = 51; + public static readonly RULE_tableNameCreate = 52; + public static readonly RULE_nonReserved = 53; + + public static readonly literalNames = [ + null, "','", "'('", "')'", "'.'", "'ADD'", "'ALL'", "'ALTER'", "'AND'", + "'AS'", "'ASC'", "'BETWEEN'", "'BIGINT'", "'BINARY'", "'BOOLEAN'", + "'BY'", "'CASE'", "'CAST'", "'CHAR'", "'CHECK'", "'COALESCE'", "'COLUMN'", + "'CONSTRAINT'", "'CREATE'", "'CROSS'", "'DATE'", "'DECIMAL'", "'DEFAULT'", + "'DELETE'", "'DESC'", "'DISTINCT'", "'DOUBLE'", "'DROP'", "'ELSE'", + "'END'", "'ESCAPE'", "'EXCEPT'", "'EXISTS'", "'FALSE'", "'FIRST'", + "'FLOAT'", "'FOREIGN'", "'FROM'", "'FULL'", "'GROUP'", "'HAVING'", + "'IF'", "'IN'", "'INNER'", "'INSERT'", "'INT'", "'INTEGER'", "'INTERSECT'", + "'INTO'", "'IS'", "'JOIN'", "'KEY'", "'LAST'", "'LEFT'", "'LIKE'", + "'LIMIT'", "'NOT'", "'NULL'", "'NULLIF'", "'NULLS'", "'NUMERIC'", + "'OFFSET'", "'ON'", "'OR'", "'ORDER'", "'OUTER'", "'PRIMARY'", "'RECURSIVE'", + "'REFERENCES'", "'RENAME'", "'RIGHT'", "'SELECT'", "'SET'", "'SMALLINT'", + "'TABLE'", "'TEXT'", "'THEN'", "'TIME'", "'TIMESTAMP'", "'TINYINT'", + "'TO'", "'TRUE'", "'UNION'", "'UNIQUE'", "'UPDATE'", "'VARCHAR'", + "'VARBINARY'", "'WHEN'", "'WHERE'", "'WITH'", "'='", null, "'<'", + "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'||'", + "'?'", "';'" + ]; + + public static readonly symbolicNames = [ + null, null, null, null, null, "KW_ADD", "KW_ALL", "KW_ALTER", "KW_AND", + "KW_AS", "KW_ASC", "KW_BETWEEN", "KW_BIGINT", "KW_BINARY", "KW_BOOLEAN", + "KW_BY", "KW_CASE", "KW_CAST", "KW_CHAR", "KW_CHECK", "KW_COALESCE", + "KW_COLUMN", "KW_CONSTRAINT", "KW_CREATE", "KW_CROSS", "KW_DATE", + "KW_DECIMAL", "KW_DEFAULT", "KW_DELETE", "KW_DESC", "KW_DISTINCT", + "KW_DOUBLE", "KW_DROP", "KW_ELSE", "KW_END", "KW_ESCAPE", "KW_EXCEPT", + "KW_EXISTS", "KW_FALSE", "KW_FIRST", "KW_FLOAT", "KW_FOREIGN", "KW_FROM", + "KW_FULL", "KW_GROUP", "KW_HAVING", "KW_IF", "KW_IN", "KW_INNER", + "KW_INSERT", "KW_INT", "KW_INTEGER", "KW_INTERSECT", "KW_INTO", + "KW_IS", "KW_JOIN", "KW_KEY", "KW_LAST", "KW_LEFT", "KW_LIKE", "KW_LIMIT", + "KW_NOT", "KW_NULL", "KW_NULLIF", "KW_NULLS", "KW_NUMERIC", "KW_OFFSET", + "KW_ON", "KW_OR", "KW_ORDER", "KW_OUTER", "KW_PRIMARY", "KW_RECURSIVE", + "KW_REFERENCES", "KW_RENAME", "KW_RIGHT", "KW_SELECT", "KW_SET", + "KW_SMALLINT", "KW_TABLE", "KW_TEXT", "KW_THEN", "KW_TIME", "KW_TIMESTAMP", + "KW_TINYINT", "KW_TO", "KW_TRUE", "KW_UNION", "KW_UNIQUE", "KW_UPDATE", + "KW_VARCHAR", "KW_VARBINARY", "KW_WHEN", "KW_WHERE", "KW_WITH", + "EQ", "NEQ", "LT", "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", + "SLASH", "PERCENT", "CONCAT", "QUESTION_MARK", "SEMICOLON", "STRING", + "BINARY_LITERAL", "INTEGER_VALUE", "DECIMAL_VALUE", "DOUBLE_VALUE", + "IDENTIFIER", "DIGIT_IDENTIFIER", "QUOTED_IDENTIFIER", "BACKQUOTED_IDENTIFIER", + "LINE_COMMENT", "BRACKETED_COMMENT", "WHITE_SPACE", "UNRECOGNIZED", + "DELIMITER" + ]; + public static readonly ruleNames = [ + "program", "statements", "singleStatement", "statement", "queryStatement", + "withClause", "namedQuery", "queryNoWith", "queryTerm", "queryPrimary", + "querySpecification", "setQuantifier", "selectItem", "fromClause", + "relation", "joinType", "aliasedRelation", "relationPrimary", "whereClause", + "groupByClause", "havingClause", "orderByClause", "sortItem", "limitClause", + "insertStatement", "columnList", "updateStatement", "updateAssignment", + "deleteStatement", "createTableStatement", "tableElement", "columnDefinition", + "tableConstraint", "alterTableStatement", "dropTableStatement", + "expression", "booleanExpression", "predicatedExpression", "predicate", + "comparisonOperator", "valueExpression", "primaryExpression", "whenClause", + "subqueryExpression", "dataType", "properties", "property", "literal", + "identifier", "qualifiedName", "columnRef", "tableName", "tableNameCreate", + "nonReserved", + ]; + + public get grammarFileName(): string { return "GenericSql.g4"; } + public get literalNames(): (string | null)[] { return GenericSqlParser.literalNames; } + public get symbolicNames(): (string | null)[] { return GenericSqlParser.symbolicNames; } + public get ruleNames(): string[] { return GenericSqlParser.ruleNames; } + public get serializedATN(): number[] { return GenericSqlParser._serializedATN; } + + protected createFailedPredicateException(predicate?: string, message?: string): antlr.FailedPredicateException { + return new antlr.FailedPredicateException(this, predicate, message); + } + + public constructor(input: antlr.TokenStream) { + super(input); + this.interpreter = new antlr.ParserATNSimulator(this, GenericSqlParser._ATN, GenericSqlParser.decisionsToDFA, new antlr.PredictionContextCache()); + } + public program(): ProgramContext { + let localContext = new ProgramContext(this.context, this.state); + this.enterRule(localContext, 0, GenericSqlParser.RULE_program); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 111; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 276824196) !== 0) || _la === 32 || _la === 49 || ((((_la - 76)) & ~0x1F) === 0 && ((1 << (_la - 76)) & 270337) !== 0)) { + { + { + this.state = 108; + this.statements(); + } + } + this.state = 113; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 114; + this.match(GenericSqlParser.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; + } + public statements(): StatementsContext { + let localContext = new StatementsContext(this.context, this.state); + this.enterRule(localContext, 2, GenericSqlParser.RULE_statements); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 116; + 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; + } + public singleStatement(): SingleStatementContext { + let localContext = new SingleStatementContext(this.context, this.state); + this.enterRule(localContext, 4, GenericSqlParser.RULE_singleStatement); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 118; + this.statement(); + this.state = 120; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 108) { + { + this.state = 119; + this.match(GenericSqlParser.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; + } + public statement(): StatementContext { + let localContext = new StatementContext(this.context, this.state); + this.enterRule(localContext, 6, GenericSqlParser.RULE_statement); + try { + this.state = 129; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.T__1: + case GenericSqlParser.KW_SELECT: + case GenericSqlParser.KW_WITH: + localContext = new StatementDefaultContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 122; + this.queryStatement(); + } + break; + case GenericSqlParser.KW_INSERT: + localContext = new InsertContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 123; + this.insertStatement(); + } + break; + case GenericSqlParser.KW_UPDATE: + localContext = new UpdateContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 124; + this.updateStatement(); + } + break; + case GenericSqlParser.KW_DELETE: + localContext = new DeleteContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 125; + this.deleteStatement(); + } + break; + case GenericSqlParser.KW_CREATE: + localContext = new CreateTableContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 126; + this.createTableStatement(); + } + break; + case GenericSqlParser.KW_ALTER: + localContext = new AlterTableContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 127; + this.alterTableStatement(); + } + break; + case GenericSqlParser.KW_DROP: + localContext = new DropTableContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 128; + this.dropTableStatement(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + 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; + } + public queryStatement(): QueryStatementContext { + let localContext = new QueryStatementContext(this.context, this.state); + this.enterRule(localContext, 8, GenericSqlParser.RULE_queryStatement); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 132; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 94) { + { + this.state = 131; + this.withClause(); + } + } + + this.state = 134; + this.queryNoWith(); + } + } + 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; + } + public withClause(): WithClauseContext { + let localContext = new WithClauseContext(this.context, this.state); + this.enterRule(localContext, 10, GenericSqlParser.RULE_withClause); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 136; + this.match(GenericSqlParser.KW_WITH); + this.state = 138; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 72) { + { + this.state = 137; + this.match(GenericSqlParser.KW_RECURSIVE); + } + } + + this.state = 140; + this.namedQuery(); + this.state = 145; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 141; + this.match(GenericSqlParser.T__0); + this.state = 142; + this.namedQuery(); + } + } + this.state = 147; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + 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; + } + public namedQuery(): NamedQueryContext { + let localContext = new NamedQueryContext(this.context, this.state); + this.enterRule(localContext, 12, GenericSqlParser.RULE_namedQuery); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 148; + localContext._name = this.identifier(); + this.state = 149; + this.match(GenericSqlParser.KW_AS); + this.state = 150; + this.match(GenericSqlParser.T__1); + this.state = 151; + this.queryStatement(); + this.state = 152; + this.match(GenericSqlParser.T__2); + } + } + 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; + } + public queryNoWith(): QueryNoWithContext { + let localContext = new QueryNoWithContext(this.context, this.state); + this.enterRule(localContext, 14, GenericSqlParser.RULE_queryNoWith); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 154; + this.queryTerm(); + this.state = 162; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 36 || _la === 52 || _la === 87) { + { + { + this.state = 155; + _la = this.tokenStream.LA(1); + if(!(_la === 36 || _la === 52 || _la === 87)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 157; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 6) { + { + this.state = 156; + this.match(GenericSqlParser.KW_ALL); + } + } + + this.state = 159; + this.queryTerm(); + } + } + this.state = 164; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + 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; + } + public queryTerm(): QueryTermContext { + let localContext = new QueryTermContext(this.context, this.state); + this.enterRule(localContext, 16, GenericSqlParser.RULE_queryTerm); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 165; + this.queryPrimary(); + } + } + 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; + } + public queryPrimary(): QueryPrimaryContext { + let localContext = new QueryPrimaryContext(this.context, this.state); + this.enterRule(localContext, 18, GenericSqlParser.RULE_queryPrimary); + try { + this.state = 172; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.KW_SELECT: + this.enterOuterAlt(localContext, 1); + { + this.state = 167; + this.querySpecification(); + } + break; + case GenericSqlParser.T__1: + this.enterOuterAlt(localContext, 2); + { + this.state = 168; + this.match(GenericSqlParser.T__1); + this.state = 169; + this.queryStatement(); + this.state = 170; + this.match(GenericSqlParser.T__2); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + 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; + } + public querySpecification(): QuerySpecificationContext { + let localContext = new QuerySpecificationContext(this.context, this.state); + this.enterRule(localContext, 20, GenericSqlParser.RULE_querySpecification); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 174; + this.match(GenericSqlParser.KW_SELECT); + this.state = 176; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context) ) { + case 1: + { + this.state = 175; + this.setQuantifier(); + } + break; + } + this.state = 178; + this.selectItem(); + this.state = 183; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 179; + this.match(GenericSqlParser.T__0); + this.state = 180; + this.selectItem(); + } + } + this.state = 185; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 187; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 186; + this.fromClause(); + } + } + + this.state = 190; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 93) { + { + this.state = 189; + this.whereClause(); + } + } + + this.state = 193; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 44) { + { + this.state = 192; + this.groupByClause(); + } + } + + this.state = 196; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 45) { + { + this.state = 195; + this.havingClause(); + } + } + + this.state = 199; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 69) { + { + this.state = 198; + this.orderByClause(); + } + } + + this.state = 202; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 60) { + { + this.state = 201; + this.limitClause(); + } + } + + } + } + 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; + } + public setQuantifier(): SetQuantifierContext { + let localContext = new SetQuantifierContext(this.context, this.state); + this.enterRule(localContext, 22, GenericSqlParser.RULE_setQuantifier); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 204; + _la = this.tokenStream.LA(1); + if(!(_la === 6 || _la === 30)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + 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; + } + public selectItem(): SelectItemContext { + let localContext = new SelectItemContext(this.context, this.state); + this.enterRule(localContext, 24, GenericSqlParser.RULE_selectItem); + let _la: number; + try { + this.state = 218; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 19, this.context) ) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 206; + this.expression(); + this.state = 211; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 18, this.context) ) { + case 1: + { + this.state = 208; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 9) { + { + this.state = 207; + this.match(GenericSqlParser.KW_AS); + } + } + + this.state = 210; + this.identifier(); + } + break; + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 213; + this.qualifiedName(); + this.state = 214; + this.match(GenericSqlParser.T__3); + this.state = 215; + this.match(GenericSqlParser.ASTERISK); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 217; + this.match(GenericSqlParser.ASTERISK); + } + break; + } + } + 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; + } + public fromClause(): FromClauseContext { + let localContext = new FromClauseContext(this.context, this.state); + this.enterRule(localContext, 26, GenericSqlParser.RULE_fromClause); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 220; + this.match(GenericSqlParser.KW_FROM); + this.state = 221; + this.relation(0); + this.state = 226; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 222; + this.match(GenericSqlParser.T__0); + this.state = 223; + this.relation(0); + } + } + this.state = 228; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + 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; + } + + public relation(): RelationContext; + public relation(_p: number): RelationContext; + public relation(_p?: number): RelationContext { + if (_p === undefined) { + _p = 0; + } + + let parentContext = this.context; + let parentState = this.state; + let localContext = new RelationContext(this.context, parentState); + let previousContext = localContext; + let _startState = 28; + this.enterRecursionRule(localContext, 28, GenericSqlParser.RULE_relation, _p); + try { + let alternative: number; + this.enterOuterAlt(localContext, 1); + { + { + localContext = new SimpleRelationContext(localContext); + this.context = localContext; + previousContext = localContext; + + this.state = 230; + this.aliasedRelation(); + } + this.context!.stop = this.tokenStream.LT(-1); + this.state = 241; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 21, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + { + localContext = new JoinRelationContext(new RelationContext(parentContext, parentState)); + (localContext as JoinRelationContext)._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, GenericSqlParser.RULE_relation); + this.state = 232; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 233; + this.joinType(); + this.state = 234; + this.match(GenericSqlParser.KW_JOIN); + this.state = 235; + (localContext as JoinRelationContext)._right = this.relation(0); + this.state = 236; + this.match(GenericSqlParser.KW_ON); + this.state = 237; + (localContext as JoinRelationContext)._condition = this.expression(); + } + } + } + this.state = 243; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 21, this.context); + } + } + } + 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.unrollRecursionContexts(parentContext); + } + return localContext; + } + public joinType(): JoinTypeContext { + let localContext = new JoinTypeContext(this.context, this.state); + this.enterRule(localContext, 30, GenericSqlParser.RULE_joinType); + let _la: number; + try { + this.state = 260; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.KW_INNER: + case GenericSqlParser.KW_JOIN: + this.enterOuterAlt(localContext, 1); + { + this.state = 245; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 48) { + { + this.state = 244; + this.match(GenericSqlParser.KW_INNER); + } + } + + } + break; + case GenericSqlParser.KW_LEFT: + this.enterOuterAlt(localContext, 2); + { + this.state = 247; + this.match(GenericSqlParser.KW_LEFT); + this.state = 249; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 70) { + { + this.state = 248; + this.match(GenericSqlParser.KW_OUTER); + } + } + + } + break; + case GenericSqlParser.KW_RIGHT: + this.enterOuterAlt(localContext, 3); + { + this.state = 251; + this.match(GenericSqlParser.KW_RIGHT); + this.state = 253; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 70) { + { + this.state = 252; + this.match(GenericSqlParser.KW_OUTER); + } + } + + } + break; + case GenericSqlParser.KW_FULL: + this.enterOuterAlt(localContext, 4); + { + this.state = 255; + this.match(GenericSqlParser.KW_FULL); + this.state = 257; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 70) { + { + this.state = 256; + this.match(GenericSqlParser.KW_OUTER); + } + } + + } + break; + case GenericSqlParser.KW_CROSS: + this.enterOuterAlt(localContext, 5); + { + this.state = 259; + this.match(GenericSqlParser.KW_CROSS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + 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; + } + public aliasedRelation(): AliasedRelationContext { + let localContext = new AliasedRelationContext(this.context, this.state); + this.enterRule(localContext, 32, GenericSqlParser.RULE_aliasedRelation); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 262; + this.relationPrimary(); + this.state = 267; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 28, this.context) ) { + case 1: + { + this.state = 264; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 9) { + { + this.state = 263; + this.match(GenericSqlParser.KW_AS); + } + } + + this.state = 266; + this.identifier(); + } + break; + } + } + } + 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; + } + public relationPrimary(): RelationPrimaryContext { + let localContext = new RelationPrimaryContext(this.context, this.state); + this.enterRule(localContext, 34, GenericSqlParser.RULE_relationPrimary); + try { + this.state = 274; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.KW_ADD: + case GenericSqlParser.KW_ALL: + case GenericSqlParser.KW_ASC: + case GenericSqlParser.KW_BIGINT: + case GenericSqlParser.KW_BINARY: + case GenericSqlParser.KW_BOOLEAN: + case GenericSqlParser.KW_BY: + case GenericSqlParser.KW_CHAR: + case GenericSqlParser.KW_COALESCE: + case GenericSqlParser.KW_COLUMN: + case GenericSqlParser.KW_CROSS: + case GenericSqlParser.KW_DATE: + case GenericSqlParser.KW_DECIMAL: + case GenericSqlParser.KW_DEFAULT: + case GenericSqlParser.KW_DESC: + case GenericSqlParser.KW_DOUBLE: + case GenericSqlParser.KW_FALSE: + case GenericSqlParser.KW_FIRST: + case GenericSqlParser.KW_FLOAT: + case GenericSqlParser.KW_FULL: + case GenericSqlParser.KW_IF: + case GenericSqlParser.KW_INT: + case GenericSqlParser.KW_INTEGER: + case GenericSqlParser.KW_KEY: + case GenericSqlParser.KW_LAST: + case GenericSqlParser.KW_LEFT: + case GenericSqlParser.KW_LIMIT: + case GenericSqlParser.KW_NULLIF: + case GenericSqlParser.KW_NULLS: + case GenericSqlParser.KW_NUMERIC: + case GenericSqlParser.KW_OFFSET: + case GenericSqlParser.KW_OUTER: + case GenericSqlParser.KW_RIGHT: + case GenericSqlParser.KW_SMALLINT: + case GenericSqlParser.KW_TEXT: + case GenericSqlParser.KW_TIME: + case GenericSqlParser.KW_TIMESTAMP: + case GenericSqlParser.KW_TINYINT: + case GenericSqlParser.KW_TO: + case GenericSqlParser.KW_TRUE: + case GenericSqlParser.KW_UNIQUE: + case GenericSqlParser.KW_VARCHAR: + case GenericSqlParser.KW_VARBINARY: + case GenericSqlParser.IDENTIFIER: + case GenericSqlParser.DIGIT_IDENTIFIER: + case GenericSqlParser.QUOTED_IDENTIFIER: + case GenericSqlParser.BACKQUOTED_IDENTIFIER: + localContext = new TableNameRelationContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 269; + this.tableName(); + } + break; + case GenericSqlParser.T__1: + localContext = new SubqueryRelationContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 270; + this.match(GenericSqlParser.T__1); + this.state = 271; + this.queryStatement(); + this.state = 272; + this.match(GenericSqlParser.T__2); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + 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; + } + public whereClause(): WhereClauseContext { + let localContext = new WhereClauseContext(this.context, this.state); + this.enterRule(localContext, 36, GenericSqlParser.RULE_whereClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 276; + this.match(GenericSqlParser.KW_WHERE); + this.state = 277; + this.expression(); + } + } + 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; + } + public groupByClause(): GroupByClauseContext { + let localContext = new GroupByClauseContext(this.context, this.state); + this.enterRule(localContext, 38, GenericSqlParser.RULE_groupByClause); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 279; + this.match(GenericSqlParser.KW_GROUP); + this.state = 280; + this.match(GenericSqlParser.KW_BY); + this.state = 282; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 30, this.context) ) { + case 1: + { + this.state = 281; + this.setQuantifier(); + } + break; + } + this.state = 284; + this.expression(); + this.state = 289; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 285; + this.match(GenericSqlParser.T__0); + this.state = 286; + this.expression(); + } + } + this.state = 291; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + 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; + } + public havingClause(): HavingClauseContext { + let localContext = new HavingClauseContext(this.context, this.state); + this.enterRule(localContext, 40, GenericSqlParser.RULE_havingClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 292; + this.match(GenericSqlParser.KW_HAVING); + this.state = 293; + this.expression(); + } + } + 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; + } + public orderByClause(): OrderByClauseContext { + let localContext = new OrderByClauseContext(this.context, this.state); + this.enterRule(localContext, 42, GenericSqlParser.RULE_orderByClause); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 295; + this.match(GenericSqlParser.KW_ORDER); + this.state = 296; + this.match(GenericSqlParser.KW_BY); + this.state = 297; + this.sortItem(); + this.state = 302; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 298; + this.match(GenericSqlParser.T__0); + this.state = 299; + this.sortItem(); + } + } + this.state = 304; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + 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; + } + public sortItem(): SortItemContext { + let localContext = new SortItemContext(this.context, this.state); + this.enterRule(localContext, 44, GenericSqlParser.RULE_sortItem); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 305; + this.expression(); + this.state = 307; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 10 || _la === 29) { + { + this.state = 306; + localContext._ordering = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if(!(_la === 10 || _la === 29)) { + localContext._ordering = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + + this.state = 311; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 64) { + { + this.state = 309; + this.match(GenericSqlParser.KW_NULLS); + this.state = 310; + localContext._nullOrdering = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if(!(_la === 39 || _la === 57)) { + localContext._nullOrdering = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + + } + } + 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; + } + public limitClause(): LimitClauseContext { + let localContext = new LimitClauseContext(this.context, this.state); + this.enterRule(localContext, 46, GenericSqlParser.RULE_limitClause); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 313; + this.match(GenericSqlParser.KW_LIMIT); + this.state = 314; + localContext._limit = this.expression(); + this.state = 317; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 66) { + { + this.state = 315; + this.match(GenericSqlParser.KW_OFFSET); + this.state = 316; + localContext._offset = this.expression(); + } + } + + } + } + 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; + } + public insertStatement(): InsertStatementContext { + let localContext = new InsertStatementContext(this.context, this.state); + this.enterRule(localContext, 48, GenericSqlParser.RULE_insertStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 319; + this.match(GenericSqlParser.KW_INSERT); + this.state = 320; + this.match(GenericSqlParser.KW_INTO); + this.state = 321; + this.tableName(); + this.state = 323; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 36, this.context) ) { + case 1: + { + this.state = 322; + this.columnList(); + } + break; + } + this.state = 325; + this.queryStatement(); + } + } + 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; + } + public columnList(): ColumnListContext { + let localContext = new ColumnListContext(this.context, this.state); + this.enterRule(localContext, 50, GenericSqlParser.RULE_columnList); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 327; + this.match(GenericSqlParser.T__1); + this.state = 328; + this.columnRef(); + this.state = 333; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 329; + this.match(GenericSqlParser.T__0); + this.state = 330; + this.columnRef(); + } + } + this.state = 335; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 336; + this.match(GenericSqlParser.T__2); + } + } + 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; + } + public updateStatement(): UpdateStatementContext { + let localContext = new UpdateStatementContext(this.context, this.state); + this.enterRule(localContext, 52, GenericSqlParser.RULE_updateStatement); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 338; + this.match(GenericSqlParser.KW_UPDATE); + this.state = 339; + this.tableName(); + this.state = 340; + this.match(GenericSqlParser.KW_SET); + this.state = 341; + this.updateAssignment(); + this.state = 346; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 342; + this.match(GenericSqlParser.T__0); + this.state = 343; + this.updateAssignment(); + } + } + this.state = 348; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 350; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 93) { + { + this.state = 349; + this.whereClause(); + } + } + + } + } + 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; + } + public updateAssignment(): UpdateAssignmentContext { + let localContext = new UpdateAssignmentContext(this.context, this.state); + this.enterRule(localContext, 54, GenericSqlParser.RULE_updateAssignment); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 352; + this.columnRef(); + this.state = 353; + this.match(GenericSqlParser.EQ); + this.state = 354; + this.expression(); + } + } + 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; + } + public deleteStatement(): DeleteStatementContext { + let localContext = new DeleteStatementContext(this.context, this.state); + this.enterRule(localContext, 56, GenericSqlParser.RULE_deleteStatement); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 356; + this.match(GenericSqlParser.KW_DELETE); + this.state = 357; + this.match(GenericSqlParser.KW_FROM); + this.state = 358; + this.tableName(); + this.state = 360; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 93) { + { + this.state = 359; + this.whereClause(); + } + } + + } + } + 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; + } + public createTableStatement(): CreateTableStatementContext { + let localContext = new CreateTableStatementContext(this.context, this.state); + this.enterRule(localContext, 58, GenericSqlParser.RULE_createTableStatement); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 362; + this.match(GenericSqlParser.KW_CREATE); + this.state = 363; + this.match(GenericSqlParser.KW_TABLE); + this.state = 367; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 41, this.context) ) { + case 1: + { + this.state = 364; + this.match(GenericSqlParser.KW_IF); + this.state = 365; + this.match(GenericSqlParser.KW_NOT); + this.state = 366; + this.match(GenericSqlParser.KW_EXISTS); + } + break; + } + this.state = 369; + this.tableNameCreate(); + this.state = 370; + this.match(GenericSqlParser.T__1); + this.state = 371; + this.tableElement(); + this.state = 376; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 372; + this.match(GenericSqlParser.T__0); + this.state = 373; + this.tableElement(); + } + } + this.state = 378; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 379; + this.match(GenericSqlParser.T__2); + this.state = 382; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 43, this.context) ) { + case 1: + { + this.state = 380; + this.match(GenericSqlParser.KW_WITH); + this.state = 381; + this.properties(); + } + break; + } + } + } + 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; + } + public tableElement(): TableElementContext { + let localContext = new TableElementContext(this.context, this.state); + this.enterRule(localContext, 60, GenericSqlParser.RULE_tableElement); + try { + this.state = 386; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 44, this.context) ) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 384; + this.columnDefinition(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 385; + this.tableConstraint(); + } + break; + } + } + 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; + } + public columnDefinition(): ColumnDefinitionContext { + let localContext = new ColumnDefinitionContext(this.context, this.state); + this.enterRule(localContext, 62, GenericSqlParser.RULE_columnDefinition); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 388; + this.columnRef(); + this.state = 389; + this.dataType(); + this.state = 392; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 61) { + { + this.state = 390; + this.match(GenericSqlParser.KW_NOT); + this.state = 391; + this.match(GenericSqlParser.KW_NULL); + } + } + + this.state = 396; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 27) { + { + this.state = 394; + this.match(GenericSqlParser.KW_DEFAULT); + this.state = 395; + this.expression(); + } + } + + this.state = 400; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 71) { + { + this.state = 398; + this.match(GenericSqlParser.KW_PRIMARY); + this.state = 399; + this.match(GenericSqlParser.KW_KEY); + } + } + + } + } + 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; + } + public tableConstraint(): TableConstraintContext { + let localContext = new TableConstraintContext(this.context, this.state); + this.enterRule(localContext, 64, GenericSqlParser.RULE_tableConstraint); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 404; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 22) { + { + this.state = 402; + this.match(GenericSqlParser.KW_CONSTRAINT); + this.state = 403; + this.identifier(); + } + } + + this.state = 461; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.KW_PRIMARY: + { + this.state = 406; + this.match(GenericSqlParser.KW_PRIMARY); + this.state = 407; + this.match(GenericSqlParser.KW_KEY); + this.state = 408; + this.match(GenericSqlParser.T__1); + this.state = 409; + this.columnRef(); + this.state = 414; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 410; + this.match(GenericSqlParser.T__0); + this.state = 411; + this.columnRef(); + } + } + this.state = 416; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 417; + this.match(GenericSqlParser.T__2); + } + break; + case GenericSqlParser.KW_UNIQUE: + { + this.state = 419; + this.match(GenericSqlParser.KW_UNIQUE); + this.state = 420; + this.match(GenericSqlParser.T__1); + this.state = 421; + this.columnRef(); + this.state = 426; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 422; + this.match(GenericSqlParser.T__0); + this.state = 423; + this.columnRef(); + } + } + this.state = 428; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 429; + this.match(GenericSqlParser.T__2); + } + break; + case GenericSqlParser.KW_CHECK: + { + this.state = 431; + this.match(GenericSqlParser.KW_CHECK); + this.state = 432; + this.match(GenericSqlParser.T__1); + this.state = 433; + this.expression(); + this.state = 434; + this.match(GenericSqlParser.T__2); + } + break; + case GenericSqlParser.KW_FOREIGN: + { + this.state = 436; + this.match(GenericSqlParser.KW_FOREIGN); + this.state = 437; + this.match(GenericSqlParser.KW_KEY); + this.state = 438; + this.match(GenericSqlParser.T__1); + this.state = 439; + this.columnRef(); + this.state = 444; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 440; + this.match(GenericSqlParser.T__0); + this.state = 441; + this.columnRef(); + } + } + this.state = 446; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 447; + this.match(GenericSqlParser.T__2); + this.state = 448; + this.match(GenericSqlParser.KW_REFERENCES); + this.state = 449; + this.tableName(); + this.state = 450; + this.match(GenericSqlParser.T__1); + this.state = 451; + this.columnRef(); + this.state = 456; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 452; + this.match(GenericSqlParser.T__0); + this.state = 453; + this.columnRef(); + } + } + this.state = 458; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 459; + this.match(GenericSqlParser.T__2); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + 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; + } + public alterTableStatement(): AlterTableStatementContext { + let localContext = new AlterTableStatementContext(this.context, this.state); + this.enterRule(localContext, 66, GenericSqlParser.RULE_alterTableStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 463; + this.match(GenericSqlParser.KW_ALTER); + this.state = 464; + this.match(GenericSqlParser.KW_TABLE); + this.state = 467; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 54, this.context) ) { + case 1: + { + this.state = 465; + this.match(GenericSqlParser.KW_IF); + this.state = 466; + this.match(GenericSqlParser.KW_EXISTS); + } + break; + } + this.state = 469; + this.tableName(); + this.state = 501; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 57, this.context) ) { + case 1: + { + this.state = 470; + this.match(GenericSqlParser.KW_ADD); + this.state = 471; + this.match(GenericSqlParser.KW_COLUMN); + this.state = 475; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 55, this.context) ) { + case 1: + { + this.state = 472; + this.match(GenericSqlParser.KW_IF); + this.state = 473; + this.match(GenericSqlParser.KW_NOT); + this.state = 474; + this.match(GenericSqlParser.KW_EXISTS); + } + break; + } + this.state = 477; + this.columnDefinition(); + } + break; + case 2: + { + this.state = 478; + this.match(GenericSqlParser.KW_DROP); + this.state = 479; + this.match(GenericSqlParser.KW_COLUMN); + this.state = 482; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 56, this.context) ) { + case 1: + { + this.state = 480; + this.match(GenericSqlParser.KW_IF); + this.state = 481; + this.match(GenericSqlParser.KW_EXISTS); + } + break; + } + this.state = 484; + this.columnRef(); + } + break; + case 3: + { + this.state = 485; + this.match(GenericSqlParser.KW_RENAME); + this.state = 486; + this.match(GenericSqlParser.KW_TO); + this.state = 487; + this.tableNameCreate(); + } + break; + case 4: + { + this.state = 488; + this.match(GenericSqlParser.KW_ALTER); + this.state = 489; + this.match(GenericSqlParser.KW_COLUMN); + this.state = 490; + this.columnRef(); + this.state = 491; + this.match(GenericSqlParser.KW_SET); + this.state = 492; + this.match(GenericSqlParser.KW_DEFAULT); + this.state = 493; + this.expression(); + } + break; + case 5: + { + this.state = 495; + this.match(GenericSqlParser.KW_ALTER); + this.state = 496; + this.match(GenericSqlParser.KW_COLUMN); + this.state = 497; + this.columnRef(); + this.state = 498; + this.match(GenericSqlParser.KW_DROP); + this.state = 499; + this.match(GenericSqlParser.KW_DEFAULT); + } + break; + } + } + } + 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; + } + public dropTableStatement(): DropTableStatementContext { + let localContext = new DropTableStatementContext(this.context, this.state); + this.enterRule(localContext, 68, GenericSqlParser.RULE_dropTableStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 503; + this.match(GenericSqlParser.KW_DROP); + this.state = 504; + this.match(GenericSqlParser.KW_TABLE); + this.state = 507; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 58, this.context) ) { + case 1: + { + this.state = 505; + this.match(GenericSqlParser.KW_IF); + this.state = 506; + this.match(GenericSqlParser.KW_EXISTS); + } + break; + } + this.state = 509; + this.tableName(); + } + } + 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; + } + public expression(): ExpressionContext { + let localContext = new ExpressionContext(this.context, this.state); + this.enterRule(localContext, 70, GenericSqlParser.RULE_expression); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 511; + this.booleanExpression(0); + } + } + 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; + } + + public booleanExpression(): BooleanExpressionContext; + public booleanExpression(_p: number): BooleanExpressionContext; + public booleanExpression(_p?: number): BooleanExpressionContext { + if (_p === undefined) { + _p = 0; + } + + let parentContext = this.context; + let parentState = this.state; + let localContext = new BooleanExpressionContext(this.context, parentState); + let previousContext = localContext; + let _startState = 72; + this.enterRecursionRule(localContext, 72, GenericSqlParser.RULE_booleanExpression, _p); + try { + let alternative: number; + this.enterOuterAlt(localContext, 1); + { + this.state = 517; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.T__1: + case GenericSqlParser.KW_ADD: + case GenericSqlParser.KW_ALL: + case GenericSqlParser.KW_ASC: + case GenericSqlParser.KW_BIGINT: + case GenericSqlParser.KW_BINARY: + case GenericSqlParser.KW_BOOLEAN: + case GenericSqlParser.KW_BY: + case GenericSqlParser.KW_CASE: + case GenericSqlParser.KW_CAST: + case GenericSqlParser.KW_CHAR: + case GenericSqlParser.KW_COALESCE: + case GenericSqlParser.KW_COLUMN: + case GenericSqlParser.KW_CROSS: + case GenericSqlParser.KW_DATE: + case GenericSqlParser.KW_DECIMAL: + case GenericSqlParser.KW_DEFAULT: + case GenericSqlParser.KW_DESC: + case GenericSqlParser.KW_DOUBLE: + case GenericSqlParser.KW_EXISTS: + case GenericSqlParser.KW_FALSE: + case GenericSqlParser.KW_FIRST: + case GenericSqlParser.KW_FLOAT: + case GenericSqlParser.KW_FULL: + case GenericSqlParser.KW_IF: + case GenericSqlParser.KW_INT: + case GenericSqlParser.KW_INTEGER: + case GenericSqlParser.KW_KEY: + case GenericSqlParser.KW_LAST: + case GenericSqlParser.KW_LEFT: + case GenericSqlParser.KW_LIMIT: + case GenericSqlParser.KW_NULL: + case GenericSqlParser.KW_NULLIF: + case GenericSqlParser.KW_NULLS: + case GenericSqlParser.KW_NUMERIC: + case GenericSqlParser.KW_OFFSET: + case GenericSqlParser.KW_OUTER: + case GenericSqlParser.KW_RIGHT: + case GenericSqlParser.KW_SMALLINT: + case GenericSqlParser.KW_TEXT: + case GenericSqlParser.KW_TIME: + case GenericSqlParser.KW_TIMESTAMP: + case GenericSqlParser.KW_TINYINT: + case GenericSqlParser.KW_TO: + case GenericSqlParser.KW_TRUE: + case GenericSqlParser.KW_UNIQUE: + case GenericSqlParser.KW_VARCHAR: + case GenericSqlParser.KW_VARBINARY: + case GenericSqlParser.PLUS: + case GenericSqlParser.MINUS: + case GenericSqlParser.STRING: + case GenericSqlParser.BINARY_LITERAL: + case GenericSqlParser.INTEGER_VALUE: + case GenericSqlParser.DECIMAL_VALUE: + case GenericSqlParser.DOUBLE_VALUE: + case GenericSqlParser.IDENTIFIER: + case GenericSqlParser.DIGIT_IDENTIFIER: + case GenericSqlParser.QUOTED_IDENTIFIER: + case GenericSqlParser.BACKQUOTED_IDENTIFIER: + { + localContext = new PredicatedContext(localContext); + this.context = localContext; + previousContext = localContext; + + this.state = 514; + this.predicatedExpression(); + } + break; + case GenericSqlParser.KW_NOT: + { + localContext = new NotExpressionContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 515; + this.match(GenericSqlParser.KW_NOT); + this.state = 516; + this.booleanExpression(3); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.context!.stop = this.tokenStream.LT(-1); + this.state = 527; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 61, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 525; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 60, this.context) ) { + case 1: + { + localContext = new AndExpressionContext(new BooleanExpressionContext(parentContext, parentState)); + (localContext as AndExpressionContext)._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, GenericSqlParser.RULE_booleanExpression); + this.state = 519; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 520; + this.match(GenericSqlParser.KW_AND); + this.state = 521; + (localContext as AndExpressionContext)._right = this.booleanExpression(3); + } + break; + case 2: + { + localContext = new OrExpressionContext(new BooleanExpressionContext(parentContext, parentState)); + (localContext as OrExpressionContext)._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, GenericSqlParser.RULE_booleanExpression); + this.state = 522; + if (!(this.precpred(this.context, 1))) { + throw this.createFailedPredicateException("this.precpred(this.context, 1)"); + } + this.state = 523; + this.match(GenericSqlParser.KW_OR); + this.state = 524; + (localContext as OrExpressionContext)._right = this.booleanExpression(2); + } + break; + } + } + } + this.state = 529; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 61, this.context); + } + } + } + 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.unrollRecursionContexts(parentContext); + } + return localContext; + } + public predicatedExpression(): PredicatedExpressionContext { + let localContext = new PredicatedExpressionContext(this.context, this.state); + this.enterRule(localContext, 74, GenericSqlParser.RULE_predicatedExpression); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 530; + this.valueExpression(0); + this.state = 532; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 62, this.context) ) { + case 1: + { + this.state = 531; + this.predicate(); + } + break; + } + } + } + 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; + } + public predicate(): PredicateContext { + let localContext = new PredicateContext(this.context, this.state); + this.enterRule(localContext, 76, GenericSqlParser.RULE_predicate); + let _la: number; + try { + this.state = 589; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 71, this.context) ) { + case 1: + localContext = new ComparisonPredicateContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 534; + this.comparisonOperator(); + this.state = 535; + (localContext as ComparisonPredicateContext)._right = this.valueExpression(0); + } + break; + case 2: + localContext = new InPredicateContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 538; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 61) { + { + this.state = 537; + this.match(GenericSqlParser.KW_NOT); + } + } + + this.state = 540; + this.match(GenericSqlParser.KW_IN); + this.state = 541; + this.match(GenericSqlParser.T__1); + this.state = 542; + this.expression(); + this.state = 547; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 543; + this.match(GenericSqlParser.T__0); + this.state = 544; + this.expression(); + } + } + this.state = 549; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 550; + this.match(GenericSqlParser.T__2); + } + break; + case 3: + localContext = new InSubqueryPredicateContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 553; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 61) { + { + this.state = 552; + this.match(GenericSqlParser.KW_NOT); + } + } + + this.state = 555; + this.match(GenericSqlParser.KW_IN); + this.state = 556; + this.match(GenericSqlParser.T__1); + this.state = 557; + this.queryStatement(); + this.state = 558; + this.match(GenericSqlParser.T__2); + } + break; + case 4: + localContext = new BetweenPredicateContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 61) { + { + this.state = 560; + this.match(GenericSqlParser.KW_NOT); + } + } + + this.state = 563; + this.match(GenericSqlParser.KW_BETWEEN); + this.state = 564; + (localContext as BetweenPredicateContext)._lower = this.valueExpression(0); + this.state = 565; + this.match(GenericSqlParser.KW_AND); + this.state = 566; + (localContext as BetweenPredicateContext)._upper = this.valueExpression(0); + } + break; + case 5: + localContext = new LikePredicateContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 569; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 61) { + { + this.state = 568; + this.match(GenericSqlParser.KW_NOT); + } + } + + this.state = 571; + this.match(GenericSqlParser.KW_LIKE); + this.state = 572; + (localContext as LikePredicateContext)._pattern = this.valueExpression(0); + this.state = 575; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 68, this.context) ) { + case 1: + { + this.state = 573; + this.match(GenericSqlParser.KW_ESCAPE); + this.state = 574; + (localContext as LikePredicateContext)._escape = this.valueExpression(0); + } + break; + } + } + break; + case 6: + localContext = new NullPredicateContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 577; + this.match(GenericSqlParser.KW_IS); + this.state = 579; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 61) { + { + this.state = 578; + this.match(GenericSqlParser.KW_NOT); + } + } + + this.state = 581; + this.match(GenericSqlParser.KW_NULL); + } + break; + case 7: + localContext = new DistinctFromPredicateContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 582; + this.match(GenericSqlParser.KW_IS); + this.state = 584; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 61) { + { + this.state = 583; + this.match(GenericSqlParser.KW_NOT); + } + } + + this.state = 586; + this.match(GenericSqlParser.KW_DISTINCT); + this.state = 587; + this.match(GenericSqlParser.KW_FROM); + this.state = 588; + (localContext as DistinctFromPredicateContext)._right = this.valueExpression(0); + } + break; + } + } + 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; + } + public comparisonOperator(): ComparisonOperatorContext { + let localContext = new ComparisonOperatorContext(this.context, this.state); + this.enterRule(localContext, 78, GenericSqlParser.RULE_comparisonOperator); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 591; + _la = this.tokenStream.LA(1); + if(!(((((_la - 95)) & ~0x1F) === 0 && ((1 << (_la - 95)) & 63) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + 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; + } + + public valueExpression(): ValueExpressionContext; + public valueExpression(_p: number): ValueExpressionContext; + public valueExpression(_p?: number): ValueExpressionContext { + if (_p === undefined) { + _p = 0; + } + + let parentContext = this.context; + let parentState = this.state; + let localContext = new ValueExpressionContext(this.context, parentState); + let previousContext = localContext; + let _startState = 80; + this.enterRecursionRule(localContext, 80, GenericSqlParser.RULE_valueExpression, _p); + let _la: number; + try { + let alternative: number; + this.enterOuterAlt(localContext, 1); + { + this.state = 597; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.T__1: + case GenericSqlParser.KW_ADD: + case GenericSqlParser.KW_ALL: + case GenericSqlParser.KW_ASC: + case GenericSqlParser.KW_BIGINT: + case GenericSqlParser.KW_BINARY: + case GenericSqlParser.KW_BOOLEAN: + case GenericSqlParser.KW_BY: + case GenericSqlParser.KW_CASE: + case GenericSqlParser.KW_CAST: + case GenericSqlParser.KW_CHAR: + case GenericSqlParser.KW_COALESCE: + case GenericSqlParser.KW_COLUMN: + case GenericSqlParser.KW_CROSS: + case GenericSqlParser.KW_DATE: + case GenericSqlParser.KW_DECIMAL: + case GenericSqlParser.KW_DEFAULT: + case GenericSqlParser.KW_DESC: + case GenericSqlParser.KW_DOUBLE: + case GenericSqlParser.KW_EXISTS: + case GenericSqlParser.KW_FALSE: + case GenericSqlParser.KW_FIRST: + case GenericSqlParser.KW_FLOAT: + case GenericSqlParser.KW_FULL: + case GenericSqlParser.KW_IF: + case GenericSqlParser.KW_INT: + case GenericSqlParser.KW_INTEGER: + case GenericSqlParser.KW_KEY: + case GenericSqlParser.KW_LAST: + case GenericSqlParser.KW_LEFT: + case GenericSqlParser.KW_LIMIT: + case GenericSqlParser.KW_NULL: + case GenericSqlParser.KW_NULLIF: + case GenericSqlParser.KW_NULLS: + case GenericSqlParser.KW_NUMERIC: + case GenericSqlParser.KW_OFFSET: + case GenericSqlParser.KW_OUTER: + case GenericSqlParser.KW_RIGHT: + case GenericSqlParser.KW_SMALLINT: + case GenericSqlParser.KW_TEXT: + case GenericSqlParser.KW_TIME: + case GenericSqlParser.KW_TIMESTAMP: + case GenericSqlParser.KW_TINYINT: + case GenericSqlParser.KW_TO: + case GenericSqlParser.KW_TRUE: + case GenericSqlParser.KW_UNIQUE: + case GenericSqlParser.KW_VARCHAR: + case GenericSqlParser.KW_VARBINARY: + case GenericSqlParser.STRING: + case GenericSqlParser.BINARY_LITERAL: + case GenericSqlParser.INTEGER_VALUE: + case GenericSqlParser.DECIMAL_VALUE: + case GenericSqlParser.DOUBLE_VALUE: + case GenericSqlParser.IDENTIFIER: + case GenericSqlParser.DIGIT_IDENTIFIER: + case GenericSqlParser.QUOTED_IDENTIFIER: + case GenericSqlParser.BACKQUOTED_IDENTIFIER: + { + localContext = new ValueExpressionDefaultContext(localContext); + this.context = localContext; + previousContext = localContext; + + this.state = 594; + this.primaryExpression(); + } + break; + case GenericSqlParser.PLUS: + case GenericSqlParser.MINUS: + { + localContext = new ArithmeticUnaryContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 595; + (localContext as ArithmeticUnaryContext)._operator = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if(!(_la === 101 || _la === 102)) { + (localContext as ArithmeticUnaryContext)._operator = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 596; + this.valueExpression(4); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.context!.stop = this.tokenStream.LT(-1); + this.state = 610; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 74, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 608; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 73, this.context) ) { + case 1: + { + localContext = new ArithmeticBinaryContext(new ValueExpressionContext(parentContext, parentState)); + (localContext as ArithmeticBinaryContext)._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, GenericSqlParser.RULE_valueExpression); + this.state = 599; + if (!(this.precpred(this.context, 3))) { + throw this.createFailedPredicateException("this.precpred(this.context, 3)"); + } + this.state = 600; + (localContext as ArithmeticBinaryContext)._operator = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if(!(((((_la - 103)) & ~0x1F) === 0 && ((1 << (_la - 103)) & 7) !== 0))) { + (localContext as ArithmeticBinaryContext)._operator = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 601; + (localContext as ArithmeticBinaryContext)._right = this.valueExpression(4); + } + break; + case 2: + { + localContext = new ArithmeticBinaryContext(new ValueExpressionContext(parentContext, parentState)); + (localContext as ArithmeticBinaryContext)._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, GenericSqlParser.RULE_valueExpression); + this.state = 602; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 603; + (localContext as ArithmeticBinaryContext)._operator = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if(!(_la === 101 || _la === 102)) { + (localContext as ArithmeticBinaryContext)._operator = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 604; + (localContext as ArithmeticBinaryContext)._right = this.valueExpression(3); + } + break; + case 3: + { + localContext = new ConcatenationContext(new ValueExpressionContext(parentContext, parentState)); + (localContext as ConcatenationContext)._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, GenericSqlParser.RULE_valueExpression); + this.state = 605; + if (!(this.precpred(this.context, 1))) { + throw this.createFailedPredicateException("this.precpred(this.context, 1)"); + } + this.state = 606; + this.match(GenericSqlParser.CONCAT); + this.state = 607; + (localContext as ConcatenationContext)._right = this.valueExpression(2); + } + break; + } + } + } + this.state = 612; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 74, this.context); + } + } + } + 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.unrollRecursionContexts(parentContext); + } + return localContext; + } + public primaryExpression(): PrimaryExpressionContext { + let localContext = new PrimaryExpressionContext(this.context, this.state); + this.enterRule(localContext, 82, GenericSqlParser.RULE_primaryExpression); + let _la: number; + try { + this.state = 693; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 83, this.context) ) { + case 1: + localContext = new LiteralExpressionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 613; + this.literal(); + } + break; + case 2: + localContext = new FunctionCallContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 614; + this.qualifiedName(); + this.state = 615; + this.match(GenericSqlParser.T__1); + this.state = 627; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 4013421668) !== 0) || ((((_la - 37)) & ~0x1F) === 0 && ((1 << (_la - 37)) & 1069048399) !== 0) || ((((_la - 70)) & ~0x1F) === 0 && ((1 << (_la - 70)) & 2151019809) !== 0) || ((((_la - 102)) & ~0x1F) === 0 && ((1 << (_la - 102)) & 65409) !== 0)) { + { + this.state = 617; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 75, this.context) ) { + case 1: + { + this.state = 616; + this.setQuantifier(); + } + break; + } + this.state = 619; + this.expression(); + this.state = 624; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 620; + this.match(GenericSqlParser.T__0); + this.state = 621; + this.expression(); + } + } + this.state = 626; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + + this.state = 629; + this.match(GenericSqlParser.T__2); + } + break; + case 3: + localContext = new SearchedCaseExpressionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 631; + this.match(GenericSqlParser.KW_CASE); + this.state = 633; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 632; + this.whenClause(); + } + } + this.state = 635; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 92); + this.state = 639; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 33) { + { + this.state = 637; + this.match(GenericSqlParser.KW_ELSE); + this.state = 638; + this.expression(); + } + } + + this.state = 641; + this.match(GenericSqlParser.KW_END); + } + break; + case 4: + localContext = new SimpleCaseExpressionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 643; + this.match(GenericSqlParser.KW_CASE); + this.state = 644; + this.expression(); + this.state = 646; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 645; + this.whenClause(); + } + } + this.state = 648; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 92); + this.state = 652; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 33) { + { + this.state = 650; + this.match(GenericSqlParser.KW_ELSE); + this.state = 651; + this.expression(); + } + } + + this.state = 654; + this.match(GenericSqlParser.KW_END); + } + break; + case 5: + localContext = new CastExpressionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 656; + this.match(GenericSqlParser.KW_CAST); + this.state = 657; + this.match(GenericSqlParser.T__1); + this.state = 658; + this.expression(); + this.state = 659; + this.match(GenericSqlParser.KW_AS); + this.state = 660; + this.dataType(); + this.state = 661; + this.match(GenericSqlParser.T__2); + } + break; + case 6: + localContext = new CoalesceExpressionContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 663; + this.match(GenericSqlParser.KW_COALESCE); + this.state = 664; + this.match(GenericSqlParser.T__1); + this.state = 665; + this.expression(); + this.state = 670; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 666; + this.match(GenericSqlParser.T__0); + this.state = 667; + this.expression(); + } + } + this.state = 672; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 673; + this.match(GenericSqlParser.T__2); + } + break; + case 7: + localContext = new NullIfExpressionContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 675; + this.match(GenericSqlParser.KW_NULLIF); + this.state = 676; + this.match(GenericSqlParser.T__1); + this.state = 677; + this.valueExpression(0); + this.state = 678; + this.match(GenericSqlParser.T__0); + this.state = 679; + this.valueExpression(0); + this.state = 680; + this.match(GenericSqlParser.T__2); + } + break; + case 8: + localContext = new ParenthesizedExpressionContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 682; + this.match(GenericSqlParser.T__1); + this.state = 683; + this.expression(); + this.state = 684; + this.match(GenericSqlParser.T__2); + } + break; + case 9: + localContext = new ExistsExpressionContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 686; + this.match(GenericSqlParser.KW_EXISTS); + this.state = 687; + this.match(GenericSqlParser.T__1); + this.state = 688; + this.queryStatement(); + this.state = 689; + this.match(GenericSqlParser.T__2); + } + break; + case 10: + localContext = new SubqueryExpressionDefaultContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 691; + this.subqueryExpression(); + } + break; + case 11: + localContext = new ColumnReferenceContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 692; + this.qualifiedName(); + } + break; + } + } + 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; + } + public whenClause(): WhenClauseContext { + let localContext = new WhenClauseContext(this.context, this.state); + this.enterRule(localContext, 84, GenericSqlParser.RULE_whenClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 695; + this.match(GenericSqlParser.KW_WHEN); + this.state = 696; + localContext._condition = this.expression(); + this.state = 697; + this.match(GenericSqlParser.KW_THEN); + this.state = 698; + localContext._result = this.expression(); + } + } + 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; + } + public subqueryExpression(): SubqueryExpressionContext { + let localContext = new SubqueryExpressionContext(this.context, this.state); + this.enterRule(localContext, 86, GenericSqlParser.RULE_subqueryExpression); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 700; + this.match(GenericSqlParser.T__1); + this.state = 701; + this.queryStatement(); + this.state = 702; + this.match(GenericSqlParser.T__2); + } + } + 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; + } + public dataType(): DataTypeContext { + let localContext = new DataTypeContext(this.context, this.state); + this.enterRule(localContext, 88, GenericSqlParser.RULE_dataType); + let _la: number; + try { + this.state = 750; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.KW_BOOLEAN: + this.enterOuterAlt(localContext, 1); + { + this.state = 704; + this.match(GenericSqlParser.KW_BOOLEAN); + } + break; + case GenericSqlParser.KW_TINYINT: + this.enterOuterAlt(localContext, 2); + { + this.state = 705; + this.match(GenericSqlParser.KW_TINYINT); + } + break; + case GenericSqlParser.KW_SMALLINT: + this.enterOuterAlt(localContext, 3); + { + this.state = 706; + this.match(GenericSqlParser.KW_SMALLINT); + } + break; + case GenericSqlParser.KW_INT: + this.enterOuterAlt(localContext, 4); + { + this.state = 707; + this.match(GenericSqlParser.KW_INT); + } + break; + case GenericSqlParser.KW_INTEGER: + this.enterOuterAlt(localContext, 5); + { + this.state = 708; + this.match(GenericSqlParser.KW_INTEGER); + } + break; + case GenericSqlParser.KW_BIGINT: + this.enterOuterAlt(localContext, 6); + { + this.state = 709; + this.match(GenericSqlParser.KW_BIGINT); + } + break; + case GenericSqlParser.KW_FLOAT: + this.enterOuterAlt(localContext, 7); + { + this.state = 710; + this.match(GenericSqlParser.KW_FLOAT); + } + break; + case GenericSqlParser.KW_DOUBLE: + this.enterOuterAlt(localContext, 8); + { + this.state = 711; + this.match(GenericSqlParser.KW_DOUBLE); + } + break; + case GenericSqlParser.KW_DECIMAL: + this.enterOuterAlt(localContext, 9); + { + this.state = 712; + this.match(GenericSqlParser.KW_DECIMAL); + this.state = 720; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 85, this.context) ) { + case 1: + { + this.state = 713; + this.match(GenericSqlParser.T__1); + this.state = 714; + localContext._precision = this.match(GenericSqlParser.INTEGER_VALUE); + this.state = 717; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 1) { + { + this.state = 715; + this.match(GenericSqlParser.T__0); + this.state = 716; + localContext._scale = this.match(GenericSqlParser.INTEGER_VALUE); + } + } + + this.state = 719; + this.match(GenericSqlParser.T__2); + } + break; + } + } + break; + case GenericSqlParser.KW_NUMERIC: + this.enterOuterAlt(localContext, 10); + { + this.state = 722; + this.match(GenericSqlParser.KW_NUMERIC); + this.state = 730; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 87, this.context) ) { + case 1: + { + this.state = 723; + this.match(GenericSqlParser.T__1); + this.state = 724; + localContext._precision = this.match(GenericSqlParser.INTEGER_VALUE); + this.state = 727; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 1) { + { + this.state = 725; + this.match(GenericSqlParser.T__0); + this.state = 726; + localContext._scale = this.match(GenericSqlParser.INTEGER_VALUE); + } + } + + this.state = 729; + this.match(GenericSqlParser.T__2); + } + break; + } + } + break; + case GenericSqlParser.KW_VARCHAR: + this.enterOuterAlt(localContext, 11); + { + this.state = 732; + this.match(GenericSqlParser.KW_VARCHAR); + this.state = 736; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 88, this.context) ) { + case 1: + { + this.state = 733; + this.match(GenericSqlParser.T__1); + this.state = 734; + localContext._maxLength = this.match(GenericSqlParser.INTEGER_VALUE); + this.state = 735; + this.match(GenericSqlParser.T__2); + } + break; + } + } + break; + case GenericSqlParser.KW_CHAR: + this.enterOuterAlt(localContext, 12); + { + this.state = 738; + this.match(GenericSqlParser.KW_CHAR); + this.state = 742; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 89, this.context) ) { + case 1: + { + this.state = 739; + this.match(GenericSqlParser.T__1); + this.state = 740; + localContext._length = this.match(GenericSqlParser.INTEGER_VALUE); + this.state = 741; + this.match(GenericSqlParser.T__2); + } + break; + } + } + break; + case GenericSqlParser.KW_TEXT: + this.enterOuterAlt(localContext, 13); + { + this.state = 744; + this.match(GenericSqlParser.KW_TEXT); + } + break; + case GenericSqlParser.KW_DATE: + this.enterOuterAlt(localContext, 14); + { + this.state = 745; + this.match(GenericSqlParser.KW_DATE); + } + break; + case GenericSqlParser.KW_TIME: + this.enterOuterAlt(localContext, 15); + { + this.state = 746; + this.match(GenericSqlParser.KW_TIME); + } + break; + case GenericSqlParser.KW_TIMESTAMP: + this.enterOuterAlt(localContext, 16); + { + this.state = 747; + this.match(GenericSqlParser.KW_TIMESTAMP); + } + break; + case GenericSqlParser.KW_BINARY: + this.enterOuterAlt(localContext, 17); + { + this.state = 748; + this.match(GenericSqlParser.KW_BINARY); + } + break; + case GenericSqlParser.KW_VARBINARY: + this.enterOuterAlt(localContext, 18); + { + this.state = 749; + this.match(GenericSqlParser.KW_VARBINARY); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + 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; + } + public properties(): PropertiesContext { + let localContext = new PropertiesContext(this.context, this.state); + this.enterRule(localContext, 90, GenericSqlParser.RULE_properties); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 752; + this.match(GenericSqlParser.T__1); + this.state = 753; + this.property(); + this.state = 758; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 1) { + { + { + this.state = 754; + this.match(GenericSqlParser.T__0); + this.state = 755; + this.property(); + } + } + this.state = 760; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 761; + this.match(GenericSqlParser.T__2); + } + } + 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; + } + public property(): PropertyContext { + let localContext = new PropertyContext(this.context, this.state); + this.enterRule(localContext, 92, GenericSqlParser.RULE_property); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 763; + this.identifier(); + this.state = 764; + this.match(GenericSqlParser.EQ); + this.state = 765; + this.literal(); + } + } + 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; + } + public literal(): LiteralContext { + let localContext = new LiteralContext(this.context, this.state); + this.enterRule(localContext, 94, GenericSqlParser.RULE_literal); + try { + this.state = 775; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.KW_NULL: + localContext = new NullLiteralContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 767; + this.match(GenericSqlParser.KW_NULL); + } + break; + case GenericSqlParser.KW_TRUE: + localContext = new BooleanLiteralContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 768; + this.match(GenericSqlParser.KW_TRUE); + } + break; + case GenericSqlParser.KW_FALSE: + localContext = new BooleanLiteralContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 769; + this.match(GenericSqlParser.KW_FALSE); + } + break; + case GenericSqlParser.INTEGER_VALUE: + localContext = new IntegerLiteralContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 770; + this.match(GenericSqlParser.INTEGER_VALUE); + } + break; + case GenericSqlParser.DECIMAL_VALUE: + localContext = new DecimalLiteralContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 771; + this.match(GenericSqlParser.DECIMAL_VALUE); + } + break; + case GenericSqlParser.DOUBLE_VALUE: + localContext = new DoubleLiteralContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 772; + this.match(GenericSqlParser.DOUBLE_VALUE); + } + break; + case GenericSqlParser.STRING: + localContext = new StringLiteralContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 773; + this.match(GenericSqlParser.STRING); + } + break; + case GenericSqlParser.BINARY_LITERAL: + localContext = new BinaryLiteralContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 774; + this.match(GenericSqlParser.BINARY_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + 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; + } + public identifier(): IdentifierContext { + let localContext = new IdentifierContext(this.context, this.state); + this.enterRule(localContext, 96, GenericSqlParser.RULE_identifier); + try { + this.state = 782; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case GenericSqlParser.IDENTIFIER: + this.enterOuterAlt(localContext, 1); + { + this.state = 777; + this.match(GenericSqlParser.IDENTIFIER); + } + break; + case GenericSqlParser.DIGIT_IDENTIFIER: + this.enterOuterAlt(localContext, 2); + { + this.state = 778; + this.match(GenericSqlParser.DIGIT_IDENTIFIER); + } + break; + case GenericSqlParser.QUOTED_IDENTIFIER: + this.enterOuterAlt(localContext, 3); + { + this.state = 779; + this.match(GenericSqlParser.QUOTED_IDENTIFIER); + } + break; + case GenericSqlParser.BACKQUOTED_IDENTIFIER: + this.enterOuterAlt(localContext, 4); + { + this.state = 780; + this.match(GenericSqlParser.BACKQUOTED_IDENTIFIER); + } + break; + case GenericSqlParser.KW_ADD: + case GenericSqlParser.KW_ALL: + case GenericSqlParser.KW_ASC: + case GenericSqlParser.KW_BIGINT: + case GenericSqlParser.KW_BINARY: + case GenericSqlParser.KW_BOOLEAN: + case GenericSqlParser.KW_BY: + case GenericSqlParser.KW_CHAR: + case GenericSqlParser.KW_COALESCE: + case GenericSqlParser.KW_COLUMN: + case GenericSqlParser.KW_CROSS: + case GenericSqlParser.KW_DATE: + case GenericSqlParser.KW_DECIMAL: + case GenericSqlParser.KW_DEFAULT: + case GenericSqlParser.KW_DESC: + case GenericSqlParser.KW_DOUBLE: + case GenericSqlParser.KW_FALSE: + case GenericSqlParser.KW_FIRST: + case GenericSqlParser.KW_FLOAT: + case GenericSqlParser.KW_FULL: + case GenericSqlParser.KW_IF: + case GenericSqlParser.KW_INT: + case GenericSqlParser.KW_INTEGER: + case GenericSqlParser.KW_KEY: + case GenericSqlParser.KW_LAST: + case GenericSqlParser.KW_LEFT: + case GenericSqlParser.KW_LIMIT: + case GenericSqlParser.KW_NULLIF: + case GenericSqlParser.KW_NULLS: + case GenericSqlParser.KW_NUMERIC: + case GenericSqlParser.KW_OFFSET: + case GenericSqlParser.KW_OUTER: + case GenericSqlParser.KW_RIGHT: + case GenericSqlParser.KW_SMALLINT: + case GenericSqlParser.KW_TEXT: + case GenericSqlParser.KW_TIME: + case GenericSqlParser.KW_TIMESTAMP: + case GenericSqlParser.KW_TINYINT: + case GenericSqlParser.KW_TO: + case GenericSqlParser.KW_TRUE: + case GenericSqlParser.KW_UNIQUE: + case GenericSqlParser.KW_VARCHAR: + case GenericSqlParser.KW_VARBINARY: + this.enterOuterAlt(localContext, 5); + { + this.state = 781; + this.nonReserved(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + 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; + } + public qualifiedName(): QualifiedNameContext { + let localContext = new QualifiedNameContext(this.context, this.state); + this.enterRule(localContext, 98, GenericSqlParser.RULE_qualifiedName); + try { + let alternative: number; + this.enterOuterAlt(localContext, 1); + { + this.state = 784; + this.identifier(); + this.state = 789; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 94, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 785; + this.match(GenericSqlParser.T__3); + this.state = 786; + this.identifier(); + } + } + } + this.state = 791; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 94, this.context); + } + } + } + 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; + } + public columnRef(): ColumnRefContext { + let localContext = new ColumnRefContext(this.context, this.state); + this.enterRule(localContext, 100, GenericSqlParser.RULE_columnRef); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 792; + this.identifier(); + } + } + 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; + } + public tableName(): TableNameContext { + let localContext = new TableNameContext(this.context, this.state); + this.enterRule(localContext, 102, GenericSqlParser.RULE_tableName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 794; + this.qualifiedName(); + } + } + 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; + } + public tableNameCreate(): TableNameCreateContext { + let localContext = new TableNameCreateContext(this.context, this.state); + this.enterRule(localContext, 104, GenericSqlParser.RULE_tableNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 796; + this.qualifiedName(); + } + } + 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; + } + public nonReserved(): NonReservedContext { + let localContext = new NonReservedContext(this.context, this.state); + this.enterRule(localContext, 106, GenericSqlParser.RULE_nonReserved); + let _la: number; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 798; + _la = this.tokenStream.LA(1); + if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 2939483232) !== 0) || ((((_la - 38)) & ~0x1F) === 0 && ((1 << (_la - 38)) & 509358375) !== 0) || ((((_la - 70)) & ~0x1F) === 0 && ((1 << (_la - 70)) & 3536161) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + 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; + } + + public override sempred(localContext: antlr.RuleContext | null, ruleIndex: number, predIndex: number): boolean { + switch (ruleIndex) { + case 14: + return this.relation_sempred(localContext as RelationContext, predIndex); + case 36: + return this.booleanExpression_sempred(localContext as BooleanExpressionContext, predIndex); + case 40: + return this.valueExpression_sempred(localContext as ValueExpressionContext, predIndex); + } + return true; + } + private relation_sempred(localContext: RelationContext | null, predIndex: number): boolean { + switch (predIndex) { + case 0: + return this.precpred(this.context, 2); + } + return true; + } + private booleanExpression_sempred(localContext: BooleanExpressionContext | null, predIndex: number): boolean { + switch (predIndex) { + case 1: + return this.precpred(this.context, 2); + case 2: + return this.precpred(this.context, 1); + } + return true; + } + private valueExpression_sempred(localContext: ValueExpressionContext | null, predIndex: number): boolean { + switch (predIndex) { + case 3: + return this.precpred(this.context, 3); + case 4: + return this.precpred(this.context, 2); + case 5: + return this.precpred(this.context, 1); + } + return true; + } + + public static readonly _serializedATN: number[] = [ + 4,1,122,801,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, + 7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7, + 13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2, + 20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7, + 26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2, + 33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7, + 39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2, + 46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7, + 52,2,53,7,53,1,0,5,0,110,8,0,10,0,12,0,113,9,0,1,0,1,0,1,1,1,1,1, + 2,1,2,3,2,121,8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,130,8,3,1,4,3, + 4,133,8,4,1,4,1,4,1,5,1,5,3,5,139,8,5,1,5,1,5,1,5,5,5,144,8,5,10, + 5,12,5,147,9,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,3,7,158,8,7,1, + 7,5,7,161,8,7,10,7,12,7,164,9,7,1,8,1,8,1,9,1,9,1,9,1,9,1,9,3,9, + 173,8,9,1,10,1,10,3,10,177,8,10,1,10,1,10,1,10,5,10,182,8,10,10, + 10,12,10,185,9,10,1,10,3,10,188,8,10,1,10,3,10,191,8,10,1,10,3,10, + 194,8,10,1,10,3,10,197,8,10,1,10,3,10,200,8,10,1,10,3,10,203,8,10, + 1,11,1,11,1,12,1,12,3,12,209,8,12,1,12,3,12,212,8,12,1,12,1,12,1, + 12,1,12,1,12,3,12,219,8,12,1,13,1,13,1,13,1,13,5,13,225,8,13,10, + 13,12,13,228,9,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1, + 14,5,14,240,8,14,10,14,12,14,243,9,14,1,15,3,15,246,8,15,1,15,1, + 15,3,15,250,8,15,1,15,1,15,3,15,254,8,15,1,15,1,15,3,15,258,8,15, + 1,15,3,15,261,8,15,1,16,1,16,3,16,265,8,16,1,16,3,16,268,8,16,1, + 17,1,17,1,17,1,17,1,17,3,17,275,8,17,1,18,1,18,1,18,1,19,1,19,1, + 19,3,19,283,8,19,1,19,1,19,1,19,5,19,288,8,19,10,19,12,19,291,9, + 19,1,20,1,20,1,20,1,21,1,21,1,21,1,21,1,21,5,21,301,8,21,10,21,12, + 21,304,9,21,1,22,1,22,3,22,308,8,22,1,22,1,22,3,22,312,8,22,1,23, + 1,23,1,23,1,23,3,23,318,8,23,1,24,1,24,1,24,1,24,3,24,324,8,24,1, + 24,1,24,1,25,1,25,1,25,1,25,5,25,332,8,25,10,25,12,25,335,9,25,1, + 25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,5,26,345,8,26,10,26,12,26, + 348,9,26,1,26,3,26,351,8,26,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1, + 28,3,28,361,8,28,1,29,1,29,1,29,1,29,1,29,3,29,368,8,29,1,29,1,29, + 1,29,1,29,1,29,5,29,375,8,29,10,29,12,29,378,9,29,1,29,1,29,1,29, + 3,29,383,8,29,1,30,1,30,3,30,387,8,30,1,31,1,31,1,31,1,31,3,31,393, + 8,31,1,31,1,31,3,31,397,8,31,1,31,1,31,3,31,401,8,31,1,32,1,32,3, + 32,405,8,32,1,32,1,32,1,32,1,32,1,32,1,32,5,32,413,8,32,10,32,12, + 32,416,9,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,5,32,425,8,32,10, + 32,12,32,428,9,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1, + 32,1,32,1,32,1,32,5,32,443,8,32,10,32,12,32,446,9,32,1,32,1,32,1, + 32,1,32,1,32,1,32,1,32,5,32,455,8,32,10,32,12,32,458,9,32,1,32,1, + 32,3,32,462,8,32,1,33,1,33,1,33,1,33,3,33,468,8,33,1,33,1,33,1,33, + 1,33,1,33,1,33,3,33,476,8,33,1,33,1,33,1,33,1,33,1,33,3,33,483,8, + 33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1, + 33,1,33,1,33,1,33,1,33,3,33,502,8,33,1,34,1,34,1,34,1,34,3,34,508, + 8,34,1,34,1,34,1,35,1,35,1,36,1,36,1,36,1,36,3,36,518,8,36,1,36, + 1,36,1,36,1,36,1,36,1,36,5,36,526,8,36,10,36,12,36,529,9,36,1,37, + 1,37,3,37,533,8,37,1,38,1,38,1,38,1,38,3,38,539,8,38,1,38,1,38,1, + 38,1,38,1,38,5,38,546,8,38,10,38,12,38,549,9,38,1,38,1,38,1,38,3, + 38,554,8,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,562,8,38,1,38,1,38, + 1,38,1,38,1,38,1,38,3,38,570,8,38,1,38,1,38,1,38,1,38,3,38,576,8, + 38,1,38,1,38,3,38,580,8,38,1,38,1,38,1,38,3,38,585,8,38,1,38,1,38, + 1,38,3,38,590,8,38,1,39,1,39,1,40,1,40,1,40,1,40,3,40,598,8,40,1, + 40,1,40,1,40,1,40,1,40,1,40,1,40,1,40,1,40,5,40,609,8,40,10,40,12, + 40,612,9,40,1,41,1,41,1,41,1,41,3,41,618,8,41,1,41,1,41,1,41,5,41, + 623,8,41,10,41,12,41,626,9,41,3,41,628,8,41,1,41,1,41,1,41,1,41, + 4,41,634,8,41,11,41,12,41,635,1,41,1,41,3,41,640,8,41,1,41,1,41, + 1,41,1,41,1,41,4,41,647,8,41,11,41,12,41,648,1,41,1,41,3,41,653, + 8,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41, + 1,41,1,41,5,41,669,8,41,10,41,12,41,672,9,41,1,41,1,41,1,41,1,41, + 1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41, + 1,41,1,41,1,41,3,41,694,8,41,1,42,1,42,1,42,1,42,1,42,1,43,1,43, + 1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44, + 1,44,1,44,3,44,718,8,44,1,44,3,44,721,8,44,1,44,1,44,1,44,1,44,1, + 44,3,44,728,8,44,1,44,3,44,731,8,44,1,44,1,44,1,44,1,44,3,44,737, + 8,44,1,44,1,44,1,44,1,44,3,44,743,8,44,1,44,1,44,1,44,1,44,1,44, + 1,44,3,44,751,8,44,1,45,1,45,1,45,1,45,5,45,757,8,45,10,45,12,45, + 760,9,45,1,45,1,45,1,46,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47, + 1,47,1,47,1,47,3,47,776,8,47,1,48,1,48,1,48,1,48,1,48,3,48,783,8, + 48,1,49,1,49,1,49,5,49,788,8,49,10,49,12,49,791,9,49,1,50,1,50,1, + 51,1,51,1,52,1,52,1,53,1,53,1,53,0,3,28,72,80,54,0,2,4,6,8,10,12, + 14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56, + 58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100, + 102,104,106,0,8,3,0,36,36,52,52,87,87,2,0,6,6,30,30,2,0,10,10,29, + 29,2,0,39,39,57,57,1,0,95,100,1,0,101,102,1,0,103,105,22,0,5,6,10, + 10,12,15,18,18,20,21,24,27,29,29,31,31,38,40,43,43,46,46,50,51,56, + 58,60,60,63,66,70,70,75,75,78,78,80,80,82,86,88,88,90,91,895,0,111, + 1,0,0,0,2,116,1,0,0,0,4,118,1,0,0,0,6,129,1,0,0,0,8,132,1,0,0,0, + 10,136,1,0,0,0,12,148,1,0,0,0,14,154,1,0,0,0,16,165,1,0,0,0,18,172, + 1,0,0,0,20,174,1,0,0,0,22,204,1,0,0,0,24,218,1,0,0,0,26,220,1,0, + 0,0,28,229,1,0,0,0,30,260,1,0,0,0,32,262,1,0,0,0,34,274,1,0,0,0, + 36,276,1,0,0,0,38,279,1,0,0,0,40,292,1,0,0,0,42,295,1,0,0,0,44,305, + 1,0,0,0,46,313,1,0,0,0,48,319,1,0,0,0,50,327,1,0,0,0,52,338,1,0, + 0,0,54,352,1,0,0,0,56,356,1,0,0,0,58,362,1,0,0,0,60,386,1,0,0,0, + 62,388,1,0,0,0,64,404,1,0,0,0,66,463,1,0,0,0,68,503,1,0,0,0,70,511, + 1,0,0,0,72,517,1,0,0,0,74,530,1,0,0,0,76,589,1,0,0,0,78,591,1,0, + 0,0,80,597,1,0,0,0,82,693,1,0,0,0,84,695,1,0,0,0,86,700,1,0,0,0, + 88,750,1,0,0,0,90,752,1,0,0,0,92,763,1,0,0,0,94,775,1,0,0,0,96,782, + 1,0,0,0,98,784,1,0,0,0,100,792,1,0,0,0,102,794,1,0,0,0,104,796,1, + 0,0,0,106,798,1,0,0,0,108,110,3,2,1,0,109,108,1,0,0,0,110,113,1, + 0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,114,1,0,0,0,113,111,1, + 0,0,0,114,115,5,0,0,1,115,1,1,0,0,0,116,117,3,4,2,0,117,3,1,0,0, + 0,118,120,3,6,3,0,119,121,5,108,0,0,120,119,1,0,0,0,120,121,1,0, + 0,0,121,5,1,0,0,0,122,130,3,8,4,0,123,130,3,48,24,0,124,130,3,52, + 26,0,125,130,3,56,28,0,126,130,3,58,29,0,127,130,3,66,33,0,128,130, + 3,68,34,0,129,122,1,0,0,0,129,123,1,0,0,0,129,124,1,0,0,0,129,125, + 1,0,0,0,129,126,1,0,0,0,129,127,1,0,0,0,129,128,1,0,0,0,130,7,1, + 0,0,0,131,133,3,10,5,0,132,131,1,0,0,0,132,133,1,0,0,0,133,134,1, + 0,0,0,134,135,3,14,7,0,135,9,1,0,0,0,136,138,5,94,0,0,137,139,5, + 72,0,0,138,137,1,0,0,0,138,139,1,0,0,0,139,140,1,0,0,0,140,145,3, + 12,6,0,141,142,5,1,0,0,142,144,3,12,6,0,143,141,1,0,0,0,144,147, + 1,0,0,0,145,143,1,0,0,0,145,146,1,0,0,0,146,11,1,0,0,0,147,145,1, + 0,0,0,148,149,3,96,48,0,149,150,5,9,0,0,150,151,5,2,0,0,151,152, + 3,8,4,0,152,153,5,3,0,0,153,13,1,0,0,0,154,162,3,16,8,0,155,157, + 7,0,0,0,156,158,5,6,0,0,157,156,1,0,0,0,157,158,1,0,0,0,158,159, + 1,0,0,0,159,161,3,16,8,0,160,155,1,0,0,0,161,164,1,0,0,0,162,160, + 1,0,0,0,162,163,1,0,0,0,163,15,1,0,0,0,164,162,1,0,0,0,165,166,3, + 18,9,0,166,17,1,0,0,0,167,173,3,20,10,0,168,169,5,2,0,0,169,170, + 3,8,4,0,170,171,5,3,0,0,171,173,1,0,0,0,172,167,1,0,0,0,172,168, + 1,0,0,0,173,19,1,0,0,0,174,176,5,76,0,0,175,177,3,22,11,0,176,175, + 1,0,0,0,176,177,1,0,0,0,177,178,1,0,0,0,178,183,3,24,12,0,179,180, + 5,1,0,0,180,182,3,24,12,0,181,179,1,0,0,0,182,185,1,0,0,0,183,181, + 1,0,0,0,183,184,1,0,0,0,184,187,1,0,0,0,185,183,1,0,0,0,186,188, + 3,26,13,0,187,186,1,0,0,0,187,188,1,0,0,0,188,190,1,0,0,0,189,191, + 3,36,18,0,190,189,1,0,0,0,190,191,1,0,0,0,191,193,1,0,0,0,192,194, + 3,38,19,0,193,192,1,0,0,0,193,194,1,0,0,0,194,196,1,0,0,0,195,197, + 3,40,20,0,196,195,1,0,0,0,196,197,1,0,0,0,197,199,1,0,0,0,198,200, + 3,42,21,0,199,198,1,0,0,0,199,200,1,0,0,0,200,202,1,0,0,0,201,203, + 3,46,23,0,202,201,1,0,0,0,202,203,1,0,0,0,203,21,1,0,0,0,204,205, + 7,1,0,0,205,23,1,0,0,0,206,211,3,70,35,0,207,209,5,9,0,0,208,207, + 1,0,0,0,208,209,1,0,0,0,209,210,1,0,0,0,210,212,3,96,48,0,211,208, + 1,0,0,0,211,212,1,0,0,0,212,219,1,0,0,0,213,214,3,98,49,0,214,215, + 5,4,0,0,215,216,5,103,0,0,216,219,1,0,0,0,217,219,5,103,0,0,218, + 206,1,0,0,0,218,213,1,0,0,0,218,217,1,0,0,0,219,25,1,0,0,0,220,221, + 5,42,0,0,221,226,3,28,14,0,222,223,5,1,0,0,223,225,3,28,14,0,224, + 222,1,0,0,0,225,228,1,0,0,0,226,224,1,0,0,0,226,227,1,0,0,0,227, + 27,1,0,0,0,228,226,1,0,0,0,229,230,6,14,-1,0,230,231,3,32,16,0,231, + 241,1,0,0,0,232,233,10,2,0,0,233,234,3,30,15,0,234,235,5,55,0,0, + 235,236,3,28,14,0,236,237,5,67,0,0,237,238,3,70,35,0,238,240,1,0, + 0,0,239,232,1,0,0,0,240,243,1,0,0,0,241,239,1,0,0,0,241,242,1,0, + 0,0,242,29,1,0,0,0,243,241,1,0,0,0,244,246,5,48,0,0,245,244,1,0, + 0,0,245,246,1,0,0,0,246,261,1,0,0,0,247,249,5,58,0,0,248,250,5,70, + 0,0,249,248,1,0,0,0,249,250,1,0,0,0,250,261,1,0,0,0,251,253,5,75, + 0,0,252,254,5,70,0,0,253,252,1,0,0,0,253,254,1,0,0,0,254,261,1,0, + 0,0,255,257,5,43,0,0,256,258,5,70,0,0,257,256,1,0,0,0,257,258,1, + 0,0,0,258,261,1,0,0,0,259,261,5,24,0,0,260,245,1,0,0,0,260,247,1, + 0,0,0,260,251,1,0,0,0,260,255,1,0,0,0,260,259,1,0,0,0,261,31,1,0, + 0,0,262,267,3,34,17,0,263,265,5,9,0,0,264,263,1,0,0,0,264,265,1, + 0,0,0,265,266,1,0,0,0,266,268,3,96,48,0,267,264,1,0,0,0,267,268, + 1,0,0,0,268,33,1,0,0,0,269,275,3,102,51,0,270,271,5,2,0,0,271,272, + 3,8,4,0,272,273,5,3,0,0,273,275,1,0,0,0,274,269,1,0,0,0,274,270, + 1,0,0,0,275,35,1,0,0,0,276,277,5,93,0,0,277,278,3,70,35,0,278,37, + 1,0,0,0,279,280,5,44,0,0,280,282,5,15,0,0,281,283,3,22,11,0,282, + 281,1,0,0,0,282,283,1,0,0,0,283,284,1,0,0,0,284,289,3,70,35,0,285, + 286,5,1,0,0,286,288,3,70,35,0,287,285,1,0,0,0,288,291,1,0,0,0,289, + 287,1,0,0,0,289,290,1,0,0,0,290,39,1,0,0,0,291,289,1,0,0,0,292,293, + 5,45,0,0,293,294,3,70,35,0,294,41,1,0,0,0,295,296,5,69,0,0,296,297, + 5,15,0,0,297,302,3,44,22,0,298,299,5,1,0,0,299,301,3,44,22,0,300, + 298,1,0,0,0,301,304,1,0,0,0,302,300,1,0,0,0,302,303,1,0,0,0,303, + 43,1,0,0,0,304,302,1,0,0,0,305,307,3,70,35,0,306,308,7,2,0,0,307, + 306,1,0,0,0,307,308,1,0,0,0,308,311,1,0,0,0,309,310,5,64,0,0,310, + 312,7,3,0,0,311,309,1,0,0,0,311,312,1,0,0,0,312,45,1,0,0,0,313,314, + 5,60,0,0,314,317,3,70,35,0,315,316,5,66,0,0,316,318,3,70,35,0,317, + 315,1,0,0,0,317,318,1,0,0,0,318,47,1,0,0,0,319,320,5,49,0,0,320, + 321,5,53,0,0,321,323,3,102,51,0,322,324,3,50,25,0,323,322,1,0,0, + 0,323,324,1,0,0,0,324,325,1,0,0,0,325,326,3,8,4,0,326,49,1,0,0,0, + 327,328,5,2,0,0,328,333,3,100,50,0,329,330,5,1,0,0,330,332,3,100, + 50,0,331,329,1,0,0,0,332,335,1,0,0,0,333,331,1,0,0,0,333,334,1,0, + 0,0,334,336,1,0,0,0,335,333,1,0,0,0,336,337,5,3,0,0,337,51,1,0,0, + 0,338,339,5,89,0,0,339,340,3,102,51,0,340,341,5,77,0,0,341,346,3, + 54,27,0,342,343,5,1,0,0,343,345,3,54,27,0,344,342,1,0,0,0,345,348, + 1,0,0,0,346,344,1,0,0,0,346,347,1,0,0,0,347,350,1,0,0,0,348,346, + 1,0,0,0,349,351,3,36,18,0,350,349,1,0,0,0,350,351,1,0,0,0,351,53, + 1,0,0,0,352,353,3,100,50,0,353,354,5,95,0,0,354,355,3,70,35,0,355, + 55,1,0,0,0,356,357,5,28,0,0,357,358,5,42,0,0,358,360,3,102,51,0, + 359,361,3,36,18,0,360,359,1,0,0,0,360,361,1,0,0,0,361,57,1,0,0,0, + 362,363,5,23,0,0,363,367,5,79,0,0,364,365,5,46,0,0,365,366,5,61, + 0,0,366,368,5,37,0,0,367,364,1,0,0,0,367,368,1,0,0,0,368,369,1,0, + 0,0,369,370,3,104,52,0,370,371,5,2,0,0,371,376,3,60,30,0,372,373, + 5,1,0,0,373,375,3,60,30,0,374,372,1,0,0,0,375,378,1,0,0,0,376,374, + 1,0,0,0,376,377,1,0,0,0,377,379,1,0,0,0,378,376,1,0,0,0,379,382, + 5,3,0,0,380,381,5,94,0,0,381,383,3,90,45,0,382,380,1,0,0,0,382,383, + 1,0,0,0,383,59,1,0,0,0,384,387,3,62,31,0,385,387,3,64,32,0,386,384, + 1,0,0,0,386,385,1,0,0,0,387,61,1,0,0,0,388,389,3,100,50,0,389,392, + 3,88,44,0,390,391,5,61,0,0,391,393,5,62,0,0,392,390,1,0,0,0,392, + 393,1,0,0,0,393,396,1,0,0,0,394,395,5,27,0,0,395,397,3,70,35,0,396, + 394,1,0,0,0,396,397,1,0,0,0,397,400,1,0,0,0,398,399,5,71,0,0,399, + 401,5,56,0,0,400,398,1,0,0,0,400,401,1,0,0,0,401,63,1,0,0,0,402, + 403,5,22,0,0,403,405,3,96,48,0,404,402,1,0,0,0,404,405,1,0,0,0,405, + 461,1,0,0,0,406,407,5,71,0,0,407,408,5,56,0,0,408,409,5,2,0,0,409, + 414,3,100,50,0,410,411,5,1,0,0,411,413,3,100,50,0,412,410,1,0,0, + 0,413,416,1,0,0,0,414,412,1,0,0,0,414,415,1,0,0,0,415,417,1,0,0, + 0,416,414,1,0,0,0,417,418,5,3,0,0,418,462,1,0,0,0,419,420,5,88,0, + 0,420,421,5,2,0,0,421,426,3,100,50,0,422,423,5,1,0,0,423,425,3,100, + 50,0,424,422,1,0,0,0,425,428,1,0,0,0,426,424,1,0,0,0,426,427,1,0, + 0,0,427,429,1,0,0,0,428,426,1,0,0,0,429,430,5,3,0,0,430,462,1,0, + 0,0,431,432,5,19,0,0,432,433,5,2,0,0,433,434,3,70,35,0,434,435,5, + 3,0,0,435,462,1,0,0,0,436,437,5,41,0,0,437,438,5,56,0,0,438,439, + 5,2,0,0,439,444,3,100,50,0,440,441,5,1,0,0,441,443,3,100,50,0,442, + 440,1,0,0,0,443,446,1,0,0,0,444,442,1,0,0,0,444,445,1,0,0,0,445, + 447,1,0,0,0,446,444,1,0,0,0,447,448,5,3,0,0,448,449,5,73,0,0,449, + 450,3,102,51,0,450,451,5,2,0,0,451,456,3,100,50,0,452,453,5,1,0, + 0,453,455,3,100,50,0,454,452,1,0,0,0,455,458,1,0,0,0,456,454,1,0, + 0,0,456,457,1,0,0,0,457,459,1,0,0,0,458,456,1,0,0,0,459,460,5,3, + 0,0,460,462,1,0,0,0,461,406,1,0,0,0,461,419,1,0,0,0,461,431,1,0, + 0,0,461,436,1,0,0,0,462,65,1,0,0,0,463,464,5,7,0,0,464,467,5,79, + 0,0,465,466,5,46,0,0,466,468,5,37,0,0,467,465,1,0,0,0,467,468,1, + 0,0,0,468,469,1,0,0,0,469,501,3,102,51,0,470,471,5,5,0,0,471,475, + 5,21,0,0,472,473,5,46,0,0,473,474,5,61,0,0,474,476,5,37,0,0,475, + 472,1,0,0,0,475,476,1,0,0,0,476,477,1,0,0,0,477,502,3,62,31,0,478, + 479,5,32,0,0,479,482,5,21,0,0,480,481,5,46,0,0,481,483,5,37,0,0, + 482,480,1,0,0,0,482,483,1,0,0,0,483,484,1,0,0,0,484,502,3,100,50, + 0,485,486,5,74,0,0,486,487,5,85,0,0,487,502,3,104,52,0,488,489,5, + 7,0,0,489,490,5,21,0,0,490,491,3,100,50,0,491,492,5,77,0,0,492,493, + 5,27,0,0,493,494,3,70,35,0,494,502,1,0,0,0,495,496,5,7,0,0,496,497, + 5,21,0,0,497,498,3,100,50,0,498,499,5,32,0,0,499,500,5,27,0,0,500, + 502,1,0,0,0,501,470,1,0,0,0,501,478,1,0,0,0,501,485,1,0,0,0,501, + 488,1,0,0,0,501,495,1,0,0,0,502,67,1,0,0,0,503,504,5,32,0,0,504, + 507,5,79,0,0,505,506,5,46,0,0,506,508,5,37,0,0,507,505,1,0,0,0,507, + 508,1,0,0,0,508,509,1,0,0,0,509,510,3,102,51,0,510,69,1,0,0,0,511, + 512,3,72,36,0,512,71,1,0,0,0,513,514,6,36,-1,0,514,518,3,74,37,0, + 515,516,5,61,0,0,516,518,3,72,36,3,517,513,1,0,0,0,517,515,1,0,0, + 0,518,527,1,0,0,0,519,520,10,2,0,0,520,521,5,8,0,0,521,526,3,72, + 36,3,522,523,10,1,0,0,523,524,5,68,0,0,524,526,3,72,36,2,525,519, + 1,0,0,0,525,522,1,0,0,0,526,529,1,0,0,0,527,525,1,0,0,0,527,528, + 1,0,0,0,528,73,1,0,0,0,529,527,1,0,0,0,530,532,3,80,40,0,531,533, + 3,76,38,0,532,531,1,0,0,0,532,533,1,0,0,0,533,75,1,0,0,0,534,535, + 3,78,39,0,535,536,3,80,40,0,536,590,1,0,0,0,537,539,5,61,0,0,538, + 537,1,0,0,0,538,539,1,0,0,0,539,540,1,0,0,0,540,541,5,47,0,0,541, + 542,5,2,0,0,542,547,3,70,35,0,543,544,5,1,0,0,544,546,3,70,35,0, + 545,543,1,0,0,0,546,549,1,0,0,0,547,545,1,0,0,0,547,548,1,0,0,0, + 548,550,1,0,0,0,549,547,1,0,0,0,550,551,5,3,0,0,551,590,1,0,0,0, + 552,554,5,61,0,0,553,552,1,0,0,0,553,554,1,0,0,0,554,555,1,0,0,0, + 555,556,5,47,0,0,556,557,5,2,0,0,557,558,3,8,4,0,558,559,5,3,0,0, + 559,590,1,0,0,0,560,562,5,61,0,0,561,560,1,0,0,0,561,562,1,0,0,0, + 562,563,1,0,0,0,563,564,5,11,0,0,564,565,3,80,40,0,565,566,5,8,0, + 0,566,567,3,80,40,0,567,590,1,0,0,0,568,570,5,61,0,0,569,568,1,0, + 0,0,569,570,1,0,0,0,570,571,1,0,0,0,571,572,5,59,0,0,572,575,3,80, + 40,0,573,574,5,35,0,0,574,576,3,80,40,0,575,573,1,0,0,0,575,576, + 1,0,0,0,576,590,1,0,0,0,577,579,5,54,0,0,578,580,5,61,0,0,579,578, + 1,0,0,0,579,580,1,0,0,0,580,581,1,0,0,0,581,590,5,62,0,0,582,584, + 5,54,0,0,583,585,5,61,0,0,584,583,1,0,0,0,584,585,1,0,0,0,585,586, + 1,0,0,0,586,587,5,30,0,0,587,588,5,42,0,0,588,590,3,80,40,0,589, + 534,1,0,0,0,589,538,1,0,0,0,589,553,1,0,0,0,589,561,1,0,0,0,589, + 569,1,0,0,0,589,577,1,0,0,0,589,582,1,0,0,0,590,77,1,0,0,0,591,592, + 7,4,0,0,592,79,1,0,0,0,593,594,6,40,-1,0,594,598,3,82,41,0,595,596, + 7,5,0,0,596,598,3,80,40,4,597,593,1,0,0,0,597,595,1,0,0,0,598,610, + 1,0,0,0,599,600,10,3,0,0,600,601,7,6,0,0,601,609,3,80,40,4,602,603, + 10,2,0,0,603,604,7,5,0,0,604,609,3,80,40,3,605,606,10,1,0,0,606, + 607,5,106,0,0,607,609,3,80,40,2,608,599,1,0,0,0,608,602,1,0,0,0, + 608,605,1,0,0,0,609,612,1,0,0,0,610,608,1,0,0,0,610,611,1,0,0,0, + 611,81,1,0,0,0,612,610,1,0,0,0,613,694,3,94,47,0,614,615,3,98,49, + 0,615,627,5,2,0,0,616,618,3,22,11,0,617,616,1,0,0,0,617,618,1,0, + 0,0,618,619,1,0,0,0,619,624,3,70,35,0,620,621,5,1,0,0,621,623,3, + 70,35,0,622,620,1,0,0,0,623,626,1,0,0,0,624,622,1,0,0,0,624,625, + 1,0,0,0,625,628,1,0,0,0,626,624,1,0,0,0,627,617,1,0,0,0,627,628, + 1,0,0,0,628,629,1,0,0,0,629,630,5,3,0,0,630,694,1,0,0,0,631,633, + 5,16,0,0,632,634,3,84,42,0,633,632,1,0,0,0,634,635,1,0,0,0,635,633, + 1,0,0,0,635,636,1,0,0,0,636,639,1,0,0,0,637,638,5,33,0,0,638,640, + 3,70,35,0,639,637,1,0,0,0,639,640,1,0,0,0,640,641,1,0,0,0,641,642, + 5,34,0,0,642,694,1,0,0,0,643,644,5,16,0,0,644,646,3,70,35,0,645, + 647,3,84,42,0,646,645,1,0,0,0,647,648,1,0,0,0,648,646,1,0,0,0,648, + 649,1,0,0,0,649,652,1,0,0,0,650,651,5,33,0,0,651,653,3,70,35,0,652, + 650,1,0,0,0,652,653,1,0,0,0,653,654,1,0,0,0,654,655,5,34,0,0,655, + 694,1,0,0,0,656,657,5,17,0,0,657,658,5,2,0,0,658,659,3,70,35,0,659, + 660,5,9,0,0,660,661,3,88,44,0,661,662,5,3,0,0,662,694,1,0,0,0,663, + 664,5,20,0,0,664,665,5,2,0,0,665,670,3,70,35,0,666,667,5,1,0,0,667, + 669,3,70,35,0,668,666,1,0,0,0,669,672,1,0,0,0,670,668,1,0,0,0,670, + 671,1,0,0,0,671,673,1,0,0,0,672,670,1,0,0,0,673,674,5,3,0,0,674, + 694,1,0,0,0,675,676,5,63,0,0,676,677,5,2,0,0,677,678,3,80,40,0,678, + 679,5,1,0,0,679,680,3,80,40,0,680,681,5,3,0,0,681,694,1,0,0,0,682, + 683,5,2,0,0,683,684,3,70,35,0,684,685,5,3,0,0,685,694,1,0,0,0,686, + 687,5,37,0,0,687,688,5,2,0,0,688,689,3,8,4,0,689,690,5,3,0,0,690, + 694,1,0,0,0,691,694,3,86,43,0,692,694,3,98,49,0,693,613,1,0,0,0, + 693,614,1,0,0,0,693,631,1,0,0,0,693,643,1,0,0,0,693,656,1,0,0,0, + 693,663,1,0,0,0,693,675,1,0,0,0,693,682,1,0,0,0,693,686,1,0,0,0, + 693,691,1,0,0,0,693,692,1,0,0,0,694,83,1,0,0,0,695,696,5,92,0,0, + 696,697,3,70,35,0,697,698,5,81,0,0,698,699,3,70,35,0,699,85,1,0, + 0,0,700,701,5,2,0,0,701,702,3,8,4,0,702,703,5,3,0,0,703,87,1,0,0, + 0,704,751,5,14,0,0,705,751,5,84,0,0,706,751,5,78,0,0,707,751,5,50, + 0,0,708,751,5,51,0,0,709,751,5,12,0,0,710,751,5,40,0,0,711,751,5, + 31,0,0,712,720,5,26,0,0,713,714,5,2,0,0,714,717,5,111,0,0,715,716, + 5,1,0,0,716,718,5,111,0,0,717,715,1,0,0,0,717,718,1,0,0,0,718,719, + 1,0,0,0,719,721,5,3,0,0,720,713,1,0,0,0,720,721,1,0,0,0,721,751, + 1,0,0,0,722,730,5,65,0,0,723,724,5,2,0,0,724,727,5,111,0,0,725,726, + 5,1,0,0,726,728,5,111,0,0,727,725,1,0,0,0,727,728,1,0,0,0,728,729, + 1,0,0,0,729,731,5,3,0,0,730,723,1,0,0,0,730,731,1,0,0,0,731,751, + 1,0,0,0,732,736,5,90,0,0,733,734,5,2,0,0,734,735,5,111,0,0,735,737, + 5,3,0,0,736,733,1,0,0,0,736,737,1,0,0,0,737,751,1,0,0,0,738,742, + 5,18,0,0,739,740,5,2,0,0,740,741,5,111,0,0,741,743,5,3,0,0,742,739, + 1,0,0,0,742,743,1,0,0,0,743,751,1,0,0,0,744,751,5,80,0,0,745,751, + 5,25,0,0,746,751,5,82,0,0,747,751,5,83,0,0,748,751,5,13,0,0,749, + 751,5,91,0,0,750,704,1,0,0,0,750,705,1,0,0,0,750,706,1,0,0,0,750, + 707,1,0,0,0,750,708,1,0,0,0,750,709,1,0,0,0,750,710,1,0,0,0,750, + 711,1,0,0,0,750,712,1,0,0,0,750,722,1,0,0,0,750,732,1,0,0,0,750, + 738,1,0,0,0,750,744,1,0,0,0,750,745,1,0,0,0,750,746,1,0,0,0,750, + 747,1,0,0,0,750,748,1,0,0,0,750,749,1,0,0,0,751,89,1,0,0,0,752,753, + 5,2,0,0,753,758,3,92,46,0,754,755,5,1,0,0,755,757,3,92,46,0,756, + 754,1,0,0,0,757,760,1,0,0,0,758,756,1,0,0,0,758,759,1,0,0,0,759, + 761,1,0,0,0,760,758,1,0,0,0,761,762,5,3,0,0,762,91,1,0,0,0,763,764, + 3,96,48,0,764,765,5,95,0,0,765,766,3,94,47,0,766,93,1,0,0,0,767, + 776,5,62,0,0,768,776,5,86,0,0,769,776,5,38,0,0,770,776,5,111,0,0, + 771,776,5,112,0,0,772,776,5,113,0,0,773,776,5,109,0,0,774,776,5, + 110,0,0,775,767,1,0,0,0,775,768,1,0,0,0,775,769,1,0,0,0,775,770, + 1,0,0,0,775,771,1,0,0,0,775,772,1,0,0,0,775,773,1,0,0,0,775,774, + 1,0,0,0,776,95,1,0,0,0,777,783,5,114,0,0,778,783,5,115,0,0,779,783, + 5,116,0,0,780,783,5,117,0,0,781,783,3,106,53,0,782,777,1,0,0,0,782, + 778,1,0,0,0,782,779,1,0,0,0,782,780,1,0,0,0,782,781,1,0,0,0,783, + 97,1,0,0,0,784,789,3,96,48,0,785,786,5,4,0,0,786,788,3,96,48,0,787, + 785,1,0,0,0,788,791,1,0,0,0,789,787,1,0,0,0,789,790,1,0,0,0,790, + 99,1,0,0,0,791,789,1,0,0,0,792,793,3,96,48,0,793,101,1,0,0,0,794, + 795,3,98,49,0,795,103,1,0,0,0,796,797,3,98,49,0,797,105,1,0,0,0, + 798,799,7,7,0,0,799,107,1,0,0,0,95,111,120,129,132,138,145,157,162, + 172,176,183,187,190,193,196,199,202,208,211,218,226,241,245,249, + 253,257,260,264,267,274,282,289,302,307,311,317,323,333,346,350, + 360,367,376,382,386,392,396,400,404,414,426,444,456,461,467,475, + 482,501,507,517,525,527,532,538,547,553,561,569,575,579,584,589, + 597,608,610,617,624,627,635,639,648,652,670,693,717,720,727,730, + 736,742,750,758,775,782,789 + ]; + + private static __ATN: antlr.ATN; + public static get _ATN(): antlr.ATN { + if (!GenericSqlParser.__ATN) { + GenericSqlParser.__ATN = new antlr.ATNDeserializer().deserialize(GenericSqlParser._serializedATN); + } + + return GenericSqlParser.__ATN; + } + + + private static readonly vocabulary = new antlr.Vocabulary(GenericSqlParser.literalNames, GenericSqlParser.symbolicNames, []); + + public override get vocabulary(): antlr.Vocabulary { + return GenericSqlParser.vocabulary; + } + + private static readonly decisionsToDFA = GenericSqlParser._ATN.decisionToState.map( (ds: antlr.DecisionState, index: number) => new antlr.DFA(ds, index) ); +} + +export class ProgramContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public EOF(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.EOF, 0)!; + } + public statements(): StatementsContext[]; + public statements(i: number): StatementsContext | null; + public statements(i?: number): StatementsContext[] | StatementsContext | null { + if (i === undefined) { + return this.getRuleContexts(StatementsContext); + } + + return this.getRuleContext(i, StatementsContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_program; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterProgram) { + listener.enterProgram(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitProgram) { + listener.exitProgram(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitProgram) { + return visitor.visitProgram(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class StatementsContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public singleStatement(): SingleStatementContext { + return this.getRuleContext(0, SingleStatementContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_statements; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterStatements) { + listener.enterStatements(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitStatements) { + listener.exitStatements(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitStatements) { + return visitor.visitStatements(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class SingleStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public statement(): StatementContext { + return this.getRuleContext(0, StatementContext)!; + } + public SEMICOLON(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.SEMICOLON, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_singleStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSingleStatement) { + listener.enterSingleStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSingleStatement) { + listener.exitSingleStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSingleStatement) { + return visitor.visitSingleStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class StatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_statement; + } + public override copyFrom(ctx: StatementContext): void { + super.copyFrom(ctx); + } +} +export class CreateTableContext extends StatementContext { + public constructor(ctx: StatementContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public createTableStatement(): CreateTableStatementContext { + return this.getRuleContext(0, CreateTableStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterCreateTable) { + listener.enterCreateTable(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitCreateTable) { + listener.exitCreateTable(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitCreateTable) { + return visitor.visitCreateTable(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class StatementDefaultContext extends StatementContext { + public constructor(ctx: StatementContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public queryStatement(): QueryStatementContext { + return this.getRuleContext(0, QueryStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterStatementDefault) { + listener.enterStatementDefault(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitStatementDefault) { + listener.exitStatementDefault(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitStatementDefault) { + return visitor.visitStatementDefault(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class InsertContext extends StatementContext { + public constructor(ctx: StatementContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public insertStatement(): InsertStatementContext { + return this.getRuleContext(0, InsertStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterInsert) { + listener.enterInsert(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitInsert) { + listener.exitInsert(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitInsert) { + return visitor.visitInsert(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class UpdateContext extends StatementContext { + public constructor(ctx: StatementContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public updateStatement(): UpdateStatementContext { + return this.getRuleContext(0, UpdateStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterUpdate) { + listener.enterUpdate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitUpdate) { + listener.exitUpdate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitUpdate) { + return visitor.visitUpdate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class DeleteContext extends StatementContext { + public constructor(ctx: StatementContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public deleteStatement(): DeleteStatementContext { + return this.getRuleContext(0, DeleteStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDelete) { + listener.enterDelete(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDelete) { + listener.exitDelete(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDelete) { + return visitor.visitDelete(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class AlterTableContext extends StatementContext { + public constructor(ctx: StatementContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public alterTableStatement(): AlterTableStatementContext { + return this.getRuleContext(0, AlterTableStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterAlterTable) { + listener.enterAlterTable(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitAlterTable) { + listener.exitAlterTable(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitAlterTable) { + return visitor.visitAlterTable(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class DropTableContext extends StatementContext { + public constructor(ctx: StatementContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public dropTableStatement(): DropTableStatementContext { + return this.getRuleContext(0, DropTableStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDropTable) { + listener.enterDropTable(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDropTable) { + listener.exitDropTable(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDropTable) { + return visitor.visitDropTable(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class QueryStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public queryNoWith(): QueryNoWithContext { + return this.getRuleContext(0, QueryNoWithContext)!; + } + public withClause(): WithClauseContext | null { + return this.getRuleContext(0, WithClauseContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_queryStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterQueryStatement) { + listener.enterQueryStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitQueryStatement) { + listener.exitQueryStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitQueryStatement) { + return visitor.visitQueryStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class WithClauseContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_WITH(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_WITH, 0)!; + } + public namedQuery(): NamedQueryContext[]; + public namedQuery(i: number): NamedQueryContext | null; + public namedQuery(i?: number): NamedQueryContext[] | NamedQueryContext | null { + if (i === undefined) { + return this.getRuleContexts(NamedQueryContext); + } + + return this.getRuleContext(i, NamedQueryContext); + } + public KW_RECURSIVE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_RECURSIVE, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_withClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterWithClause) { + listener.enterWithClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitWithClause) { + listener.exitWithClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitWithClause) { + return visitor.visitWithClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class NamedQueryContext extends antlr.ParserRuleContext { + public _name?: IdentifierContext; + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_AS(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_AS, 0)!; + } + public queryStatement(): QueryStatementContext { + return this.getRuleContext(0, QueryStatementContext)!; + } + public identifier(): IdentifierContext { + return this.getRuleContext(0, IdentifierContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_namedQuery; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterNamedQuery) { + listener.enterNamedQuery(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitNamedQuery) { + listener.exitNamedQuery(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitNamedQuery) { + return visitor.visitNamedQuery(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class QueryNoWithContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public queryTerm(): QueryTermContext[]; + public queryTerm(i: number): QueryTermContext | null; + public queryTerm(i?: number): QueryTermContext[] | QueryTermContext | null { + if (i === undefined) { + return this.getRuleContexts(QueryTermContext); + } + + return this.getRuleContext(i, QueryTermContext); + } + public KW_UNION(): antlr.TerminalNode[]; + public KW_UNION(i: number): antlr.TerminalNode | null; + public KW_UNION(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.KW_UNION); + } else { + return this.getToken(GenericSqlParser.KW_UNION, i); + } + } + public KW_INTERSECT(): antlr.TerminalNode[]; + public KW_INTERSECT(i: number): antlr.TerminalNode | null; + public KW_INTERSECT(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.KW_INTERSECT); + } else { + return this.getToken(GenericSqlParser.KW_INTERSECT, i); + } + } + public KW_EXCEPT(): antlr.TerminalNode[]; + public KW_EXCEPT(i: number): antlr.TerminalNode | null; + public KW_EXCEPT(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.KW_EXCEPT); + } else { + return this.getToken(GenericSqlParser.KW_EXCEPT, i); + } + } + public KW_ALL(): antlr.TerminalNode[]; + public KW_ALL(i: number): antlr.TerminalNode | null; + public KW_ALL(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.KW_ALL); + } else { + return this.getToken(GenericSqlParser.KW_ALL, i); + } + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_queryNoWith; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterQueryNoWith) { + listener.enterQueryNoWith(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitQueryNoWith) { + listener.exitQueryNoWith(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitQueryNoWith) { + return visitor.visitQueryNoWith(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class QueryTermContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public queryPrimary(): QueryPrimaryContext { + return this.getRuleContext(0, QueryPrimaryContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_queryTerm; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterQueryTerm) { + listener.enterQueryTerm(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitQueryTerm) { + listener.exitQueryTerm(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitQueryTerm) { + return visitor.visitQueryTerm(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class QueryPrimaryContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public querySpecification(): QuerySpecificationContext | null { + return this.getRuleContext(0, QuerySpecificationContext); + } + public queryStatement(): QueryStatementContext | null { + return this.getRuleContext(0, QueryStatementContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_queryPrimary; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterQueryPrimary) { + listener.enterQueryPrimary(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitQueryPrimary) { + listener.exitQueryPrimary(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitQueryPrimary) { + return visitor.visitQueryPrimary(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class QuerySpecificationContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_SELECT(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_SELECT, 0)!; + } + public selectItem(): SelectItemContext[]; + public selectItem(i: number): SelectItemContext | null; + public selectItem(i?: number): SelectItemContext[] | SelectItemContext | null { + if (i === undefined) { + return this.getRuleContexts(SelectItemContext); + } + + return this.getRuleContext(i, SelectItemContext); + } + public setQuantifier(): SetQuantifierContext | null { + return this.getRuleContext(0, SetQuantifierContext); + } + public fromClause(): FromClauseContext | null { + return this.getRuleContext(0, FromClauseContext); + } + public whereClause(): WhereClauseContext | null { + return this.getRuleContext(0, WhereClauseContext); + } + public groupByClause(): GroupByClauseContext | null { + return this.getRuleContext(0, GroupByClauseContext); + } + public havingClause(): HavingClauseContext | null { + return this.getRuleContext(0, HavingClauseContext); + } + public orderByClause(): OrderByClauseContext | null { + return this.getRuleContext(0, OrderByClauseContext); + } + public limitClause(): LimitClauseContext | null { + return this.getRuleContext(0, LimitClauseContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_querySpecification; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterQuerySpecification) { + listener.enterQuerySpecification(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitQuerySpecification) { + listener.exitQuerySpecification(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitQuerySpecification) { + return visitor.visitQuerySpecification(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class SetQuantifierContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_DISTINCT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DISTINCT, 0); + } + public KW_ALL(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ALL, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_setQuantifier; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSetQuantifier) { + listener.enterSetQuantifier(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSetQuantifier) { + listener.exitSetQuantifier(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSetQuantifier) { + return visitor.visitSetQuantifier(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class SelectItemContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public expression(): ExpressionContext | null { + return this.getRuleContext(0, ExpressionContext); + } + public identifier(): IdentifierContext | null { + return this.getRuleContext(0, IdentifierContext); + } + public KW_AS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_AS, 0); + } + public qualifiedName(): QualifiedNameContext | null { + return this.getRuleContext(0, QualifiedNameContext); + } + public ASTERISK(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.ASTERISK, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_selectItem; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSelectItem) { + listener.enterSelectItem(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSelectItem) { + listener.exitSelectItem(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSelectItem) { + return visitor.visitSelectItem(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class FromClauseContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_FROM(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_FROM, 0)!; + } + public relation(): RelationContext[]; + public relation(i: number): RelationContext | null; + public relation(i?: number): RelationContext[] | RelationContext | null { + if (i === undefined) { + return this.getRuleContexts(RelationContext); + } + + return this.getRuleContext(i, RelationContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_fromClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterFromClause) { + listener.enterFromClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitFromClause) { + listener.exitFromClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitFromClause) { + return visitor.visitFromClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class RelationContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_relation; + } + public override copyFrom(ctx: RelationContext): void { + super.copyFrom(ctx); + } +} +export class SimpleRelationContext extends RelationContext { + public constructor(ctx: RelationContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public aliasedRelation(): AliasedRelationContext { + return this.getRuleContext(0, AliasedRelationContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSimpleRelation) { + listener.enterSimpleRelation(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSimpleRelation) { + listener.exitSimpleRelation(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSimpleRelation) { + return visitor.visitSimpleRelation(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class JoinRelationContext extends RelationContext { + public _left?: RelationContext; + public _right?: RelationContext; + public _condition?: ExpressionContext; + public constructor(ctx: RelationContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public joinType(): JoinTypeContext { + return this.getRuleContext(0, JoinTypeContext)!; + } + public KW_JOIN(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_JOIN, 0)!; + } + public KW_ON(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_ON, 0)!; + } + public relation(): RelationContext[]; + public relation(i: number): RelationContext | null; + public relation(i?: number): RelationContext[] | RelationContext | null { + if (i === undefined) { + return this.getRuleContexts(RelationContext); + } + + return this.getRuleContext(i, RelationContext); + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterJoinRelation) { + listener.enterJoinRelation(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitJoinRelation) { + listener.exitJoinRelation(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitJoinRelation) { + return visitor.visitJoinRelation(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class JoinTypeContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_INNER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_INNER, 0); + } + public KW_LEFT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_LEFT, 0); + } + public KW_OUTER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_OUTER, 0); + } + public KW_RIGHT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_RIGHT, 0); + } + public KW_FULL(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FULL, 0); + } + public KW_CROSS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_CROSS, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_joinType; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterJoinType) { + listener.enterJoinType(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitJoinType) { + listener.exitJoinType(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitJoinType) { + return visitor.visitJoinType(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class AliasedRelationContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public relationPrimary(): RelationPrimaryContext { + return this.getRuleContext(0, RelationPrimaryContext)!; + } + public identifier(): IdentifierContext | null { + return this.getRuleContext(0, IdentifierContext); + } + public KW_AS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_AS, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_aliasedRelation; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterAliasedRelation) { + listener.enterAliasedRelation(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitAliasedRelation) { + listener.exitAliasedRelation(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitAliasedRelation) { + return visitor.visitAliasedRelation(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class RelationPrimaryContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_relationPrimary; + } + public override copyFrom(ctx: RelationPrimaryContext): void { + super.copyFrom(ctx); + } +} +export class SubqueryRelationContext extends RelationPrimaryContext { + public constructor(ctx: RelationPrimaryContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public queryStatement(): QueryStatementContext { + return this.getRuleContext(0, QueryStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSubqueryRelation) { + listener.enterSubqueryRelation(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSubqueryRelation) { + listener.exitSubqueryRelation(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSubqueryRelation) { + return visitor.visitSubqueryRelation(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class TableNameRelationContext extends RelationPrimaryContext { + public constructor(ctx: RelationPrimaryContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public tableName(): TableNameContext { + return this.getRuleContext(0, TableNameContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterTableNameRelation) { + listener.enterTableNameRelation(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitTableNameRelation) { + listener.exitTableNameRelation(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitTableNameRelation) { + return visitor.visitTableNameRelation(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class WhereClauseContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_WHERE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_WHERE, 0)!; + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_whereClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterWhereClause) { + listener.enterWhereClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitWhereClause) { + listener.exitWhereClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitWhereClause) { + return visitor.visitWhereClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class GroupByClauseContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_GROUP(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_GROUP, 0)!; + } + public KW_BY(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_BY, 0)!; + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext | null; + public expression(i?: number): ExpressionContext[] | ExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } + + return this.getRuleContext(i, ExpressionContext); + } + public setQuantifier(): SetQuantifierContext | null { + return this.getRuleContext(0, SetQuantifierContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_groupByClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterGroupByClause) { + listener.enterGroupByClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitGroupByClause) { + listener.exitGroupByClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitGroupByClause) { + return visitor.visitGroupByClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class HavingClauseContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_HAVING(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_HAVING, 0)!; + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_havingClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterHavingClause) { + listener.enterHavingClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitHavingClause) { + listener.exitHavingClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitHavingClause) { + return visitor.visitHavingClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class OrderByClauseContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_ORDER(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_ORDER, 0)!; + } + public KW_BY(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_BY, 0)!; + } + public sortItem(): SortItemContext[]; + public sortItem(i: number): SortItemContext | null; + public sortItem(i?: number): SortItemContext[] | SortItemContext | null { + if (i === undefined) { + return this.getRuleContexts(SortItemContext); + } + + return this.getRuleContext(i, SortItemContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_orderByClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterOrderByClause) { + listener.enterOrderByClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitOrderByClause) { + listener.exitOrderByClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitOrderByClause) { + return visitor.visitOrderByClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class SortItemContext extends antlr.ParserRuleContext { + public _ordering?: Token | null; + public _nullOrdering?: Token | null; + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext)!; + } + public KW_NULLS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NULLS, 0); + } + public KW_ASC(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ASC, 0); + } + public KW_DESC(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DESC, 0); + } + public KW_FIRST(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FIRST, 0); + } + public KW_LAST(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_LAST, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_sortItem; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSortItem) { + listener.enterSortItem(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSortItem) { + listener.exitSortItem(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSortItem) { + return visitor.visitSortItem(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class LimitClauseContext extends antlr.ParserRuleContext { + public _limit?: ExpressionContext; + public _offset?: ExpressionContext; + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_LIMIT(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_LIMIT, 0)!; + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext | null; + public expression(i?: number): ExpressionContext[] | ExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } + + return this.getRuleContext(i, ExpressionContext); + } + public KW_OFFSET(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_OFFSET, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_limitClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterLimitClause) { + listener.enterLimitClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitLimitClause) { + listener.exitLimitClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitLimitClause) { + return visitor.visitLimitClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class InsertStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_INSERT(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_INSERT, 0)!; + } + public KW_INTO(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_INTO, 0)!; + } + public tableName(): TableNameContext { + return this.getRuleContext(0, TableNameContext)!; + } + public queryStatement(): QueryStatementContext { + return this.getRuleContext(0, QueryStatementContext)!; + } + public columnList(): ColumnListContext | null { + return this.getRuleContext(0, ColumnListContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_insertStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterInsertStatement) { + listener.enterInsertStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitInsertStatement) { + listener.exitInsertStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitInsertStatement) { + return visitor.visitInsertStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ColumnListContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public columnRef(): ColumnRefContext[]; + public columnRef(i: number): ColumnRefContext | null; + public columnRef(i?: number): ColumnRefContext[] | ColumnRefContext | null { + if (i === undefined) { + return this.getRuleContexts(ColumnRefContext); + } + + return this.getRuleContext(i, ColumnRefContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_columnList; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterColumnList) { + listener.enterColumnList(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitColumnList) { + listener.exitColumnList(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitColumnList) { + return visitor.visitColumnList(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class UpdateStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_UPDATE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_UPDATE, 0)!; + } + public tableName(): TableNameContext { + return this.getRuleContext(0, TableNameContext)!; + } + public KW_SET(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_SET, 0)!; + } + public updateAssignment(): UpdateAssignmentContext[]; + public updateAssignment(i: number): UpdateAssignmentContext | null; + public updateAssignment(i?: number): UpdateAssignmentContext[] | UpdateAssignmentContext | null { + if (i === undefined) { + return this.getRuleContexts(UpdateAssignmentContext); + } + + return this.getRuleContext(i, UpdateAssignmentContext); + } + public whereClause(): WhereClauseContext | null { + return this.getRuleContext(0, WhereClauseContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_updateStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterUpdateStatement) { + listener.enterUpdateStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitUpdateStatement) { + listener.exitUpdateStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitUpdateStatement) { + return visitor.visitUpdateStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class UpdateAssignmentContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public columnRef(): ColumnRefContext { + return this.getRuleContext(0, ColumnRefContext)!; + } + public EQ(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.EQ, 0)!; + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_updateAssignment; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterUpdateAssignment) { + listener.enterUpdateAssignment(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitUpdateAssignment) { + listener.exitUpdateAssignment(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitUpdateAssignment) { + return visitor.visitUpdateAssignment(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class DeleteStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_DELETE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_DELETE, 0)!; + } + public KW_FROM(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_FROM, 0)!; + } + public tableName(): TableNameContext { + return this.getRuleContext(0, TableNameContext)!; + } + public whereClause(): WhereClauseContext | null { + return this.getRuleContext(0, WhereClauseContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_deleteStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDeleteStatement) { + listener.enterDeleteStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDeleteStatement) { + listener.exitDeleteStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDeleteStatement) { + return visitor.visitDeleteStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class CreateTableStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_CREATE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_CREATE, 0)!; + } + public KW_TABLE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_TABLE, 0)!; + } + public tableNameCreate(): TableNameCreateContext { + return this.getRuleContext(0, TableNameCreateContext)!; + } + public tableElement(): TableElementContext[]; + public tableElement(i: number): TableElementContext | null; + public tableElement(i?: number): TableElementContext[] | TableElementContext | null { + if (i === undefined) { + return this.getRuleContexts(TableElementContext); + } + + return this.getRuleContext(i, TableElementContext); + } + public KW_IF(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_IF, 0); + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public KW_EXISTS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_EXISTS, 0); + } + public KW_WITH(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_WITH, 0); + } + public properties(): PropertiesContext | null { + return this.getRuleContext(0, PropertiesContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_createTableStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterCreateTableStatement) { + listener.enterCreateTableStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitCreateTableStatement) { + listener.exitCreateTableStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitCreateTableStatement) { + return visitor.visitCreateTableStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TableElementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public columnDefinition(): ColumnDefinitionContext | null { + return this.getRuleContext(0, ColumnDefinitionContext); + } + public tableConstraint(): TableConstraintContext | null { + return this.getRuleContext(0, TableConstraintContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_tableElement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterTableElement) { + listener.enterTableElement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitTableElement) { + listener.exitTableElement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitTableElement) { + return visitor.visitTableElement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ColumnDefinitionContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public columnRef(): ColumnRefContext { + return this.getRuleContext(0, ColumnRefContext)!; + } + public dataType(): DataTypeContext { + return this.getRuleContext(0, DataTypeContext)!; + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public KW_NULL(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NULL, 0); + } + public KW_DEFAULT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DEFAULT, 0); + } + public expression(): ExpressionContext | null { + return this.getRuleContext(0, ExpressionContext); + } + public KW_PRIMARY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_PRIMARY, 0); + } + public KW_KEY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_KEY, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_columnDefinition; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterColumnDefinition) { + listener.enterColumnDefinition(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitColumnDefinition) { + listener.exitColumnDefinition(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitColumnDefinition) { + return visitor.visitColumnDefinition(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TableConstraintContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_PRIMARY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_PRIMARY, 0); + } + public KW_KEY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_KEY, 0); + } + public columnRef(): ColumnRefContext[]; + public columnRef(i: number): ColumnRefContext | null; + public columnRef(i?: number): ColumnRefContext[] | ColumnRefContext | null { + if (i === undefined) { + return this.getRuleContexts(ColumnRefContext); + } + + return this.getRuleContext(i, ColumnRefContext); + } + public KW_UNIQUE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_UNIQUE, 0); + } + public KW_CHECK(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_CHECK, 0); + } + public expression(): ExpressionContext | null { + return this.getRuleContext(0, ExpressionContext); + } + public KW_FOREIGN(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FOREIGN, 0); + } + public KW_REFERENCES(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_REFERENCES, 0); + } + public tableName(): TableNameContext | null { + return this.getRuleContext(0, TableNameContext); + } + public KW_CONSTRAINT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_CONSTRAINT, 0); + } + public identifier(): IdentifierContext | null { + return this.getRuleContext(0, IdentifierContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_tableConstraint; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterTableConstraint) { + listener.enterTableConstraint(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitTableConstraint) { + listener.exitTableConstraint(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitTableConstraint) { + return visitor.visitTableConstraint(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class AlterTableStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_ALTER(): antlr.TerminalNode[]; + public KW_ALTER(i: number): antlr.TerminalNode | null; + public KW_ALTER(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.KW_ALTER); + } else { + return this.getToken(GenericSqlParser.KW_ALTER, i); + } + } + public KW_TABLE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_TABLE, 0)!; + } + public tableName(): TableNameContext { + return this.getRuleContext(0, TableNameContext)!; + } + public KW_ADD(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ADD, 0); + } + public KW_COLUMN(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_COLUMN, 0); + } + public columnDefinition(): ColumnDefinitionContext | null { + return this.getRuleContext(0, ColumnDefinitionContext); + } + public KW_DROP(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DROP, 0); + } + public columnRef(): ColumnRefContext | null { + return this.getRuleContext(0, ColumnRefContext); + } + public KW_RENAME(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_RENAME, 0); + } + public KW_TO(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TO, 0); + } + public tableNameCreate(): TableNameCreateContext | null { + return this.getRuleContext(0, TableNameCreateContext); + } + public KW_SET(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_SET, 0); + } + public KW_DEFAULT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DEFAULT, 0); + } + public expression(): ExpressionContext | null { + return this.getRuleContext(0, ExpressionContext); + } + public KW_IF(): antlr.TerminalNode[]; + public KW_IF(i: number): antlr.TerminalNode | null; + public KW_IF(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.KW_IF); + } else { + return this.getToken(GenericSqlParser.KW_IF, i); + } + } + public KW_EXISTS(): antlr.TerminalNode[]; + public KW_EXISTS(i: number): antlr.TerminalNode | null; + public KW_EXISTS(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.KW_EXISTS); + } else { + return this.getToken(GenericSqlParser.KW_EXISTS, i); + } + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_alterTableStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterAlterTableStatement) { + listener.enterAlterTableStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitAlterTableStatement) { + listener.exitAlterTableStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitAlterTableStatement) { + return visitor.visitAlterTableStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class DropTableStatementContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_DROP(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_DROP, 0)!; + } + public KW_TABLE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_TABLE, 0)!; + } + public tableName(): TableNameContext { + return this.getRuleContext(0, TableNameContext)!; + } + public KW_IF(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_IF, 0); + } + public KW_EXISTS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_EXISTS, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_dropTableStatement; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDropTableStatement) { + listener.enterDropTableStatement(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDropTableStatement) { + listener.exitDropTableStatement(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDropTableStatement) { + return visitor.visitDropTableStatement(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ExpressionContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public booleanExpression(): BooleanExpressionContext { + return this.getRuleContext(0, BooleanExpressionContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_expression; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterExpression) { + listener.enterExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitExpression) { + listener.exitExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitExpression) { + return visitor.visitExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class BooleanExpressionContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_booleanExpression; + } + public override copyFrom(ctx: BooleanExpressionContext): void { + super.copyFrom(ctx); + } +} +export class OrExpressionContext extends BooleanExpressionContext { + public _left?: BooleanExpressionContext; + public _right?: BooleanExpressionContext; + public constructor(ctx: BooleanExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_OR(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_OR, 0)!; + } + public booleanExpression(): BooleanExpressionContext[]; + public booleanExpression(i: number): BooleanExpressionContext | null; + public booleanExpression(i?: number): BooleanExpressionContext[] | BooleanExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(BooleanExpressionContext); + } + + return this.getRuleContext(i, BooleanExpressionContext); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterOrExpression) { + listener.enterOrExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitOrExpression) { + listener.exitOrExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitOrExpression) { + return visitor.visitOrExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class AndExpressionContext extends BooleanExpressionContext { + public _left?: BooleanExpressionContext; + public _right?: BooleanExpressionContext; + public constructor(ctx: BooleanExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_AND(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_AND, 0)!; + } + public booleanExpression(): BooleanExpressionContext[]; + public booleanExpression(i: number): BooleanExpressionContext | null; + public booleanExpression(i?: number): BooleanExpressionContext[] | BooleanExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(BooleanExpressionContext); + } + + return this.getRuleContext(i, BooleanExpressionContext); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterAndExpression) { + listener.enterAndExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitAndExpression) { + listener.exitAndExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitAndExpression) { + return visitor.visitAndExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class PredicatedContext extends BooleanExpressionContext { + public constructor(ctx: BooleanExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public predicatedExpression(): PredicatedExpressionContext { + return this.getRuleContext(0, PredicatedExpressionContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterPredicated) { + listener.enterPredicated(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitPredicated) { + listener.exitPredicated(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitPredicated) { + return visitor.visitPredicated(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class NotExpressionContext extends BooleanExpressionContext { + public constructor(ctx: BooleanExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_NOT(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_NOT, 0)!; + } + public booleanExpression(): BooleanExpressionContext { + return this.getRuleContext(0, BooleanExpressionContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterNotExpression) { + listener.enterNotExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitNotExpression) { + listener.exitNotExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitNotExpression) { + return visitor.visitNotExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PredicatedExpressionContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public valueExpression(): ValueExpressionContext { + return this.getRuleContext(0, ValueExpressionContext)!; + } + public predicate(): PredicateContext | null { + return this.getRuleContext(0, PredicateContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_predicatedExpression; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterPredicatedExpression) { + listener.enterPredicatedExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitPredicatedExpression) { + listener.exitPredicatedExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitPredicatedExpression) { + return visitor.visitPredicatedExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PredicateContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_predicate; + } + public override copyFrom(ctx: PredicateContext): void { + super.copyFrom(ctx); + } +} +export class ComparisonPredicateContext extends PredicateContext { + public _right?: ValueExpressionContext; + public constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public comparisonOperator(): ComparisonOperatorContext { + return this.getRuleContext(0, ComparisonOperatorContext)!; + } + public valueExpression(): ValueExpressionContext { + return this.getRuleContext(0, ValueExpressionContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterComparisonPredicate) { + listener.enterComparisonPredicate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitComparisonPredicate) { + listener.exitComparisonPredicate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitComparisonPredicate) { + return visitor.visitComparisonPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class InPredicateContext extends PredicateContext { + public constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_IN(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_IN, 0)!; + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext | null; + public expression(i?: number): ExpressionContext[] | ExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } + + return this.getRuleContext(i, ExpressionContext); + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterInPredicate) { + listener.enterInPredicate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitInPredicate) { + listener.exitInPredicate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitInPredicate) { + return visitor.visitInPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class InSubqueryPredicateContext extends PredicateContext { + public constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_IN(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_IN, 0)!; + } + public queryStatement(): QueryStatementContext { + return this.getRuleContext(0, QueryStatementContext)!; + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterInSubqueryPredicate) { + listener.enterInSubqueryPredicate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitInSubqueryPredicate) { + listener.exitInSubqueryPredicate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitInSubqueryPredicate) { + return visitor.visitInSubqueryPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class BetweenPredicateContext extends PredicateContext { + public _lower?: ValueExpressionContext; + public _upper?: ValueExpressionContext; + public constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_BETWEEN(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_BETWEEN, 0)!; + } + public KW_AND(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_AND, 0)!; + } + public valueExpression(): ValueExpressionContext[]; + public valueExpression(i: number): ValueExpressionContext | null; + public valueExpression(i?: number): ValueExpressionContext[] | ValueExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ValueExpressionContext); + } + + return this.getRuleContext(i, ValueExpressionContext); + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterBetweenPredicate) { + listener.enterBetweenPredicate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitBetweenPredicate) { + listener.exitBetweenPredicate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitBetweenPredicate) { + return visitor.visitBetweenPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class LikePredicateContext extends PredicateContext { + public _pattern?: ValueExpressionContext; + public _escape?: ValueExpressionContext; + public constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_LIKE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_LIKE, 0)!; + } + public valueExpression(): ValueExpressionContext[]; + public valueExpression(i: number): ValueExpressionContext | null; + public valueExpression(i?: number): ValueExpressionContext[] | ValueExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ValueExpressionContext); + } + + return this.getRuleContext(i, ValueExpressionContext); + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public KW_ESCAPE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ESCAPE, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterLikePredicate) { + listener.enterLikePredicate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitLikePredicate) { + listener.exitLikePredicate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitLikePredicate) { + return visitor.visitLikePredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class NullPredicateContext extends PredicateContext { + public constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_IS(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_IS, 0)!; + } + public KW_NULL(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_NULL, 0)!; + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterNullPredicate) { + listener.enterNullPredicate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitNullPredicate) { + listener.exitNullPredicate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitNullPredicate) { + return visitor.visitNullPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class DistinctFromPredicateContext extends PredicateContext { + public _right?: ValueExpressionContext; + public constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_IS(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_IS, 0)!; + } + public KW_DISTINCT(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_DISTINCT, 0)!; + } + public KW_FROM(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_FROM, 0)!; + } + public valueExpression(): ValueExpressionContext { + return this.getRuleContext(0, ValueExpressionContext)!; + } + public KW_NOT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NOT, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDistinctFromPredicate) { + listener.enterDistinctFromPredicate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDistinctFromPredicate) { + listener.exitDistinctFromPredicate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDistinctFromPredicate) { + return visitor.visitDistinctFromPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ComparisonOperatorContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public EQ(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.EQ, 0); + } + public NEQ(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.NEQ, 0); + } + public LT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.LT, 0); + } + public LTE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.LTE, 0); + } + public GT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.GT, 0); + } + public GTE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.GTE, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_comparisonOperator; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterComparisonOperator) { + listener.enterComparisonOperator(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitComparisonOperator) { + listener.exitComparisonOperator(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitComparisonOperator) { + return visitor.visitComparisonOperator(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ValueExpressionContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_valueExpression; + } + public override copyFrom(ctx: ValueExpressionContext): void { + super.copyFrom(ctx); + } +} +export class ValueExpressionDefaultContext extends ValueExpressionContext { + public constructor(ctx: ValueExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public primaryExpression(): PrimaryExpressionContext { + return this.getRuleContext(0, PrimaryExpressionContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterValueExpressionDefault) { + listener.enterValueExpressionDefault(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitValueExpressionDefault) { + listener.exitValueExpressionDefault(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitValueExpressionDefault) { + return visitor.visitValueExpressionDefault(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class ConcatenationContext extends ValueExpressionContext { + public _left?: ValueExpressionContext; + public _right?: ValueExpressionContext; + public constructor(ctx: ValueExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public CONCAT(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.CONCAT, 0)!; + } + public valueExpression(): ValueExpressionContext[]; + public valueExpression(i: number): ValueExpressionContext | null; + public valueExpression(i?: number): ValueExpressionContext[] | ValueExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ValueExpressionContext); + } + + return this.getRuleContext(i, ValueExpressionContext); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterConcatenation) { + listener.enterConcatenation(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitConcatenation) { + listener.exitConcatenation(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitConcatenation) { + return visitor.visitConcatenation(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class ArithmeticBinaryContext extends ValueExpressionContext { + public _left?: ValueExpressionContext; + public _operator?: Token | null; + public _right?: ValueExpressionContext; + public constructor(ctx: ValueExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public valueExpression(): ValueExpressionContext[]; + public valueExpression(i: number): ValueExpressionContext | null; + public valueExpression(i?: number): ValueExpressionContext[] | ValueExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ValueExpressionContext); + } + + return this.getRuleContext(i, ValueExpressionContext); + } + public ASTERISK(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.ASTERISK, 0); + } + public SLASH(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.SLASH, 0); + } + public PERCENT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.PERCENT, 0); + } + public PLUS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.PLUS, 0); + } + public MINUS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.MINUS, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterArithmeticBinary) { + listener.enterArithmeticBinary(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitArithmeticBinary) { + listener.exitArithmeticBinary(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitArithmeticBinary) { + return visitor.visitArithmeticBinary(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class ArithmeticUnaryContext extends ValueExpressionContext { + public _operator?: Token | null; + public constructor(ctx: ValueExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public valueExpression(): ValueExpressionContext { + return this.getRuleContext(0, ValueExpressionContext)!; + } + public MINUS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.MINUS, 0); + } + public PLUS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.PLUS, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterArithmeticUnary) { + listener.enterArithmeticUnary(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitArithmeticUnary) { + listener.exitArithmeticUnary(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitArithmeticUnary) { + return visitor.visitArithmeticUnary(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PrimaryExpressionContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_primaryExpression; + } + public override copyFrom(ctx: PrimaryExpressionContext): void { + super.copyFrom(ctx); + } +} +export class SubqueryExpressionDefaultContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public subqueryExpression(): SubqueryExpressionContext { + return this.getRuleContext(0, SubqueryExpressionContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSubqueryExpressionDefault) { + listener.enterSubqueryExpressionDefault(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSubqueryExpressionDefault) { + listener.exitSubqueryExpressionDefault(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSubqueryExpressionDefault) { + return visitor.visitSubqueryExpressionDefault(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class CastExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_CAST(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_CAST, 0)!; + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext)!; + } + public KW_AS(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_AS, 0)!; + } + public dataType(): DataTypeContext { + return this.getRuleContext(0, DataTypeContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterCastExpression) { + listener.enterCastExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitCastExpression) { + listener.exitCastExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitCastExpression) { + return visitor.visitCastExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class CoalesceExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_COALESCE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_COALESCE, 0)!; + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext | null; + public expression(i?: number): ExpressionContext[] | ExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } + + return this.getRuleContext(i, ExpressionContext); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterCoalesceExpression) { + listener.enterCoalesceExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitCoalesceExpression) { + listener.exitCoalesceExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitCoalesceExpression) { + return visitor.visitCoalesceExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class ColumnReferenceContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public qualifiedName(): QualifiedNameContext { + return this.getRuleContext(0, QualifiedNameContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterColumnReference) { + listener.enterColumnReference(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitColumnReference) { + listener.exitColumnReference(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitColumnReference) { + return visitor.visitColumnReference(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class ParenthesizedExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterParenthesizedExpression) { + listener.enterParenthesizedExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitParenthesizedExpression) { + listener.exitParenthesizedExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitParenthesizedExpression) { + return visitor.visitParenthesizedExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class ExistsExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_EXISTS(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_EXISTS, 0)!; + } + public queryStatement(): QueryStatementContext { + return this.getRuleContext(0, QueryStatementContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterExistsExpression) { + listener.enterExistsExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitExistsExpression) { + listener.exitExistsExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitExistsExpression) { + return visitor.visitExistsExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class FunctionCallContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public qualifiedName(): QualifiedNameContext { + return this.getRuleContext(0, QualifiedNameContext)!; + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext | null; + public expression(i?: number): ExpressionContext[] | ExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } + + return this.getRuleContext(i, ExpressionContext); + } + public setQuantifier(): SetQuantifierContext | null { + return this.getRuleContext(0, SetQuantifierContext); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterFunctionCall) { + listener.enterFunctionCall(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitFunctionCall) { + listener.exitFunctionCall(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitFunctionCall) { + return visitor.visitFunctionCall(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class LiteralExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public literal(): LiteralContext { + return this.getRuleContext(0, LiteralContext)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterLiteralExpression) { + listener.enterLiteralExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitLiteralExpression) { + listener.exitLiteralExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitLiteralExpression) { + return visitor.visitLiteralExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class SearchedCaseExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_CASE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_CASE, 0)!; + } + public KW_END(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_END, 0)!; + } + public whenClause(): WhenClauseContext[]; + public whenClause(i: number): WhenClauseContext | null; + public whenClause(i?: number): WhenClauseContext[] | WhenClauseContext | null { + if (i === undefined) { + return this.getRuleContexts(WhenClauseContext); + } + + return this.getRuleContext(i, WhenClauseContext); + } + public KW_ELSE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ELSE, 0); + } + public expression(): ExpressionContext | null { + return this.getRuleContext(0, ExpressionContext); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSearchedCaseExpression) { + listener.enterSearchedCaseExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSearchedCaseExpression) { + listener.exitSearchedCaseExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSearchedCaseExpression) { + return visitor.visitSearchedCaseExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class NullIfExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_NULLIF(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_NULLIF, 0)!; + } + public valueExpression(): ValueExpressionContext[]; + public valueExpression(i: number): ValueExpressionContext | null; + public valueExpression(i?: number): ValueExpressionContext[] | ValueExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ValueExpressionContext); + } + + return this.getRuleContext(i, ValueExpressionContext); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterNullIfExpression) { + listener.enterNullIfExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitNullIfExpression) { + listener.exitNullIfExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitNullIfExpression) { + return visitor.visitNullIfExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class SimpleCaseExpressionContext extends PrimaryExpressionContext { + public constructor(ctx: PrimaryExpressionContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_CASE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_CASE, 0)!; + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext | null; + public expression(i?: number): ExpressionContext[] | ExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } + + return this.getRuleContext(i, ExpressionContext); + } + public KW_END(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_END, 0)!; + } + public whenClause(): WhenClauseContext[]; + public whenClause(i: number): WhenClauseContext | null; + public whenClause(i?: number): WhenClauseContext[] | WhenClauseContext | null { + if (i === undefined) { + return this.getRuleContexts(WhenClauseContext); + } + + return this.getRuleContext(i, WhenClauseContext); + } + public KW_ELSE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ELSE, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSimpleCaseExpression) { + listener.enterSimpleCaseExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSimpleCaseExpression) { + listener.exitSimpleCaseExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSimpleCaseExpression) { + return visitor.visitSimpleCaseExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class WhenClauseContext extends antlr.ParserRuleContext { + public _condition?: ExpressionContext; + public _result?: ExpressionContext; + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_WHEN(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_WHEN, 0)!; + } + public KW_THEN(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_THEN, 0)!; + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext | null; + public expression(i?: number): ExpressionContext[] | ExpressionContext | null { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } + + return this.getRuleContext(i, ExpressionContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_whenClause; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterWhenClause) { + listener.enterWhenClause(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitWhenClause) { + listener.exitWhenClause(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitWhenClause) { + return visitor.visitWhenClause(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class SubqueryExpressionContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public queryStatement(): QueryStatementContext { + return this.getRuleContext(0, QueryStatementContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_subqueryExpression; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterSubqueryExpression) { + listener.enterSubqueryExpression(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitSubqueryExpression) { + listener.exitSubqueryExpression(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitSubqueryExpression) { + return visitor.visitSubqueryExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class DataTypeContext extends antlr.ParserRuleContext { + public _precision?: Token | null; + public _scale?: Token | null; + public _maxLength?: Token | null; + public _length?: Token | null; + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_BOOLEAN(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_BOOLEAN, 0); + } + public KW_TINYINT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TINYINT, 0); + } + public KW_SMALLINT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_SMALLINT, 0); + } + public KW_INT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_INT, 0); + } + public KW_INTEGER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_INTEGER, 0); + } + public KW_BIGINT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_BIGINT, 0); + } + public KW_FLOAT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FLOAT, 0); + } + public KW_DOUBLE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DOUBLE, 0); + } + public KW_DECIMAL(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DECIMAL, 0); + } + public INTEGER_VALUE(): antlr.TerminalNode[]; + public INTEGER_VALUE(i: number): antlr.TerminalNode | null; + public INTEGER_VALUE(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { + if (i === undefined) { + return this.getTokens(GenericSqlParser.INTEGER_VALUE); + } else { + return this.getToken(GenericSqlParser.INTEGER_VALUE, i); + } + } + public KW_NUMERIC(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NUMERIC, 0); + } + public KW_VARCHAR(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_VARCHAR, 0); + } + public KW_CHAR(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_CHAR, 0); + } + public KW_TEXT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TEXT, 0); + } + public KW_DATE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DATE, 0); + } + public KW_TIME(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TIME, 0); + } + public KW_TIMESTAMP(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TIMESTAMP, 0); + } + public KW_BINARY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_BINARY, 0); + } + public KW_VARBINARY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_VARBINARY, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_dataType; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDataType) { + listener.enterDataType(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDataType) { + listener.exitDataType(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDataType) { + return visitor.visitDataType(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PropertiesContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public property(): PropertyContext[]; + public property(i: number): PropertyContext | null; + public property(i?: number): PropertyContext[] | PropertyContext | null { + if (i === undefined) { + return this.getRuleContexts(PropertyContext); + } + + return this.getRuleContext(i, PropertyContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_properties; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterProperties) { + listener.enterProperties(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitProperties) { + listener.exitProperties(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitProperties) { + return visitor.visitProperties(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PropertyContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public identifier(): IdentifierContext { + return this.getRuleContext(0, IdentifierContext)!; + } + public EQ(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.EQ, 0)!; + } + public literal(): LiteralContext { + return this.getRuleContext(0, LiteralContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_property; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterProperty) { + listener.enterProperty(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitProperty) { + listener.exitProperty(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitProperty) { + return visitor.visitProperty(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class LiteralContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_literal; + } + public override copyFrom(ctx: LiteralContext): void { + super.copyFrom(ctx); + } +} +export class BinaryLiteralContext extends LiteralContext { + public constructor(ctx: LiteralContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public BINARY_LITERAL(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.BINARY_LITERAL, 0)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterBinaryLiteral) { + listener.enterBinaryLiteral(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitBinaryLiteral) { + listener.exitBinaryLiteral(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitBinaryLiteral) { + return visitor.visitBinaryLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class DecimalLiteralContext extends LiteralContext { + public constructor(ctx: LiteralContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public DECIMAL_VALUE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.DECIMAL_VALUE, 0)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDecimalLiteral) { + listener.enterDecimalLiteral(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDecimalLiteral) { + listener.exitDecimalLiteral(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDecimalLiteral) { + return visitor.visitDecimalLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class NullLiteralContext extends LiteralContext { + public constructor(ctx: LiteralContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_NULL(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.KW_NULL, 0)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterNullLiteral) { + listener.enterNullLiteral(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitNullLiteral) { + listener.exitNullLiteral(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitNullLiteral) { + return visitor.visitNullLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class StringLiteralContext extends LiteralContext { + public constructor(ctx: LiteralContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public STRING(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.STRING, 0)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterStringLiteral) { + listener.enterStringLiteral(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitStringLiteral) { + listener.exitStringLiteral(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitStringLiteral) { + return visitor.visitStringLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class DoubleLiteralContext extends LiteralContext { + public constructor(ctx: LiteralContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public DOUBLE_VALUE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.DOUBLE_VALUE, 0)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterDoubleLiteral) { + listener.enterDoubleLiteral(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitDoubleLiteral) { + listener.exitDoubleLiteral(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitDoubleLiteral) { + return visitor.visitDoubleLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class IntegerLiteralContext extends LiteralContext { + public constructor(ctx: LiteralContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public INTEGER_VALUE(): antlr.TerminalNode { + return this.getToken(GenericSqlParser.INTEGER_VALUE, 0)!; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterIntegerLiteral) { + listener.enterIntegerLiteral(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitIntegerLiteral) { + listener.exitIntegerLiteral(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitIntegerLiteral) { + return visitor.visitIntegerLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class BooleanLiteralContext extends LiteralContext { + public constructor(ctx: LiteralContext) { + super(ctx.parent, ctx.invokingState); + super.copyFrom(ctx); + } + public KW_TRUE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TRUE, 0); + } + public KW_FALSE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FALSE, 0); + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterBooleanLiteral) { + listener.enterBooleanLiteral(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitBooleanLiteral) { + listener.exitBooleanLiteral(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitBooleanLiteral) { + return visitor.visitBooleanLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class IdentifierContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public IDENTIFIER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.IDENTIFIER, 0); + } + public DIGIT_IDENTIFIER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.DIGIT_IDENTIFIER, 0); + } + public QUOTED_IDENTIFIER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.QUOTED_IDENTIFIER, 0); + } + public BACKQUOTED_IDENTIFIER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.BACKQUOTED_IDENTIFIER, 0); + } + public nonReserved(): NonReservedContext | null { + return this.getRuleContext(0, NonReservedContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_identifier; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterIdentifier) { + listener.enterIdentifier(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitIdentifier) { + listener.exitIdentifier(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitIdentifier) { + return visitor.visitIdentifier(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class QualifiedNameContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public identifier(): IdentifierContext[]; + public identifier(i: number): IdentifierContext | null; + public identifier(i?: number): IdentifierContext[] | IdentifierContext | null { + if (i === undefined) { + return this.getRuleContexts(IdentifierContext); + } + + return this.getRuleContext(i, IdentifierContext); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_qualifiedName; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterQualifiedName) { + listener.enterQualifiedName(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitQualifiedName) { + listener.exitQualifiedName(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitQualifiedName) { + return visitor.visitQualifiedName(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ColumnRefContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public identifier(): IdentifierContext { + return this.getRuleContext(0, IdentifierContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_columnRef; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterColumnRef) { + listener.enterColumnRef(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitColumnRef) { + listener.exitColumnRef(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitColumnRef) { + return visitor.visitColumnRef(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TableNameContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public qualifiedName(): QualifiedNameContext { + return this.getRuleContext(0, QualifiedNameContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_tableName; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterTableName) { + listener.enterTableName(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitTableName) { + listener.exitTableName(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitTableName) { + return visitor.visitTableName(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TableNameCreateContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public qualifiedName(): QualifiedNameContext { + return this.getRuleContext(0, QualifiedNameContext)!; + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_tableNameCreate; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterTableNameCreate) { + listener.enterTableNameCreate(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitTableNameCreate) { + listener.exitTableNameCreate(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitTableNameCreate) { + return visitor.visitTableNameCreate(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class NonReservedContext extends antlr.ParserRuleContext { + public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) { + super(parent, invokingState); + } + public KW_ADD(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ADD, 0); + } + public KW_ALL(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ALL, 0); + } + public KW_ASC(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_ASC, 0); + } + public KW_BIGINT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_BIGINT, 0); + } + public KW_BINARY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_BINARY, 0); + } + public KW_BOOLEAN(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_BOOLEAN, 0); + } + public KW_BY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_BY, 0); + } + public KW_CHAR(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_CHAR, 0); + } + public KW_COALESCE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_COALESCE, 0); + } + public KW_COLUMN(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_COLUMN, 0); + } + public KW_CROSS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_CROSS, 0); + } + public KW_DATE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DATE, 0); + } + public KW_DECIMAL(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DECIMAL, 0); + } + public KW_DEFAULT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DEFAULT, 0); + } + public KW_DESC(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DESC, 0); + } + public KW_DOUBLE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_DOUBLE, 0); + } + public KW_FALSE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FALSE, 0); + } + public KW_FIRST(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FIRST, 0); + } + public KW_FLOAT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FLOAT, 0); + } + public KW_FULL(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_FULL, 0); + } + public KW_IF(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_IF, 0); + } + public KW_INT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_INT, 0); + } + public KW_INTEGER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_INTEGER, 0); + } + public KW_KEY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_KEY, 0); + } + public KW_LAST(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_LAST, 0); + } + public KW_LEFT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_LEFT, 0); + } + public KW_LIMIT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_LIMIT, 0); + } + public KW_NULLIF(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NULLIF, 0); + } + public KW_NULLS(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NULLS, 0); + } + public KW_NUMERIC(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_NUMERIC, 0); + } + public KW_OFFSET(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_OFFSET, 0); + } + public KW_OUTER(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_OUTER, 0); + } + public KW_RIGHT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_RIGHT, 0); + } + public KW_SMALLINT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_SMALLINT, 0); + } + public KW_TEXT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TEXT, 0); + } + public KW_TIME(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TIME, 0); + } + public KW_TIMESTAMP(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TIMESTAMP, 0); + } + public KW_TINYINT(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TINYINT, 0); + } + public KW_TO(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TO, 0); + } + public KW_TRUE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_TRUE, 0); + } + public KW_UNIQUE(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_UNIQUE, 0); + } + public KW_VARCHAR(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_VARCHAR, 0); + } + public KW_VARBINARY(): antlr.TerminalNode | null { + return this.getToken(GenericSqlParser.KW_VARBINARY, 0); + } + public override get ruleIndex(): number { + return GenericSqlParser.RULE_nonReserved; + } + public override enterRule(listener: GenericSqlListener): void { + if(listener.enterNonReserved) { + listener.enterNonReserved(this); + } + } + public override exitRule(listener: GenericSqlListener): void { + if(listener.exitNonReserved) { + listener.exitNonReserved(this); + } + } + public override accept(visitor: GenericSqlVisitor): Result | null { + if (visitor.visitNonReserved) { + return visitor.visitNonReserved(this); + } else { + return visitor.visitChildren(this); + } + } +} diff --git a/src/lib/generic/GenericSqlVisitor.ts b/src/lib/generic/GenericSqlVisitor.ts new file mode 100644 index 00000000..ab836337 --- /dev/null +++ b/src/lib/generic/GenericSqlVisitor.ts @@ -0,0 +1,696 @@ +// Generated from dt-sql-parser/src/grammar/generic/GenericSql.g4 by ANTLR 4.13.1 + +// @ts-nocheck + +import { AbstractParseTreeVisitor } from "antlr4ng"; + + +import { SQLParserBase } from '../SQLParserBase'; + + +import { ProgramContext } from "./GenericSqlParser.js"; +import { StatementsContext } from "./GenericSqlParser.js"; +import { SingleStatementContext } from "./GenericSqlParser.js"; +import { StatementDefaultContext } from "./GenericSqlParser.js"; +import { InsertContext } from "./GenericSqlParser.js"; +import { UpdateContext } from "./GenericSqlParser.js"; +import { DeleteContext } from "./GenericSqlParser.js"; +import { CreateTableContext } from "./GenericSqlParser.js"; +import { AlterTableContext } from "./GenericSqlParser.js"; +import { DropTableContext } from "./GenericSqlParser.js"; +import { QueryStatementContext } from "./GenericSqlParser.js"; +import { WithClauseContext } from "./GenericSqlParser.js"; +import { NamedQueryContext } from "./GenericSqlParser.js"; +import { QueryNoWithContext } from "./GenericSqlParser.js"; +import { QueryTermContext } from "./GenericSqlParser.js"; +import { QueryPrimaryContext } from "./GenericSqlParser.js"; +import { QuerySpecificationContext } from "./GenericSqlParser.js"; +import { SetQuantifierContext } from "./GenericSqlParser.js"; +import { SelectItemContext } from "./GenericSqlParser.js"; +import { FromClauseContext } from "./GenericSqlParser.js"; +import { SimpleRelationContext } from "./GenericSqlParser.js"; +import { JoinRelationContext } from "./GenericSqlParser.js"; +import { JoinTypeContext } from "./GenericSqlParser.js"; +import { AliasedRelationContext } from "./GenericSqlParser.js"; +import { TableNameRelationContext } from "./GenericSqlParser.js"; +import { SubqueryRelationContext } from "./GenericSqlParser.js"; +import { WhereClauseContext } from "./GenericSqlParser.js"; +import { GroupByClauseContext } from "./GenericSqlParser.js"; +import { HavingClauseContext } from "./GenericSqlParser.js"; +import { OrderByClauseContext } from "./GenericSqlParser.js"; +import { SortItemContext } from "./GenericSqlParser.js"; +import { LimitClauseContext } from "./GenericSqlParser.js"; +import { InsertStatementContext } from "./GenericSqlParser.js"; +import { ColumnListContext } from "./GenericSqlParser.js"; +import { UpdateStatementContext } from "./GenericSqlParser.js"; +import { UpdateAssignmentContext } from "./GenericSqlParser.js"; +import { DeleteStatementContext } from "./GenericSqlParser.js"; +import { CreateTableStatementContext } from "./GenericSqlParser.js"; +import { TableElementContext } from "./GenericSqlParser.js"; +import { ColumnDefinitionContext } from "./GenericSqlParser.js"; +import { TableConstraintContext } from "./GenericSqlParser.js"; +import { AlterTableStatementContext } from "./GenericSqlParser.js"; +import { DropTableStatementContext } from "./GenericSqlParser.js"; +import { ExpressionContext } from "./GenericSqlParser.js"; +import { OrExpressionContext } from "./GenericSqlParser.js"; +import { AndExpressionContext } from "./GenericSqlParser.js"; +import { PredicatedContext } from "./GenericSqlParser.js"; +import { NotExpressionContext } from "./GenericSqlParser.js"; +import { PredicatedExpressionContext } from "./GenericSqlParser.js"; +import { ComparisonPredicateContext } from "./GenericSqlParser.js"; +import { InPredicateContext } from "./GenericSqlParser.js"; +import { InSubqueryPredicateContext } from "./GenericSqlParser.js"; +import { BetweenPredicateContext } from "./GenericSqlParser.js"; +import { LikePredicateContext } from "./GenericSqlParser.js"; +import { NullPredicateContext } from "./GenericSqlParser.js"; +import { DistinctFromPredicateContext } from "./GenericSqlParser.js"; +import { ComparisonOperatorContext } from "./GenericSqlParser.js"; +import { ValueExpressionDefaultContext } from "./GenericSqlParser.js"; +import { ConcatenationContext } from "./GenericSqlParser.js"; +import { ArithmeticBinaryContext } from "./GenericSqlParser.js"; +import { ArithmeticUnaryContext } from "./GenericSqlParser.js"; +import { LiteralExpressionContext } from "./GenericSqlParser.js"; +import { FunctionCallContext } from "./GenericSqlParser.js"; +import { SearchedCaseExpressionContext } from "./GenericSqlParser.js"; +import { SimpleCaseExpressionContext } from "./GenericSqlParser.js"; +import { CastExpressionContext } from "./GenericSqlParser.js"; +import { CoalesceExpressionContext } from "./GenericSqlParser.js"; +import { NullIfExpressionContext } from "./GenericSqlParser.js"; +import { ParenthesizedExpressionContext } from "./GenericSqlParser.js"; +import { ExistsExpressionContext } from "./GenericSqlParser.js"; +import { SubqueryExpressionDefaultContext } from "./GenericSqlParser.js"; +import { ColumnReferenceContext } from "./GenericSqlParser.js"; +import { WhenClauseContext } from "./GenericSqlParser.js"; +import { SubqueryExpressionContext } from "./GenericSqlParser.js"; +import { DataTypeContext } from "./GenericSqlParser.js"; +import { PropertiesContext } from "./GenericSqlParser.js"; +import { PropertyContext } from "./GenericSqlParser.js"; +import { NullLiteralContext } from "./GenericSqlParser.js"; +import { BooleanLiteralContext } from "./GenericSqlParser.js"; +import { IntegerLiteralContext } from "./GenericSqlParser.js"; +import { DecimalLiteralContext } from "./GenericSqlParser.js"; +import { DoubleLiteralContext } from "./GenericSqlParser.js"; +import { StringLiteralContext } from "./GenericSqlParser.js"; +import { BinaryLiteralContext } from "./GenericSqlParser.js"; +import { IdentifierContext } from "./GenericSqlParser.js"; +import { QualifiedNameContext } from "./GenericSqlParser.js"; +import { ColumnRefContext } from "./GenericSqlParser.js"; +import { TableNameContext } from "./GenericSqlParser.js"; +import { TableNameCreateContext } from "./GenericSqlParser.js"; +import { NonReservedContext } from "./GenericSqlParser.js"; + + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by `GenericSqlParser`. + * + * @param The return type of the visit operation. Use `void` for + * operations with no return type. + */ +export class GenericSqlVisitor extends AbstractParseTreeVisitor { + /** + * Visit a parse tree produced by `GenericSqlParser.program`. + * @param ctx the parse tree + * @return the visitor result + */ + visitProgram?: (ctx: ProgramContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.statements`. + * @param ctx the parse tree + * @return the visitor result + */ + visitStatements?: (ctx: StatementsContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.singleStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSingleStatement?: (ctx: SingleStatementContext) => Result; + /** + * Visit a parse tree produced by the `statementDefault` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitStatementDefault?: (ctx: StatementDefaultContext) => Result; + /** + * Visit a parse tree produced by the `insert` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitInsert?: (ctx: InsertContext) => Result; + /** + * Visit a parse tree produced by the `update` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitUpdate?: (ctx: UpdateContext) => Result; + /** + * Visit a parse tree produced by the `delete` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDelete?: (ctx: DeleteContext) => Result; + /** + * Visit a parse tree produced by the `createTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitCreateTable?: (ctx: CreateTableContext) => Result; + /** + * Visit a parse tree produced by the `alterTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAlterTable?: (ctx: AlterTableContext) => Result; + /** + * Visit a parse tree produced by the `dropTable` + * labeled alternative in `GenericSqlParser.statement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDropTable?: (ctx: DropTableContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.queryStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitQueryStatement?: (ctx: QueryStatementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.withClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitWithClause?: (ctx: WithClauseContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.namedQuery`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNamedQuery?: (ctx: NamedQueryContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.queryNoWith`. + * @param ctx the parse tree + * @return the visitor result + */ + visitQueryNoWith?: (ctx: QueryNoWithContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.queryTerm`. + * @param ctx the parse tree + * @return the visitor result + */ + visitQueryTerm?: (ctx: QueryTermContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.queryPrimary`. + * @param ctx the parse tree + * @return the visitor result + */ + visitQueryPrimary?: (ctx: QueryPrimaryContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.querySpecification`. + * @param ctx the parse tree + * @return the visitor result + */ + visitQuerySpecification?: (ctx: QuerySpecificationContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.setQuantifier`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSetQuantifier?: (ctx: SetQuantifierContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.selectItem`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSelectItem?: (ctx: SelectItemContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.fromClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitFromClause?: (ctx: FromClauseContext) => Result; + /** + * Visit a parse tree produced by the `simpleRelation` + * labeled alternative in `GenericSqlParser.relation`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSimpleRelation?: (ctx: SimpleRelationContext) => Result; + /** + * Visit a parse tree produced by the `joinRelation` + * labeled alternative in `GenericSqlParser.relation`. + * @param ctx the parse tree + * @return the visitor result + */ + visitJoinRelation?: (ctx: JoinRelationContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.joinType`. + * @param ctx the parse tree + * @return the visitor result + */ + visitJoinType?: (ctx: JoinTypeContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.aliasedRelation`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAliasedRelation?: (ctx: AliasedRelationContext) => Result; + /** + * Visit a parse tree produced by the `tableNameRelation` + * labeled alternative in `GenericSqlParser.relationPrimary`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTableNameRelation?: (ctx: TableNameRelationContext) => Result; + /** + * Visit a parse tree produced by the `subqueryRelation` + * labeled alternative in `GenericSqlParser.relationPrimary`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSubqueryRelation?: (ctx: SubqueryRelationContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.whereClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitWhereClause?: (ctx: WhereClauseContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.groupByClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitGroupByClause?: (ctx: GroupByClauseContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.havingClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitHavingClause?: (ctx: HavingClauseContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.orderByClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitOrderByClause?: (ctx: OrderByClauseContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.sortItem`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSortItem?: (ctx: SortItemContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.limitClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitLimitClause?: (ctx: LimitClauseContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.insertStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitInsertStatement?: (ctx: InsertStatementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.columnList`. + * @param ctx the parse tree + * @return the visitor result + */ + visitColumnList?: (ctx: ColumnListContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.updateStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitUpdateStatement?: (ctx: UpdateStatementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.updateAssignment`. + * @param ctx the parse tree + * @return the visitor result + */ + visitUpdateAssignment?: (ctx: UpdateAssignmentContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.deleteStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDeleteStatement?: (ctx: DeleteStatementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.createTableStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitCreateTableStatement?: (ctx: CreateTableStatementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.tableElement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTableElement?: (ctx: TableElementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.columnDefinition`. + * @param ctx the parse tree + * @return the visitor result + */ + visitColumnDefinition?: (ctx: ColumnDefinitionContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.tableConstraint`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTableConstraint?: (ctx: TableConstraintContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.alterTableStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAlterTableStatement?: (ctx: AlterTableStatementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.dropTableStatement`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDropTableStatement?: (ctx: DropTableStatementContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitExpression?: (ctx: ExpressionContext) => Result; + /** + * Visit a parse tree produced by the `orExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitOrExpression?: (ctx: OrExpressionContext) => Result; + /** + * Visit a parse tree produced by the `andExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAndExpression?: (ctx: AndExpressionContext) => Result; + /** + * Visit a parse tree produced by the `predicated` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPredicated?: (ctx: PredicatedContext) => Result; + /** + * Visit a parse tree produced by the `notExpression` + * labeled alternative in `GenericSqlParser.booleanExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNotExpression?: (ctx: NotExpressionContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.predicatedExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPredicatedExpression?: (ctx: PredicatedExpressionContext) => Result; + /** + * Visit a parse tree produced by the `comparisonPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitComparisonPredicate?: (ctx: ComparisonPredicateContext) => Result; + /** + * Visit a parse tree produced by the `inPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitInPredicate?: (ctx: InPredicateContext) => Result; + /** + * Visit a parse tree produced by the `inSubqueryPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitInSubqueryPredicate?: (ctx: InSubqueryPredicateContext) => Result; + /** + * Visit a parse tree produced by the `betweenPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitBetweenPredicate?: (ctx: BetweenPredicateContext) => Result; + /** + * Visit a parse tree produced by the `likePredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitLikePredicate?: (ctx: LikePredicateContext) => Result; + /** + * Visit a parse tree produced by the `nullPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNullPredicate?: (ctx: NullPredicateContext) => Result; + /** + * Visit a parse tree produced by the `distinctFromPredicate` + * labeled alternative in `GenericSqlParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDistinctFromPredicate?: (ctx: DistinctFromPredicateContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.comparisonOperator`. + * @param ctx the parse tree + * @return the visitor result + */ + visitComparisonOperator?: (ctx: ComparisonOperatorContext) => Result; + /** + * Visit a parse tree produced by the `valueExpressionDefault` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitValueExpressionDefault?: (ctx: ValueExpressionDefaultContext) => Result; + /** + * Visit a parse tree produced by the `concatenation` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitConcatenation?: (ctx: ConcatenationContext) => Result; + /** + * Visit a parse tree produced by the `arithmeticBinary` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitArithmeticBinary?: (ctx: ArithmeticBinaryContext) => Result; + /** + * Visit a parse tree produced by the `arithmeticUnary` + * labeled alternative in `GenericSqlParser.valueExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitArithmeticUnary?: (ctx: ArithmeticUnaryContext) => Result; + /** + * Visit a parse tree produced by the `literalExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitLiteralExpression?: (ctx: LiteralExpressionContext) => Result; + /** + * Visit a parse tree produced by the `functionCall` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitFunctionCall?: (ctx: FunctionCallContext) => Result; + /** + * Visit a parse tree produced by the `searchedCaseExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSearchedCaseExpression?: (ctx: SearchedCaseExpressionContext) => Result; + /** + * Visit a parse tree produced by the `simpleCaseExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSimpleCaseExpression?: (ctx: SimpleCaseExpressionContext) => Result; + /** + * Visit a parse tree produced by the `castExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitCastExpression?: (ctx: CastExpressionContext) => Result; + /** + * Visit a parse tree produced by the `coalesceExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitCoalesceExpression?: (ctx: CoalesceExpressionContext) => Result; + /** + * Visit a parse tree produced by the `nullIfExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNullIfExpression?: (ctx: NullIfExpressionContext) => Result; + /** + * Visit a parse tree produced by the `parenthesizedExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => Result; + /** + * Visit a parse tree produced by the `existsExpression` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitExistsExpression?: (ctx: ExistsExpressionContext) => Result; + /** + * Visit a parse tree produced by the `subqueryExpressionDefault` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSubqueryExpressionDefault?: (ctx: SubqueryExpressionDefaultContext) => Result; + /** + * Visit a parse tree produced by the `columnReference` + * labeled alternative in `GenericSqlParser.primaryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitColumnReference?: (ctx: ColumnReferenceContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.whenClause`. + * @param ctx the parse tree + * @return the visitor result + */ + visitWhenClause?: (ctx: WhenClauseContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.subqueryExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitSubqueryExpression?: (ctx: SubqueryExpressionContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.dataType`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDataType?: (ctx: DataTypeContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.properties`. + * @param ctx the parse tree + * @return the visitor result + */ + visitProperties?: (ctx: PropertiesContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.property`. + * @param ctx the parse tree + * @return the visitor result + */ + visitProperty?: (ctx: PropertyContext) => Result; + /** + * Visit a parse tree produced by the `nullLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNullLiteral?: (ctx: NullLiteralContext) => Result; + /** + * Visit a parse tree produced by the `booleanLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitBooleanLiteral?: (ctx: BooleanLiteralContext) => Result; + /** + * Visit a parse tree produced by the `integerLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitIntegerLiteral?: (ctx: IntegerLiteralContext) => Result; + /** + * Visit a parse tree produced by the `decimalLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDecimalLiteral?: (ctx: DecimalLiteralContext) => Result; + /** + * Visit a parse tree produced by the `doubleLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDoubleLiteral?: (ctx: DoubleLiteralContext) => Result; + /** + * Visit a parse tree produced by the `stringLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitStringLiteral?: (ctx: StringLiteralContext) => Result; + /** + * Visit a parse tree produced by the `binaryLiteral` + * labeled alternative in `GenericSqlParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitBinaryLiteral?: (ctx: BinaryLiteralContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.identifier`. + * @param ctx the parse tree + * @return the visitor result + */ + visitIdentifier?: (ctx: IdentifierContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.qualifiedName`. + * @param ctx the parse tree + * @return the visitor result + */ + visitQualifiedName?: (ctx: QualifiedNameContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.columnRef`. + * @param ctx the parse tree + * @return the visitor result + */ + visitColumnRef?: (ctx: ColumnRefContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.tableName`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTableName?: (ctx: TableNameContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.tableNameCreate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTableNameCreate?: (ctx: TableNameCreateContext) => Result; + /** + * Visit a parse tree produced by `GenericSqlParser.nonReserved`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNonReserved?: (ctx: NonReservedContext) => Result; +} + diff --git a/src/lib/index.ts b/src/lib/index.ts index c2b48709..3065e8f7 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -17,4 +17,7 @@ export { TrinoSqlListener } from './trino/TrinoSqlListener'; export { TrinoSqlVisitor } from './trino/TrinoSqlVisitor'; export { ImpalaSqlParserListener } from './impala/ImpalaSqlParserListener'; -export { ImpalaSqlParserVisitor } from './impala/ImpalaSqlParserVisitor'; \ No newline at end of file +export { ImpalaSqlParserVisitor } from './impala/ImpalaSqlParserVisitor'; + +export { GenericSqlListener } from './generic/GenericSqlListener'; +export { GenericSqlVisitor } from './generic/GenericSqlVisitor'; \ No newline at end of file diff --git a/src/parser/generic/genericEntityCollector.ts b/src/parser/generic/genericEntityCollector.ts new file mode 100644 index 00000000..870d8156 --- /dev/null +++ b/src/parser/generic/genericEntityCollector.ts @@ -0,0 +1,154 @@ +import type { GenericSqlListener } from '../../lib/generic/GenericSqlListener'; +import { + AlterTableContext, + ColumnDefinitionContext, + ColumnRefContext, + CreateTableContext, + CreateTableStatementContext, + DeleteContext, + DropTableContext, + InsertContext, + QuerySpecificationContext, + QueryStatementContext, + SelectItemContext, + SingleStatementContext, + TableNameContext, + TableNameCreateContext, + UpdateContext, +} from '../../lib/generic/GenericSqlParser'; +import { + AttrName, + ColumnDeclareType, + EntityCollector, + StmtContextType, + TableDeclareType, +} from '../common/entityCollector'; +import { EntityContextType } from '../common/types'; + +export class GenericEntityCollector extends EntityCollector implements GenericSqlListener { + /** ====== Entity Begin */ + + exitTableName(ctx: TableNameContext) { + this.pushEntity(ctx, EntityContextType.TABLE, [], { + declareType: TableDeclareType.LITERAL, + }); + } + + exitTableNameCreate(ctx: TableNameCreateContext) { + this.pushEntity(ctx, EntityContextType.TABLE_CREATE, [ + { + attrName: AttrName.comment, + endContextList: [CreateTableStatementContext.name], + }, + ]); + } + + exitColumnRef(ctx: ColumnRefContext) { + this.pushEntity(ctx, EntityContextType.COLUMN); + } + + exitColumnDefinition(ctx: ColumnDefinitionContext) { + this.pushEntity(ctx, EntityContextType.COLUMN_CREATE, [ + { + attrName: AttrName.colType, + endContextList: [ColumnDefinitionContext.name], + }, + { + attrName: AttrName.comment, + endContextList: [ColumnDefinitionContext.name], + }, + ]); + } + + exitQuerySpecification(ctx: QuerySpecificationContext) { + this.pushEntity(ctx, EntityContextType.QUERY_RESULT); + } + + exitSelectItem(ctx: SelectItemContext) { + if (ctx.ASTERISK()) { + this.pushEntity(ctx, EntityContextType.COLUMN, [], { + declareType: ColumnDeclareType.ALL, + }); + } else { + this.pushEntity( + ctx, + EntityContextType.COLUMN, + [ + { + attrName: AttrName.alias, + endContextList: [SelectItemContext.name], + }, + ], + { + declareType: ColumnDeclareType.EXPRESSION, + } + ); + } + } + + /** ===== Statement begin */ + + enterSingleStatement(ctx: SingleStatementContext) { + this.pushStmt(ctx, StmtContextType.COMMON_STMT); + } + + exitSingleStatement(ctx: SingleStatementContext) { + this.popStmt(); + } + + enterCreateTable(ctx: CreateTableContext) { + this.pushStmt(ctx, StmtContextType.CREATE_TABLE_STMT); + } + + exitCreateTable(ctx: CreateTableContext) { + this.popStmt(); + } + + enterQueryStatement(ctx: QueryStatementContext) { + this.pushStmt(ctx, StmtContextType.SELECT_STMT); + } + + exitQueryStatement(ctx: QueryStatementContext) { + this.popStmt(); + } + + enterInsert(ctx: InsertContext) { + this.pushStmt(ctx, StmtContextType.INSERT_STMT); + } + + exitInsert(ctx: InsertContext) { + this.popStmt(); + } + + enterUpdate(ctx: UpdateContext) { + this.pushStmt(ctx, StmtContextType.COMMON_STMT); + } + + exitUpdate(ctx: UpdateContext) { + this.popStmt(); + } + + enterDelete(ctx: DeleteContext) { + this.pushStmt(ctx, StmtContextType.COMMON_STMT); + } + + exitDelete(ctx: DeleteContext) { + this.popStmt(); + } + + enterAlterTable(ctx: AlterTableContext) { + this.pushStmt(ctx, StmtContextType.ALTER_TABLE_STMT); + } + + exitAlterTable(ctx: AlterTableContext) { + this.popStmt(); + } + + enterDropTable(ctx: DropTableContext) { + this.pushStmt(ctx, StmtContextType.COMMON_STMT); + } + + exitDropTable(ctx: DropTableContext) { + this.popStmt(); + } +} diff --git a/src/parser/generic/genericErrorListener.ts b/src/parser/generic/genericErrorListener.ts new file mode 100644 index 00000000..9616ceac --- /dev/null +++ b/src/parser/generic/genericErrorListener.ts @@ -0,0 +1,66 @@ +import { CodeCompletionCore } from 'antlr4-c3'; +import { Parser, Token } from 'antlr4ng'; + +import { GenericSqlParser } from '../../lib/generic/GenericSqlParser'; +import { ParseErrorListener } from '../common/parseErrorListener'; + +export class GenericErrorListener extends ParseErrorListener { + private objectNames: Map = new Map([ + [GenericSqlParser.RULE_tableName, 'table'], + [GenericSqlParser.RULE_tableNameCreate, 'table'], + [GenericSqlParser.RULE_columnRef, 'column'], + ]); + + public getExpectedText(parser: Parser, token: Token) { + let expectedText = ''; + const input = this.parserContext.getParsedInput(); + + let currentContext = parser.context ?? undefined; + while (currentContext?.parent) { + currentContext = currentContext.parent; + } + + const parserInfo = this.parserContext.getMinimumParserInfo( + input, + token.tokenIndex, + currentContext + ); + + if (!parserInfo) return ''; + + const { parser: c3Parser, newTokenIndex, parseTree: c3Context } = parserInfo; + + const core = new CodeCompletionCore(c3Parser); + core.preferredRules = this.preferredRules; + + const candidates = core.collectCandidates(newTokenIndex, c3Context); + + if (candidates.rules.size) { + const result: string[] = []; + for (const candidate of candidates.rules) { + const [ruleType] = candidate; + const name = this.objectNames.get(ruleType); + switch (ruleType) { + case GenericSqlParser.RULE_tableName: + case GenericSqlParser.RULE_columnRef: { + if (name && !result.includes(`{existing}${name}`)) { + result.push(`{existing}${name}`); + } + break; + } + case GenericSqlParser.RULE_tableNameCreate: { + if (name && !result.includes(`{new}${name}`)) { + result.push(`{new}${name}`); + } + break; + } + } + } + expectedText = result.join('{or}'); + } + if (candidates.tokens.size) { + expectedText += expectedText ? '{orKeyword}' : '{keyword}'; + } + return expectedText; + } +} diff --git a/src/parser/generic/genericSemanticContextCollector.ts b/src/parser/generic/genericSemanticContextCollector.ts new file mode 100644 index 00000000..6a02fcda --- /dev/null +++ b/src/parser/generic/genericSemanticContextCollector.ts @@ -0,0 +1,20 @@ +import { GenericSqlListener } from '../../lib/generic/GenericSqlListener'; +import { GenericSqlParser, StatementsContext } from '../../lib/generic/GenericSqlParser'; +import SemanticContextCollector from '../common/semanticContextCollector'; + +class GenericSemanticContextCollector + extends SemanticContextCollector + implements GenericSqlListener +{ + override getWhiteSpaceRuleType(): number { + return GenericSqlParser.WHITE_SPACE; + } + override getStatementRuleType(): number { + return GenericSqlParser.RULE_statements; + } + enterStatements(ctx: StatementsContext) { + this.visitStatement(ctx); + } +} + +export { GenericSemanticContextCollector }; diff --git a/src/parser/generic/genericSplitListener.ts b/src/parser/generic/genericSplitListener.ts new file mode 100644 index 00000000..142ce74e --- /dev/null +++ b/src/parser/generic/genericSplitListener.ts @@ -0,0 +1,12 @@ +import { SingleStatementContext } from '../../lib/generic/GenericSqlParser'; +import { GenericSqlListener } from '../../lib/generic/GenericSqlListener'; +import { SplitListener } from '../common/splitListener'; + +export class GenericSplitListener + extends SplitListener + implements GenericSqlListener +{ + exitSingleStatement(ctx: SingleStatementContext) { + this._statementsContext.push(ctx); + } +} diff --git a/src/parser/generic/index.ts b/src/parser/generic/index.ts new file mode 100644 index 00000000..97c65e03 --- /dev/null +++ b/src/parser/generic/index.ts @@ -0,0 +1,138 @@ +import { CandidatesCollection } from 'antlr4-c3'; +import { CharStream, CommonTokenStream, Token } from 'antlr4ng'; +import { processTokenCandidates } from '../common/tokenUtils'; +import { GenericSqlLexer } from '../../lib/generic/GenericSqlLexer'; +import { GenericSqlParser, ProgramContext } from '../../lib/generic/GenericSqlParser'; +import { BasicSQL } from '../common/basicSQL'; +import { + Suggestions, + EntityContextType, + SyntaxSuggestion, + CaretPosition, + SemanticCollectOptions, +} from '../common/types'; +import { StmtContextType } from '../common/entityCollector'; +import { ErrorListener, ParseError } from '../common/parseErrorListener'; +import { GenericEntityCollector } from './genericEntityCollector'; +import { GenericErrorListener } from './genericErrorListener'; +import { GenericSplitListener } from './genericSplitListener'; +import { GenericSemanticContextCollector } from './genericSemanticContextCollector'; + +export { GenericEntityCollector, GenericSplitListener }; + +export interface GenericSQLOptions { + /** Enable or disable diagnostics (parse error collection). Defaults to true. */ + diagnostics?: boolean; +} + +export class GenericSQL extends BasicSQL { + private _diagnostics: boolean; + + constructor(options?: GenericSQLOptions) { + super(); + this._diagnostics = options?.diagnostics !== false; + } + protected createLexerFromCharStream(charStreams: CharStream): GenericSqlLexer { + return new GenericSqlLexer(charStreams); + } + + public override validate(input: string): ParseError[] { + if (!this._diagnostics) { + return []; + } + return super.validate(input); + } + + protected createParserFromTokenStream(tokenStream: CommonTokenStream): GenericSqlParser { + return new GenericSqlParser(tokenStream); + } + + /** + * The rules that keywords you don't want to be suggested. + */ + protected excludeKeywordRules = new Set([GenericSqlParser.RULE_nonReserved]); + + protected preferredRules: Set = new Set([ + GenericSqlParser.RULE_tableName, + GenericSqlParser.RULE_tableNameCreate, + GenericSqlParser.RULE_columnRef, + ...this.excludeKeywordRules, + ]); + + protected get splitListener() { + return new GenericSplitListener(); + } + + protected createErrorListener(_errorListener: ErrorListener): GenericErrorListener { + const parserContext = this; + return new GenericErrorListener(_errorListener, parserContext, this.preferredRules); + } + + protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number) { + return new GenericEntityCollector(input, allTokens, caretTokenIndex); + } + + protected createSemanticContextCollector( + input: string, + caretPosition: CaretPosition, + allTokens: Token[], + options?: SemanticCollectOptions + ) { + return new GenericSemanticContextCollector(input, caretPosition, allTokens, options); + } + + protected processCandidates( + candidates: CandidatesCollection, + allTokens: Token[], + caretTokenIndex: number + ): Suggestions { + const originalSyntaxSuggestions: SyntaxSuggestion[] = []; + const keywords: string[] = []; + + for (const candidate of candidates.rules) { + const [ruleType, candidateRule] = candidate; + const tokenRanges = allTokens.slice(candidateRule.startTokenIndex, caretTokenIndex + 1); + + let syntaxContextType: EntityContextType | StmtContextType | undefined = void 0; + switch (ruleType) { + case GenericSqlParser.RULE_tableName: { + syntaxContextType = EntityContextType.TABLE; + break; + } + case GenericSqlParser.RULE_tableNameCreate: { + syntaxContextType = EntityContextType.TABLE_CREATE; + break; + } + case GenericSqlParser.RULE_columnRef: { + syntaxContextType = EntityContextType.COLUMN; + break; + } + default: + break; + } + + if ( + syntaxContextType && + !originalSyntaxSuggestions.some( + (syn) => + syn.syntaxContextType === syntaxContextType && + syn.wordRanges.map((wordRange: Token) => wordRange.text)?.join(',') === + tokenRanges.map((tokenRange: Token) => tokenRange.text)?.join(',') + ) + ) { + originalSyntaxSuggestions.push({ + syntaxContextType, + wordRanges: tokenRanges, + }); + } + } + + const processedKeywords = processTokenCandidates(this._parser, candidates.tokens); + keywords.push(...processedKeywords); + + return { + syntax: originalSyntaxSuggestions, + keywords, + }; + } +} diff --git a/src/parser/index.ts b/src/parser/index.ts index 79e36a08..9371753c 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -5,3 +5,4 @@ export { SparkSQL } from './spark'; export { PostgreSQL } from './postgresql'; export { TrinoSQL } from './trino'; export { ImpalaSQL } from './impala'; +export { GenericSQL } from './generic'; diff --git a/test/parser/generic/errorListener.test.ts b/test/parser/generic/errorListener.test.ts new file mode 100644 index 00000000..2ac26541 --- /dev/null +++ b/test/parser/generic/errorListener.test.ts @@ -0,0 +1,67 @@ +import { GenericSQL } from 'src/parser/generic'; + +describe('GenericSQL Error Listener Tests', () => { + const genericSQL = new GenericSQL(); + + describe('Syntax Errors', () => { + it('should detect random text', () => { + const sql = 'dhsdansdnkla ndjnsla ndnalks'; + const errors = genericSQL.validate(sql); + expect(errors.length).toBeGreaterThan(0); + }); + + it('should detect invalid syntax', () => { + const sql = 'SELECT FROM'; + const errors = genericSQL.validate(sql); + expect(errors.length).toBeGreaterThan(0); + }); + + it('should detect incomplete statement', () => { + const sql = 'SELECT * FROM'; + const errors = genericSQL.validate(sql); + expect(errors.length).toBeGreaterThan(0); + }); + }); + + describe('Error Recovery', () => { + it('should recover from errors and continue parsing', () => { + const sql = 'SELECT * FROM users; INVALID SYNTAX; SELECT 1'; + const errors = genericSQL.validate(sql); + expect(errors.length).toBeGreaterThan(0); + }); + }); + + describe('Error Message Format', () => { + it('should have proper error structure', () => { + const sql = 'INVALID_TOKEN_xyz FROM'; + const errors = genericSQL.validate(sql); + expect(errors.length).toBeGreaterThan(0); + const error = errors[0]; + expect(error).toHaveProperty('startLine'); + expect(error).toHaveProperty('endLine'); + expect(error).toHaveProperty('startColumn'); + expect(error).toHaveProperty('endColumn'); + expect(error).toHaveProperty('message'); + expect(typeof error.message).toBe('string'); + expect(error.message.length).toBeGreaterThan(0); + }); + }); + + describe('Locale Support', () => { + it('should return error messages in English by default', () => { + const sql = 'xyzabc123 invalid'; + const errors = genericSQL.validate(sql); + expect(errors.length).toBeGreaterThan(0); + expect(errors[0].message).toContain('is not valid at this position'); + }); + + it('should return error messages in Chinese when locale is zh_CN', () => { + genericSQL.locale = 'zh_CN'; + const sql = 'unique_test_token invalid'; + const errors = genericSQL.validate(sql); + expect(errors.length).toBeGreaterThan(0); + expect(errors[0].message).toContain('在此位置无效'); + genericSQL.locale = 'en_US'; + }); + }); +}); diff --git a/test/parser/generic/lexer.test.ts b/test/parser/generic/lexer.test.ts new file mode 100644 index 00000000..4bd16221 --- /dev/null +++ b/test/parser/generic/lexer.test.ts @@ -0,0 +1,121 @@ +import { GenericSQL } from 'src/parser/generic'; + +describe('GenericSQL Lexer Tests', () => { + const parser = new GenericSQL(); + + describe('Keywords', () => { + it('should recognize SELECT keyword', () => { + const sql = 'SELECT'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('SELECT'); + }); + + it('should recognize INSERT keyword', () => { + const sql = 'INSERT'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('INSERT'); + }); + + it('should recognize UPDATE keyword', () => { + const sql = 'UPDATE'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('UPDATE'); + }); + + it('should recognize DELETE keyword', () => { + const sql = 'DELETE'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('DELETE'); + }); + }); + + describe('Identifiers', () => { + it('should recognize regular identifiers', () => { + const sql = 'users'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('users'); + }); + + it('should recognize quoted identifiers', () => { + const sql = '"users"'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('"users"'); + }); + + it('should recognize backtick identifiers', () => { + const sql = '`users`'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('`users`'); + }); + }); + + describe('Literals', () => { + it('should recognize string literals', () => { + const sql = "'hello'"; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe("'hello'"); + }); + + it('should recognize integer literals', () => { + const sql = '42'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('42'); + }); + + it('should recognize decimal literals', () => { + const sql = '3.14'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBeGreaterThan(0); + expect(tokens[0].text).toBe('3.14'); + }); + }); + + describe('Operators', () => { + it('should recognize comparison operators', () => { + const sql = '= <> != < <= > >='; + const tokens = parser.getAllTokens(sql); + const nonWhitespace = tokens.filter((t) => t.text?.trim() !== ''); + expect(nonWhitespace.length).toBe(7); + }); + + it('should recognize arithmetic operators', () => { + const sql = '+ - * / %'; + const tokens = parser.getAllTokens(sql); + const nonWhitespace = tokens.filter((t) => t.text?.trim() !== ''); + expect(nonWhitespace.length).toBe(5); + }); + }); + + describe('Comments', () => { + it('should recognize line comments', () => { + const sql = '-- This is a comment\nSELECT'; + const tokens = parser.getAllTokens(sql); + const nonWhitespace = tokens.filter((t) => t.text?.trim() !== ''); + expect(nonWhitespace.some((t) => t.text === 'SELECT')).toBe(true); + }); + + it('should recognize block comments', () => { + const sql = '/* This is a block comment */ SELECT'; + const tokens = parser.getAllTokens(sql); + const nonWhitespace = tokens.filter((t) => t.text?.trim() !== ''); + expect(nonWhitespace.some((t) => t.text === 'SELECT')).toBe(true); + }); + }); + + describe('Full SQL Tokenization', () => { + it('should tokenize a simple SELECT statement', () => { + const sql = 'SELECT * FROM table1'; + const tokens = parser.getAllTokens(sql); + expect(tokens.length).toBe(7); + }); + }); +}); diff --git a/test/parser/generic/syntax.test.ts b/test/parser/generic/syntax.test.ts new file mode 100644 index 00000000..7fc5e2a7 --- /dev/null +++ b/test/parser/generic/syntax.test.ts @@ -0,0 +1,224 @@ +import { GenericSQL } from 'src/parser/generic'; + +describe('GenericSQL Syntax Tests', () => { + const parser = new GenericSQL(); + + describe('SELECT Statements', () => { + const features = { + select: ['SELECT * FROM users'], + selectWithWhere: ['SELECT * FROM users WHERE id = 1'], + selectWithJoin: [ + 'SELECT u.name, o.amount FROM users u JOIN orders o ON u.id = o.user_id', + ], + selectWithGroupBy: ['SELECT name, id FROM employees GROUP BY name, id'], + selectWithOrderBy: ['SELECT * FROM users ORDER BY name ASC'], + selectWithLimit: ['SELECT * FROM users LIMIT 10'], + }; + + features.select.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.selectWithWhere.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.selectWithJoin.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.selectWithGroupBy.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.selectWithOrderBy.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.selectWithLimit.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); + + describe('INSERT Statements', () => { + const features = { + insert: [`INSERT INTO users SELECT * FROM temp_users`], + insertWithColumnList: [ + `INSERT INTO users (name, email) SELECT name, email FROM temp_users`, + ], + }; + + features.insert.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.insertWithColumnList.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); + + describe('UPDATE Statements', () => { + const features = { + update: [`UPDATE users SET name = 'Jane' WHERE id = 1`], + updateMultiple: [ + `UPDATE users SET name = 'Jane', email = 'jane@example.com' WHERE id = 1`, + ], + }; + + features.update.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.updateMultiple.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); + + describe('DELETE Statements', () => { + const features = { + delete: ['DELETE FROM users WHERE id = 1'], + deleteWithoutWhere: ['DELETE FROM users'], + }; + + features.delete.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.deleteWithoutWhere.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); + + describe('CREATE TABLE Statements', () => { + const features = { + createTable: [ + `CREATE TABLE users ( + id INT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + email VARCHAR(255) + )`, + ], + createTableWithConstraints: [ + `CREATE TABLE orders ( + id INT PRIMARY KEY, + user_id INT, + amount DECIMAL(10, 2), + UNIQUE (user_id), + FOREIGN KEY (user_id) REFERENCES users(id) + )`, + ], + }; + + features.createTable.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.createTableWithConstraints.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); + + describe('ALTER TABLE Statements', () => { + const features = { + addColumn: ['ALTER TABLE users ADD COLUMN age INT'], + dropColumn: ['ALTER TABLE users DROP COLUMN age'], + renameTable: ['ALTER TABLE users RENAME TO people'], + }; + + features.addColumn.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.dropColumn.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.renameTable.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); + + describe('DROP TABLE Statements', () => { + const features = { + dropTable: ['DROP TABLE users'], + dropTableIfExists: ['DROP TABLE IF EXISTS users'], + }; + + features.dropTable.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.dropTableIfExists.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); + + describe('Complex Queries', () => { + const features = { + union: ['SELECT name FROM users UNION SELECT name FROM employees'], + subquery: ['SELECT * FROM users WHERE id IN (SELECT user_id FROM orders)'], + cte: [ + `WITH active_users AS ( + SELECT * FROM users WHERE status = 'active' + ) + SELECT * FROM active_users`, + ], + }; + + features.union.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.subquery.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + + features.cte.forEach((sql) => { + it(sql, () => { + expect(parser.validate(sql).length).toBe(0); + }); + }); + }); +});