@hamelin.sh/compiler 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +30 -30
- package/dist/main.js +81 -81
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -299,6 +299,12 @@ declare class HamelinLexer extends antlr.Lexer {
|
|
|
299
299
|
* operations with no return type.
|
|
300
300
|
*/
|
|
301
301
|
declare class HamelinVisitor<Result> extends AbstractParseTreeVisitor<Result> {
|
|
302
|
+
/**
|
|
303
|
+
* Visit a parse tree produced by `HamelinParser.identifierEOF`.
|
|
304
|
+
* @param ctx the parse tree
|
|
305
|
+
* @return the visitor result
|
|
306
|
+
*/
|
|
307
|
+
visitIdentifierEOF?: (ctx: IdentifierEOFContext) => Result;
|
|
302
308
|
/**
|
|
303
309
|
* Visit a parse tree produced by `HamelinParser.queryEOF`.
|
|
304
310
|
* @param ctx the parse tree
|
|
@@ -317,12 +323,6 @@ declare class HamelinVisitor<Result> extends AbstractParseTreeVisitor<Result> {
|
|
|
317
323
|
* @return the visitor result
|
|
318
324
|
*/
|
|
319
325
|
visitExpressionEOF?: (ctx: ExpressionEOFContext) => Result;
|
|
320
|
-
/**
|
|
321
|
-
* Visit a parse tree produced by `HamelinParser.identifierEOF`.
|
|
322
|
-
* @param ctx the parse tree
|
|
323
|
-
* @return the visitor result
|
|
324
|
-
*/
|
|
325
|
-
visitIdentifierEOF?: (ctx: IdentifierEOFContext) => Result;
|
|
326
326
|
/**
|
|
327
327
|
* Visit a parse tree produced by `HamelinParser.simpleIdentifierEOF`.
|
|
328
328
|
* @param ctx the parse tree
|
|
@@ -961,10 +961,10 @@ declare class HamelinParser extends antlr.Parser {
|
|
|
961
961
|
static readonly SIMPLE_COMMENT = 94;
|
|
962
962
|
static readonly BRACKETED_COMMENT = 95;
|
|
963
963
|
static readonly WS = 96;
|
|
964
|
-
static readonly
|
|
965
|
-
static readonly
|
|
966
|
-
static readonly
|
|
967
|
-
static readonly
|
|
964
|
+
static readonly RULE_identifierEOF = 0;
|
|
965
|
+
static readonly RULE_queryEOF = 1;
|
|
966
|
+
static readonly RULE_commandEOF = 2;
|
|
967
|
+
static readonly RULE_expressionEOF = 3;
|
|
968
968
|
static readonly RULE_simpleIdentifierEOF = 4;
|
|
969
969
|
static readonly RULE_query = 5;
|
|
970
970
|
static readonly RULE_pipeline = 6;
|
|
@@ -999,10 +999,10 @@ declare class HamelinParser extends antlr.Parser {
|
|
|
999
999
|
get serializedATN(): number[];
|
|
1000
1000
|
protected createFailedPredicateException(predicate?: string, message?: string): antlr.FailedPredicateException;
|
|
1001
1001
|
constructor(input: antlr.TokenStream);
|
|
1002
|
+
identifierEOF(): IdentifierEOFContext;
|
|
1002
1003
|
queryEOF(): QueryEOFContext;
|
|
1003
1004
|
commandEOF(): CommandEOFContext;
|
|
1004
1005
|
expressionEOF(): ExpressionEOFContext;
|
|
1005
|
-
identifierEOF(): IdentifierEOFContext;
|
|
1006
1006
|
simpleIdentifierEOF(): SimpleIdentifierEOFContext;
|
|
1007
1007
|
query(): QueryContext;
|
|
1008
1008
|
pipeline(): PipelineContext;
|
|
@@ -1037,36 +1037,36 @@ declare class HamelinParser extends antlr.Parser {
|
|
|
1037
1037
|
get vocabulary(): antlr.Vocabulary;
|
|
1038
1038
|
private static readonly decisionsToDFA;
|
|
1039
1039
|
}
|
|
1040
|
-
declare class
|
|
1040
|
+
declare class IdentifierEOFContext extends antlr.ParserRuleContext {
|
|
1041
1041
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
1042
|
-
|
|
1042
|
+
identifier(): IdentifierContext;
|
|
1043
1043
|
EOF(): antlr.TerminalNode;
|
|
1044
1044
|
get ruleIndex(): number;
|
|
1045
1045
|
enterRule(listener: HamelinListener): void;
|
|
1046
1046
|
exitRule(listener: HamelinListener): void;
|
|
1047
1047
|
accept<Result>(visitor: HamelinVisitor<Result>): Result | null;
|
|
1048
1048
|
}
|
|
1049
|
-
declare class
|
|
1049
|
+
declare class QueryEOFContext extends antlr.ParserRuleContext {
|
|
1050
1050
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
1051
|
-
|
|
1051
|
+
query(): QueryContext;
|
|
1052
1052
|
EOF(): antlr.TerminalNode;
|
|
1053
1053
|
get ruleIndex(): number;
|
|
1054
1054
|
enterRule(listener: HamelinListener): void;
|
|
1055
1055
|
exitRule(listener: HamelinListener): void;
|
|
1056
1056
|
accept<Result>(visitor: HamelinVisitor<Result>): Result | null;
|
|
1057
1057
|
}
|
|
1058
|
-
declare class
|
|
1058
|
+
declare class CommandEOFContext extends antlr.ParserRuleContext {
|
|
1059
1059
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
1060
|
-
|
|
1060
|
+
command(): CommandContext;
|
|
1061
1061
|
EOF(): antlr.TerminalNode;
|
|
1062
1062
|
get ruleIndex(): number;
|
|
1063
1063
|
enterRule(listener: HamelinListener): void;
|
|
1064
1064
|
exitRule(listener: HamelinListener): void;
|
|
1065
1065
|
accept<Result>(visitor: HamelinVisitor<Result>): Result | null;
|
|
1066
1066
|
}
|
|
1067
|
-
declare class
|
|
1067
|
+
declare class ExpressionEOFContext extends antlr.ParserRuleContext {
|
|
1068
1068
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
1069
|
-
|
|
1069
|
+
expression(): ExpressionContext;
|
|
1070
1070
|
EOF(): antlr.TerminalNode;
|
|
1071
1071
|
get ruleIndex(): number;
|
|
1072
1072
|
enterRule(listener: HamelinListener): void;
|
|
@@ -1961,6 +1961,16 @@ declare class NamedArgumentContext extends antlr.ParserRuleContext {
|
|
|
1961
1961
|
* `HamelinParser`.
|
|
1962
1962
|
*/
|
|
1963
1963
|
declare class HamelinListener implements ParseTreeListener {
|
|
1964
|
+
/**
|
|
1965
|
+
* Enter a parse tree produced by `HamelinParser.identifierEOF`.
|
|
1966
|
+
* @param ctx the parse tree
|
|
1967
|
+
*/
|
|
1968
|
+
enterIdentifierEOF?: (ctx: IdentifierEOFContext) => void;
|
|
1969
|
+
/**
|
|
1970
|
+
* Exit a parse tree produced by `HamelinParser.identifierEOF`.
|
|
1971
|
+
* @param ctx the parse tree
|
|
1972
|
+
*/
|
|
1973
|
+
exitIdentifierEOF?: (ctx: IdentifierEOFContext) => void;
|
|
1964
1974
|
/**
|
|
1965
1975
|
* Enter a parse tree produced by `HamelinParser.queryEOF`.
|
|
1966
1976
|
* @param ctx the parse tree
|
|
@@ -1991,16 +2001,6 @@ declare class HamelinListener implements ParseTreeListener {
|
|
|
1991
2001
|
* @param ctx the parse tree
|
|
1992
2002
|
*/
|
|
1993
2003
|
exitExpressionEOF?: (ctx: ExpressionEOFContext) => void;
|
|
1994
|
-
/**
|
|
1995
|
-
* Enter a parse tree produced by `HamelinParser.identifierEOF`.
|
|
1996
|
-
* @param ctx the parse tree
|
|
1997
|
-
*/
|
|
1998
|
-
enterIdentifierEOF?: (ctx: IdentifierEOFContext) => void;
|
|
1999
|
-
/**
|
|
2000
|
-
* Exit a parse tree produced by `HamelinParser.identifierEOF`.
|
|
2001
|
-
* @param ctx the parse tree
|
|
2002
|
-
*/
|
|
2003
|
-
exitIdentifierEOF?: (ctx: IdentifierEOFContext) => void;
|
|
2004
2004
|
/**
|
|
2005
2005
|
* Enter a parse tree produced by `HamelinParser.simpleIdentifierEOF`.
|
|
2006
2006
|
* @param ctx the parse tree
|
|
@@ -2927,7 +2927,7 @@ declare class HamelinListener implements ParseTreeListener {
|
|
|
2927
2927
|
exitEveryRule(node: ParserRuleContext): void;
|
|
2928
2928
|
}
|
|
2929
2929
|
|
|
2930
|
-
declare const hamelinGrammar = "grammar Hamelin;\n\nqueryEOF\n : query EOF\n ;\n\ncommandEOF\n : command EOF\n ;\n\nexpressionEOF\n : expression EOF\n ;\n\nidentifierEOF\n : identifier EOF\n ;\n\nsimpleIdentifierEOF\n : simpleIdentifier EOF\n ;\n\nquery\n : (WITH simpleIdentifier ASSIGN pipeline)+ pipeline #withQuery\n | pipeline #standaloneQuery\n | expression #expressionQuery\n ;\n\npipeline\n : command ( PIPE command )* #pipelineAlt\n ;\n\ncommand\n : LET_COMMAND assignment (COMMA assignment)* COMMA? #letCommand\n | WHERE_COMMAND expression #whereCommand\n | SELECT_COMMAND assignmentClause (COMMA assignmentClause)* COMMA? #selectCommand\n | DROP_COMMAND selection (COMMA selection)* COMMA? #dropCommand\n | FROM_COMMAND fromClause (COMMA fromClause)* COMMA? #fromCommand\n | UNION_COMMAND fromClause (COMMA fromClause)* COMMA? #unionCommand\n | LIMIT_COMMAND expression #limitCommand\n | PARSE_COMMAND src=expression? string\n AS? identifier (COMMA identifier)* COMMA? NODROP? #parseCommand\n | WITHIN_COMMAND expression #withinCommand\n | AGG_COMMAND (assignmentClause (COMMA assignmentClause)*)? COMMA?\n (BY groupClause (COMMA groupClause)*)? COMMA?\n (SORT BY? sortExpression (COMMA sortExpression)*)? COMMA? #aggCommand\n | SORT BY? sortExpression (COMMA sortExpression)* COMMA? #sortCommand\n | WINDOW_COMMAND assignmentClause (COMMA assignmentClause)* COMMA?\n (BY groupClause (COMMA groupClause)*)? COMMA?\n (SORT BY? sortExpression (COMMA sortExpression)*)? COMMA?\n (WITHIN_COMMAND within=expression)? #windowCommand\n | APPEND_COMMAND tableReference (DISTINCT_BY selection (COMMA selection)*)? COMMA? #appendCommand\n | (JOIN_COMMAND | LOOKUP_COMMAND) fromClause (ON on=expression)? #joinCommand\n | EXPLODE_COMMAND assignmentClause #explodeCommand\n | (UNNEST_COMMAND | ROWS_COMMAND) expression #unnestCommand\n | NEST_COMMAND identifier #nestCommand\n | MATCH_COMMAND pattern+\n (WHEN matchDefine (COMMA matchDefine)*)? COMMA?\n (BY groupClause (COMMA groupClause)*)? COMMA?\n (SORT BY? sortExpression (COMMA sortExpression)*)? COMMA? #matchCommand\n ;\n\nassignmentClause: assignment | expression;\ngroupClause: assignmentClause;\nassignment: identifier ASSIGN expression;\nmatchDefine: simpleIdentifier ASSIGN expression;\nselection: identifier;\nsortExpression: expression (ASC | DESC)?;\ntableAlias: simpleIdentifier ASSIGN tableReference;\nfromClause: tableAlias | tableReference;\n\nexpression\n // Keep this list in precedence order (important!)\n : operator=(MINUS | PLUS) expression #unaryPrefixOperator\n | expression (SECOND_TRUNC | MINUTE_TRUNC | HOUR_TRUNC | DAY_TRUNC | WEEK_TRUNC |\n MONTH_TRUNC | QUARTER_TRUNC | YEAR_TRUNC) #tsTrunc\n | left=expression operator=DOT right=simpleIdentifier #deref\n | value=expression LBRACKET index=expression RBRACKET #indexAccess\n | left=expression operator=(ASTERISK | SLASH | PERCENT) right=expression #binaryOperator\n | left=expression operator=(PLUS | MINUS) right=expression #binaryOperator\n | operator=RANGE expression #unaryPrefixOperator\n | expression operator=RANGE #unaryPostfixOperator\n | left=expression operator=RANGE right=expression #binaryOperator\n | left=expression operator=AS right=hamelintype #cast\n | left=expression\n operator=(EQ | NEQ | LT | LTE | GT | GTE | IS | ISNOT | IN) right=expression #binaryOperator\n | operator=NOT expression #unaryPrefixOperator\n | left=expression operator=AND right=expression #binaryOperator\n | left=expression operator=OR right=expression #binaryOperator\n\n // Complex Literals\n | left=expression operator=COLON right=expression #pairLiteral\n | LCURLY simpleIdentifier COLON expression\n (COMMA simpleIdentifier COLON expression)* COMMA? RCURLY #structLiteral\n | LPARENS ((expression COMMA) |\n (expression COMMA expression (COMMA expression)* COMMA?)) RPARENS #tupleLiteral\n | LBRACKET (expression (COMMA expression)* COMMA?)? RBRACKET #arrayLiteral\n\n // Function Calls\n | functionName=simpleIdentifier\n LPARENS (namedArgument (COMMA namedArgument)* COMMA?)? RPARENS #functionCall\n | functionName=simpleIdentifier LPARENS\n positionalArgument (COMMA positionalArgument)*\n (COMMA namedArgument)* COMMA? RPARENS #functionCall\n\n // Primitive Literals\n | NULL #nullLiteral\n | number #numericLiteral\n | TRUE #booleanLiteral\n | FALSE #booleanLiteral\n | string #stringLiteral\n | BINARY_LITERAL #binaryLiteral\n | RANGE #unboundRangeLiteral\n | (NANOSECOND_INTERVAL | MICROSECOND_INTERVAL | MILLISECOND_INTERVAL |\n SECOND_INTERVAL | MINUTE_INTERVAL | HOUR_INTERVAL | DAY_INTERVAL |\n WEEK_INTERVAL | MONTH_INTERVAL | QUARTER_INTERVAL | YEAR_INTERVAL) #intervalLiteral\n | ROWS_LITERAL #rowsLiteral\n | (SECOND_TRUNC | MINUTE_TRUNC | HOUR_TRUNC | DAY_TRUNC | WEEK_TRUNC |\n MONTH_TRUNC | QUARTER_TRUNC | YEAR_TRUNC) #tsTruncTimestampLiteral\n\n // Environment references\n | columnReference #columnReferenceAlt\n\n // Keep this at the bottom to use it the mechanism that query authors have to specify precedence.\n | LPARENS expression RPARENS #parenthesizedExpression\n ;\n\nhamelintype\n : simpleIdentifier LPARENS hamelintype (COMMA hamelintype)* COMMA? RPARENS #parameterizedType\n | simpleIdentifier LPARENS INTEGER_VALUE (COMMA INTEGER_VALUE)* COMMA? RPARENS #typeWithArguments\n | LCURLY simpleIdentifier COLON hamelintype\n (COMMA simpleIdentifier COLON hamelintype)* COMMA? RCURLY #structType\n | LPARENS hamelintype (COMMA hamelintype )* COMMA? RPARENS #tupleType\n | simpleIdentifier #simpleType\n ;\n\npattern\n : fromClause quantifier? #quantified\n | LPARENS pattern+ RPARENS quantifier #nested\n ;\n\nquantifier\n : ASTERISK #AnyNumber\n | PLUS #AtLeastOne\n | QUESTIONMARK #ZeroOrOne\n | LCURLY INTEGER_VALUE RCURLY #Exactly\n ;\n\ncolumnReference\n : simpleIdentifier\n ;\n\ntableReference\n : identifier\n ;\n\nidentifier\n : simpleIdentifier\n | simpleIdentifier (DOT simpleIdentifier)+\n ;\n\nsimpleIdentifier\n : IDENTIFIER #unquotedIdentifier\n | BACKQUOTED_IDENTIFIER #backQuotedIdentifier\n ;\n\nstring\n : SINGLE_QUOTED_STRING #basicSingleQuotedStringLiteral\n | DOUBLE_QUOTED_STRING #basicDoubleQuotedStringLiteral\n | value=SINGLE_QUOTED_UNICODE_STRING (UESCAPE uesc=SINGLE_QUOTED_STRING)? #unicodeSingleQuotedStringLiteral\n | value=DOUBLE_QUOTED_UNICODE_STRING (UESCAPE uesc=DOUBLE_QUOTED_STRING)? #unicodeDoubleQuotedStringLiteral\n ;\n\nnumber\n : value=DECIMAL_VALUE #decimalLiteral\n | value=DOUBLE_VALUE #scientificLiteral\n | value=INTEGER_VALUE #integerLiteral\n ;\n\npositionalArgument\n : expression\n ;\n\nnamedArgument\n : simpleIdentifier ASSIGN expression\n ;\n\n//\n// COMMANDS\n//\n\nLET_COMMAND: 'LET' | 'let';\nWHERE_COMMAND: 'WHERE' | 'where';\nSELECT_COMMAND: 'SELECT' | 'select';\nDROP_COMMAND: 'DROP' | 'drop';\nFROM_COMMAND: 'FROM' | 'from';\nUNION_COMMAND: 'UNION' | 'union';\nLIMIT_COMMAND: 'LIMIT' | 'limit';\nPARSE_COMMAND: 'PARSE' | 'parse';\nWITHIN_COMMAND: 'WITHIN' | 'within';\nAGG_COMMAND: 'AGG' | 'agg';\nWINDOW_COMMAND: 'WINDOW' | 'window';\nAPPEND_COMMAND: 'APPEND' | 'append';\nJOIN_COMMAND: 'JOIN' | 'join';\nLOOKUP_COMMAND: 'LOOKUP' | 'lookup';\nEXPLODE_COMMAND: 'EXPLODE' | 'explode';\nUNNEST_COMMAND: 'UNNEST' | 'unnest';\nNEST_COMMAND: 'NEST' | 'nest';\nROWS_COMMAND: 'ROWS' | 'rows';\nMATCH_COMMAND: 'MATCH' | 'match';\n\nAS: 'AS' | 'as';\nNODROP: 'NODROP' | 'nodrop';\n\n//\n// Operators\n//\n\nPLUS: '+';\nMINUS: '-';\nASTERISK: '*';\nSLASH: '/';\nPERCENT: '%';\nLCURLY: '{';\nRCURLY: '}';\nCOLON: ':';\nQUESTIONMARK: '?';\n\nEQ: '==';\nNEQ: '!=';\nLT: '<';\nLTE: '<=';\nGT: '>';\nGTE: '>=';\nRANGE: '..';\n\nASSIGN: '=';\n\n//\n// Keywords\n//\n\nAND: 'AND' | 'and';\nFALSE: 'FALSE' | 'false';\nIS: 'IS' | 'is';\nNOT: 'NOT' | 'not';\nISNOT: 'IS NOT' | 'is not';\nIN: 'IN' | 'in';\nNULL: 'NULL' | 'null';\nOR: 'OR' | 'or';\nTRUE: 'TRUE' | 'true';\nUESCAPE: 'UESCAPE' | 'uescape';\nWITH: 'WITH' | 'with';\nBY: 'BY' | 'by';\nSORT: 'SORT' | 'sort';\nASC: 'ASC' | 'asc';\nDESC: 'DESC' | 'desc';\nDISTINCT_BY: 'DISTINCT BY' | 'distinct by';\nON: 'ON' | 'on';\nWHEN: 'WHEN' | 'when';\n\n//\n// Symbols\n//\n\nCOMMA: ',';\nPIPE: '|';\nLPARENS: '(';\nRPARENS: ')';\nDOT: '.';\nLBRACKET: '[';\nRBRACKET: ']';\n\n//\n// Literals\n//\n\nSINGLE_QUOTED_STRING\n : '\\'' ( ~'\\'' | '\\'\\'')* '\\''\n ;\nDOUBLE_QUOTED_STRING\n : '\"' ( ~'\"' | '\"\"')* '\"'\n ;\n\nSINGLE_QUOTED_UNICODE_STRING\n : 'U&\\'' ( ~'\\'' | '\\'\\'')* '\\'' // Unicode string with default escape character: U&'Hello winter \\2603 !'\n ;\n\nDOUBLE_QUOTED_UNICODE_STRING\n : 'U&\"' ( ~'\"' | '\"\"')* '\"' // Unicode string with custom escape character: U&'Hello winter #2603 !' UESCAPE '#'\n ;\n\n// Note: we allow any character inside the binary literal and validate\n// its a correct literal when the AST is being constructed. This\n// allows us to provide more meaningful error messages to the user\nBINARY_LITERAL\n : 'x\\'' (~'\\'')* '\\''\n ;\n\nNANOSECOND_INTERVAL\n : DECIMAL_INTEGER 'ns'\n ;\n\nMICROSECOND_INTERVAL\n : DECIMAL_INTEGER 'us'\n ;\n\nMILLISECOND_INTERVAL\n : DECIMAL_INTEGER 'ms'\n ;\n\nSECOND_INTERVAL\n : DECIMAL_INTEGER ('s' | 'sec' | 'secs' | 'second' | 'seconds')\n ;\n\nMINUTE_INTERVAL\n : DECIMAL_INTEGER ('m' | 'min' | 'mins' | 'minute' | 'minutes')\n ;\n\nHOUR_INTERVAL\n : DECIMAL_INTEGER ('h' | 'hr' | 'hrs' | 'hour' | 'hours')\n ;\n\nDAY_INTERVAL\n : DECIMAL_INTEGER ('d' | 'day' | 'days')\n ;\n\nWEEK_INTERVAL\n : DECIMAL_INTEGER ('w' | 'week' | 'weeks')\n ;\n\nMONTH_INTERVAL\n : DECIMAL_INTEGER ('mon' | 'month' | 'months')\n ;\n\nQUARTER_INTERVAL\n : DECIMAL_INTEGER ('q' | 'qtr' | 'qtrs' | 'quarter' | 'quarters')\n ;\n\nYEAR_INTERVAL\n : DECIMAL_INTEGER ('y' | 'yr' | 'yrs' | 'year' | 'years')\n ;\n\nROWS_LITERAL\n : DECIMAL_INTEGER ('r' | 'row' | 'rows')\n ;\n\nSECOND_TRUNC\n : '@' ('s' | 'sec' | 'secs' | 'second' | 'seconds')\n ;\n\nMINUTE_TRUNC\n : '@' ('m' | 'min' | 'mins' | 'minute' | 'minutes')\n ;\n\nHOUR_TRUNC\n : '@' ('h' | 'hr' | 'hrs' | 'hour' | 'hours')\n ;\n\nDAY_TRUNC\n : '@' ('d' | 'day' | 'days')\n ;\n\nWEEK_TRUNC\n : '@' ('w' | 'week' | 'weeks')\n ;\n\nMONTH_TRUNC\n : '@' ('mon' | 'month' | 'months')\n ;\n\nQUARTER_TRUNC\n : '@' ('q' | 'qtr' | 'qtrs' | 'quarter' | 'quarters')\n ;\n\nYEAR_TRUNC\n : '@' ('y' | 'yr' | 'yrs' | 'year' | 'years')\n ;\n\nINTEGER_VALUE\n : DECIMAL_INTEGER\n | HEXADECIMAL_INTEGER\n | OCTAL_INTEGER\n | BINARY_INTEGER\n ;\n\nDECIMAL_VALUE\n : DECIMAL_INTEGER '.' DECIMAL_INTEGER\n | '.' DECIMAL_INTEGER\n ;\n\nDOUBLE_VALUE\n : DIGIT+ ('.' DIGIT*)? EXPONENT\n | '.' DIGIT+ EXPONENT\n ;\n\nIDENTIFIER\n : [a-zA-Z_][a-zA-Z_0-9]*\n ;\n\nBACKQUOTED_IDENTIFIER\n : '`' ( ~'`' | '``' )* '`'\n ;\n\nfragment DECIMAL_INTEGER\n : DIGIT ('_'? DIGIT)*\n ;\n\nfragment HEXADECIMAL_INTEGER\n : '0x' ('_'? (DIGIT | [A-F]))+\n ;\n\nfragment OCTAL_INTEGER\n : '0o' ('_'? [0-7])+\n ;\n\nfragment BINARY_INTEGER\n : '0b' ('_'? [01])+\n ;\n\nfragment EXPONENT\n : 'e' [+-]? DIGIT+\n ;\n\nfragment DIGIT\n : [0-9]\n ;\n\n//\n// Comments and whitespace\n//\n\nSIMPLE_COMMENT\n : '//' ~[\\r\\n]* '\\r'? '\\n'? -> channel(HIDDEN)\n ;\n\nBRACKETED_COMMENT\n : '/*' .*? '*/' -> channel(HIDDEN)\n ;\n\nWS\n : [ \\r\\n\\t]+ -> skip\n ;\n";
|
|
2930
|
+
declare const hamelinGrammar = "grammar Hamelin;\n\nidentifierEOF\n : identifier EOF\n ;\n\nqueryEOF\n : query EOF\n ;\n\ncommandEOF\n : command EOF\n ;\n\nexpressionEOF\n : expression EOF\n ;\n\nsimpleIdentifierEOF\n : simpleIdentifier EOF\n ;\n\nquery\n : (WITH simpleIdentifier ASSIGN pipeline)+ pipeline #withQuery\n | pipeline #standaloneQuery\n | expression #expressionQuery\n ;\n\npipeline\n : command ( PIPE command )* #pipelineAlt\n ;\n\ncommand\n : LET_COMMAND assignment (COMMA assignment)* COMMA? #letCommand\n | WHERE_COMMAND expression #whereCommand\n | SELECT_COMMAND assignmentClause (COMMA assignmentClause)* COMMA? #selectCommand\n | DROP_COMMAND selection (COMMA selection)* COMMA? #dropCommand\n | FROM_COMMAND fromClause (COMMA fromClause)* COMMA? #fromCommand\n | UNION_COMMAND fromClause (COMMA fromClause)* COMMA? #unionCommand\n | LIMIT_COMMAND expression #limitCommand\n | PARSE_COMMAND src=expression? string\n AS? identifier (COMMA identifier)* COMMA? NODROP? #parseCommand\n | WITHIN_COMMAND expression #withinCommand\n | AGG_COMMAND (assignmentClause (COMMA assignmentClause)*)? COMMA?\n (BY groupClause (COMMA groupClause)*)? COMMA?\n (SORT BY? sortExpression (COMMA sortExpression)*)? COMMA? #aggCommand\n | SORT BY? sortExpression (COMMA sortExpression)* COMMA? #sortCommand\n | WINDOW_COMMAND assignmentClause (COMMA assignmentClause)* COMMA?\n (BY groupClause (COMMA groupClause)*)? COMMA?\n (SORT BY? sortExpression (COMMA sortExpression)*)? COMMA?\n (WITHIN_COMMAND within=expression)? #windowCommand\n | APPEND_COMMAND tableReference (DISTINCT_BY selection (COMMA selection)*)? COMMA? #appendCommand\n | (JOIN_COMMAND | LOOKUP_COMMAND) fromClause (ON on=expression)? #joinCommand\n | EXPLODE_COMMAND assignmentClause #explodeCommand\n | (UNNEST_COMMAND | ROWS_COMMAND) expression #unnestCommand\n | NEST_COMMAND identifier #nestCommand\n | MATCH_COMMAND pattern+\n (WHEN matchDefine (COMMA matchDefine)*)? COMMA?\n (BY groupClause (COMMA groupClause)*)? COMMA?\n (SORT BY? sortExpression (COMMA sortExpression)*)? COMMA? #matchCommand\n ;\n\nassignmentClause: assignment | expression;\ngroupClause: assignmentClause;\nassignment: identifier ASSIGN expression;\nmatchDefine: simpleIdentifier ASSIGN expression;\nselection: identifier;\nsortExpression: expression (ASC | DESC)?;\ntableAlias: simpleIdentifier ASSIGN tableReference;\nfromClause: tableAlias | tableReference;\n\nexpression\n // Keep this list in precedence order (important!)\n : operator=(MINUS | PLUS) expression #unaryPrefixOperator\n | expression (SECOND_TRUNC | MINUTE_TRUNC | HOUR_TRUNC | DAY_TRUNC | WEEK_TRUNC |\n MONTH_TRUNC | QUARTER_TRUNC | YEAR_TRUNC) #tsTrunc\n | left=expression operator=DOT right=simpleIdentifier #deref\n | value=expression LBRACKET index=expression RBRACKET #indexAccess\n | left=expression operator=(ASTERISK | SLASH | PERCENT) right=expression #binaryOperator\n | left=expression operator=(PLUS | MINUS) right=expression #binaryOperator\n | operator=RANGE expression #unaryPrefixOperator\n | expression operator=RANGE #unaryPostfixOperator\n | left=expression operator=RANGE right=expression #binaryOperator\n | left=expression operator=AS right=hamelintype #cast\n | left=expression\n operator=(EQ | NEQ | LT | LTE | GT | GTE | IS | ISNOT | IN) right=expression #binaryOperator\n | operator=NOT expression #unaryPrefixOperator\n | left=expression operator=AND right=expression #binaryOperator\n | left=expression operator=OR right=expression #binaryOperator\n\n // Complex Literals\n | left=expression operator=COLON right=expression #pairLiteral\n | LCURLY simpleIdentifier COLON expression\n (COMMA simpleIdentifier COLON expression)* COMMA? RCURLY #structLiteral\n | LPARENS ((expression COMMA) |\n (expression COMMA expression (COMMA expression)* COMMA?)) RPARENS #tupleLiteral\n | LBRACKET (expression (COMMA expression)* COMMA?)? RBRACKET #arrayLiteral\n\n // Function Calls\n | functionName=simpleIdentifier\n LPARENS (namedArgument (COMMA namedArgument)* COMMA?)? RPARENS #functionCall\n | functionName=simpleIdentifier LPARENS\n positionalArgument (COMMA positionalArgument)*\n (COMMA namedArgument)* COMMA? RPARENS #functionCall\n\n // Primitive Literals\n | NULL #nullLiteral\n | number #numericLiteral\n | TRUE #booleanLiteral\n | FALSE #booleanLiteral\n | string #stringLiteral\n | BINARY_LITERAL #binaryLiteral\n | RANGE #unboundRangeLiteral\n | (NANOSECOND_INTERVAL | MICROSECOND_INTERVAL | MILLISECOND_INTERVAL |\n SECOND_INTERVAL | MINUTE_INTERVAL | HOUR_INTERVAL | DAY_INTERVAL |\n WEEK_INTERVAL | MONTH_INTERVAL | QUARTER_INTERVAL | YEAR_INTERVAL) #intervalLiteral\n | ROWS_LITERAL #rowsLiteral\n | (SECOND_TRUNC | MINUTE_TRUNC | HOUR_TRUNC | DAY_TRUNC | WEEK_TRUNC |\n MONTH_TRUNC | QUARTER_TRUNC | YEAR_TRUNC) #tsTruncTimestampLiteral\n\n // Environment references\n | columnReference #columnReferenceAlt\n\n // Keep this at the bottom to use it the mechanism that query authors have to specify precedence.\n | LPARENS expression RPARENS #parenthesizedExpression\n ;\n\nhamelintype\n : simpleIdentifier LPARENS hamelintype (COMMA hamelintype)* COMMA? RPARENS #parameterizedType\n | simpleIdentifier LPARENS INTEGER_VALUE (COMMA INTEGER_VALUE)* COMMA? RPARENS #typeWithArguments\n | LCURLY simpleIdentifier COLON hamelintype\n (COMMA simpleIdentifier COLON hamelintype)* COMMA? RCURLY #structType\n | LPARENS hamelintype (COMMA hamelintype )* COMMA? RPARENS #tupleType\n | simpleIdentifier #simpleType\n ;\n\npattern\n : fromClause quantifier? #quantified\n | LPARENS pattern+ RPARENS quantifier #nested\n ;\n\nquantifier\n : ASTERISK #AnyNumber\n | PLUS #AtLeastOne\n | QUESTIONMARK #ZeroOrOne\n | LCURLY INTEGER_VALUE RCURLY #Exactly\n ;\n\ncolumnReference\n : simpleIdentifier\n ;\n\ntableReference\n : identifier\n ;\n\nidentifier\n : simpleIdentifier\n | simpleIdentifier (DOT simpleIdentifier)+\n ;\n\nsimpleIdentifier\n : IDENTIFIER #unquotedIdentifier\n | BACKQUOTED_IDENTIFIER #backQuotedIdentifier\n ;\n\nstring\n : SINGLE_QUOTED_STRING #basicSingleQuotedStringLiteral\n | DOUBLE_QUOTED_STRING #basicDoubleQuotedStringLiteral\n | value=SINGLE_QUOTED_UNICODE_STRING (UESCAPE uesc=SINGLE_QUOTED_STRING)? #unicodeSingleQuotedStringLiteral\n | value=DOUBLE_QUOTED_UNICODE_STRING (UESCAPE uesc=DOUBLE_QUOTED_STRING)? #unicodeDoubleQuotedStringLiteral\n ;\n\nnumber\n : value=DECIMAL_VALUE #decimalLiteral\n | value=DOUBLE_VALUE #scientificLiteral\n | value=INTEGER_VALUE #integerLiteral\n ;\n\npositionalArgument\n : expression\n ;\n\nnamedArgument\n : simpleIdentifier ASSIGN expression\n ;\n\n//\n// COMMANDS\n//\n\nLET_COMMAND: 'LET' | 'let';\nWHERE_COMMAND: 'WHERE' | 'where';\nSELECT_COMMAND: 'SELECT' | 'select';\nDROP_COMMAND: 'DROP' | 'drop';\nFROM_COMMAND: 'FROM' | 'from';\nUNION_COMMAND: 'UNION' | 'union';\nLIMIT_COMMAND: 'LIMIT' | 'limit';\nPARSE_COMMAND: 'PARSE' | 'parse';\nWITHIN_COMMAND: 'WITHIN' | 'within';\nAGG_COMMAND: 'AGG' | 'agg';\nWINDOW_COMMAND: 'WINDOW' | 'window';\nAPPEND_COMMAND: 'APPEND' | 'append';\nJOIN_COMMAND: 'JOIN' | 'join';\nLOOKUP_COMMAND: 'LOOKUP' | 'lookup';\nEXPLODE_COMMAND: 'EXPLODE' | 'explode';\nUNNEST_COMMAND: 'UNNEST' | 'unnest';\nNEST_COMMAND: 'NEST' | 'nest';\nROWS_COMMAND: 'ROWS' | 'rows';\nMATCH_COMMAND: 'MATCH' | 'match';\n\nAS: 'AS' | 'as';\nNODROP: 'NODROP' | 'nodrop';\n\n//\n// Operators\n//\n\nPLUS: '+';\nMINUS: '-';\nASTERISK: '*';\nSLASH: '/';\nPERCENT: '%';\nLCURLY: '{';\nRCURLY: '}';\nCOLON: ':';\nQUESTIONMARK: '?';\n\nEQ: '==';\nNEQ: '!=';\nLT: '<';\nLTE: '<=';\nGT: '>';\nGTE: '>=';\nRANGE: '..';\n\nASSIGN: '=';\n\n//\n// Keywords\n//\n\nAND: 'AND' | 'and';\nFALSE: 'FALSE' | 'false';\nIS: 'IS' | 'is';\nNOT: 'NOT' | 'not';\nISNOT: 'IS NOT' | 'is not';\nIN: 'IN' | 'in';\nNULL: 'NULL' | 'null';\nOR: 'OR' | 'or';\nTRUE: 'TRUE' | 'true';\nUESCAPE: 'UESCAPE' | 'uescape';\nWITH: 'WITH' | 'with';\nBY: 'BY' | 'by';\nSORT: 'SORT' | 'sort';\nASC: 'ASC' | 'asc';\nDESC: 'DESC' | 'desc';\nDISTINCT_BY: 'DISTINCT BY' | 'distinct by';\nON: 'ON' | 'on';\nWHEN: 'WHEN' | 'when';\n\n//\n// Symbols\n//\n\nCOMMA: ',';\nPIPE: '|';\nLPARENS: '(';\nRPARENS: ')';\nDOT: '.';\nLBRACKET: '[';\nRBRACKET: ']';\n\n//\n// Literals\n//\n\nSINGLE_QUOTED_STRING\n : '\\'' ( ~'\\'' | '\\'\\'')* '\\''\n ;\nDOUBLE_QUOTED_STRING\n : '\"' ( ~'\"' | '\"\"')* '\"'\n ;\n\nSINGLE_QUOTED_UNICODE_STRING\n : 'U&\\'' ( ~'\\'' | '\\'\\'')* '\\'' // Unicode string with default escape character: U&'Hello winter \\2603 !'\n ;\n\nDOUBLE_QUOTED_UNICODE_STRING\n : 'U&\"' ( ~'\"' | '\"\"')* '\"' // Unicode string with custom escape character: U&'Hello winter #2603 !' UESCAPE '#'\n ;\n\n// Note: we allow any character inside the binary literal and validate\n// its a correct literal when the AST is being constructed. This\n// allows us to provide more meaningful error messages to the user\nBINARY_LITERAL\n : 'x\\'' (~'\\'')* '\\''\n ;\n\nNANOSECOND_INTERVAL\n : DECIMAL_INTEGER 'ns'\n ;\n\nMICROSECOND_INTERVAL\n : DECIMAL_INTEGER 'us'\n ;\n\nMILLISECOND_INTERVAL\n : DECIMAL_INTEGER 'ms'\n ;\n\nSECOND_INTERVAL\n : DECIMAL_INTEGER ('s' | 'sec' | 'secs' | 'second' | 'seconds')\n ;\n\nMINUTE_INTERVAL\n : DECIMAL_INTEGER ('m' | 'min' | 'mins' | 'minute' | 'minutes')\n ;\n\nHOUR_INTERVAL\n : DECIMAL_INTEGER ('h' | 'hr' | 'hrs' | 'hour' | 'hours')\n ;\n\nDAY_INTERVAL\n : DECIMAL_INTEGER ('d' | 'day' | 'days')\n ;\n\nWEEK_INTERVAL\n : DECIMAL_INTEGER ('w' | 'week' | 'weeks')\n ;\n\nMONTH_INTERVAL\n : DECIMAL_INTEGER ('mon' | 'month' | 'months')\n ;\n\nQUARTER_INTERVAL\n : DECIMAL_INTEGER ('q' | 'qtr' | 'qtrs' | 'quarter' | 'quarters')\n ;\n\nYEAR_INTERVAL\n : DECIMAL_INTEGER ('y' | 'yr' | 'yrs' | 'year' | 'years')\n ;\n\nROWS_LITERAL\n : DECIMAL_INTEGER ('r' | 'row' | 'rows')\n ;\n\nSECOND_TRUNC\n : '@' ('s' | 'sec' | 'secs' | 'second' | 'seconds')\n ;\n\nMINUTE_TRUNC\n : '@' ('m' | 'min' | 'mins' | 'minute' | 'minutes')\n ;\n\nHOUR_TRUNC\n : '@' ('h' | 'hr' | 'hrs' | 'hour' | 'hours')\n ;\n\nDAY_TRUNC\n : '@' ('d' | 'day' | 'days')\n ;\n\nWEEK_TRUNC\n : '@' ('w' | 'week' | 'weeks')\n ;\n\nMONTH_TRUNC\n : '@' ('mon' | 'month' | 'months')\n ;\n\nQUARTER_TRUNC\n : '@' ('q' | 'qtr' | 'qtrs' | 'quarter' | 'quarters')\n ;\n\nYEAR_TRUNC\n : '@' ('y' | 'yr' | 'yrs' | 'year' | 'years')\n ;\n\nINTEGER_VALUE\n : DECIMAL_INTEGER\n | HEXADECIMAL_INTEGER\n | OCTAL_INTEGER\n | BINARY_INTEGER\n ;\n\nDECIMAL_VALUE\n : DECIMAL_INTEGER '.' DECIMAL_INTEGER\n | '.' DECIMAL_INTEGER\n ;\n\nDOUBLE_VALUE\n : DIGIT+ ('.' DIGIT*)? EXPONENT\n | '.' DIGIT+ EXPONENT\n ;\n\nIDENTIFIER\n : [a-zA-Z_][a-zA-Z_0-9]*\n ;\n\nBACKQUOTED_IDENTIFIER\n : '`' ( ~'`' | '``' )* '`'\n ;\n\nfragment DECIMAL_INTEGER\n : DIGIT ('_'? DIGIT)*\n ;\n\nfragment HEXADECIMAL_INTEGER\n : '0x' ('_'? (DIGIT | [A-F]))+\n ;\n\nfragment OCTAL_INTEGER\n : '0o' ('_'? [0-7])+\n ;\n\nfragment BINARY_INTEGER\n : '0b' ('_'? [01])+\n ;\n\nfragment EXPONENT\n : 'e' [+-]? DIGIT+\n ;\n\nfragment DIGIT\n : [0-9]\n ;\n\n//\n// Comments and whitespace\n//\n\nSIMPLE_COMMENT\n : '//' ~[\\r\\n]* '\\r'? '\\n'? -> channel(HIDDEN)\n ;\n\nBRACKETED_COMMENT\n : '/*' .*? '*/' -> channel(HIDDEN)\n ;\n\nWS\n : [ \\r\\n\\t]+ -> skip\n ;\n";
|
|
2931
2931
|
|
|
2932
2932
|
declare const getDatasetsFromQuery: (catalog: Catalog, hamelinInput: string) => Promise<QueryDatasetsResult>;
|
|
2933
2933
|
|