[Step 2][ESQL] Autocomplete part (#148307)

## Summary

Autocomplete support for ESQL lang. Initially target branch for that PR
was
[elastic:feature-esql](https://github.com/elastic/kibana/tree/feature-esql)
but then we decided to merge it separately. This PR is as copy of
#148006

## Notes: 
Important: please do `yarn kbn clean & yarn kbn bootstrap` before
testing.

## How to update syntax. 

`antlr` syntax was copied from `ES` and was slightly modified. In case
if you need to update it please follow next steps:
- modify `esql_parser.g4 `and/or `esql_lexer.g4` files
- go to `kbn-monaco` package and execute `bazel clean & npm run
build:antlr4ts:painless`
- go to /painless_parser.ts file and revert the following change: 

<img width="478" alt="image"
src="https://user-images.githubusercontent.com/20072247/209540586-bb77cad1-a6f0-42fa-9875-025bd4afbace.png">

- do `yarn kbn bootstrap`
This commit is contained in:
Alexey Antonov 2023-01-03 22:35:55 +03:00 committed by GitHub
parent 72d2f75287
commit 5cf614b246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 2445 additions and 1765 deletions

View file

@ -11,7 +11,8 @@ import './src/register_globals';
export { monaco } from './src/monaco_imports';
export { XJsonLang } from './src/xjson';
export { SQLLang } from './src/sql';
export { ESQL_LANG_ID, ESQL_THEME_ID } from './src/esql';
export { ESQL_LANG_ID, ESQL_THEME_ID, ESQLLang } from './src/esql';
export type { ESQLCustomAutocompleteCallbacks } from './src/esql';
export * from './src/painless';
/* eslint-disable-next-line @kbn/eslint/module_migration */

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { ANTLRErrorListener, RecognitionException, Recognizer } from 'antlr4ts';
import { ANTLRErrorListener, Recognizer } from 'antlr4ts';
import type { EditorError } from '../types';
export class ANTLREErrorListener implements ANTLRErrorListener<any> {
@ -17,8 +17,7 @@ export class ANTLREErrorListener implements ANTLRErrorListener<any> {
offendingSymbol: any,
line: number,
column: number,
message: string,
e: RecognitionException | undefined
message: string
): void {
let endColumn = column + 1;

View file

@ -29,7 +29,6 @@ WS
: [ \r\n\t]+ -> channel(HIDDEN)
;
mode EXPRESSION;
PIPE : '|' -> popMode;
@ -73,30 +72,30 @@ DECIMAL_LITERAL
BY : 'by';
AND : 'and';
ASC : 'asc';
ASSIGN : '=';
COMMA : ',';
DESC : 'desc';
DOT : '.';
FALSE : 'false';
FIRST : 'first';
LAST : 'last';
LP : '(';
OPENING_BRACKET : '[' -> pushMode(DEFAULT_MODE);
CLOSING_BRACKET : ']' -> popMode, popMode; // pop twice, once to clear mode of current cmd and once to exit DEFAULT_MODE
NOT : 'not';
NULL : 'null';
NULLS : 'nulls';
OR : 'or';
RP : ')';
TRUE : 'true';
EQ : '==';
NEQ : '!=';
LT : '<';
LTE : '<=';
GT : '>';
GTE : '>=';
BOOLEAN_VALUE
: 'true'
| 'false'
;
COMPARISON_OPERATOR
: '=='
|'!='
| '<'
| '<='
| '>'
| '>='
;
PLUS : '+';
MINUS : '-';
@ -104,12 +103,24 @@ ASTERISK : '*';
SLASH : '/';
PERCENT : '%';
ROUND_FUNCTION_MATH : 'round';
AVG_FUNCTION_MATH : 'avg';
SUM_FUNCTION_MATH : 'sum';
MIN_FUNCTION_MATH : 'min';
MAX_FUNCTION_MATH : 'max';
ORDERING
: 'asc'
| 'desc'
;
NULLS_ORDERING: 'nulls';
NULLS_ORDERING_DIRECTION
: 'first'
| 'last'
;
UNARY_FUNCTION
: 'round'
| 'avg'
| 'min'
| 'max'
| 'sum'
;
UNQUOTED_IDENTIFIER
: (LETTER | '_') (LETTER | DIGIT | '_')*
@ -163,5 +174,3 @@ SRC_MULTILINE_COMMENT
SRC_WS
: WS -> channel(HIDDEN)
;
UNKNOWN_CMD : ~[ \r\n\t[\]/]+ -> pushMode(EXPRESSION);

File diff suppressed because one or more lines are too long

View file

@ -16,50 +16,37 @@ INTEGER_LITERAL=15
DECIMAL_LITERAL=16
BY=17
AND=18
ASC=19
ASSIGN=20
COMMA=21
DESC=22
DOT=23
FALSE=24
FIRST=25
LAST=26
LP=27
OPENING_BRACKET=28
CLOSING_BRACKET=29
NOT=30
NULL=31
NULLS=32
OR=33
RP=34
TRUE=35
EQ=36
NEQ=37
LT=38
LTE=39
GT=40
GTE=41
PLUS=42
MINUS=43
ASTERISK=44
SLASH=45
PERCENT=46
ROUND_FUNCTION_MATH=47
AVG_FUNCTION_MATH=48
SUM_FUNCTION_MATH=49
MIN_FUNCTION_MATH=50
MAX_FUNCTION_MATH=51
UNQUOTED_IDENTIFIER=52
QUOTED_IDENTIFIER=53
EXPR_LINE_COMMENT=54
EXPR_MULTILINE_COMMENT=55
EXPR_WS=56
SRC_UNQUOTED_IDENTIFIER=57
SRC_QUOTED_IDENTIFIER=58
SRC_LINE_COMMENT=59
SRC_MULTILINE_COMMENT=60
SRC_WS=61
UNKNOWN_CMD=62
ASSIGN=19
COMMA=20
DOT=21
LP=22
OPENING_BRACKET=23
CLOSING_BRACKET=24
NOT=25
NULL=26
OR=27
RP=28
BOOLEAN_VALUE=29
COMPARISON_OPERATOR=30
PLUS=31
MINUS=32
ASTERISK=33
SLASH=34
PERCENT=35
ORDERING=36
NULLS_ORDERING=37
NULLS_ORDERING_DIRECTION=38
UNARY_FUNCTION=39
UNQUOTED_IDENTIFIER=40
QUOTED_IDENTIFIER=41
EXPR_LINE_COMMENT=42
EXPR_MULTILINE_COMMENT=43
EXPR_WS=44
SRC_UNQUOTED_IDENTIFIER=45
SRC_QUOTED_IDENTIFIER=46
SRC_LINE_COMMENT=47
SRC_MULTILINE_COMMENT=48
SRC_WS=49
'eval'=1
'explain'=2
'from'=3
@ -71,34 +58,17 @@ UNKNOWN_CMD=62
'project'=9
'by'=17
'and'=18
'asc'=19
'desc'=22
'.'=23
'false'=24
'first'=25
'last'=26
'('=27
'['=28
']'=29
'not'=30
'null'=31
'nulls'=32
'or'=33
')'=34
'true'=35
'=='=36
'!='=37
'<'=38
'<='=39
'>'=40
'>='=41
'+'=42
'-'=43
'*'=44
'/'=45
'%'=46
'round'=47
'avg'=48
'sum'=49
'min'=50
'max'=51
'.'=21
'('=22
'['=23
']'=24
'not'=25
'null'=26
'or'=27
')'=28
'+'=31
'-'=32
'*'=33
'/'=34
'%'=35
'nulls'=37

View file

@ -35,50 +35,37 @@ export class esql_lexer extends Lexer {
public static readonly DECIMAL_LITERAL = 16;
public static readonly BY = 17;
public static readonly AND = 18;
public static readonly ASC = 19;
public static readonly ASSIGN = 20;
public static readonly COMMA = 21;
public static readonly DESC = 22;
public static readonly DOT = 23;
public static readonly FALSE = 24;
public static readonly FIRST = 25;
public static readonly LAST = 26;
public static readonly LP = 27;
public static readonly OPENING_BRACKET = 28;
public static readonly CLOSING_BRACKET = 29;
public static readonly NOT = 30;
public static readonly NULL = 31;
public static readonly NULLS = 32;
public static readonly OR = 33;
public static readonly RP = 34;
public static readonly TRUE = 35;
public static readonly EQ = 36;
public static readonly NEQ = 37;
public static readonly LT = 38;
public static readonly LTE = 39;
public static readonly GT = 40;
public static readonly GTE = 41;
public static readonly PLUS = 42;
public static readonly MINUS = 43;
public static readonly ASTERISK = 44;
public static readonly SLASH = 45;
public static readonly PERCENT = 46;
public static readonly ROUND_FUNCTION_MATH = 47;
public static readonly AVG_FUNCTION_MATH = 48;
public static readonly SUM_FUNCTION_MATH = 49;
public static readonly MIN_FUNCTION_MATH = 50;
public static readonly MAX_FUNCTION_MATH = 51;
public static readonly UNQUOTED_IDENTIFIER = 52;
public static readonly QUOTED_IDENTIFIER = 53;
public static readonly EXPR_LINE_COMMENT = 54;
public static readonly EXPR_MULTILINE_COMMENT = 55;
public static readonly EXPR_WS = 56;
public static readonly SRC_UNQUOTED_IDENTIFIER = 57;
public static readonly SRC_QUOTED_IDENTIFIER = 58;
public static readonly SRC_LINE_COMMENT = 59;
public static readonly SRC_MULTILINE_COMMENT = 60;
public static readonly SRC_WS = 61;
public static readonly UNKNOWN_CMD = 62;
public static readonly ASSIGN = 19;
public static readonly COMMA = 20;
public static readonly DOT = 21;
public static readonly LP = 22;
public static readonly OPENING_BRACKET = 23;
public static readonly CLOSING_BRACKET = 24;
public static readonly NOT = 25;
public static readonly NULL = 26;
public static readonly OR = 27;
public static readonly RP = 28;
public static readonly BOOLEAN_VALUE = 29;
public static readonly COMPARISON_OPERATOR = 30;
public static readonly PLUS = 31;
public static readonly MINUS = 32;
public static readonly ASTERISK = 33;
public static readonly SLASH = 34;
public static readonly PERCENT = 35;
public static readonly ORDERING = 36;
public static readonly NULLS_ORDERING = 37;
public static readonly NULLS_ORDERING_DIRECTION = 38;
public static readonly UNARY_FUNCTION = 39;
public static readonly UNQUOTED_IDENTIFIER = 40;
public static readonly QUOTED_IDENTIFIER = 41;
public static readonly EXPR_LINE_COMMENT = 42;
public static readonly EXPR_MULTILINE_COMMENT = 43;
public static readonly EXPR_WS = 44;
public static readonly SRC_UNQUOTED_IDENTIFIER = 45;
public static readonly SRC_QUOTED_IDENTIFIER = 46;
public static readonly SRC_LINE_COMMENT = 47;
public static readonly SRC_MULTILINE_COMMENT = 48;
public static readonly SRC_WS = 49;
public static readonly EXPRESSION = 1;
public static readonly SOURCE_IDENTIFIERS = 2;
@ -96,37 +83,33 @@ export class esql_lexer extends Lexer {
"EVAL", "EXPLAIN", "FROM", "ROW", "STATS", "WHERE", "SORT", "LIMIT", "PROJECT",
"LINE_COMMENT", "MULTILINE_COMMENT", "WS", "PIPE", "DIGIT", "LETTER",
"ESCAPE_SEQUENCE", "UNESCAPED_CHARS", "EXPONENT", "STRING", "INTEGER_LITERAL",
"DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN", "COMMA", "DESC", "DOT",
"FALSE", "FIRST", "LAST", "LP", "OPENING_BRACKET", "CLOSING_BRACKET",
"NOT", "NULL", "NULLS", "OR", "RP", "TRUE", "EQ", "NEQ", "LT", "LTE",
"GT", "GTE", "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "ROUND_FUNCTION_MATH",
"AVG_FUNCTION_MATH", "SUM_FUNCTION_MATH", "MIN_FUNCTION_MATH", "MAX_FUNCTION_MATH",
"UNQUOTED_IDENTIFIER", "QUOTED_IDENTIFIER", "EXPR_LINE_COMMENT", "EXPR_MULTILINE_COMMENT",
"EXPR_WS", "SRC_PIPE", "SRC_CLOSING_BRACKET", "SRC_COMMA", "SRC_ASSIGN",
"SRC_UNQUOTED_IDENTIFIER", "SRC_UNQUOTED_IDENTIFIER_PART", "SRC_QUOTED_IDENTIFIER",
"SRC_LINE_COMMENT", "SRC_MULTILINE_COMMENT", "SRC_WS", "UNKNOWN_CMD",
"DECIMAL_LITERAL", "BY", "AND", "ASSIGN", "COMMA", "DOT", "LP", "OPENING_BRACKET",
"CLOSING_BRACKET", "NOT", "NULL", "OR", "RP", "BOOLEAN_VALUE", "COMPARISON_OPERATOR",
"PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "ORDERING", "NULLS_ORDERING",
"NULLS_ORDERING_DIRECTION", "UNARY_FUNCTION", "UNQUOTED_IDENTIFIER", "QUOTED_IDENTIFIER",
"EXPR_LINE_COMMENT", "EXPR_MULTILINE_COMMENT", "EXPR_WS", "SRC_PIPE",
"SRC_CLOSING_BRACKET", "SRC_COMMA", "SRC_ASSIGN", "SRC_UNQUOTED_IDENTIFIER",
"SRC_UNQUOTED_IDENTIFIER_PART", "SRC_QUOTED_IDENTIFIER", "SRC_LINE_COMMENT",
"SRC_MULTILINE_COMMENT", "SRC_WS",
];
private static readonly _LITERAL_NAMES: Array<string | undefined> = [
undefined, "'eval'", "'explain'", "'from'", "'row'", "'stats'", "'where'",
"'sort'", "'limit'", "'project'", undefined, undefined, undefined, undefined,
undefined, undefined, undefined, "'by'", "'and'", "'asc'", undefined,
undefined, "'desc'", "'.'", "'false'", "'first'", "'last'", "'('", "'['",
"']'", "'not'", "'null'", "'nulls'", "'or'", "')'", "'true'", "'=='",
"'!='", "'<'", "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'",
"'round'", "'avg'", "'sum'", "'min'", "'max'",
undefined, undefined, undefined, "'by'", "'and'", undefined, undefined,
"'.'", "'('", "'['", "']'", "'not'", "'null'", "'or'", "')'", undefined,
undefined, "'+'", "'-'", "'*'", "'/'", "'%'", undefined, "'nulls'",
];
private static readonly _SYMBOLIC_NAMES: Array<string | undefined> = [
undefined, "EVAL", "EXPLAIN", "FROM", "ROW", "STATS", "WHERE", "SORT",
"LIMIT", "PROJECT", "LINE_COMMENT", "MULTILINE_COMMENT", "WS", "PIPE",
"STRING", "INTEGER_LITERAL", "DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN",
"COMMA", "DESC", "DOT", "FALSE", "FIRST", "LAST", "LP", "OPENING_BRACKET",
"CLOSING_BRACKET", "NOT", "NULL", "NULLS", "OR", "RP", "TRUE", "EQ", "NEQ",
"LT", "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT",
"ROUND_FUNCTION_MATH", "AVG_FUNCTION_MATH", "SUM_FUNCTION_MATH", "MIN_FUNCTION_MATH",
"MAX_FUNCTION_MATH", "UNQUOTED_IDENTIFIER", "QUOTED_IDENTIFIER", "EXPR_LINE_COMMENT",
"STRING", "INTEGER_LITERAL", "DECIMAL_LITERAL", "BY", "AND", "ASSIGN",
"COMMA", "DOT", "LP", "OPENING_BRACKET", "CLOSING_BRACKET", "NOT", "NULL",
"OR", "RP", "BOOLEAN_VALUE", "COMPARISON_OPERATOR", "PLUS", "MINUS", "ASTERISK",
"SLASH", "PERCENT", "ORDERING", "NULLS_ORDERING", "NULLS_ORDERING_DIRECTION",
"UNARY_FUNCTION", "UNQUOTED_IDENTIFIER", "QUOTED_IDENTIFIER", "EXPR_LINE_COMMENT",
"EXPR_MULTILINE_COMMENT", "EXPR_WS", "SRC_UNQUOTED_IDENTIFIER", "SRC_QUOTED_IDENTIFIER",
"SRC_LINE_COMMENT", "SRC_MULTILINE_COMMENT", "SRC_WS", "UNKNOWN_CMD",
"SRC_LINE_COMMENT", "SRC_MULTILINE_COMMENT", "SRC_WS",
];
public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(esql_lexer._LITERAL_NAMES, esql_lexer._SYMBOLIC_NAMES, []);
@ -158,9 +141,8 @@ export class esql_lexer extends Lexer {
// @Override
public get modeNames(): string[] { return esql_lexer.modeNames; }
private static readonly _serializedATNSegments: number = 2;
private static readonly _serializedATNSegment0: string =
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02@\u023D\b\x01" +
public static readonly _serializedATN: string =
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x023\u0215\b\x01" +
"\b\x01\b\x01\x04\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04" +
"\x06\t\x06\x04\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f" +
"\t\f\x04\r\t\r\x04\x0E\t\x0E\x04\x0F\t\x0F\x04\x10\t\x10\x04\x11\t\x11" +
@ -170,280 +152,255 @@ export class esql_lexer extends Lexer {
"\t!\x04\"\t\"\x04#\t#\x04$\t$\x04%\t%\x04&\t&\x04\'\t\'\x04(\t(\x04)\t" +
")\x04*\t*\x04+\t+\x04,\t,\x04-\t-\x04.\t.\x04/\t/\x040\t0\x041\t1\x04" +
"2\t2\x043\t3\x044\t4\x045\t5\x046\t6\x047\t7\x048\t8\x049\t9\x04:\t:\x04" +
";\t;\x04<\t<\x04=\t=\x04>\t>\x04?\t?\x04@\t@\x04A\tA\x04B\tB\x04C\tC\x04" +
"D\tD\x04E\tE\x04F\tF\x04G\tG\x04H\tH\x04I\tI\x03\x02\x03\x02\x03\x02\x03" +
"\x02\x03\x02\x03\x02\x03\x02\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03" +
"\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03" +
"\x04\x03\x04\x03\x04\x03\x05\x03\x05\x03\x05\x03\x05\x03\x05\x03\x05\x03" +
"\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x07\x03" +
"\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\b\x03\b\x03\b" +
"\x03\b\x03\b\x03\b\x03\b\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03" +
"\t\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\v\x03" +
"\v\x03\v\x03\v\x07\v\xE1\n\v\f\v\x0E\v\xE4\v\v\x03\v\x05\v\xE7\n\v\x03" +
"\v\x05\v\xEA\n\v\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\f\x07\f\xF3\n" +
"\f\f\f\x0E\f\xF6\v\f\x03\f\x03\f\x03\f\x03\f\x03\f\x03\r\x06\r\xFE\n\r" +
"\r\r\x0E\r\xFF\x03\r\x03\r\x03\x0E\x03\x0E\x03\x0E\x03\x0E\x03\x0F\x03" +
"\x0F\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x12\x03\x12\x03\x13\x03" +
"\x13\x05\x13\u0113\n\x13\x03\x13\x06\x13\u0116\n\x13\r\x13\x0E\x13\u0117" +
"\x03\x14\x03\x14\x03\x14\x07\x14\u011D\n\x14\f\x14\x0E\x14\u0120\v\x14" +
"\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x07\x14\u0128\n\x14\f" +
"\x14\x0E\x14\u012B\v\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x05\x14" +
"\u0132\n\x14\x03\x14\x05\x14\u0135\n\x14\x05\x14\u0137\n\x14\x03\x15\x06" +
"\x15\u013A\n\x15\r\x15\x0E\x15\u013B\x03\x16\x06\x16\u013F\n\x16\r\x16" +
"\x0E\x16\u0140\x03\x16\x03\x16\x07\x16\u0145\n\x16\f\x16\x0E\x16\u0148" +
"\v\x16\x03\x16\x03\x16\x06\x16\u014C\n\x16\r\x16\x0E\x16\u014D\x03\x16" +
"\x06\x16\u0151\n\x16\r\x16\x0E\x16\u0152\x03\x16\x03\x16\x07\x16\u0157" +
"\n\x16\f\x16\x0E\x16\u015A\v\x16\x05\x16\u015C\n\x16\x03\x16\x03\x16\x03" +
"\x16\x03\x16\x06\x16\u0162\n\x16\r\x16\x0E\x16\u0163\x03\x16\x03\x16\x05" +
"\x16\u0168\n\x16\x03\x17\x03\x17\x03\x17\x03\x18\x03\x18\x03\x18\x03\x18" +
"\x03\x19\x03\x19\x03\x19\x03\x19\x03\x1A\x03\x1A\x03\x1B\x03\x1B\x03\x1C" +
"\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1D\x03\x1D\x03\x1E\x03\x1E\x03\x1E" +
"\x03\x1E\x03\x1E\x03\x1E\x03\x1F\x03\x1F\x03\x1F\x03\x1F\x03\x1F\x03\x1F" +
"\x03 \x03 \x03 \x03 \x03 \x03!\x03!\x03\"\x03\"\x03\"\x03\"\x03#\x03#" +
"\x03#\x03#\x03#\x03$\x03$\x03$\x03$\x03%\x03%\x03%\x03%\x03%\x03&\x03" +
"&\x03&\x03&\x03&\x03&\x03\'\x03\'\x03\'\x03(\x03(\x03)\x03)\x03)\x03)" +
"\x03)\x03*\x03*\x03*\x03+\x03+\x03+\x03,\x03,\x03-\x03-\x03-\x03.\x03" +
".\x03/\x03/\x03/\x030\x030\x031\x031\x032\x032\x033\x033\x034\x034\x03" +
"5\x035\x035\x035\x035\x035\x036\x036\x036\x036\x037\x037\x037\x037\x03" +
"8\x038\x038\x038\x039\x039\x039\x039\x03:\x03:\x05:\u01E7\n:\x03:\x03" +
":\x03:\x07:\u01EC\n:\f:\x0E:\u01EF\v:\x03;\x03;\x03;\x03;\x07;\u01F5\n" +
";\f;\x0E;\u01F8\v;\x03;\x03;\x03<\x03<\x03<\x03<\x03=\x03=\x03=\x03=\x03" +
">\x03>\x03>\x03>\x03?\x03?\x03?\x03?\x03?\x03@\x03@\x03@\x03@\x03@\x03" +
"@\x03A\x03A\x03A\x03A\x03B\x03B\x03B\x03B\x03C\x06C\u021C\nC\rC\x0EC\u021D" +
"\x03D\x06D\u0221\nD\rD\x0ED\u0222\x03D\x03D\x05D\u0227\nD\x03E\x03E\x03" +
"F\x03F\x03F\x03F\x03G\x03G\x03G\x03G\x03H\x03H\x03H\x03H\x03I\x06I\u0238" +
"\nI\rI\x0EI\u0239\x03I\x03I\x04\xF4\u0129\x02\x02J\x05\x02\x03\x07\x02" +
"\x04\t\x02\x05\v\x02\x06\r\x02\x07\x0F\x02\b\x11\x02\t\x13\x02\n\x15\x02" +
"\v\x17\x02\f\x19\x02\r\x1B\x02\x0E\x1D\x02\x0F\x1F\x02\x02!\x02\x02#\x02" +
"\x02%\x02\x02\'\x02\x02)\x02\x10+\x02\x11-\x02\x12/\x02\x131\x02\x143" +
"\x02\x155\x02\x167\x02\x179\x02\x18;\x02\x19=\x02\x1A?\x02\x1BA\x02\x1C" +
"C\x02\x1DE\x02\x1EG\x02\x1FI\x02 K\x02!M\x02\"O\x02#Q\x02$S\x02%U\x02" +
"&W\x02\'Y\x02([\x02)]\x02*_\x02+a\x02,c\x02-e\x02.g\x02/i\x020k\x021m" +
"\x022o\x023q\x024s\x025u\x026w\x027y\x028{\x029}\x02:\x7F\x02\x02\x81" +
"\x02\x02\x83\x02\x02\x85\x02\x02\x87\x02;\x89\x02\x02\x8B\x02<\x8D\x02" +
"=\x8F\x02>\x91\x02?\x93\x02@\x05\x02\x03\x04\x0E\x04\x02\f\f\x0F\x0F\x05" +
"\x02\v\f\x0F\x0F\"\"\x03\x022;\x04\x02C\\c|\x07\x02$$^^ppttvv\x06\x02" +
"\f\f\x0F\x0F$$^^\x04\x02GGgg\x04\x02--//\x03\x02bb\f\x02\v\f\x0F\x0F\"" +
"\"..11??]]__bb~~\x04\x02,,11\b\x02\v\f\x0F\x0F\"\"11]]__\x02\u0257\x02" +
"\x05\x03\x02\x02\x02\x02\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02\x02" +
"\v\x03\x02\x02\x02\x02\r\x03\x02\x02\x02\x02\x0F\x03\x02\x02\x02\x02\x11" +
"\x03\x02\x02\x02\x02\x13\x03\x02\x02\x02\x02\x15\x03\x02\x02\x02\x02\x17" +
"\x03\x02\x02\x02\x02\x19\x03\x02\x02\x02\x02\x1B\x03\x02\x02\x02\x03\x1D" +
"\x03\x02\x02\x02\x03)\x03\x02\x02\x02\x03+\x03\x02\x02\x02\x03-\x03\x02" +
"\x02\x02\x03/\x03\x02\x02\x02\x031\x03\x02\x02\x02\x033\x03\x02\x02\x02" +
"\x035\x03\x02\x02\x02\x037\x03\x02\x02\x02\x039\x03\x02\x02\x02\x03;\x03" +
"\x02\x02\x02\x03=\x03\x02\x02\x02\x03?\x03\x02\x02\x02\x03A\x03\x02\x02" +
"\x02\x03C\x03\x02\x02\x02\x03E\x03\x02\x02\x02\x03G\x03\x02\x02\x02\x03" +
"I\x03\x02\x02\x02\x03K\x03\x02\x02\x02\x03M\x03\x02\x02\x02\x03O\x03\x02" +
"\x02\x02\x03Q\x03\x02\x02\x02\x03S\x03\x02\x02\x02\x03U\x03\x02\x02\x02" +
"\x03W\x03\x02\x02\x02\x03Y\x03\x02\x02\x02\x03[\x03\x02\x02\x02\x03]\x03" +
"\x02\x02\x02\x03_\x03\x02\x02\x02\x03a\x03\x02\x02\x02\x03c\x03\x02\x02" +
"\x02\x03e\x03\x02\x02\x02\x03g\x03\x02\x02\x02\x03i\x03\x02\x02\x02\x03" +
"k\x03\x02\x02\x02\x03m\x03\x02\x02\x02\x03o\x03\x02\x02\x02\x03q\x03\x02" +
"\x02\x02\x03s\x03\x02\x02\x02\x03u\x03\x02\x02\x02\x03w\x03\x02\x02\x02" +
"\x03y\x03\x02\x02\x02\x03{\x03\x02\x02\x02\x03}\x03\x02\x02\x02\x04\x7F" +
"\x03\x02\x02\x02\x04\x81\x03\x02\x02\x02\x04\x83\x03\x02\x02\x02\x04\x85" +
"\x03\x02\x02\x02\x04\x87\x03\x02\x02\x02\x04\x8B\x03\x02\x02\x02\x04\x8D" +
"\x03\x02\x02\x02\x04\x8F\x03\x02\x02\x02\x04\x91\x03\x02\x02\x02\x04\x93" +
"\x03\x02\x02\x02\x05\x95\x03\x02\x02\x02\x07\x9C\x03\x02\x02\x02\t\xA6" +
"\x03\x02\x02\x02\v\xAD\x03\x02\x02\x02\r\xB3\x03\x02\x02\x02\x0F\xBB\x03" +
"\x02\x02\x02\x11\xC3\x03\x02\x02\x02\x13\xCA\x03\x02\x02\x02\x15\xD2\x03" +
"\x02\x02\x02\x17\xDC\x03\x02\x02\x02\x19\xED\x03\x02\x02\x02\x1B\xFD\x03" +
"\x02\x02\x02\x1D\u0103\x03\x02\x02\x02\x1F\u0107\x03\x02\x02\x02!\u0109" +
"\x03\x02\x02\x02#\u010B\x03\x02\x02\x02%\u010E\x03\x02\x02\x02\'\u0110" +
"\x03\x02\x02\x02)\u0136\x03\x02\x02\x02+\u0139\x03\x02\x02\x02-\u0167" +
"\x03\x02\x02\x02/\u0169\x03\x02\x02\x021\u016C\x03\x02\x02\x023\u0170" +
"\x03\x02\x02\x025\u0174\x03\x02\x02\x027\u0176\x03\x02\x02\x029\u0178" +
"\x03\x02\x02\x02;\u017D\x03\x02\x02\x02=\u017F\x03\x02\x02\x02?\u0185" +
"\x03\x02\x02\x02A\u018B\x03\x02\x02\x02C\u0190\x03\x02\x02\x02E\u0192" +
"\x03\x02\x02\x02G\u0196\x03\x02\x02\x02I\u019B\x03\x02\x02\x02K\u019F" +
"\x03\x02\x02\x02M\u01A4\x03\x02\x02\x02O\u01AA\x03\x02\x02\x02Q\u01AD" +
"\x03\x02\x02\x02S\u01AF\x03\x02\x02\x02U\u01B4\x03\x02\x02\x02W\u01B7" +
"\x03\x02\x02\x02Y\u01BA\x03\x02\x02\x02[\u01BC\x03\x02\x02\x02]\u01BF" +
"\x03\x02\x02\x02_\u01C1\x03\x02\x02\x02a\u01C4\x03\x02\x02\x02c\u01C6" +
"\x03\x02\x02\x02e\u01C8\x03\x02\x02\x02g\u01CA\x03\x02\x02\x02i\u01CC" +
"\x03\x02\x02\x02k\u01CE\x03\x02\x02\x02m\u01D4\x03\x02\x02\x02o\u01D8" +
"\x03\x02\x02\x02q\u01DC\x03\x02\x02\x02s\u01E0\x03\x02\x02\x02u\u01E6" +
"\x03\x02\x02\x02w\u01F0\x03\x02\x02\x02y\u01FB\x03\x02\x02\x02{\u01FF" +
"\x03\x02\x02\x02}\u0203\x03\x02\x02\x02\x7F\u0207\x03\x02\x02\x02\x81" +
"\u020C\x03\x02\x02\x02\x83\u0212\x03\x02\x02\x02\x85\u0216\x03\x02\x02" +
"\x02\x87\u021B\x03\x02\x02\x02\x89\u0226\x03\x02\x02\x02\x8B\u0228\x03" +
"\x02\x02\x02\x8D\u022A\x03\x02\x02\x02\x8F\u022E\x03\x02\x02\x02\x91\u0232" +
"\x03\x02\x02\x02\x93\u0237\x03\x02\x02\x02\x95\x96\x07g\x02\x02\x96\x97" +
"\x07x\x02\x02\x97\x98\x07c\x02\x02\x98\x99\x07n\x02\x02\x99\x9A\x03\x02" +
"\x02\x02\x9A\x9B\b\x02\x02\x02\x9B\x06\x03\x02\x02\x02\x9C\x9D\x07g\x02" +
"\x02\x9D\x9E\x07z\x02\x02\x9E\x9F\x07r\x02\x02\x9F\xA0\x07n\x02\x02\xA0" +
"\xA1\x07c\x02\x02\xA1\xA2\x07k\x02\x02\xA2\xA3\x07p\x02\x02\xA3\xA4\x03" +
"\x02\x02\x02\xA4\xA5\b\x03\x02\x02\xA5\b\x03\x02\x02\x02\xA6\xA7\x07h" +
"\x02\x02\xA7\xA8\x07t\x02\x02\xA8\xA9\x07q\x02\x02\xA9\xAA\x07o\x02\x02" +
"\xAA\xAB\x03\x02\x02\x02\xAB\xAC\b\x04\x03\x02\xAC\n\x03\x02\x02\x02\xAD" +
"\xAE\x07t\x02\x02\xAE\xAF\x07q\x02\x02\xAF\xB0\x07y\x02\x02\xB0\xB1\x03" +
"\x02\x02\x02\xB1\xB2\b\x05\x02\x02\xB2\f\x03\x02\x02\x02\xB3\xB4\x07u" +
"\x02\x02\xB4\xB5\x07v\x02\x02\xB5\xB6\x07c\x02\x02\xB6\xB7\x07v\x02\x02" +
"\xB7\xB8\x07u\x02\x02\xB8\xB9\x03\x02\x02\x02\xB9\xBA\b\x06\x02\x02\xBA" +
"\x0E\x03\x02\x02\x02\xBB\xBC\x07y\x02\x02\xBC\xBD\x07j\x02\x02\xBD\xBE" +
"\x07g\x02\x02\xBE\xBF\x07t\x02\x02\xBF\xC0\x07g\x02\x02\xC0\xC1\x03\x02" +
"\x02\x02\xC1\xC2\b\x07\x02\x02\xC2\x10\x03\x02\x02\x02\xC3\xC4\x07u\x02" +
"\x02\xC4\xC5\x07q\x02\x02\xC5\xC6\x07t\x02\x02\xC6\xC7\x07v\x02\x02\xC7" +
"\xC8\x03\x02\x02\x02\xC8\xC9\b\b\x02\x02\xC9\x12\x03\x02\x02\x02\xCA\xCB" +
"\x07n\x02\x02\xCB\xCC\x07k\x02\x02\xCC\xCD\x07o\x02\x02\xCD\xCE\x07k\x02" +
"\x02\xCE\xCF\x07v\x02\x02\xCF\xD0\x03\x02\x02\x02\xD0\xD1\b\t\x02\x02" +
"\xD1\x14\x03\x02\x02\x02\xD2\xD3\x07r\x02\x02\xD3\xD4\x07t\x02\x02\xD4" +
"\xD5\x07q\x02\x02\xD5\xD6\x07l\x02\x02\xD6\xD7\x07g\x02\x02\xD7\xD8\x07" +
"e\x02\x02\xD8\xD9\x07v\x02\x02\xD9\xDA\x03\x02\x02\x02\xDA\xDB\b\n\x03" +
"\x02\xDB\x16\x03\x02\x02\x02\xDC\xDD\x071\x02\x02\xDD\xDE\x071\x02\x02" +
"\xDE\xE2\x03\x02\x02\x02\xDF\xE1\n\x02\x02\x02\xE0\xDF\x03\x02\x02\x02" +
"\xE1\xE4\x03\x02\x02\x02\xE2\xE0\x03\x02\x02\x02\xE2\xE3\x03\x02\x02\x02" +
"\xE3\xE6\x03\x02\x02\x02\xE4\xE2\x03\x02\x02\x02\xE5\xE7\x07\x0F\x02\x02" +
"\xE6\xE5\x03\x02\x02\x02\xE6\xE7\x03\x02\x02\x02\xE7\xE9\x03\x02\x02\x02" +
"\xE8\xEA\x07\f\x02\x02\xE9\xE8\x03\x02\x02\x02\xE9\xEA\x03\x02\x02\x02" +
"\xEA\xEB\x03\x02\x02\x02\xEB\xEC\b\v\x04\x02\xEC\x18\x03\x02\x02\x02\xED" +
"\xEE\x071\x02\x02\xEE\xEF\x07,\x02\x02\xEF\xF4\x03\x02\x02\x02\xF0\xF3" +
"\x05\x19\f\x02\xF1\xF3\v\x02\x02\x02\xF2\xF0\x03\x02\x02\x02\xF2\xF1\x03" +
"\x02\x02\x02\xF3\xF6\x03\x02\x02\x02\xF4\xF5\x03\x02\x02\x02\xF4\xF2\x03" +
"\x02\x02\x02\xF5\xF7\x03\x02\x02\x02\xF6\xF4\x03\x02\x02\x02\xF7\xF8\x07" +
",\x02\x02\xF8\xF9\x071\x02\x02\xF9\xFA\x03\x02\x02\x02\xFA\xFB\b\f\x04" +
"\x02\xFB\x1A\x03\x02\x02\x02\xFC\xFE\t\x03\x02\x02\xFD\xFC\x03\x02\x02" +
"\x02\xFE\xFF\x03\x02\x02\x02\xFF\xFD\x03\x02\x02\x02\xFF\u0100\x03\x02" +
"\x02\x02\u0100\u0101\x03\x02\x02\x02\u0101\u0102\b\r\x04\x02\u0102\x1C" +
"\x03\x02\x02\x02\u0103\u0104\x07~\x02\x02\u0104\u0105\x03\x02\x02\x02" +
"\u0105\u0106\b\x0E\x05\x02\u0106\x1E\x03\x02\x02\x02\u0107\u0108\t\x04" +
"\x02\x02\u0108 \x03\x02\x02\x02\u0109\u010A\t\x05\x02\x02\u010A\"\x03" +
"\x02\x02\x02\u010B\u010C\x07^\x02\x02\u010C\u010D\t\x06\x02\x02\u010D" +
"$\x03\x02\x02\x02\u010E\u010F\n\x07\x02\x02\u010F&\x03\x02\x02\x02\u0110" +
"\u0112\t\b\x02\x02\u0111\u0113\t\t\x02\x02\u0112\u0111\x03\x02\x02\x02" +
"\u0112\u0113\x03\x02\x02\x02\u0113\u0115\x03\x02\x02\x02\u0114\u0116\x05" +
"\x1F\x0F\x02\u0115\u0114\x03\x02\x02\x02\u0116\u0117\x03\x02\x02\x02\u0117" +
"\u0115\x03\x02\x02\x02\u0117\u0118\x03\x02\x02\x02\u0118(\x03\x02\x02" +
"\x02\u0119\u011E\x07$\x02\x02\u011A\u011D\x05#\x11\x02\u011B\u011D\x05" +
"%\x12\x02\u011C\u011A\x03\x02\x02\x02\u011C\u011B\x03\x02\x02\x02\u011D" +
"\u0120\x03\x02\x02\x02\u011E\u011C\x03\x02\x02\x02\u011E\u011F\x03\x02" +
"\x02\x02\u011F\u0121\x03\x02\x02\x02\u0120\u011E\x03\x02\x02\x02\u0121" +
"\u0137\x07$\x02\x02\u0122\u0123\x07$\x02\x02\u0123\u0124\x07$\x02\x02" +
"\u0124\u0125\x07$\x02\x02\u0125\u0129\x03\x02\x02\x02\u0126\u0128\n\x02" +
"\x02\x02\u0127\u0126\x03\x02\x02\x02\u0128\u012B\x03\x02\x02\x02\u0129" +
"\u012A\x03\x02\x02\x02\u0129\u0127\x03\x02\x02\x02\u012A\u012C\x03\x02" +
"\x02\x02\u012B\u0129\x03\x02\x02\x02\u012C\u012D\x07$\x02\x02\u012D\u012E" +
"\x07$\x02\x02\u012E\u012F\x07$\x02\x02\u012F\u0131\x03\x02\x02\x02\u0130" +
"\u0132\x07$\x02\x02\u0131\u0130\x03\x02\x02\x02\u0131\u0132\x03\x02\x02" +
"\x02\u0132\u0134\x03\x02\x02\x02\u0133\u0135\x07$\x02\x02\u0134\u0133" +
"\x03\x02\x02\x02\u0134\u0135\x03\x02\x02\x02\u0135\u0137\x03\x02\x02\x02" +
"\u0136\u0119\x03\x02\x02\x02\u0136\u0122\x03\x02\x02\x02\u0137*\x03\x02" +
"\x02\x02\u0138\u013A\x05\x1F\x0F\x02\u0139\u0138\x03\x02\x02\x02\u013A" +
"\u013B\x03\x02\x02\x02\u013B\u0139\x03\x02\x02\x02\u013B\u013C\x03\x02" +
"\x02\x02\u013C,\x03\x02\x02\x02\u013D\u013F\x05\x1F\x0F\x02\u013E\u013D" +
"\x03\x02\x02\x02\u013F\u0140\x03\x02\x02\x02\u0140\u013E\x03\x02\x02\x02" +
"\u0140\u0141\x03\x02\x02\x02\u0141\u0142\x03\x02\x02\x02\u0142\u0146\x05" +
";\x1D\x02\u0143\u0145\x05\x1F\x0F\x02\u0144\u0143\x03\x02\x02\x02\u0145" +
"\u0148\x03\x02\x02\x02\u0146\u0144\x03\x02\x02\x02\u0146\u0147\x03\x02" +
"\x02\x02\u0147\u0168\x03\x02\x02\x02\u0148\u0146\x03\x02\x02\x02\u0149" +
"\u014B\x05;\x1D\x02\u014A\u014C\x05\x1F\x0F\x02\u014B\u014A\x03\x02\x02" +
"\x02\u014C\u014D\x03\x02\x02\x02\u014D\u014B\x03\x02\x02\x02\u014D\u014E" +
"\x03\x02\x02\x02\u014E\u0168\x03\x02\x02\x02\u014F\u0151\x05\x1F\x0F\x02" +
"\u0150\u014F\x03\x02\x02\x02\u0151\u0152\x03\x02\x02\x02\u0152\u0150\x03" +
"\x02\x02\x02\u0152\u0153\x03\x02\x02\x02\u0153\u015B\x03\x02\x02\x02\u0154" +
"\u0158\x05;\x1D\x02\u0155\u0157\x05\x1F\x0F\x02\u0156\u0155\x03\x02\x02" +
"\x02\u0157\u015A\x03\x02\x02\x02\u0158\u0156\x03\x02\x02\x02\u0158\u0159" +
"\x03\x02\x02\x02\u0159\u015C\x03\x02\x02\x02\u015A\u0158\x03\x02\x02\x02" +
"\u015B\u0154\x03\x02\x02\x02\u015B\u015C\x03\x02\x02\x02\u015C\u015D\x03" +
"\x02\x02\x02\u015D\u015E\x05\'\x13\x02\u015E\u0168\x03\x02\x02\x02\u015F" +
"\u0161\x05;\x1D\x02\u0160\u0162\x05\x1F\x0F\x02\u0161\u0160\x03\x02\x02" +
"\x02\u0162\u0163\x03\x02\x02\x02\u0163\u0161\x03\x02\x02\x02\u0163\u0164" +
"\x03\x02\x02\x02\u0164\u0165\x03\x02\x02\x02\u0165\u0166\x05\'\x13\x02" +
"\u0166\u0168\x03\x02\x02\x02\u0167\u013E\x03\x02\x02\x02\u0167\u0149\x03" +
"\x02\x02\x02\u0167\u0150\x03\x02\x02\x02\u0167\u015F\x03\x02\x02\x02\u0168" +
".\x03\x02\x02\x02\u0169\u016A\x07d\x02\x02\u016A\u016B\x07{\x02\x02\u016B" +
"0\x03\x02\x02\x02\u016C\u016D\x07c\x02\x02\u016D\u016E\x07p\x02\x02\u016E" +
"\u016F\x07f\x02\x02\u016F2\x03\x02\x02\x02\u0170\u0171\x07c\x02\x02\u0171" +
"\u0172\x07u\x02\x02\u0172\u0173\x07e\x02\x02\u01734\x03\x02\x02\x02\u0174" +
"\u0175\x07?\x02\x02\u01756\x03\x02\x02\x02\u0176\u0177\x07.\x02\x02\u0177" +
"8\x03\x02\x02\x02\u0178\u0179\x07f\x02\x02\u0179\u017A\x07g\x02\x02\u017A" +
"\u017B\x07u\x02\x02\u017B\u017C\x07e\x02\x02\u017C:\x03\x02\x02\x02\u017D" +
"\u017E\x070\x02\x02\u017E<\x03\x02\x02\x02\u017F\u0180\x07h\x02\x02\u0180" +
"\u0181\x07c\x02\x02\u0181\u0182\x07n\x02\x02\u0182\u0183\x07u\x02\x02" +
"\u0183\u0184\x07g\x02\x02\u0184>\x03\x02\x02\x02\u0185\u0186\x07h\x02" +
"\x02\u0186\u0187\x07k\x02\x02\u0187\u0188\x07t\x02\x02\u0188\u0189\x07" +
"u\x02\x02\u0189\u018A\x07v\x02\x02\u018A@\x03\x02\x02\x02\u018B\u018C" +
"\x07n\x02\x02\u018C\u018D\x07c\x02\x02\u018D\u018E\x07u\x02\x02\u018E" +
"\u018F\x07v\x02\x02\u018FB\x03\x02\x02\x02\u0190\u0191\x07*\x02\x02\u0191" +
"D\x03\x02\x02\x02\u0192\u0193\x07]\x02\x02\u0193\u0194\x03\x02\x02\x02" +
"\u0194\u0195\b\"\x06\x02\u0195F\x03\x02\x02\x02\u0196\u0197\x07_\x02\x02" +
"\u0197\u0198\x03\x02\x02\x02\u0198\u0199\b#\x05\x02\u0199\u019A\b#\x05" +
"\x02\u019AH\x03\x02\x02\x02\u019B\u019C\x07p\x02\x02\u019C\u019D\x07q" +
"\x02\x02\u019D\u019E\x07v\x02\x02\u019EJ\x03\x02\x02\x02\u019F\u01A0\x07" +
"p\x02\x02\u01A0\u01A1\x07w\x02\x02\u01A1\u01A2\x07n\x02\x02\u01A2\u01A3" +
"\x07n\x02\x02\u01A3L\x03\x02\x02\x02\u01A4\u01A5\x07p\x02\x02\u01A5\u01A6" +
"\x07w\x02\x02\u01A6\u01A7\x07n\x02\x02\u01A7\u01A8\x07n\x02\x02\u01A8" +
"\u01A9\x07u\x02\x02\u01A9N\x03\x02\x02\x02\u01AA\u01AB\x07q\x02\x02\u01AB" +
"\u01AC\x07t\x02\x02\u01ACP\x03\x02\x02\x02\u01AD\u01AE\x07+\x02\x02\u01AE" +
"R\x03\x02\x02\x02\u01AF\u01B0\x07v\x02\x02\u01B0\u01B1\x07t\x02\x02\u01B1" +
"\u01B2\x07w\x02\x02\u01B2\u01B3\x07g\x02\x02\u01B3T\x03\x02\x02\x02\u01B4" +
"\u01B5\x07?\x02\x02\u01B5\u01B6\x07?\x02\x02\u01B6V\x03\x02\x02\x02\u01B7" +
"\u01B8\x07#\x02\x02\u01B8\u01B9\x07?\x02\x02\u01B9X\x03\x02\x02\x02\u01BA" +
"\u01BB\x07>\x02\x02\u01BBZ\x03\x02\x02\x02\u01BC\u01BD\x07>\x02\x02\u01BD" +
"\u01BE\x07?\x02\x02\u01BE\\\x03\x02\x02\x02\u01BF\u01C0\x07@\x02\x02\u01C0" +
"^\x03\x02\x02\x02\u01C1\u01C2\x07@\x02\x02\u01C2\u01C3\x07?\x02\x02\u01C3" +
"`\x03\x02\x02\x02\u01C4\u01C5\x07-\x02\x02\u01C5b\x03\x02\x02\x02\u01C6" +
"\u01C7\x07/\x02\x02\u01C7d\x03\x02\x02\x02\u01C8\u01C9\x07,\x02\x02\u01C9" +
"f\x03\x02\x02\x02\u01CA\u01CB\x071\x02\x02\u01CBh\x03\x02\x02\x02\u01CC" +
"\u01CD\x07\'\x02\x02\u01CDj\x03\x02\x02\x02\u01CE\u01CF\x07t\x02\x02\u01CF" +
"\u01D0\x07q\x02\x02\u01D0\u01D1\x07w\x02\x02\u01D1\u01D2\x07p\x02\x02" +
"\u01D2\u01D3\x07f\x02\x02\u01D3l\x03\x02\x02\x02\u01D4\u01D5\x07c\x02" +
"\x02\u01D5\u01D6\x07x\x02\x02\u01D6\u01D7\x07i\x02\x02\u01D7n\x03\x02" +
"\x02\x02\u01D8\u01D9\x07u\x02\x02\u01D9\u01DA\x07w\x02\x02\u01DA\u01DB" +
"\x07o\x02\x02\u01DBp\x03\x02\x02\x02\u01DC\u01DD\x07o\x02\x02\u01DD\u01DE" +
"\x07k\x02\x02\u01DE\u01DF\x07p\x02\x02\u01DFr\x03\x02\x02\x02\u01E0\u01E1" +
"\x07o\x02\x02\u01E1\u01E2\x07c\x02\x02\u01E2\u01E3\x07z\x02\x02\u01E3" +
"t\x03\x02\x02\x02\u01E4\u01E7\x05!\x10\x02\u01E5\u01E7\x07a\x02\x02\u01E6" +
"\u01E4\x03\x02\x02\x02\u01E6\u01E5\x03\x02\x02\x02\u01E7\u01ED\x03\x02" +
"\x02\x02\u01E8\u01EC\x05!\x10\x02\u01E9\u01EC\x05\x1F\x0F\x02\u01EA\u01EC" +
"\x07a\x02\x02\u01EB\u01E8\x03\x02\x02\x02\u01EB\u01E9\x03\x02\x02\x02" +
"\u01EB\u01EA\x03\x02\x02\x02\u01EC\u01EF\x03\x02\x02\x02\u01ED\u01EB\x03" +
"\x02\x02\x02\u01ED\u01EE\x03\x02\x02\x02\u01EEv\x03\x02\x02\x02\u01EF" +
"\u01ED\x03\x02\x02\x02\u01F0\u01F6\x07b\x02\x02\u01F1\u01F5\n\n\x02\x02" +
"\u01F2\u01F3\x07b\x02\x02\u01F3\u01F5\x07b\x02\x02\u01F4\u01F1\x03\x02" +
"\x02\x02\u01F4\u01F2\x03\x02\x02\x02\u01F5\u01F8\x03\x02\x02\x02\u01F6" +
"\u01F4\x03\x02\x02\x02\u01F6\u01F7\x03\x02\x02\x02\u01F7\u01F9\x03\x02" +
"\x02\x02\u01F8\u01F6\x03\x02\x02\x02\u01F9\u01FA\x07b\x02\x02\u01FAx\x03" +
"\x02\x02\x02\u01FB\u01FC\x05\x17\v\x02\u01FC\u01FD\x03\x02\x02\x02\u01FD" +
"\u01FE\b<\x04\x02\u01FEz\x03\x02\x02\x02\u01FF\u0200\x05\x19\f\x02\u0200" +
"\u0201\x03\x02\x02\x02\u0201\u0202\b=\x04\x02\u0202|\x03\x02\x02\x02\u0203" +
"\u0204\x05\x1B\r\x02\u0204\u0205\x03\x02\x02\x02\u0205\u0206\b>\x04\x02" +
"\u0206~\x03\x02\x02\x02\u0207\u0208\x07~\x02\x02\u0208\u0209\x03\x02\x02" +
"\x02\u0209\u020A\b?\x07\x02\u020A\u020B\b?\x05\x02\u020B\x80\x03\x02\x02" +
"\x02\u020C\u020D\x07_\x02\x02\u020D\u020E\x03\x02\x02\x02\u020E\u020F" +
"\b@\x05\x02\u020F\u0210\b@\x05\x02\u0210\u0211\b@\b\x02\u0211\x82\x03" +
"\x02\x02\x02\u0212\u0213\x07.\x02\x02\u0213\u0214\x03\x02\x02\x02\u0214" +
"\u0215\bA\t\x02\u0215\x84\x03\x02\x02\x02\u0216\u0217\x07?\x02\x02\u0217" +
"\u0218\x03\x02\x02\x02\u0218\u0219\bB\n\x02\u0219\x86\x03\x02\x02\x02" +
"\u021A\u021C\x05\x89D\x02\u021B\u021A\x03\x02\x02\x02\u021C\u021D\x03" +
"\x02\x02\x02\u021D\u021B\x03\x02\x02\x02\u021D\u021E\x03\x02\x02\x02\u021E" +
"\x88\x03\x02\x02\x02\u021F\u0221\n\v\x02\x02\u0220\u021F\x03\x02\x02\x02" +
"\u0221\u0222\x03\x02\x02\x02\u0222\u0220\x03\x02\x02\x02\u0222\u0223\x03" +
"\x02\x02\x02\u0223\u0227\x03\x02\x02\x02\u0224\u0225\x071\x02\x02\u0225" +
"\u0227\n\f\x02\x02\u0226\u0220\x03\x02\x02\x02\u0226\u0224\x03\x02\x02" +
"\x02\u0227\x8A\x03\x02\x02\x02\u0228\u0229\x05w;\x02\u0229\x8C\x03\x02" +
"\x02\x02\u022A\u022B\x05\x17\v";
private static readonly _serializedATNSegment1: string =
"\x02\u022B\u022C\x03\x02\x02\x02\u022C\u022D\bF\x04\x02\u022D\x8E\x03" +
"\x02\x02\x02\u022E\u022F\x05\x19\f\x02\u022F\u0230\x03\x02\x02\x02\u0230" +
"\u0231\bG\x04\x02\u0231\x90\x03\x02\x02\x02\u0232\u0233\x05\x1B\r\x02" +
"\u0233\u0234\x03\x02\x02\x02\u0234\u0235\bH\x04\x02\u0235\x92\x03\x02" +
"\x02\x02\u0236\u0238\n\r\x02\x02\u0237\u0236\x03\x02\x02\x02\u0238\u0239" +
"\x03\x02\x02\x02\u0239\u0237\x03\x02\x02\x02\u0239\u023A\x03\x02\x02\x02" +
"\u023A\u023B\x03\x02\x02\x02\u023B\u023C\bI\x02\x02\u023C\x94\x03\x02" +
"\x02\x02%\x02\x03\x04\xE2\xE6\xE9\xF2\xF4\xFF\u0112\u0117\u011C\u011E" +
"\u0129\u0131\u0134\u0136\u013B\u0140\u0146\u014D\u0152\u0158\u015B\u0163" +
"\u0167\u01E6\u01EB\u01ED\u01F4\u01F6\u021D\u0222\u0226\u0239\v\x07\x03" +
"\x02\x07\x04\x02\x02\x03\x02\x06\x02\x02\x07\x02\x02\t\x0F\x02\t\x1F\x02" +
"\t\x17\x02\t\x16\x02";
public static readonly _serializedATN: string = Utils.join(
[
esql_lexer._serializedATNSegment0,
esql_lexer._serializedATNSegment1,
],
"",
);
";\t;\x04<\t<\x03\x02\x03\x02\x03\x02\x03\x02\x03\x02\x03\x02\x03\x02\x03" +
"\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03" +
"\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03" +
"\x05\x03\x05\x03\x05\x03\x05\x03\x05\x03\x06\x03\x06\x03\x06\x03\x06\x03" +
"\x06\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03" +
"\x07\x03\x07\x03\x07\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\t\x03" +
"\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\n\x03\n\x03\n\x03\n\x03\n\x03" +
"\n\x03\n\x03\n\x03\n\x03\n\x03\v\x03\v\x03\v\x03\v\x07\v\xC7\n\v\f\v\x0E" +
"\v\xCA\v\v\x03\v\x05\v\xCD\n\v\x03\v\x05\v\xD0\n\v\x03\v\x03\v\x03\f\x03" +
"\f\x03\f\x03\f\x03\f\x07\f\xD9\n\f\f\f\x0E\f\xDC\v\f\x03\f\x03\f\x03\f" +
"\x03\f\x03\f\x03\r\x06\r\xE4\n\r\r\r\x0E\r\xE5\x03\r\x03\r\x03\x0E\x03" +
"\x0E\x03\x0E\x03\x0E\x03\x0F\x03\x0F\x03\x10\x03\x10\x03\x11\x03\x11\x03" +
"\x11\x03\x12\x03\x12\x03\x13\x03\x13\x05\x13\xF9\n\x13\x03\x13\x06\x13" +
"\xFC\n\x13\r\x13\x0E\x13\xFD\x03\x14\x03\x14\x03\x14\x07\x14\u0103\n\x14" +
"\f\x14\x0E\x14\u0106\v\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03" +
"\x14\x07\x14\u010E\n\x14\f\x14\x0E\x14\u0111\v\x14\x03\x14\x03\x14\x03" +
"\x14\x03\x14\x03\x14\x05\x14\u0118\n\x14\x03\x14\x05\x14\u011B\n\x14\x05" +
"\x14\u011D\n\x14\x03\x15\x06\x15\u0120\n\x15\r\x15\x0E\x15\u0121\x03\x16" +
"\x06\x16\u0125\n\x16\r\x16\x0E\x16\u0126\x03\x16\x03\x16\x07\x16\u012B" +
"\n\x16\f\x16\x0E\x16\u012E\v\x16\x03\x16\x03\x16\x06\x16\u0132\n\x16\r" +
"\x16\x0E\x16\u0133\x03\x16\x06\x16\u0137\n\x16\r\x16\x0E\x16\u0138\x03" +
"\x16\x03\x16\x07\x16\u013D\n\x16\f\x16\x0E\x16\u0140\v\x16\x05\x16\u0142" +
"\n\x16\x03\x16\x03\x16\x03\x16\x03\x16\x06\x16\u0148\n\x16\r\x16\x0E\x16" +
"\u0149\x03\x16\x03\x16\x05\x16\u014E\n\x16\x03\x17\x03\x17\x03\x17\x03" +
"\x18\x03\x18\x03\x18\x03\x18\x03\x19\x03\x19\x03\x1A\x03\x1A\x03\x1B\x03" +
"\x1B\x03\x1C\x03\x1C\x03\x1D\x03\x1D\x03\x1D\x03\x1D\x03\x1E\x03\x1E\x03" +
"\x1E\x03\x1E\x03\x1E\x03\x1F\x03\x1F\x03\x1F\x03\x1F\x03 \x03 \x03 \x03" +
" \x03 \x03!\x03!\x03!\x03\"\x03\"\x03#\x03#\x03#\x03#\x03#\x03#\x03#\x03" +
"#\x03#\x05#\u017F\n#\x03$\x03$\x03$\x03$\x03$\x03$\x03$\x03$\x03$\x03" +
"$\x05$\u018B\n$\x03%\x03%\x03&\x03&\x03\'\x03\'\x03(\x03(\x03)\x03)\x03" +
"*\x03*\x03*\x03*\x03*\x03*\x03*\x05*\u019E\n*\x03+\x03+\x03+\x03+\x03" +
"+\x03+\x03,\x03,\x03,\x03,\x03,\x03,\x03,\x03,\x03,\x05,\u01AF\n,\x03" +
"-\x03-\x03-\x03-\x03-\x03-\x03-\x03-\x03-\x03-\x03-\x03-\x03-\x03-\x03" +
"-\x03-\x03-\x05-\u01C2\n-\x03.\x03.\x05.\u01C6\n.\x03.\x03.\x03.\x07." +
"\u01CB\n.\f.\x0E.\u01CE\v.\x03/\x03/\x03/\x03/\x07/\u01D4\n/\f/\x0E/\u01D7" +
"\v/\x03/\x03/\x030\x030\x030\x030\x031\x031\x031\x031\x032\x032\x032\x03" +
"2\x033\x033\x033\x033\x033\x034\x034\x034\x034\x034\x034\x035\x035\x03" +
"5\x035\x036\x036\x036\x036\x037\x067\u01FB\n7\r7\x0E7\u01FC\x038\x068" +
"\u0200\n8\r8\x0E8\u0201\x038\x038\x058\u0206\n8\x039\x039\x03:\x03:\x03" +
":\x03:\x03;\x03;\x03;\x03;\x03<\x03<\x03<\x03<\x04\xDA\u010F\x02\x02=" +
"\x05\x02\x03\x07\x02\x04\t\x02\x05\v\x02\x06\r\x02\x07\x0F\x02\b\x11\x02" +
"\t\x13\x02\n\x15\x02\v\x17\x02\f\x19\x02\r\x1B\x02\x0E\x1D\x02\x0F\x1F" +
"\x02\x02!\x02\x02#\x02\x02%\x02\x02\'\x02\x02)\x02\x10+\x02\x11-\x02\x12" +
"/\x02\x131\x02\x143\x02\x155\x02\x167\x02\x179\x02\x18;\x02\x19=\x02\x1A" +
"?\x02\x1BA\x02\x1CC\x02\x1DE\x02\x1EG\x02\x1FI\x02 K\x02!M\x02\"O\x02" +
"#Q\x02$S\x02%U\x02&W\x02\'Y\x02([\x02)]\x02*_\x02+a\x02,c\x02-e\x02.g" +
"\x02\x02i\x02\x02k\x02\x02m\x02\x02o\x02/q\x02\x02s\x020u\x021w\x022y" +
"\x023\x05\x02\x03\x04\r\x04\x02\f\f\x0F\x0F\x05\x02\v\f\x0F\x0F\"\"\x03" +
"\x022;\x04\x02C\\c|\x07\x02$$^^ppttvv\x06\x02\f\f\x0F\x0F$$^^\x04\x02" +
"GGgg\x04\x02--//\x03\x02bb\f\x02\v\f\x0F\x0F\"\"..11??]]__bb~~\x04\x02" +
",,11\x02\u023A\x02\x05\x03\x02\x02\x02\x02\x07\x03\x02\x02\x02\x02\t\x03" +
"\x02\x02\x02\x02\v\x03\x02\x02\x02\x02\r\x03\x02\x02\x02\x02\x0F\x03\x02" +
"\x02\x02\x02\x11\x03\x02\x02\x02\x02\x13\x03\x02\x02\x02\x02\x15\x03\x02" +
"\x02\x02\x02\x17\x03\x02\x02\x02\x02\x19\x03\x02\x02\x02\x02\x1B\x03\x02" +
"\x02\x02\x03\x1D\x03\x02\x02\x02\x03)\x03\x02\x02\x02\x03+\x03\x02\x02" +
"\x02\x03-\x03\x02\x02\x02\x03/\x03\x02\x02\x02\x031\x03\x02\x02\x02\x03" +
"3\x03\x02\x02\x02\x035\x03\x02\x02\x02\x037\x03\x02\x02\x02\x039\x03\x02" +
"\x02\x02\x03;\x03\x02\x02\x02\x03=\x03\x02\x02\x02\x03?\x03\x02\x02\x02" +
"\x03A\x03\x02\x02\x02\x03C\x03\x02\x02\x02\x03E\x03\x02\x02\x02\x03G\x03" +
"\x02\x02\x02\x03I\x03\x02\x02\x02\x03K\x03\x02\x02\x02\x03M\x03\x02\x02" +
"\x02\x03O\x03\x02\x02\x02\x03Q\x03\x02\x02\x02\x03S\x03\x02\x02\x02\x03" +
"U\x03\x02\x02\x02\x03W\x03\x02\x02\x02\x03Y\x03\x02\x02\x02\x03[\x03\x02" +
"\x02\x02\x03]\x03\x02\x02\x02\x03_\x03\x02\x02\x02\x03a\x03\x02\x02\x02" +
"\x03c\x03\x02\x02\x02\x03e\x03\x02\x02\x02\x04g\x03\x02\x02\x02\x04i\x03" +
"\x02\x02\x02\x04k\x03\x02\x02\x02\x04m\x03\x02\x02\x02\x04o\x03\x02\x02" +
"\x02\x04s\x03\x02\x02\x02\x04u\x03\x02\x02\x02\x04w\x03\x02\x02\x02\x04" +
"y\x03\x02\x02\x02\x05{\x03\x02\x02\x02\x07\x82\x03\x02\x02\x02\t\x8C\x03" +
"\x02\x02\x02\v\x93\x03\x02\x02\x02\r\x99\x03\x02\x02\x02\x0F\xA1\x03\x02" +
"\x02\x02\x11\xA9\x03\x02\x02\x02\x13\xB0\x03\x02\x02\x02\x15\xB8\x03\x02" +
"\x02\x02\x17\xC2\x03\x02\x02\x02\x19\xD3\x03\x02\x02\x02\x1B\xE3\x03\x02" +
"\x02\x02\x1D\xE9\x03\x02\x02\x02\x1F\xED\x03\x02\x02\x02!\xEF\x03\x02" +
"\x02\x02#\xF1\x03\x02\x02\x02%\xF4\x03\x02\x02\x02\'\xF6\x03\x02\x02\x02" +
")\u011C\x03\x02\x02\x02+\u011F\x03\x02\x02\x02-\u014D\x03\x02\x02\x02" +
"/\u014F\x03\x02\x02\x021\u0152\x03\x02\x02\x023\u0156\x03\x02\x02\x02" +
"5\u0158\x03\x02\x02\x027\u015A\x03\x02\x02\x029\u015C\x03\x02\x02\x02" +
";\u015E\x03\x02\x02\x02=\u0162\x03\x02\x02\x02?\u0167\x03\x02\x02\x02" +
"A\u016B\x03\x02\x02\x02C\u0170\x03\x02\x02\x02E\u0173\x03\x02\x02\x02" +
"G\u017E\x03\x02\x02\x02I\u018A\x03\x02\x02\x02K\u018C\x03\x02\x02\x02" +
"M\u018E\x03\x02\x02\x02O\u0190\x03\x02\x02\x02Q\u0192\x03\x02\x02\x02" +
"S\u0194\x03\x02\x02\x02U\u019D\x03\x02\x02\x02W\u019F\x03\x02\x02\x02" +
"Y\u01AE\x03\x02\x02\x02[\u01C1\x03\x02\x02\x02]\u01C5\x03\x02\x02\x02" +
"_\u01CF\x03\x02\x02\x02a\u01DA\x03\x02\x02\x02c\u01DE\x03\x02\x02\x02" +
"e\u01E2\x03\x02\x02\x02g\u01E6\x03\x02\x02\x02i\u01EB\x03\x02\x02\x02" +
"k\u01F1\x03\x02\x02\x02m\u01F5\x03\x02\x02\x02o\u01FA\x03\x02\x02\x02" +
"q\u0205\x03\x02\x02\x02s\u0207\x03\x02\x02\x02u\u0209\x03\x02\x02\x02" +
"w\u020D\x03\x02\x02\x02y\u0211\x03\x02\x02\x02{|\x07g\x02\x02|}\x07x\x02" +
"\x02}~\x07c\x02\x02~\x7F\x07n\x02\x02\x7F\x80\x03\x02\x02\x02\x80\x81" +
"\b\x02\x02\x02\x81\x06\x03\x02\x02\x02\x82\x83\x07g\x02\x02\x83\x84\x07" +
"z\x02\x02\x84\x85\x07r\x02\x02\x85\x86\x07n\x02\x02\x86\x87\x07c\x02\x02" +
"\x87\x88\x07k\x02\x02\x88\x89\x07p\x02\x02\x89\x8A\x03\x02\x02\x02\x8A" +
"\x8B\b\x03\x02\x02\x8B\b\x03\x02\x02\x02\x8C\x8D\x07h\x02\x02\x8D\x8E" +
"\x07t\x02\x02\x8E\x8F\x07q\x02\x02\x8F\x90\x07o\x02\x02\x90\x91\x03\x02" +
"\x02\x02\x91\x92\b\x04\x03\x02\x92\n\x03\x02\x02\x02\x93\x94\x07t\x02" +
"\x02\x94\x95\x07q\x02\x02\x95\x96\x07y\x02\x02\x96\x97\x03\x02\x02\x02" +
"\x97\x98\b\x05\x02\x02\x98\f\x03\x02\x02\x02\x99\x9A\x07u\x02\x02\x9A" +
"\x9B\x07v\x02\x02\x9B\x9C\x07c\x02\x02\x9C\x9D\x07v\x02\x02\x9D\x9E\x07" +
"u\x02\x02\x9E\x9F\x03\x02\x02\x02\x9F\xA0\b\x06\x02\x02\xA0\x0E\x03\x02" +
"\x02\x02\xA1\xA2\x07y\x02\x02\xA2\xA3\x07j\x02\x02\xA3\xA4\x07g\x02\x02" +
"\xA4\xA5\x07t\x02\x02\xA5\xA6\x07g\x02\x02\xA6\xA7\x03\x02\x02\x02\xA7" +
"\xA8\b\x07\x02\x02\xA8\x10\x03\x02\x02\x02\xA9\xAA\x07u\x02\x02\xAA\xAB" +
"\x07q\x02\x02\xAB\xAC\x07t\x02\x02\xAC\xAD\x07v\x02\x02\xAD\xAE\x03\x02" +
"\x02\x02\xAE\xAF\b\b\x02\x02\xAF\x12\x03\x02\x02\x02\xB0\xB1\x07n\x02" +
"\x02\xB1\xB2\x07k\x02\x02\xB2\xB3\x07o\x02\x02\xB3\xB4\x07k\x02\x02\xB4" +
"\xB5\x07v\x02\x02\xB5\xB6\x03\x02\x02\x02\xB6\xB7\b\t\x02\x02\xB7\x14" +
"\x03\x02\x02\x02\xB8\xB9\x07r\x02\x02\xB9\xBA\x07t\x02\x02\xBA\xBB\x07" +
"q\x02\x02\xBB\xBC\x07l\x02\x02\xBC\xBD\x07g\x02\x02\xBD\xBE\x07e\x02\x02" +
"\xBE\xBF\x07v\x02\x02\xBF\xC0\x03\x02\x02\x02\xC0\xC1\b\n\x03\x02\xC1" +
"\x16\x03\x02\x02\x02\xC2\xC3\x071\x02\x02\xC3\xC4\x071\x02\x02\xC4\xC8" +
"\x03\x02\x02\x02\xC5\xC7\n\x02\x02\x02\xC6\xC5\x03\x02\x02\x02\xC7\xCA" +
"\x03\x02\x02\x02\xC8\xC6\x03\x02\x02\x02\xC8\xC9\x03\x02\x02\x02\xC9\xCC" +
"\x03\x02\x02\x02\xCA\xC8\x03\x02\x02\x02\xCB\xCD\x07\x0F\x02\x02\xCC\xCB" +
"\x03\x02\x02\x02\xCC\xCD\x03\x02\x02\x02\xCD\xCF\x03\x02\x02\x02\xCE\xD0" +
"\x07\f\x02\x02\xCF\xCE\x03\x02\x02\x02\xCF\xD0\x03\x02\x02\x02\xD0\xD1" +
"\x03\x02\x02\x02\xD1\xD2\b\v\x04\x02\xD2\x18\x03\x02\x02\x02\xD3\xD4\x07" +
"1\x02\x02\xD4\xD5\x07,\x02\x02\xD5\xDA\x03\x02\x02\x02\xD6\xD9\x05\x19" +
"\f\x02\xD7\xD9\v\x02\x02\x02\xD8\xD6\x03\x02\x02\x02\xD8\xD7\x03\x02\x02" +
"\x02\xD9\xDC\x03\x02\x02\x02\xDA\xDB\x03\x02\x02\x02\xDA\xD8\x03\x02\x02" +
"\x02\xDB\xDD\x03\x02\x02\x02\xDC\xDA\x03\x02\x02\x02\xDD\xDE\x07,\x02" +
"\x02\xDE\xDF\x071\x02\x02\xDF\xE0\x03\x02\x02\x02\xE0\xE1\b\f\x04\x02" +
"\xE1\x1A\x03\x02\x02\x02\xE2\xE4\t\x03\x02\x02\xE3\xE2\x03\x02\x02\x02" +
"\xE4\xE5\x03\x02\x02\x02\xE5\xE3\x03\x02\x02\x02\xE5\xE6\x03\x02\x02\x02" +
"\xE6\xE7\x03\x02\x02\x02\xE7\xE8\b\r\x04\x02\xE8\x1C\x03\x02\x02\x02\xE9" +
"\xEA\x07~\x02\x02\xEA\xEB\x03\x02\x02\x02\xEB\xEC\b\x0E\x05\x02\xEC\x1E" +
"\x03\x02\x02\x02\xED\xEE\t\x04\x02\x02\xEE \x03\x02\x02\x02\xEF\xF0\t" +
"\x05\x02\x02\xF0\"\x03\x02\x02\x02\xF1\xF2\x07^\x02\x02\xF2\xF3\t\x06" +
"\x02\x02\xF3$\x03\x02\x02\x02\xF4\xF5\n\x07\x02\x02\xF5&\x03\x02\x02\x02" +
"\xF6\xF8\t\b\x02\x02\xF7\xF9\t\t\x02\x02\xF8\xF7\x03\x02\x02\x02\xF8\xF9" +
"\x03\x02\x02\x02\xF9\xFB\x03\x02\x02\x02\xFA\xFC\x05\x1F\x0F\x02\xFB\xFA" +
"\x03\x02\x02\x02\xFC\xFD\x03\x02\x02\x02\xFD\xFB\x03\x02\x02\x02\xFD\xFE" +
"\x03\x02\x02\x02\xFE(\x03\x02\x02\x02\xFF\u0104\x07$\x02\x02\u0100\u0103" +
"\x05#\x11\x02\u0101\u0103\x05%\x12\x02\u0102\u0100\x03\x02\x02\x02\u0102" +
"\u0101\x03\x02\x02\x02\u0103\u0106\x03\x02\x02\x02\u0104\u0102\x03\x02" +
"\x02\x02\u0104\u0105\x03\x02\x02\x02\u0105\u0107\x03\x02\x02\x02\u0106" +
"\u0104\x03\x02\x02\x02\u0107\u011D\x07$\x02\x02\u0108\u0109\x07$\x02\x02" +
"\u0109\u010A\x07$\x02\x02\u010A\u010B\x07$\x02\x02\u010B\u010F\x03\x02" +
"\x02\x02\u010C\u010E\n\x02\x02\x02\u010D\u010C\x03\x02\x02\x02\u010E\u0111" +
"\x03\x02\x02\x02\u010F\u0110\x03\x02\x02\x02\u010F\u010D\x03\x02\x02\x02" +
"\u0110\u0112\x03\x02\x02\x02\u0111\u010F\x03\x02\x02\x02\u0112\u0113\x07" +
"$\x02\x02\u0113\u0114\x07$\x02\x02\u0114\u0115\x07$\x02\x02\u0115\u0117" +
"\x03\x02\x02\x02\u0116\u0118\x07$\x02\x02\u0117\u0116\x03\x02\x02\x02" +
"\u0117\u0118\x03\x02\x02\x02\u0118\u011A\x03\x02\x02\x02\u0119\u011B\x07" +
"$\x02\x02\u011A\u0119\x03\x02\x02\x02\u011A\u011B\x03\x02\x02\x02\u011B" +
"\u011D\x03\x02\x02\x02\u011C\xFF\x03\x02\x02\x02\u011C\u0108\x03\x02\x02" +
"\x02\u011D*\x03\x02\x02\x02\u011E\u0120\x05\x1F\x0F\x02\u011F\u011E\x03" +
"\x02\x02\x02\u0120\u0121\x03\x02\x02\x02\u0121\u011F\x03\x02\x02\x02\u0121" +
"\u0122\x03\x02\x02\x02\u0122,\x03\x02\x02\x02\u0123\u0125\x05\x1F\x0F" +
"\x02\u0124\u0123\x03\x02\x02\x02\u0125\u0126\x03\x02\x02\x02\u0126\u0124" +
"\x03\x02\x02\x02\u0126\u0127\x03\x02\x02\x02\u0127\u0128\x03\x02\x02\x02" +
"\u0128\u012C\x057\x1B\x02\u0129\u012B\x05\x1F\x0F\x02\u012A\u0129\x03" +
"\x02\x02\x02\u012B\u012E\x03\x02\x02\x02\u012C\u012A\x03\x02\x02\x02\u012C" +
"\u012D\x03\x02\x02\x02\u012D\u014E\x03\x02\x02\x02\u012E\u012C\x03\x02" +
"\x02\x02\u012F\u0131\x057\x1B\x02\u0130\u0132\x05\x1F\x0F\x02\u0131\u0130" +
"\x03\x02\x02\x02\u0132\u0133\x03\x02\x02\x02\u0133\u0131\x03\x02\x02\x02" +
"\u0133\u0134\x03\x02\x02\x02\u0134\u014E\x03\x02\x02\x02\u0135\u0137\x05" +
"\x1F\x0F\x02\u0136\u0135\x03\x02\x02\x02\u0137\u0138\x03\x02\x02\x02\u0138" +
"\u0136\x03\x02\x02\x02\u0138\u0139\x03\x02\x02\x02\u0139\u0141\x03\x02" +
"\x02\x02\u013A\u013E\x057\x1B\x02\u013B\u013D\x05\x1F\x0F\x02\u013C\u013B" +
"\x03\x02\x02\x02\u013D\u0140\x03\x02\x02\x02\u013E\u013C\x03\x02\x02\x02" +
"\u013E\u013F\x03\x02\x02\x02\u013F\u0142\x03\x02\x02\x02\u0140\u013E\x03" +
"\x02\x02\x02\u0141\u013A\x03\x02\x02\x02\u0141\u0142\x03\x02\x02\x02\u0142" +
"\u0143\x03\x02\x02\x02\u0143\u0144\x05\'\x13\x02\u0144\u014E\x03\x02\x02" +
"\x02\u0145\u0147\x057\x1B\x02\u0146\u0148\x05\x1F\x0F\x02\u0147\u0146" +
"\x03\x02\x02\x02\u0148\u0149\x03\x02\x02\x02\u0149\u0147\x03\x02\x02\x02" +
"\u0149\u014A\x03\x02\x02\x02\u014A\u014B\x03\x02\x02\x02\u014B\u014C\x05" +
"\'\x13\x02\u014C\u014E\x03\x02\x02\x02\u014D\u0124\x03\x02\x02\x02\u014D" +
"\u012F\x03\x02\x02\x02\u014D\u0136\x03\x02\x02\x02\u014D\u0145\x03\x02" +
"\x02\x02\u014E.\x03\x02\x02\x02\u014F\u0150\x07d\x02\x02\u0150\u0151\x07" +
"{\x02\x02\u01510\x03\x02\x02\x02\u0152\u0153\x07c\x02\x02\u0153\u0154" +
"\x07p\x02\x02\u0154\u0155\x07f\x02\x02\u01552\x03\x02\x02\x02\u0156\u0157" +
"\x07?\x02\x02\u01574\x03\x02\x02\x02\u0158\u0159\x07.\x02\x02\u01596\x03" +
"\x02\x02\x02\u015A\u015B\x070\x02\x02\u015B8\x03\x02\x02\x02\u015C\u015D" +
"\x07*\x02\x02\u015D:\x03\x02\x02\x02\u015E\u015F\x07]\x02\x02\u015F\u0160" +
"\x03\x02\x02\x02\u0160\u0161\b\x1D\x06\x02\u0161<\x03\x02\x02\x02\u0162" +
"\u0163\x07_\x02\x02\u0163\u0164\x03\x02\x02\x02\u0164\u0165\b\x1E\x05" +
"\x02\u0165\u0166\b\x1E\x05\x02\u0166>\x03\x02\x02\x02\u0167\u0168\x07" +
"p\x02\x02\u0168\u0169\x07q\x02\x02\u0169\u016A\x07v\x02\x02\u016A@\x03" +
"\x02\x02\x02\u016B\u016C\x07p\x02\x02\u016C\u016D\x07w\x02\x02\u016D\u016E" +
"\x07n\x02\x02\u016E\u016F\x07n\x02\x02\u016FB\x03\x02\x02\x02\u0170\u0171" +
"\x07q\x02\x02\u0171\u0172\x07t\x02\x02\u0172D\x03\x02\x02\x02\u0173\u0174" +
"\x07+\x02\x02\u0174F\x03\x02\x02\x02\u0175\u0176\x07v\x02\x02\u0176\u0177" +
"\x07t\x02\x02\u0177\u0178\x07w\x02\x02\u0178\u017F\x07g\x02\x02\u0179" +
"\u017A\x07h\x02\x02\u017A\u017B\x07c\x02\x02\u017B\u017C\x07n\x02\x02" +
"\u017C\u017D\x07u\x02\x02\u017D\u017F\x07g\x02\x02\u017E\u0175\x03\x02" +
"\x02\x02\u017E\u0179\x03\x02\x02\x02\u017FH\x03\x02\x02\x02\u0180\u0181" +
"\x07?\x02\x02\u0181\u018B\x07?\x02\x02\u0182\u0183\x07#\x02\x02\u0183" +
"\u018B\x07?\x02\x02\u0184\u018B\x07>\x02\x02\u0185\u0186\x07>\x02\x02" +
"\u0186\u018B\x07?\x02\x02\u0187\u018B\x07@\x02\x02\u0188\u0189\x07@\x02" +
"\x02\u0189\u018B\x07?\x02\x02\u018A\u0180\x03\x02\x02\x02\u018A\u0182" +
"\x03\x02\x02\x02\u018A\u0184\x03\x02\x02\x02\u018A\u0185\x03\x02\x02\x02" +
"\u018A\u0187\x03\x02\x02\x02\u018A\u0188\x03\x02\x02\x02\u018BJ\x03\x02" +
"\x02\x02\u018C\u018D\x07-\x02\x02\u018DL\x03\x02\x02\x02\u018E\u018F\x07" +
"/\x02\x02\u018FN\x03\x02\x02\x02\u0190\u0191\x07,\x02\x02\u0191P\x03\x02" +
"\x02\x02\u0192\u0193\x071\x02\x02\u0193R\x03\x02\x02\x02\u0194\u0195\x07" +
"\'\x02\x02\u0195T\x03\x02\x02\x02\u0196\u0197\x07c\x02\x02\u0197\u0198" +
"\x07u\x02\x02\u0198\u019E\x07e\x02\x02\u0199\u019A\x07f\x02\x02\u019A" +
"\u019B\x07g\x02\x02\u019B\u019C\x07u\x02\x02\u019C\u019E\x07e\x02\x02" +
"\u019D\u0196\x03\x02\x02\x02\u019D\u0199\x03\x02\x02\x02\u019EV\x03\x02" +
"\x02\x02\u019F\u01A0\x07p\x02\x02\u01A0\u01A1\x07w\x02\x02\u01A1\u01A2" +
"\x07n\x02\x02\u01A2\u01A3\x07n\x02\x02\u01A3\u01A4\x07u\x02\x02\u01A4" +
"X\x03\x02\x02\x02\u01A5\u01A6\x07h\x02\x02\u01A6\u01A7\x07k\x02\x02\u01A7" +
"\u01A8\x07t\x02\x02\u01A8\u01A9\x07u\x02\x02\u01A9\u01AF\x07v\x02\x02" +
"\u01AA\u01AB\x07n\x02\x02\u01AB\u01AC\x07c\x02\x02\u01AC\u01AD\x07u\x02" +
"\x02\u01AD\u01AF\x07v\x02\x02\u01AE\u01A5\x03\x02\x02\x02\u01AE\u01AA" +
"\x03\x02\x02\x02\u01AFZ\x03\x02\x02\x02\u01B0\u01B1\x07t\x02\x02\u01B1" +
"\u01B2\x07q\x02\x02\u01B2\u01B3\x07w\x02\x02\u01B3\u01B4\x07p\x02\x02" +
"\u01B4\u01C2\x07f\x02\x02\u01B5\u01B6\x07c\x02\x02\u01B6\u01B7\x07x\x02" +
"\x02\u01B7\u01C2\x07i\x02\x02\u01B8\u01B9\x07o\x02\x02\u01B9\u01BA\x07" +
"k\x02\x02\u01BA\u01C2\x07p\x02\x02\u01BB\u01BC\x07o\x02\x02\u01BC\u01BD" +
"\x07c\x02\x02\u01BD\u01C2\x07z\x02\x02\u01BE\u01BF\x07u\x02\x02\u01BF" +
"\u01C0\x07w\x02\x02\u01C0\u01C2\x07o\x02\x02\u01C1\u01B0\x03\x02\x02\x02" +
"\u01C1\u01B5\x03\x02\x02\x02\u01C1\u01B8\x03\x02\x02\x02\u01C1\u01BB\x03" +
"\x02\x02\x02\u01C1\u01BE\x03\x02\x02\x02\u01C2\\\x03\x02\x02\x02\u01C3" +
"\u01C6\x05!\x10\x02\u01C4\u01C6\x07a\x02\x02\u01C5\u01C3\x03\x02\x02\x02" +
"\u01C5\u01C4\x03\x02\x02\x02\u01C6\u01CC\x03\x02\x02\x02\u01C7\u01CB\x05" +
"!\x10\x02\u01C8\u01CB\x05\x1F\x0F\x02\u01C9\u01CB\x07a\x02\x02\u01CA\u01C7" +
"\x03\x02\x02\x02\u01CA\u01C8\x03\x02\x02\x02\u01CA\u01C9\x03\x02\x02\x02" +
"\u01CB\u01CE\x03\x02\x02\x02\u01CC\u01CA\x03\x02\x02\x02\u01CC\u01CD\x03" +
"\x02\x02\x02\u01CD^\x03\x02\x02\x02\u01CE\u01CC\x03\x02\x02\x02\u01CF" +
"\u01D5\x07b\x02\x02\u01D0\u01D4\n\n\x02\x02\u01D1\u01D2\x07b\x02\x02\u01D2" +
"\u01D4\x07b\x02\x02\u01D3\u01D0\x03\x02\x02\x02\u01D3\u01D1\x03\x02\x02" +
"\x02\u01D4\u01D7\x03\x02\x02\x02\u01D5\u01D3\x03\x02\x02\x02\u01D5\u01D6" +
"\x03\x02\x02\x02\u01D6\u01D8\x03\x02\x02\x02\u01D7\u01D5\x03\x02\x02\x02" +
"\u01D8\u01D9\x07b\x02\x02\u01D9`\x03\x02\x02\x02\u01DA\u01DB\x05\x17\v" +
"\x02\u01DB\u01DC\x03\x02\x02\x02\u01DC\u01DD\b0\x04\x02\u01DDb\x03\x02" +
"\x02\x02\u01DE\u01DF\x05\x19\f\x02\u01DF\u01E0\x03\x02\x02\x02\u01E0\u01E1" +
"\b1\x04\x02\u01E1d\x03\x02\x02\x02\u01E2\u01E3\x05\x1B\r\x02\u01E3\u01E4" +
"\x03\x02\x02\x02\u01E4\u01E5\b2\x04\x02\u01E5f\x03\x02\x02\x02\u01E6\u01E7" +
"\x07~\x02\x02\u01E7\u01E8\x03\x02\x02\x02\u01E8\u01E9\b3\x07\x02\u01E9" +
"\u01EA\b3\x05\x02\u01EAh\x03\x02\x02\x02\u01EB\u01EC\x07_\x02\x02\u01EC" +
"\u01ED\x03\x02\x02\x02\u01ED\u01EE\b4\x05\x02\u01EE\u01EF\b4\x05\x02\u01EF" +
"\u01F0\b4\b\x02\u01F0j\x03\x02\x02\x02\u01F1\u01F2\x07.\x02\x02\u01F2" +
"\u01F3\x03\x02\x02\x02\u01F3\u01F4\b5\t\x02\u01F4l\x03\x02\x02\x02\u01F5" +
"\u01F6\x07?\x02\x02\u01F6\u01F7\x03\x02\x02\x02\u01F7\u01F8\b6\n\x02\u01F8" +
"n\x03\x02\x02\x02\u01F9\u01FB\x05q8\x02\u01FA\u01F9\x03\x02\x02\x02\u01FB" +
"\u01FC\x03\x02\x02\x02\u01FC\u01FA\x03\x02\x02\x02\u01FC\u01FD\x03\x02" +
"\x02\x02\u01FDp\x03\x02\x02\x02\u01FE\u0200\n\v\x02\x02\u01FF\u01FE\x03" +
"\x02\x02\x02\u0200\u0201\x03\x02\x02\x02\u0201\u01FF\x03\x02\x02\x02\u0201" +
"\u0202\x03\x02\x02\x02\u0202\u0206\x03\x02\x02\x02\u0203\u0204\x071\x02" +
"\x02\u0204\u0206\n\f\x02\x02\u0205\u01FF\x03\x02\x02\x02\u0205\u0203\x03" +
"\x02\x02\x02\u0206r\x03\x02\x02\x02\u0207\u0208\x05_/\x02\u0208t\x03\x02" +
"\x02\x02\u0209\u020A\x05\x17\v\x02\u020A\u020B\x03\x02\x02\x02\u020B\u020C" +
"\b:\x04\x02\u020Cv\x03\x02\x02\x02\u020D\u020E\x05\x19\f\x02\u020E\u020F" +
"\x03\x02\x02\x02\u020F\u0210\b;\x04\x02\u0210x\x03\x02\x02\x02\u0211\u0212" +
"\x05\x1B\r\x02\u0212\u0213\x03\x02\x02\x02\u0213\u0214\b<\x04\x02\u0214" +
"z\x03\x02\x02\x02)\x02\x03\x04\xC8\xCC\xCF\xD8\xDA\xE5\xF8\xFD\u0102\u0104" +
"\u010F\u0117\u011A\u011C\u0121\u0126\u012C\u0133\u0138\u013E\u0141\u0149" +
"\u014D\u017E\u018A\u019D\u01AE\u01C1\u01C5\u01CA\u01CC\u01D3\u01D5\u01FC" +
"\u0201\u0205\v\x07\x03\x02\x07\x04\x02\x02\x03\x02\x06\x02\x02\x07\x02" +
"\x02\t\x0F\x02\t\x1A\x02\t\x16\x02\t\x15\x02";
public static __ATN: ATN;
public static get _ATN(): ATN {
if (!esql_lexer.__ATN) {

View file

@ -39,30 +39,38 @@ whereCommand
;
booleanExpression
: NOT booleanExpression #logicalNot
| valueExpression #booleanDefault
| left=booleanExpression operator=AND right=booleanExpression #logicalBinary
| left=booleanExpression operator=OR right=booleanExpression #logicalBinary
: NOT booleanExpression
| valueExpression
| left=booleanExpression operator=AND right=booleanExpression
| left=booleanExpression operator=OR right=booleanExpression
;
valueExpression
: functionIdentifier LP (functionExpressionArgument (COMMA functionExpressionArgument)*)? RP #valueFunctionExpression
| operatorExpression #valueExpressionDefault
| left=operatorExpression comparisonOperator right=operatorExpression #comparison
: operatorExpression
| comparison
;
comparison
: left=operatorExpression comparisonOperator right=operatorExpression
;
mathFn
: functionIdentifier LP (functionExpressionArgument (COMMA functionExpressionArgument)*)? RP
;
operatorExpression
: primaryExpression #operatorExpressionDefault
| operator=(MINUS | PLUS) operatorExpression #arithmeticUnary
| left=operatorExpression operator=(ASTERISK | SLASH | PERCENT) right=operatorExpression #arithmeticBinary
| left=operatorExpression operator=(PLUS | MINUS) right=operatorExpression #arithmeticBinary
: primaryExpression
| mathFn
| operator=(MINUS | PLUS) operatorExpression
| left=operatorExpression operator=(ASTERISK | SLASH | PERCENT) right=operatorExpression
| left=operatorExpression operator=(PLUS | MINUS) right=operatorExpression
;
primaryExpression
: constant #constantDefault
| qualifiedName #dereference
| LP booleanExpression RP #parenthesizedExpression
| identifier LP (booleanExpression (COMMA booleanExpression)*)? RP #functionExpression
: constant
| qualifiedName
| LP booleanExpression RP
| identifier LP (booleanExpression (COMMA booleanExpression)*)? RP
;
rowCommand
@ -74,11 +82,14 @@ fields
;
field
: qualifiedName ASSIGN valueExpression
| booleanExpression
| qualifiedName ASSIGN booleanExpression
: booleanExpression
| userVariable ASSIGN booleanExpression
;
userVariable
: identifier
;
fromCommand
: FROM sourceIdentifier (COMMA sourceIdentifier)*
;
@ -115,14 +126,9 @@ identifier
;
functionIdentifier
: ROUND_FUNCTION_MATH
| AVG_FUNCTION_MATH
| SUM_FUNCTION_MATH
| MIN_FUNCTION_MATH
| MAX_FUNCTION_MATH
: UNARY_FUNCTION
;
constant
: NULL #nullLiteral
| number #numericLiteral
@ -139,7 +145,7 @@ sortCommand
;
orderExpression
: booleanExpression ordering=(ASC | DESC)? (NULLS nullOrdering=(FIRST | LAST))?
: booleanExpression (ORDERING)? (NULLS_ORDERING (NULLS_ORDERING_DIRECTION))?
;
projectCommand
@ -152,7 +158,7 @@ projectClause
;
booleanValue
: TRUE | FALSE
: BOOLEAN_VALUE
;
number
@ -165,7 +171,7 @@ string
;
comparisonOperator
: EQ | NEQ | LT | LTE | GT | GTE
: COMPARISON_OPERATOR
;
explainCommand

File diff suppressed because one or more lines are too long

View file

@ -16,50 +16,37 @@ INTEGER_LITERAL=15
DECIMAL_LITERAL=16
BY=17
AND=18
ASC=19
ASSIGN=20
COMMA=21
DESC=22
DOT=23
FALSE=24
FIRST=25
LAST=26
LP=27
OPENING_BRACKET=28
CLOSING_BRACKET=29
NOT=30
NULL=31
NULLS=32
OR=33
RP=34
TRUE=35
EQ=36
NEQ=37
LT=38
LTE=39
GT=40
GTE=41
PLUS=42
MINUS=43
ASTERISK=44
SLASH=45
PERCENT=46
ROUND_FUNCTION_MATH=47
AVG_FUNCTION_MATH=48
SUM_FUNCTION_MATH=49
MIN_FUNCTION_MATH=50
MAX_FUNCTION_MATH=51
UNQUOTED_IDENTIFIER=52
QUOTED_IDENTIFIER=53
EXPR_LINE_COMMENT=54
EXPR_MULTILINE_COMMENT=55
EXPR_WS=56
SRC_UNQUOTED_IDENTIFIER=57
SRC_QUOTED_IDENTIFIER=58
SRC_LINE_COMMENT=59
SRC_MULTILINE_COMMENT=60
SRC_WS=61
UNKNOWN_CMD=62
ASSIGN=19
COMMA=20
DOT=21
LP=22
OPENING_BRACKET=23
CLOSING_BRACKET=24
NOT=25
NULL=26
OR=27
RP=28
BOOLEAN_VALUE=29
COMPARISON_OPERATOR=30
PLUS=31
MINUS=32
ASTERISK=33
SLASH=34
PERCENT=35
ORDERING=36
NULLS_ORDERING=37
NULLS_ORDERING_DIRECTION=38
UNARY_FUNCTION=39
UNQUOTED_IDENTIFIER=40
QUOTED_IDENTIFIER=41
EXPR_LINE_COMMENT=42
EXPR_MULTILINE_COMMENT=43
EXPR_WS=44
SRC_UNQUOTED_IDENTIFIER=45
SRC_QUOTED_IDENTIFIER=46
SRC_LINE_COMMENT=47
SRC_MULTILINE_COMMENT=48
SRC_WS=49
'eval'=1
'explain'=2
'from'=3
@ -71,34 +58,17 @@ UNKNOWN_CMD=62
'project'=9
'by'=17
'and'=18
'asc'=19
'desc'=22
'.'=23
'false'=24
'first'=25
'last'=26
'('=27
'['=28
']'=29
'not'=30
'null'=31
'nulls'=32
'or'=33
')'=34
'true'=35
'=='=36
'!='=37
'<'=38
'<='=39
'>'=40
'>='=41
'+'=42
'-'=43
'*'=44
'/'=45
'%'=46
'round'=47
'avg'=48
'sum'=49
'min'=50
'max'=51
'.'=21
'('=22
'['=23
']'=24
'not'=25
'null'=26
'or'=27
')'=28
'+'=31
'-'=32
'*'=33
'/'=34
'%'=35
'nulls'=37

File diff suppressed because it is too large Load diff

View file

@ -4,27 +4,14 @@
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
import { ValueFunctionExpressionContext } from "./esql_parser";
import { ValueExpressionDefaultContext } from "./esql_parser";
import { ComparisonContext } from "./esql_parser";
import { NullLiteralContext } from "./esql_parser";
import { NumericLiteralContext } from "./esql_parser";
import { BooleanLiteralContext } from "./esql_parser";
import { StringLiteralContext } from "./esql_parser";
import { DecimalLiteralContext } from "./esql_parser";
import { IntegerLiteralContext } from "./esql_parser";
import { ConstantDefaultContext } from "./esql_parser";
import { DereferenceContext } from "./esql_parser";
import { ParenthesizedExpressionContext } from "./esql_parser";
import { FunctionExpressionContext } from "./esql_parser";
import { SingleCommandQueryContext } from "./esql_parser";
import { CompositeQueryContext } from "./esql_parser";
import { LogicalNotContext } from "./esql_parser";
import { BooleanDefaultContext } from "./esql_parser";
import { LogicalBinaryContext } from "./esql_parser";
import { OperatorExpressionDefaultContext } from "./esql_parser";
import { ArithmeticUnaryContext } from "./esql_parser";
import { ArithmeticBinaryContext } from "./esql_parser";
import { SingleStatementContext } from "./esql_parser";
import { QueryContext } from "./esql_parser";
import { SourceCommandContext } from "./esql_parser";
@ -32,11 +19,14 @@ import { ProcessingCommandContext } from "./esql_parser";
import { WhereCommandContext } from "./esql_parser";
import { BooleanExpressionContext } from "./esql_parser";
import { ValueExpressionContext } from "./esql_parser";
import { ComparisonContext } from "./esql_parser";
import { MathFnContext } from "./esql_parser";
import { OperatorExpressionContext } from "./esql_parser";
import { PrimaryExpressionContext } from "./esql_parser";
import { RowCommandContext } from "./esql_parser";
import { FieldsContext } from "./esql_parser";
import { FieldContext } from "./esql_parser";
import { UserVariableContext } from "./esql_parser";
import { FromCommandContext } from "./esql_parser";
import { EvalCommandContext } from "./esql_parser";
import { StatsCommandContext } from "./esql_parser";
@ -65,45 +55,6 @@ import { SubqueryExpressionContext } from "./esql_parser";
* `esql_parser`.
*/
export interface esql_parserListener extends ParseTreeListener {
/**
* Enter a parse tree produced by the `valueFunctionExpression`
* labeled alternative in `esql_parser.valueExpression`.
* @param ctx the parse tree
*/
enterValueFunctionExpression?: (ctx: ValueFunctionExpressionContext) => void;
/**
* Exit a parse tree produced by the `valueFunctionExpression`
* labeled alternative in `esql_parser.valueExpression`.
* @param ctx the parse tree
*/
exitValueFunctionExpression?: (ctx: ValueFunctionExpressionContext) => void;
/**
* Enter a parse tree produced by the `valueExpressionDefault`
* labeled alternative in `esql_parser.valueExpression`.
* @param ctx the parse tree
*/
enterValueExpressionDefault?: (ctx: ValueExpressionDefaultContext) => void;
/**
* Exit a parse tree produced by the `valueExpressionDefault`
* labeled alternative in `esql_parser.valueExpression`.
* @param ctx the parse tree
*/
exitValueExpressionDefault?: (ctx: ValueExpressionDefaultContext) => void;
/**
* Enter a parse tree produced by the `comparison`
* labeled alternative in `esql_parser.valueExpression`.
* @param ctx the parse tree
*/
enterComparison?: (ctx: ComparisonContext) => void;
/**
* Exit a parse tree produced by the `comparison`
* labeled alternative in `esql_parser.valueExpression`.
* @param ctx the parse tree
*/
exitComparison?: (ctx: ComparisonContext) => void;
/**
* Enter a parse tree produced by the `nullLiteral`
* labeled alternative in `esql_parser.constant`.
@ -182,58 +133,6 @@ export interface esql_parserListener extends ParseTreeListener {
*/
exitIntegerLiteral?: (ctx: IntegerLiteralContext) => void;
/**
* Enter a parse tree produced by the `constantDefault`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
enterConstantDefault?: (ctx: ConstantDefaultContext) => void;
/**
* Exit a parse tree produced by the `constantDefault`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
exitConstantDefault?: (ctx: ConstantDefaultContext) => void;
/**
* Enter a parse tree produced by the `dereference`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
enterDereference?: (ctx: DereferenceContext) => void;
/**
* Exit a parse tree produced by the `dereference`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
exitDereference?: (ctx: DereferenceContext) => void;
/**
* Enter a parse tree produced by the `parenthesizedExpression`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
enterParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void;
/**
* Exit a parse tree produced by the `parenthesizedExpression`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
exitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void;
/**
* Enter a parse tree produced by the `functionExpression`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
enterFunctionExpression?: (ctx: FunctionExpressionContext) => void;
/**
* Exit a parse tree produced by the `functionExpression`
* labeled alternative in `esql_parser.primaryExpression`.
* @param ctx the parse tree
*/
exitFunctionExpression?: (ctx: FunctionExpressionContext) => void;
/**
* Enter a parse tree produced by the `singleCommandQuery`
* labeled alternative in `esql_parser.query`.
@ -260,84 +159,6 @@ export interface esql_parserListener extends ParseTreeListener {
*/
exitCompositeQuery?: (ctx: CompositeQueryContext) => void;
/**
* Enter a parse tree produced by the `logicalNot`
* labeled alternative in `esql_parser.booleanExpression`.
* @param ctx the parse tree
*/
enterLogicalNot?: (ctx: LogicalNotContext) => void;
/**
* Exit a parse tree produced by the `logicalNot`
* labeled alternative in `esql_parser.booleanExpression`.
* @param ctx the parse tree
*/
exitLogicalNot?: (ctx: LogicalNotContext) => void;
/**
* Enter a parse tree produced by the `booleanDefault`
* labeled alternative in `esql_parser.booleanExpression`.
* @param ctx the parse tree
*/
enterBooleanDefault?: (ctx: BooleanDefaultContext) => void;
/**
* Exit a parse tree produced by the `booleanDefault`
* labeled alternative in `esql_parser.booleanExpression`.
* @param ctx the parse tree
*/
exitBooleanDefault?: (ctx: BooleanDefaultContext) => void;
/**
* Enter a parse tree produced by the `logicalBinary`
* labeled alternative in `esql_parser.booleanExpression`.
* @param ctx the parse tree
*/
enterLogicalBinary?: (ctx: LogicalBinaryContext) => void;
/**
* Exit a parse tree produced by the `logicalBinary`
* labeled alternative in `esql_parser.booleanExpression`.
* @param ctx the parse tree
*/
exitLogicalBinary?: (ctx: LogicalBinaryContext) => void;
/**
* Enter a parse tree produced by the `operatorExpressionDefault`
* labeled alternative in `esql_parser.operatorExpression`.
* @param ctx the parse tree
*/
enterOperatorExpressionDefault?: (ctx: OperatorExpressionDefaultContext) => void;
/**
* Exit a parse tree produced by the `operatorExpressionDefault`
* labeled alternative in `esql_parser.operatorExpression`.
* @param ctx the parse tree
*/
exitOperatorExpressionDefault?: (ctx: OperatorExpressionDefaultContext) => void;
/**
* Enter a parse tree produced by the `arithmeticUnary`
* labeled alternative in `esql_parser.operatorExpression`.
* @param ctx the parse tree
*/
enterArithmeticUnary?: (ctx: ArithmeticUnaryContext) => void;
/**
* Exit a parse tree produced by the `arithmeticUnary`
* labeled alternative in `esql_parser.operatorExpression`.
* @param ctx the parse tree
*/
exitArithmeticUnary?: (ctx: ArithmeticUnaryContext) => void;
/**
* Enter a parse tree produced by the `arithmeticBinary`
* labeled alternative in `esql_parser.operatorExpression`.
* @param ctx the parse tree
*/
enterArithmeticBinary?: (ctx: ArithmeticBinaryContext) => void;
/**
* Exit a parse tree produced by the `arithmeticBinary`
* labeled alternative in `esql_parser.operatorExpression`.
* @param ctx the parse tree
*/
exitArithmeticBinary?: (ctx: ArithmeticBinaryContext) => void;
/**
* Enter a parse tree produced by `esql_parser.singleStatement`.
* @param ctx the parse tree
@ -415,6 +236,28 @@ export interface esql_parserListener extends ParseTreeListener {
*/
exitValueExpression?: (ctx: ValueExpressionContext) => void;
/**
* Enter a parse tree produced by `esql_parser.comparison`.
* @param ctx the parse tree
*/
enterComparison?: (ctx: ComparisonContext) => void;
/**
* Exit a parse tree produced by `esql_parser.comparison`.
* @param ctx the parse tree
*/
exitComparison?: (ctx: ComparisonContext) => void;
/**
* Enter a parse tree produced by `esql_parser.mathFn`.
* @param ctx the parse tree
*/
enterMathFn?: (ctx: MathFnContext) => void;
/**
* Exit a parse tree produced by `esql_parser.mathFn`.
* @param ctx the parse tree
*/
exitMathFn?: (ctx: MathFnContext) => void;
/**
* Enter a parse tree produced by `esql_parser.operatorExpression`.
* @param ctx the parse tree
@ -470,6 +313,17 @@ export interface esql_parserListener extends ParseTreeListener {
*/
exitField?: (ctx: FieldContext) => void;
/**
* Enter a parse tree produced by `esql_parser.userVariable`.
* @param ctx the parse tree
*/
enterUserVariable?: (ctx: UserVariableContext) => void;
/**
* Exit a parse tree produced by `esql_parser.userVariable`.
* @param ctx the parse tree
*/
exitUserVariable?: (ctx: UserVariableContext) => void;
/**
* Enter a parse tree produced by `esql_parser.fromCommand`.
* @param ctx the parse tree

View file

@ -8,5 +8,5 @@
export { ESQL_LANG_ID, ESQL_THEME_ID } from './lib/constants';
export { ESQLLang } from './language';
export type { ESQLCustomAutocompleteCallbacks } from './lib/autocomplete/types';
export { buildESQlTheme } from './lib/monaco/esql_theme';

View file

@ -15,12 +15,15 @@ import type { ESQLWorker } from './worker/esql_worker';
import { DiagnosticsAdapter } from '../common/diagnostics_adapter';
import { WorkerProxyService } from '../common/worker_proxy';
import { ESQLCompletionAdapter } from './lib/monaco/esql_completion_provider';
import type { ESQLCustomAutocompleteCallbacks } from './lib/autocomplete/types';
const workerProxyService = new WorkerProxyService<ESQLWorker>();
export const ESQLLang: CustomLangModuleType = {
ID: ESQL_LANG_ID,
async onLanguage() {
const { ESQLTokensProvider } = await import('./lib/monaco');
const workerProxyService = new WorkerProxyService<ESQLWorker>();
workerProxyService.setup(ESQL_LANG_ID);
@ -28,4 +31,8 @@ export const ESQLLang: CustomLangModuleType = {
new DiagnosticsAdapter(ESQL_LANG_ID, (...uris) => workerProxyService.getWorker(uris));
},
getSuggestionProvider(callbacks?: ESQLCustomAutocompleteCallbacks) {
return new ESQLCompletionAdapter((...uris) => workerProxyService.getWorker(uris), callbacks);
},
};

View file

@ -10,10 +10,17 @@ import { CommonTokenStream, CodePointCharStream } from 'antlr4ts';
import { esql_lexer as ESQLLexer } from '../antlr/esql_lexer';
import { esql_parser as ESQLParser } from '../antlr/esql_parser';
import type { esql_parserListener as ESQLParserListener } from '../antlr/esql_parser_listener';
import type { ANTLREErrorListener } from '../../common/error_listener';
export const getParser = (inputStream: CodePointCharStream, errorListener: ANTLREErrorListener) => {
export const ROOT_STATEMENT = 'singleStatement';
export const getParser = (
inputStream: CodePointCharStream,
errorListener: ANTLREErrorListener,
parseListener?: ESQLParserListener
) => {
const lexer = getLexer(inputStream, errorListener);
const tokenStream = new CommonTokenStream(lexer);
const parser = new ESQLParser(tokenStream);
@ -21,6 +28,10 @@ export const getParser = (inputStream: CodePointCharStream, errorListener: ANTLR
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
if (parseListener) {
parser.addParseListener(parseListener);
}
return parser;
};

View file

@ -0,0 +1,88 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import type { AutocompleteCommandDefinition } from '../types';
export const comparisonOperatorsCommandsDefinitions: AutocompleteCommandDefinition[] = [
{
label: 'or',
insertText: 'or',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.orDoc', {
defaultMessage: 'or',
}),
sortText: 'D',
},
{
label: 'and',
insertText: 'and',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.andDoc', {
defaultMessage: 'and',
}),
sortText: 'D',
},
];
export const comparisonCommandsDefinitions: AutocompleteCommandDefinition[] = [
{
label: '==',
insertText: '==',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.equalToDoc', {
defaultMessage: 'Equal to',
}),
sortText: 'D',
},
{
label: '!=',
insertText: '!=',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.notEqualToDoc', {
defaultMessage: 'Not equal to',
}),
sortText: 'D',
},
{
label: '<',
insertText: '<',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.lessThanDoc', {
defaultMessage: 'Less than',
}),
sortText: 'D',
},
{
label: '>',
insertText: '>',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.greaterThanDoc', {
defaultMessage: 'Greater than',
}),
sortText: 'D',
},
{
label: '<=',
insertText: '<=',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.lessThanOrEqualToDoc', {
defaultMessage: 'Less than or equal to',
}),
sortText: 'D',
},
{
label: '>=',
insertText: '>=',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.greaterThanOrEqualToDoc', {
defaultMessage: 'Greater than or equal to',
}),
sortText: 'D',
},
];

View file

@ -0,0 +1,60 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import type { AutocompleteCommandDefinition } from '../types';
export const buildFieldsDefinitions = (fields: string[]): AutocompleteCommandDefinition[] =>
fields.map((label) => ({
label,
insertText: label,
kind: 4,
detail: i18n.translate('monaco.esql.autocomplete.fieldDefinition', {
defaultMessage: `Field specified by the input table`,
}),
sortText: 'D',
}));
export const buildNewVarDefinition = (label: string): AutocompleteCommandDefinition => {
return {
label,
insertText: label,
kind: 21,
detail: i18n.translate('monaco.esql.autocomplete.newVarDoc', {
defaultMessage: 'Define a new variable',
}),
sortText: 'D',
};
};
export const buildSourcesDefinitions = (sources: string[]): AutocompleteCommandDefinition[] =>
sources.map((label) => ({
label,
insertText: label,
kind: 21,
detail: i18n.translate('monaco.esql.autocomplete.sourceDefinition', {
defaultMessage: `Input table`,
}),
sortText: 'A',
}));
export const buildConstantsDefinitions = (
userConstants: string[],
detail?: string
): AutocompleteCommandDefinition[] =>
userConstants.map((label) => ({
label,
insertText: label,
kind: 14,
detail:
detail ??
i18n.translate('monaco.esql.autocomplete.constantDefinition', {
defaultMessage: `User defined variable`,
}),
sortText: 'A',
}));

View file

@ -0,0 +1,87 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import { buildDocumentation } from './utils';
import type { AutocompleteCommandDefinition } from '../types';
export const roundCommandDefinition: AutocompleteCommandDefinition = {
label: 'round',
insertText: 'round',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.roundDoc', {
defaultMessage:
'Returns a number rounded to the decimal, specified by he closest integer value. The default is to round to an integer.',
}),
documentation: {
value: buildDocumentation('round(grouped[T]): aggregated[T]', [
'from index where field="value" | eval rounded = round(field)',
]),
},
sortText: 'C',
};
export const aggregationFunctionsDefinitions: AutocompleteCommandDefinition[] = [
{
label: 'avg',
insertText: 'avg',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.avgDoc', {
defaultMessage: 'Returns the average of the values in a field',
}),
documentation: {
value: buildDocumentation('avg(grouped[T]): aggregated[T]', [
'from index | stats average = avg(field)',
]),
},
sortText: 'C',
},
{
label: 'max',
insertText: 'max',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.maxDoc', {
defaultMessage: 'Returns the maximum value in a field.',
}),
documentation: {
value: buildDocumentation('max(grouped[T]): aggregated[T]', [
'from index | stats max = max(field)',
]),
},
sortText: 'C',
},
{
label: 'min',
insertText: 'min',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.minDoc', {
defaultMessage: 'Returns the minimum value in a field.',
}),
documentation: {
value: buildDocumentation('min(grouped[T]): aggregated[T]', [
'from index | stats min = min(field)',
]),
},
sortText: 'C',
},
{
label: 'sum',
insertText: 'sum',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.sumDoc', {
defaultMessage: 'Returns the sum of the values in a field.',
}),
documentation: {
value: buildDocumentation('sum(grouped[T]): aggregated[T]', [
'from index | stats sum = sum(field)',
]),
},
sortText: 'C',
},
];

View file

@ -0,0 +1,36 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export { aggregationFunctionsDefinitions, roundCommandDefinition } from './functions_commands';
export { sourceCommandsDefinitions } from './source_commands';
export { processingCommandsDefinitions, pipeDefinition } from './processing_commands';
export {
comparisonCommandsDefinitions,
comparisonOperatorsCommandsDefinitions,
} from './comparison_commands';
export {
mathOperatorsCommandsDefinitions,
assignOperatorDefinition,
byOperatorDefinition,
openBracketDefinition,
closeBracketDefinition,
} from './operators_commands';
export {
orderingCommandsDefinitions,
nullsCommandsDefinition,
nullsOrderingCommandsDefinitions,
} from './ordering_commands';
export {
buildNewVarDefinition,
buildSourcesDefinitions,
buildFieldsDefinitions,
buildConstantsDefinitions,
} from './dynamic_commands';

View file

@ -0,0 +1,89 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import type { AutocompleteCommandDefinition } from '../types';
export const byOperatorDefinition: AutocompleteCommandDefinition = {
label: 'by',
insertText: 'by ',
kind: 21,
detail: i18n.translate('monaco.esql.autocomplete.byDoc', {
defaultMessage: 'By',
}),
sortText: 'D',
};
export const assignOperatorDefinition: AutocompleteCommandDefinition = {
label: '=',
insertText: '=',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.assignDoc', {
defaultMessage: 'Assign (=)',
}),
sortText: 'D',
};
export const openBracketDefinition: AutocompleteCommandDefinition = {
label: '(',
insertText: '(',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.openBracketDoc', {
defaultMessage: 'Open Bracket (',
}),
sortText: 'A',
};
export const closeBracketDefinition: AutocompleteCommandDefinition = {
label: ')',
insertText: ')',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.closeBracketDoc', {
defaultMessage: 'Close Bracket )',
}),
sortText: 'A',
};
export const mathOperatorsCommandsDefinitions: AutocompleteCommandDefinition[] = [
{
label: '+',
insertText: '+',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.addDoc', {
defaultMessage: 'Add (+)',
}),
sortText: 'D',
},
{
label: '-',
insertText: '-',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.subtractDoc', {
defaultMessage: 'Subtract (-)',
}),
sortText: 'D',
},
{
label: '/',
insertText: '/',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.divideDoc', {
defaultMessage: 'Divide (/)',
}),
sortText: 'D',
},
{
label: '*',
insertText: '*',
kind: 11,
detail: i18n.translate('monaco.esql.autocomplete.multiplyDoc', {
defaultMessage: 'Multiply (*)',
}),
sortText: 'D',
},
];

View file

@ -0,0 +1,54 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import type { AutocompleteCommandDefinition } from '../types';
export const orderingCommandsDefinitions: AutocompleteCommandDefinition[] = [
{
label: 'asc',
insertText: 'asc',
kind: 17,
detail: i18n.translate('monaco.esql.autocomplete.ascDoc', {
defaultMessage: 'Ascending Order',
}),
sortText: 'D',
},
{
label: 'desc',
insertText: 'desc',
kind: 17,
detail: i18n.translate('monaco.esql.autocomplete.descDoc', {
defaultMessage: 'Descending Order',
}),
sortText: 'D',
},
];
export const nullsCommandsDefinition: AutocompleteCommandDefinition = {
label: 'nulls',
insertText: 'nulls',
kind: 13,
sortText: 'D',
};
export const nullsOrderingCommandsDefinitions: AutocompleteCommandDefinition[] = [
{
label: 'first',
insertText: 'first',
kind: 13,
sortText: 'D',
},
{
label: 'last',
insertText: 'last',
kind: 13,
sortText: 'D',
},
];

View file

@ -0,0 +1,99 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import { buildDocumentation } from './utils';
import type { AutocompleteCommandDefinition } from '../types';
export const pipeDefinition: AutocompleteCommandDefinition = {
label: '|',
insertText: '|',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.pipeDoc', {
defaultMessage: 'Pipe (|)',
}),
sortText: 'B',
};
export const processingCommandsDefinitions: AutocompleteCommandDefinition[] = [
{
label: 'stats',
insertText: 'stats',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.statsDoc', {
defaultMessage:
'Calculates aggregate statistics, such as average, count, and sum, over the incoming search results set. Similar to SQL aggregation, if the stats command is used without a BY clause, only one row is returned, which is the aggregation over the entire incoming search results set. When you use a BY clause, one row is returned for each distinct value in the field specified in the BY clause. The stats command returns only the fields in the aggregation, and you can use a wide range of statistical functions with the stats command. When you perform more than one aggregation, separate each aggregation with a comma.',
}),
documentation: {
value: buildDocumentation(
'stats aggs = fieldSpecification ( `,` fieldSpecification )* ( `by` groups = identifier ( `,` identifier )* )?',
['… | stats sum(b) by b)', '… | stats avg = avg(a)']
),
},
sortText: 'B',
},
{
label: 'limit',
insertText: 'limit',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.limitDoc', {
defaultMessage:
'Returns the first search results, in search order, based on the "limit" specified.',
}),
documentation: {
value: buildDocumentation('limit size = integerLiteral', ['… | limit 100', '… | limit 0']),
},
sortText: 'B',
},
{
label: 'eval',
insertText: 'eval',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.evalDoc', {
defaultMessage:
'Calculates an expression and puts the resulting value into a search results field.',
}),
documentation: {
value: buildDocumentation('eval columns = fieldSpecification ( `,` fieldSpecification )*', [
'… | eval a = b * c',
]),
},
sortText: 'B',
},
{
label: 'sort',
insertText: 'sort',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.sortDoc', {
defaultMessage:
'Sorts all results by the specified fields. When in descending order, the results missing a field are considered the smallest possible value of the field, or the largest possible value of the field when in ascending order.',
}),
documentation: {
value: buildDocumentation('sort orders = orderExpression ( `,` orderExpression )*', [
'… | sort a desc, b nulls last, c asc nulls first',
'… | sort b nulls last`',
'… | sort c asc nulls first`',
]),
},
sortText: 'B',
},
{
label: 'where',
insertText: 'where',
kind: 1,
detail: i18n.translate('monaco.esql.autocomplete.whereDoc', {
defaultMessage:
'Uses "predicate-expressions" to filter search results. A predicate expression, when evaluated, returns TRUE or FALSE. The where command only returns the results that evaluate to TRUE. For example, to filter results for a specific field value',
}),
documentation: {
value: buildDocumentation('where condition = expression', ['… | where status_code == 200']),
},
sortText: 'B',
},
];

View file

@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import { buildDocumentation } from './utils';
import type { AutocompleteCommandDefinition } from '../types';
export const sourceCommandsDefinitions: AutocompleteCommandDefinition[] = [
{
label: 'from',
insertText: 'from',
kind: 0,
detail: i18n.translate('monaco.esql.autocomplete.fromDoc', {
defaultMessage:
'Retrieves data from one or more datasets. A dataset is a collection of data that you want to search. The only supported dataset is an index. In a query or subquery, you must use the from command first and it does not need a leading pipe. For example, to retrieve data from an index:',
}),
documentation: {
value: buildDocumentation(
'from` indexPatterns = wildcardIdentifier (`,` wildcardIdentifier)*',
['from logs', 'from logs-*', 'from logs_*, events-*', 'from from remote*:logs*']
),
},
sortText: 'A',
},
];

View file

@ -0,0 +1,39 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
const declarationLabel = i18n.translate('monaco.esql.autocomplete.declarationLabel', {
defaultMessage: 'Declaration:',
});
const examplesLabel = i18n.translate('monaco.esql.autocomplete.examplesLabel', {
defaultMessage: 'Examples:',
});
/** @internal **/
export const buildDocumentation = (declaration: string, examples?: string[]) => `
---
\
***${declarationLabel}***
\
- \`\`${declaration}\`\`
\
---
${
examples
? `\
***${examplesLabel}***
\
${examples.map(
(i) => `
- \`\`${i}\`\`
`
)}`
: ''
}`;

View file

@ -0,0 +1,109 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { CharStreams } from 'antlr4ts';
import { AutocompleteListener } from './autocomplete_listener';
import { ANTLREErrorListener } from '../../../common/error_listener';
import { getParser, ROOT_STATEMENT } from '../antlr_facade';
import { isDynamicAutocompleteItem } from './dymanic_item';
describe('autocomplete_listener', () => {
const getAutocompleteSuggestions = (text: string) => {
const errorListener = new ANTLREErrorListener();
const parseListener = new AutocompleteListener();
const parser = getParser(CharStreams.fromString(text), errorListener, parseListener);
parser[ROOT_STATEMENT]();
return parseListener.getAutocompleteSuggestions();
};
const testSuggestions = (text: string, expected: string[]) => {
test(`${text} => [${expected.join(',')}]`, () => {
const { suggestions } = getAutocompleteSuggestions(text);
expect(suggestions.map((i) => (isDynamicAutocompleteItem(i) ? i : i.label))).toEqual(
expected
);
});
};
describe('from', () => {
testSuggestions('f', ['from']);
testSuggestions('from ', ['SourceIdentifier']);
testSuggestions('from a,', ['SourceIdentifier']);
testSuggestions('from a, b ', ['|']);
});
describe('where', () => {
testSuggestions('from a | where ', ['FieldIdentifier']);
testSuggestions('from a | where "field" ', ['==', '!=', '<', '>', '<=', '>=']);
testSuggestions('from a | where "field" >= ', ['FieldIdentifier']);
testSuggestions('from a | where "field" >= "field1" ', ['or', 'and', '|']);
testSuggestions('from a | where "field" >= "field1" and ', ['FieldIdentifier']);
testSuggestions('from a | where "field" >= "field1" and "field2" ', [
'==',
'!=',
'<',
'>',
'<=',
'>=',
]);
testSuggestions('from a | stats a=avg("field") | where a ', ['==', '!=', '<', '>', '<=', '>=']);
testSuggestions('from a | stats a=avg("b") | where "c" ', ['==', '!=', '<', '>', '<=', '>=']);
testSuggestions('from a | where "field" >= "field1" and "field2 == ', ['FieldIdentifier']);
});
describe('sort', () => {
testSuggestions('from a | sort ', ['FieldIdentifier']);
testSuggestions('from a | sort "field" ', ['asc', 'desc']);
testSuggestions('from a | sort "field" desc ', ['nulls']);
testSuggestions('from a | sort "field" desc nulls ', ['first', 'last']);
});
describe('limit', () => {
testSuggestions('from a | limit ', ['1000']);
testSuggestions('from a | limit 4 ', ['|']);
});
describe('stats', () => {
testSuggestions('from a | stats ', ['var0']);
testSuggestions('from a | stats a ', ['=']);
testSuggestions('from a | stats a=', ['avg', 'max', 'min', 'sum', 'FieldIdentifier']);
testSuggestions('from a | stats a=b', ['|', 'by']);
testSuggestions('from a | stats a=b by ', ['FieldIdentifier']);
testSuggestions('from a | stats a=c by d', ['|']);
testSuggestions('from a | stats a=b, ', ['var0']);
testSuggestions('from a | stats a=max', ['(']);
testSuggestions('from a | stats a=min(', ['FieldIdentifier']);
testSuggestions('from a | stats a=min(b', [')', 'FieldIdentifier']);
testSuggestions('from a | stats a=min(b) ', ['|', 'by']);
testSuggestions('from a | stats a=min(b) by ', ['FieldIdentifier']);
testSuggestions('from a | stats a=min(b),', ['var0']);
testSuggestions('from a | stats var0=min(b),var1=c,', ['var2']);
testSuggestions('from a | stats a=min(b), b=max(', ['FieldIdentifier']);
});
describe('eval', () => {
testSuggestions('from a | eval ', ['var0']);
testSuggestions('from a | eval a ', ['=']);
testSuggestions('from a | eval a=', ['round', 'FieldIdentifier']);
testSuggestions('from a | eval a=b', ['|', '+', '-', '/', '*']);
testSuggestions('from a | eval a=b, ', ['var0']);
testSuggestions('from a | eval a=round', ['(']);
testSuggestions('from a | eval a=round(', ['FieldIdentifier']);
testSuggestions('from a | eval a=round(b) ', ['|', '+', '-', '/', '*']);
testSuggestions('from a | eval a=round(b),', ['var0']);
testSuggestions('from a | eval a=round(b) +', ['FieldIdentifier']);
testSuggestions('from a | eval a=round(b', [')', 'FieldIdentifier']);
testSuggestions('from a | eval a=round(b), b=round(', ['FieldIdentifier']);
testSuggestions('from a | stats a=round(b), b=round(', ['FieldIdentifier']);
testSuggestions('from a | eval var0=round(b), var1=round(c) | stats ', ['var2']);
});
});

View file

@ -0,0 +1,316 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { TerminalNode } from 'antlr4ts/tree/TerminalNode';
import type { AutocompleteCommandDefinition, UserDefinedVariables } from './types';
import { DynamicAutocompleteItem } from './dymanic_item';
import { esql_parserListener as ESQLParserListener } from '../../antlr/esql_parser_listener';
import { esql_parser, esql_parser as ESQLParser } from '../../antlr/esql_parser';
import {
processingCommandsDefinitions,
sourceCommandsDefinitions,
orderingCommandsDefinitions,
nullsCommandsDefinition,
nullsOrderingCommandsDefinitions,
comparisonCommandsDefinitions,
comparisonOperatorsCommandsDefinitions,
byOperatorDefinition,
pipeDefinition,
openBracketDefinition,
closeBracketDefinition,
mathOperatorsCommandsDefinitions,
aggregationFunctionsDefinitions,
roundCommandDefinition,
assignOperatorDefinition,
buildConstantsDefinitions,
buildNewVarDefinition,
} from './autocomplete_definitions';
import {
EvalCommandContext,
StatsCommandContext,
ComparisonContext,
WhereCommandContext,
SourceCommandContext,
OrderExpressionContext,
FieldContext,
QualifiedNameContext,
ProcessingCommandContext,
SourceIdentifierContext,
UserVariableContext,
BooleanExpressionContext,
LimitCommandContext,
ValueExpressionContext,
} from '../../antlr/esql_parser';
export class AutocompleteListener implements ESQLParserListener {
private suggestions: Array<AutocompleteCommandDefinition | DynamicAutocompleteItem> = [];
private readonly userDefinedVariables: UserDefinedVariables = {
sourceIdentifiers: [],
};
private readonly tables: string[][] = [];
private parentContext: number | undefined;
private get fields() {
return this.tables.length > 1
? buildConstantsDefinitions(this.tables.at(-2)!)
: [DynamicAutocompleteItem.FieldIdentifier];
}
private get hasSuggestions() {
return Boolean(this.suggestions.length);
}
private isTerminalNodeExists(node: TerminalNode | undefined) {
return node && node.payload?.startIndex >= 0;
}
private getEndCommandSuggestions(skipDefinitions: AutocompleteCommandDefinition[] = []) {
const suggestions = [pipeDefinition];
if (
!skipDefinitions.find((i) => i === byOperatorDefinition) &&
this.parentContext === ESQLParser.STATS
) {
suggestions.push(byOperatorDefinition);
}
return suggestions;
}
private getNewVarName() {
const vars = this.tables.flat();
let index = 0;
while (true) {
const value = `var${index}`;
if (!vars.includes(value)) {
return value;
}
index++;
}
}
getAutocompleteSuggestions() {
return {
suggestions: this.suggestions,
userDefinedVariables: this.userDefinedVariables,
};
}
/** ESQLParserListener fields **/
enterSourceCommand(ctx: SourceCommandContext) {
this.suggestions = [];
}
exitSourceCommand(ctx: SourceCommandContext) {
if (ctx.exception) {
this.suggestions = sourceCommandsDefinitions;
} else if (!this.hasSuggestions) {
this.suggestions = this.getEndCommandSuggestions();
}
}
exitSourceIdentifier(ctx: SourceIdentifierContext) {
if (!ctx.childCount) {
this.suggestions = [DynamicAutocompleteItem.SourceIdentifier];
} else if (!ctx.exception && ctx.text) {
this.userDefinedVariables.sourceIdentifiers.push(ctx.text);
}
}
enterProcessingCommand(ctx: ProcessingCommandContext) {
this.tables.push([]);
this.suggestions = [];
this.parentContext = undefined;
}
exitProcessingCommand(ctx: ProcessingCommandContext) {
if (ctx.exception) {
this.suggestions = processingCommandsDefinitions;
}
this.parentContext = undefined;
}
enterStatsCommand(ctx: StatsCommandContext) {
this.suggestions = [];
this.parentContext = ESQLParser.STATS;
}
enterEvalCommand(ctx: EvalCommandContext) {
this.suggestions = [];
this.parentContext = ESQLParser.EVAL;
}
exitStatsCommand(ctx: StatsCommandContext) {
const qn = ctx.qualifiedNames();
if (qn && qn.text) {
this.suggestions = this.getEndCommandSuggestions([byOperatorDefinition]);
}
}
exitQualifiedName(ctx: QualifiedNameContext) {
if (
ctx
.identifier()
.some(
(i) =>
!(
this.isTerminalNodeExists(i.QUOTED_IDENTIFIER()) ||
this.isTerminalNodeExists(i.UNQUOTED_IDENTIFIER())
)
)
) {
this.suggestions = this.fields;
}
}
enterField(ctx: FieldContext) {
this.suggestions = [];
}
exitField(ctx: FieldContext) {
const hasAssign = this.isTerminalNodeExists(ctx.ASSIGN());
if (ctx.exception) {
if (!hasAssign) {
this.suggestions = [buildNewVarDefinition(this.getNewVarName())];
return;
}
} else {
if (!hasAssign) {
this.suggestions = [assignOperatorDefinition];
}
}
}
exitUserVariable(ctx: UserVariableContext) {
if (!ctx.exception && ctx.text) {
this.tables.at(-1)?.push(ctx.text);
}
}
enterBooleanExpression(ctx: BooleanExpressionContext) {
this.suggestions = [];
}
exitBooleanExpression(ctx: BooleanExpressionContext) {
if (ctx.exception) {
const ve = ctx.valueExpression();
if (!ve) {
if (this.parentContext === ESQLParser.STATS) {
this.suggestions = [...aggregationFunctionsDefinitions, ...this.fields];
return;
}
if (this.parentContext === ESQLParser.EVAL) {
this.suggestions = [roundCommandDefinition, ...this.fields];
return;
}
}
}
}
exitValueExpression(ctx: ValueExpressionContext) {
const isInStats = this.parentContext === ESQLParser.STATS;
const isInEval = this.parentContext === ESQLParser.EVAL;
if (this.parentContext && (isInStats || isInEval)) {
const hasFN = ctx.tryGetToken(esql_parser.UNARY_FUNCTION, 0);
const hasLP = ctx.tryGetToken(esql_parser.LP, 0);
const hasRP = ctx.tryGetToken(esql_parser.RP, 0);
if (hasFN) {
if (!hasLP) {
this.suggestions = [openBracketDefinition];
return;
}
if (!hasRP) {
if (ctx.childCount === 3) {
this.suggestions = [closeBracketDefinition, ...this.fields];
return;
}
}
} else {
if (ctx.childCount === 1) {
this.suggestions = [
...this.getEndCommandSuggestions(),
...(isInEval ? mathOperatorsCommandsDefinitions : []),
];
return;
}
}
this.suggestions = this.fields;
}
}
enterWhereCommand(ctx: WhereCommandContext) {
this.suggestions = [];
this.parentContext = ESQLParser.WHERE;
}
exitWhereCommand(ctx: WhereCommandContext) {
const booleanExpression = ctx.booleanExpression();
if (booleanExpression.exception) {
this.suggestions = this.fields;
return;
} else {
const innerBooleanExpressions = booleanExpression.getRuleContexts(BooleanExpressionContext);
if (innerBooleanExpressions.some((be) => be.exception)) {
this.suggestions = this.fields;
return;
}
}
if (!this.hasSuggestions) {
this.suggestions = comparisonCommandsDefinitions;
}
}
exitComparison(ctx: ComparisonContext) {
const operatorExpression = ctx.operatorExpression();
if (operatorExpression.some((o) => o.exception)) {
this.suggestions = this.fields;
return;
}
this.suggestions = [
...comparisonOperatorsCommandsDefinitions,
...this.getEndCommandSuggestions(),
];
}
exitOrderExpression(ctx: OrderExpressionContext) {
if (ctx.booleanExpression().exception) {
this.suggestions = this.fields;
return;
}
if (!this.isTerminalNodeExists(ctx.ORDERING())) {
this.suggestions = orderingCommandsDefinitions;
return;
}
if (!this.isTerminalNodeExists(ctx.NULLS_ORDERING())) {
this.suggestions = [nullsCommandsDefinition];
return;
}
if (!this.isTerminalNodeExists(ctx.NULLS_ORDERING_DIRECTION())) {
this.suggestions = nullsOrderingCommandsDefinitions;
return;
}
}
exitLimitCommand(ctx: LimitCommandContext) {
const DEFAULT_LIMIT_SIZE = 1000;
if (!this.isTerminalNodeExists(ctx.INTEGER_LITERAL())) {
this.suggestions = buildConstantsDefinitions([DEFAULT_LIMIT_SIZE.toString()], '');
} else {
this.suggestions = this.getEndCommandSuggestions();
}
}
}

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export enum DynamicAutocompleteItem {
SourceIdentifier = 'SourceIdentifier',
FieldIdentifier = 'FieldIdentifier',
}
export function isDynamicAutocompleteItem(v: unknown): v is DynamicAutocompleteItem {
return (
v === DynamicAutocompleteItem.SourceIdentifier || v === DynamicAutocompleteItem.FieldIdentifier
);
}

View file

@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { monaco } from '../../../..';
/** @public **/
export interface ESQLCustomAutocompleteCallbacks {
getSourceIdentifiers?: CallbackFn;
getFieldsIdentifiers?: CallbackFn;
}
/** @internal **/
type CallbackFn = (ctx: {
word: string;
userDefinedVariables: UserDefinedVariables;
}) => string[] | Promise<string[]>;
/** @internal **/
export interface UserDefinedVariables {
sourceIdentifiers: string[];
}
/** @internal **/
export type AutocompleteCommandDefinition = Pick<
monaco.languages.CompletionItem,
'label' | 'insertText' | 'kind' | 'detail' | 'documentation' | 'sortText'
>;

View file

@ -0,0 +1,111 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { monaco } from '../../../monaco_imports';
import { DynamicAutocompleteItem, isDynamicAutocompleteItem } from '../autocomplete/dymanic_item';
import {
buildFieldsDefinitions,
buildSourcesDefinitions,
} from '../autocomplete/autocomplete_definitions/dynamic_commands';
import type {
AutocompleteCommandDefinition,
ESQLCustomAutocompleteCallbacks,
UserDefinedVariables,
} from '../autocomplete/types';
import type { ESQLWorker } from '../../worker/esql_worker';
const emptyCompletionList: monaco.languages.CompletionList = {
incomplete: false,
suggestions: [],
};
export class ESQLCompletionAdapter implements monaco.languages.CompletionItemProvider {
constructor(
private worker: (...uris: monaco.Uri[]) => Promise<ESQLWorker>,
private callbacks?: ESQLCustomAutocompleteCallbacks
) {}
public triggerCharacters = ['(', ' ', ''];
private async injectDynamicAutocompleteItems(
suggestions: Array<AutocompleteCommandDefinition | DynamicAutocompleteItem>,
ctx: {
word: string;
userDefinedVariables: UserDefinedVariables;
}
): Promise<AutocompleteCommandDefinition[]> {
let result: AutocompleteCommandDefinition[] = [];
for (const suggestion of suggestions) {
if (isDynamicAutocompleteItem(suggestion)) {
let dynamicItems: AutocompleteCommandDefinition[] = [];
if (suggestion === DynamicAutocompleteItem.SourceIdentifier) {
dynamicItems = buildSourcesDefinitions(
(await this.callbacks?.getSourceIdentifiers?.(ctx)) ?? []
);
}
if (suggestion === DynamicAutocompleteItem.FieldIdentifier) {
dynamicItems = buildFieldsDefinitions(
(await this.callbacks?.getFieldsIdentifiers?.(ctx)) ?? []
);
}
result = [...result, ...dynamicItems];
} else {
result = [...result, suggestion];
}
}
return result;
}
async provideCompletionItems(
model: monaco.editor.IReadOnlyModel,
position: monaco.Position
): Promise<monaco.languages.CompletionList> {
const lines = model.getLineCount();
if (
lines !== position.lineNumber ||
model.getLineContent(position.lineNumber).trimEnd().length >= position.column
) {
return emptyCompletionList;
}
const worker = await this.worker(model.uri);
const wordInfo = model.getWordUntilPosition(position);
const providedSuggestions = await worker.provideAutocompleteSuggestions(model.uri.toString(), {
word: wordInfo.word,
line: position.lineNumber,
index: position.column,
});
const withDynamicItems = providedSuggestions
? await this.injectDynamicAutocompleteItems(providedSuggestions.suggestions, {
word: wordInfo.word,
userDefinedVariables: providedSuggestions.userDefinedVariables,
})
: [];
return {
incomplete: true,
suggestions: withDynamicItems.map((i) => ({
...i,
range: {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: wordInfo.startColumn,
endColumn: wordInfo.endColumn,
},
})),
};
}
}

View file

@ -39,6 +39,14 @@ export const buildESQlTheme = (): monaco.editor.IStandaloneThemeData => ({
'quoted_identifier',
'src_ws',
'unquoted_identifier',
'pipe',
'not',
'percent',
'integer_literal',
'decimal_literal',
'src_unquoted_identifier',
'src_quoted_identifier',
'string',
],
euiThemeVars.euiTextColor
),
@ -52,79 +60,24 @@ export const buildESQlTheme = (): monaco.editor.IStandaloneThemeData => ({
'sort',
'by',
'where',
'unknown_cmd',
'expr_ws',
'row',
'limit',
'asc',
'desc',
'nulls_ordering_direction',
'nulls_ordering',
'null',
'boolean_value',
'comparison_operator',
],
euiThemeVars.euiColorPrimaryText
),
// math functions
...buildRuleGroup(
[
'round_function_math',
'avg_function_math',
'sum_function_math',
'min_function_math',
'max_function_math',
],
euiThemeVars.euiColorPrimaryText
),
// values
...buildRuleGroup(
[
'pipe',
'true',
'not',
'null',
'nulls',
'false',
'src_unquoted_identifier',
'src_quoted_identifier',
'string',
],
euiThemeVars.euiTextColor
),
// values #2
...buildRuleGroup(
[
'true',
'not',
'null',
'nulls',
'false',
'not',
'null',
'percent',
'integer_literal',
'decimal_literal',
],
euiThemeVars.euiTextColor
),
...buildRuleGroup(['unary_function'], euiThemeVars.euiColorPrimaryText),
// operators
...buildRuleGroup(
[
'or',
'and',
'rp',
'eq',
'neq',
'lp',
'lt',
'lte',
'gt',
'gte',
'plus',
'minus',
'asterisk',
'slash',
],
['or', 'and', 'rp', 'lp', 'plus', 'minus', 'asterisk', 'slash'],
euiThemeVars.euiTextSubduedColor
),

View file

@ -8,8 +8,9 @@
import { CharStreams } from 'antlr4ts';
import { monaco } from '../../monaco_imports';
import { AutocompleteListener } from '../lib/autocomplete/autocomplete_listener';
import type { BaseWorkerDefinition } from '../../types';
import { getParser } from '../lib/antlr_facade';
import { getParser, ROOT_STATEMENT } from '../lib/antlr_facade';
import { ANTLREErrorListener } from '../../common/error_listener';
export class ESQLWorker implements BaseWorkerDefinition {
@ -19,23 +20,47 @@ export class ESQLWorker implements BaseWorkerDefinition {
this._ctx = ctx;
}
private getTextDocument(modelUri: string): string | undefined {
private getModelCharStream(modelUri: string) {
const model = this._ctx.getMirrorModels().find((m) => m.uri.toString() === modelUri);
const text = model?.getValue();
return model?.getValue();
if (text) {
return CharStreams.fromString(text);
}
}
public async getSyntaxErrors(modelUri: string) {
const code = this.getTextDocument(modelUri);
const inputStream = this.getModelCharStream(modelUri);
if (code) {
const inputStream = CharStreams.fromString(code);
if (inputStream) {
const errorListener = new ANTLREErrorListener();
const parser = getParser(inputStream, errorListener);
parser.singleStatement();
parser[ROOT_STATEMENT]();
return errorListener.getErrors();
}
return [];
}
public async provideAutocompleteSuggestions(
modelUri: string,
meta: {
word: string;
line: number;
index: number;
}
) {
const inputStream = this.getModelCharStream(modelUri);
if (inputStream) {
const errorListener = new ANTLREErrorListener();
const parseListener = new AutocompleteListener();
const parser = getParser(inputStream, errorListener, parseListener);
parser[ROOT_STATEMENT]();
return parseListener.getAutocompleteSuggestions();
}
}
}

View file

@ -7,13 +7,13 @@
*/
import type { Observable } from 'rxjs';
import { monaco } from './monaco_imports';
export interface LangModuleType {
ID: string;
lexerRules?: monaco.languages.IMonarchLanguage;
languageConfiguration?: monaco.languages.LanguageConfiguration;
getSuggestionProvider?: Function;
}
export interface CompleteLangModuleType extends LangModuleType {