@elastic/monaco-esql 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ export declare const commands: string[];
2
+ export declare const options: string[];
3
+ export declare const literals: string[];
4
+ export declare const functions: string[];
5
+ export declare const delimiters: string[];
6
+ export declare const operators: {
7
+ named: {
8
+ binary: string[];
9
+ other: string[];
10
+ };
11
+ };
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operators = exports.delimiters = exports.functions = exports.literals = exports.options = exports.commands = void 0;
4
+ exports.commands = [
5
+ "DISSECT",
6
+ "DROP",
7
+ "ENRICH",
8
+ "EVAL",
9
+ "EXPLAIN",
10
+ "FORK",
11
+ "FROM",
12
+ "FULL JOIN",
13
+ "GROK",
14
+ "INFO",
15
+ "INLINESTATS",
16
+ "JOIN",
17
+ "KEEP",
18
+ "LEFT JOIN",
19
+ "LEFT",
20
+ "LIMIT",
21
+ "LOOKUP JOIN",
22
+ "LOOKUP",
23
+ "METRICS",
24
+ "MV_EXPAND",
25
+ "RENAME",
26
+ "RIGHT JOIN",
27
+ "RIGHT",
28
+ "ROW",
29
+ "SHOW INFO",
30
+ "SHOW",
31
+ "SORT",
32
+ "STATS",
33
+ "WHERE",
34
+ ];
35
+ exports.options = ["BY", "ON", "WITH", "METADATA", "WHERE"];
36
+ exports.literals = ["TRUE", "FALSE", "NULL"];
37
+ exports.functions = [
38
+ "ABS",
39
+ "ACOS",
40
+ "ASIN",
41
+ "ATAN",
42
+ "ATAN2",
43
+ "AVG",
44
+ "BIT_LENGTH",
45
+ "BUCKET",
46
+ "BYTE_LENGTH",
47
+ "CASE",
48
+ "CATEGORIZE",
49
+ "CBRT",
50
+ "CEIL",
51
+ "CIDR_MATCH",
52
+ "COALESCE",
53
+ "CONCAT",
54
+ "COS",
55
+ "COSH",
56
+ "COUNT_DISTINCT",
57
+ "COUNT",
58
+ "DATE_DIFF",
59
+ "DATE_EXTRACT",
60
+ "DATE_FORMAT",
61
+ "DATE_PARSE",
62
+ "DATE_TRUNC",
63
+ "E",
64
+ "ENDS_WITH",
65
+ "EXP",
66
+ "FLOOR",
67
+ "FROM_BASE64",
68
+ "GREATEST",
69
+ "HASH",
70
+ "HYPOT",
71
+ "IP_PREFIX",
72
+ "LEAST",
73
+ "LEFT",
74
+ "LENGTH",
75
+ "LOCATE",
76
+ "LOG",
77
+ "LOG10",
78
+ "LTRIM",
79
+ "MATCH",
80
+ "MAX",
81
+ "MEDIAN_ABSOLUTE_DEVIATION",
82
+ "MEDIAN",
83
+ "MIN",
84
+ "MV_APPEND",
85
+ "MV_AVG",
86
+ "MV_CONCAT",
87
+ "MV_COUNT",
88
+ "MV_DEDUPE",
89
+ "MV_FIRST",
90
+ "MV_LAST",
91
+ "MV_MAX",
92
+ "MV_MEDIAN_ABSOLUTE_DEVIATION",
93
+ "MV_MEDIAN",
94
+ "MV_MIN",
95
+ "MV_PERCENTILE",
96
+ "MV_PSERIES_WEIGHTED_SUM",
97
+ "MV_SLICE",
98
+ "MV_SORT",
99
+ "MV_SUM",
100
+ "MV_ZIP",
101
+ "NOW",
102
+ "PERCENTILE",
103
+ "PI",
104
+ "POW",
105
+ "QSTR",
106
+ "REPEAT",
107
+ "REPLACE",
108
+ "REVERSE",
109
+ "RIGHT",
110
+ "ROUND",
111
+ "RTRIM",
112
+ "SIGNUM",
113
+ "SIN",
114
+ "SINH",
115
+ "SPACE",
116
+ "SPLIT",
117
+ "SQRT",
118
+ "ST_CENTROID_AGG",
119
+ "ST_CONTAINS",
120
+ "ST_DISJOINT",
121
+ "ST_DISTANCE",
122
+ "ST_ENVELOPE",
123
+ "ST_EXTENT_AGG",
124
+ "ST_INTERSECTS",
125
+ "ST_WITHIN",
126
+ "ST_X",
127
+ "ST_XMAX",
128
+ "ST_XMIN",
129
+ "ST_Y",
130
+ "ST_YMAX",
131
+ "ST_YMIN",
132
+ "STARTS_WITH",
133
+ "STD_DEV",
134
+ "SUBSTRING",
135
+ "SUM",
136
+ "TAN",
137
+ "TANH",
138
+ "TAU",
139
+ "TO_BASE64",
140
+ "TO_BOOLEAN",
141
+ "TO_CARTESIANPOINT",
142
+ "TO_CARTESIANSHAPE",
143
+ "TO_DATE_NANOS",
144
+ "TO_DATEPERIOD",
145
+ "TO_DATETIME",
146
+ "TO_DEGREES",
147
+ "TO_DOUBLE",
148
+ "TO_GEOPOINT",
149
+ "TO_GEOSHAPE",
150
+ "TO_INTEGER",
151
+ "TO_IP",
152
+ "TO_LONG",
153
+ "TO_LOWER",
154
+ "TO_RADIANS",
155
+ "TO_STRING",
156
+ "TO_TIMEDURATION",
157
+ "TO_UNSIGNED_LONG",
158
+ "TO_UPPER",
159
+ "TO_VERSION",
160
+ "TOP",
161
+ "TRIM",
162
+ "VALUES",
163
+ "WEIGHTED_AVG",
164
+ ];
165
+ exports.delimiters = [
166
+ "/",
167
+ ".",
168
+ ",",
169
+ "=~",
170
+ "<=",
171
+ ">=",
172
+ "==",
173
+ "!=",
174
+ "===",
175
+ "!==",
176
+ "=>",
177
+ "+",
178
+ "-",
179
+ "**",
180
+ "*",
181
+ "/",
182
+ "%",
183
+ "++",
184
+ "--",
185
+ "<<",
186
+ "</",
187
+ ">>",
188
+ ">>>",
189
+ "&",
190
+ "|",
191
+ "^",
192
+ "!",
193
+ "~",
194
+ "&&",
195
+ "||",
196
+ "?",
197
+ ":",
198
+ "=",
199
+ "+=",
200
+ "-=",
201
+ "*=",
202
+ "**=",
203
+ "/=",
204
+ "%=",
205
+ "<<=",
206
+ ">>=",
207
+ ">>>=",
208
+ "&=",
209
+ "|=",
210
+ "^=",
211
+ "@",
212
+ ];
213
+ exports.operators = {
214
+ named: {
215
+ binary: ["AND", "OR", "IS", "IN", "AS", "LIKE", "RLIKE"],
216
+ other: ["ASC", "DESC", "FIRST", "LAST", "NULLS", "NOT"],
217
+ },
218
+ };
package/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { monarchLanguage } from "./monarch";
1
+ export * as monarch from "./monarch";
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.monarchLanguage = void 0;
4
- var monarch_1 = require("./monarch");
5
- Object.defineProperty(exports, "monarchLanguage", { enumerable: true, get: function () { return monarch_1.monarchLanguage; } });
3
+ exports.monarch = void 0;
4
+ const tslib_1 = require("tslib");
5
+ exports.monarch = tslib_1.__importStar(require("./monarch"));
@@ -0,0 +1 @@
1
+ export declare const language: import("monaco-editor").languages.IMonarchLanguage;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.language = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const monarch_1 = require("./monarch");
6
+ const definitions = tslib_1.__importStar(require("./definitions"));
7
+ exports.language = (0, monarch_1.create)(definitions);
package/lib/monarch.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import type { languages } from "monaco-editor";
2
- export declare const monarchLanguage: languages.IMonarchLanguage;
2
+ export type CreateDependencies = Partial<typeof import("./definitions")>;
3
+ export declare const create: (deps?: CreateDependencies) => languages.IMonarchLanguage;
package/lib/monarch.js CHANGED
@@ -1,360 +1,156 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.monarchLanguage = void 0;
4
- const commands = [
5
- "DISSECT",
6
- "DROP",
7
- "ENRICH",
8
- "EVAL",
9
- "EXPLAIN",
10
- "FORK",
11
- "FROM",
12
- "FULL JOIN",
13
- "GROK",
14
- "INFO",
15
- "INLINESTATS",
16
- "JOIN",
17
- "KEEP",
18
- "LEFT JOIN",
19
- "LEFT",
20
- "LIMIT",
21
- "LOOKUP JOIN",
22
- "LOOKUP",
23
- "METRICS",
24
- "MV_EXPAND",
25
- "RENAME",
26
- "RIGHT JOIN",
27
- "RIGHT",
28
- "ROW",
29
- "SHOW INFO",
30
- "SHOW",
31
- "SORT",
32
- "STATS",
33
- "WHERE",
34
- ];
35
- const options = ["BY", "ON", "WITH", "METADATA", "WHERE"];
36
- const literals = ["TRUE", "FALSE", "NULL"];
37
- const functions = [
38
- "ABS",
39
- "ACOS",
40
- "ASIN",
41
- "ATAN",
42
- "ATAN2",
43
- "AVG",
44
- "BIT_LENGTH",
45
- "BUCKET",
46
- "BYTE_LENGTH",
47
- "CASE",
48
- "CATEGORIZE",
49
- "CBRT",
50
- "CEIL",
51
- "CIDR_MATCH",
52
- "COALESCE",
53
- "CONCAT",
54
- "COS",
55
- "COSH",
56
- "COUNT_DISTINCT",
57
- "COUNT",
58
- "DATE_DIFF",
59
- "DATE_EXTRACT",
60
- "DATE_FORMAT",
61
- "DATE_PARSE",
62
- "DATE_TRUNC",
63
- "E",
64
- "ENDS_WITH",
65
- "EXP",
66
- "FLOOR",
67
- "FROM_BASE64",
68
- "GREATEST",
69
- "HASH",
70
- "HYPOT",
71
- "IP_PREFIX",
72
- "LEAST",
73
- "LEFT",
74
- "LENGTH",
75
- "LOCATE",
76
- "LOG",
77
- "LOG10",
78
- "LTRIM",
79
- "MATCH",
80
- "MAX",
81
- "MEDIAN_ABSOLUTE_DEVIATION",
82
- "MEDIAN",
83
- "MIN",
84
- "MV_APPEND",
85
- "MV_AVG",
86
- "MV_CONCAT",
87
- "MV_COUNT",
88
- "MV_DEDUPE",
89
- "MV_FIRST",
90
- "MV_LAST",
91
- "MV_MAX",
92
- "MV_MEDIAN_ABSOLUTE_DEVIATION",
93
- "MV_MEDIAN",
94
- "MV_MIN",
95
- "MV_PERCENTILE",
96
- "MV_PSERIES_WEIGHTED_SUM",
97
- "MV_SLICE",
98
- "MV_SORT",
99
- "MV_SUM",
100
- "MV_ZIP",
101
- "NOW",
102
- "PERCENTILE",
103
- "PI",
104
- "POW",
105
- "QSTR",
106
- "REPEAT",
107
- "REPLACE",
108
- "REVERSE",
109
- "RIGHT",
110
- "ROUND",
111
- "RTRIM",
112
- "SIGNUM",
113
- "SIN",
114
- "SINH",
115
- "SPACE",
116
- "SPLIT",
117
- "SQRT",
118
- "ST_CENTROID_AGG",
119
- "ST_CONTAINS",
120
- "ST_DISJOINT",
121
- "ST_DISTANCE",
122
- "ST_ENVELOPE",
123
- "ST_EXTENT_AGG",
124
- "ST_INTERSECTS",
125
- "ST_WITHIN",
126
- "ST_X",
127
- "ST_XMAX",
128
- "ST_XMIN",
129
- "ST_Y",
130
- "ST_YMAX",
131
- "ST_YMIN",
132
- "STARTS_WITH",
133
- "STD_DEV",
134
- "SUBSTRING",
135
- "SUM",
136
- "TAN",
137
- "TANH",
138
- "TAU",
139
- "TO_BASE64",
140
- "TO_BOOLEAN",
141
- "TO_CARTESIANPOINT",
142
- "TO_CARTESIANSHAPE",
143
- "TO_DATE_NANOS",
144
- "TO_DATEPERIOD",
145
- "TO_DATETIME",
146
- "TO_DEGREES",
147
- "TO_DOUBLE",
148
- "TO_GEOPOINT",
149
- "TO_GEOSHAPE",
150
- "TO_INTEGER",
151
- "TO_IP",
152
- "TO_LONG",
153
- "TO_LOWER",
154
- "TO_RADIANS",
155
- "TO_STRING",
156
- "TO_TIMEDURATION",
157
- "TO_UNSIGNED_LONG",
158
- "TO_UPPER",
159
- "TO_VERSION",
160
- "TOP",
161
- "TRIM",
162
- "VALUES",
163
- "WEIGHTED_AVG",
164
- ];
165
- const delimiters = [
166
- "/",
167
- ".",
168
- ",",
169
- "=~",
170
- "<=",
171
- ">=",
172
- "==",
173
- "!=",
174
- "===",
175
- "!==",
176
- "=>",
177
- "+",
178
- "-",
179
- "**",
180
- "*",
181
- "/",
182
- "%",
183
- "++",
184
- "--",
185
- "<<",
186
- "</",
187
- ">>",
188
- ">>>",
189
- "&",
190
- "|",
191
- "^",
192
- "!",
193
- "~",
194
- "&&",
195
- "||",
196
- "?",
197
- ":",
198
- "=",
199
- "+=",
200
- "-=",
201
- "*=",
202
- "**=",
203
- "/=",
204
- "%=",
205
- "<<=",
206
- ">>=",
207
- ">>>=",
208
- "&=",
209
- "|=",
210
- "^=",
211
- "@",
212
- ];
213
- const binaryNamedOperators = ["AND", "OR", "IS", "IN", "AS", "LIKE", "RLIKE"];
214
- const otherNamedOperators = ["ASC", "DESC", "FIRST", "LAST", "NULLS", "NOT"];
215
- exports.monarchLanguage = {
216
- // Uncomment when developing.
217
- // defaultToken: "invalid",
218
- // ES|QL is case-insensitive.
219
- ignoreCase: true,
220
- // Lists of known language keywords and built-ins.
221
- commands,
222
- options,
223
- literals,
224
- functions,
225
- delimiters,
226
- namedOperators: [...binaryNamedOperators, ...otherNamedOperators],
227
- // Pre-defined regular expressions.
228
- escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
229
- digits: /\d+(_+\d+)*/,
230
- brackets: [
231
- { open: "[", close: "]", token: "delimiter.square" },
232
- { open: "(", close: ")", token: "delimiter.parenthesis" },
233
- { open: "{", close: "}", token: "delimiter.curly" },
234
- { open: "<", close: ">", token: "delimiter.angle" },
235
- ],
236
- tokenizer: {
237
- root: [
238
- { include: "@whitespace" },
239
- // Keywords
240
- [
241
- /[a-zA-Z_$][\w$]*/,
242
- {
243
- cases: {
244
- "@commands": { token: "keyword.command.$0" },
245
- "@options": { token: "keyword.option.$0" },
246
- "@literals": { token: "keyword.literal.$0" },
247
- "@functions": { token: "identifier.function.$0" },
248
- "@namedOperators": { token: "keyword.operator.$0" },
249
- "@default": "identifier",
3
+ exports.create = void 0;
4
+ const create = (deps = {}) => {
5
+ const { commands = [], options = [], literals = [], functions = [], delimiters = [], } = deps;
6
+ return {
7
+ // Uncomment when developing.
8
+ // defaultToken: "invalid",
9
+ // ES|QL is case-insensitive.
10
+ ignoreCase: true,
11
+ // Lists of known language keywords and built-ins.
12
+ commands,
13
+ options,
14
+ literals,
15
+ functions,
16
+ delimiters,
17
+ namedOperators: [
18
+ ...(deps.operators?.named?.binary ?? []),
19
+ ...(deps.operators?.named?.other ?? []),
20
+ ],
21
+ // Pre-defined regular expressions.
22
+ escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
23
+ digits: /\d+(_+\d+)*/,
24
+ brackets: [
25
+ { open: "[", close: "]", token: "delimiter.square" },
26
+ { open: "(", close: ")", token: "delimiter.parenthesis" },
27
+ { open: "{", close: "}", token: "delimiter.curly" },
28
+ { open: "<", close: ">", token: "delimiter.angle" },
29
+ ],
30
+ tokenizer: {
31
+ root: [
32
+ { include: "@whitespace" },
33
+ // Keywords
34
+ [
35
+ /[a-zA-Z_$][\w$]*/,
36
+ {
37
+ cases: {
38
+ "@commands": { token: "keyword.command.$0" },
39
+ "@options": { token: "keyword.option.$0" },
40
+ "@literals": { token: "keyword.literal.$0" },
41
+ "@functions": { token: "identifier.function.$0" },
42
+ "@namedOperators": { token: "keyword.operator.$0" },
43
+ "@default": "identifier",
44
+ },
250
45
  },
251
- },
252
- ],
253
- { include: "@expression" },
254
- { include: "@processingCommand" },
255
- [/\[|\(|\)|\]/, "@brackets"],
256
- [
257
- /[^\s]+/,
258
- {
259
- cases: {
260
- "@delimiters": "delimiter",
46
+ ],
47
+ { include: "@expression" },
48
+ { include: "@processingCommand" },
49
+ [/\[|\(|\)|\]/, "@brackets"],
50
+ [
51
+ /[^\s]+/,
52
+ {
53
+ cases: {
54
+ "@delimiters": "delimiter",
55
+ },
261
56
  },
262
- },
57
+ ],
263
58
  ],
264
- ],
265
- // --------------------------------- Hidden channel: whitespace and comments
266
- whitespace: [
267
- [/[ \t\r\n]+/, ""],
268
- [/\/\*\*(?!\/)/, "comment.doc", "@doc"],
269
- [/\/\*/, "comment", "@comment"],
270
- [/\/\/.*$/, "comment"],
271
- ],
272
- comment: [
273
- [/[^\/*]+/, "comment"],
274
- [/\*\//, "comment", "@pop"],
275
- [/[\/*]/, "comment"],
276
- ],
277
- doc: [
278
- [/[^\/*]+/, "comment.doc"],
279
- [/\*\//, "comment.doc", "@pop"],
280
- [/[\/*]/, "comment.doc"],
281
- ],
282
- // ---------------------------------------------------------------- Commands
283
- // This code block allows to color commands when they are followed by a pipe
284
- // character "|", this way all new processing commands are color even if
285
- // they are not part of the command name list.
286
- processingCommand: [
287
- [
288
- /\|/,
289
- { token: "delimiter.pipe", switchTo: "@beforeMnemonicWhitespace" },
59
+ // --------------------------------- Hidden channel: whitespace and comments
60
+ whitespace: [
61
+ [/[ \t\r\n]+/, ""],
62
+ [/\/\*\*(?!\/)/, "comment.doc", "@doc"],
63
+ [/\/\*/, "comment", "@comment"],
64
+ [/\/\/.*$/, "comment"],
290
65
  ],
291
- ],
292
- beforeMnemonicWhitespace: [
293
- { include: "@whitespace" },
294
- ["", { token: "", switchTo: "@commandName" }],
295
- ],
296
- // Matches *command name*, i.e. the mnemonic.
297
- commandName: [
298
- // First tries to match all known command names.
299
- [
300
- commands.join("|"),
301
- { token: "keyword.command.name", switchTo: "@root" },
66
+ comment: [
67
+ [/[^\/*]+/, "comment"],
68
+ [/\*\//, "comment", "@pop"],
69
+ [/[\/*]/, "comment"],
302
70
  ],
303
- // If command name is not well known, just matches the first word.
304
- [/\w+\b/, { token: "keyword.command.name", switchTo: "@root" }],
305
- ],
306
- // ------------------------------------------------------------- Expressions
307
- expression: [
308
- { include: "@whitespace" },
309
- { include: "@literal" },
310
- // Inline casts: 1.3::INTEGER
311
- [/::\w+\b/, "type"],
312
- // strings
313
- [/"""/, "string.triple", "@string_triple"],
314
- [/"([^"\\]|\\.)*$/, "string.invalid"], // non-terminated string
315
- [/'([^'\\]|\\.)*$/, "string.invalid"], // non-terminated string
316
- [/"/, "string", "@string"],
317
- // Escaped column parts: nested.`escaped`.column
318
- [/`/, "string", "@column_escape_part"],
319
- ],
320
- literal: [
321
- { include: "@number" },
322
- // Params
323
- [
324
- /\?{1,9}(([a-zA-Z_][a-zA-Z_0-9]+)|[0-9]+)?/,
325
- {
326
- cases: {
327
- "\\?{1,9}": "variable.name.unnamed",
328
- "\\?{1,9}([a-zA-Z_][a-zA-Z_0-9]+)?": "variable.name.named",
329
- "\\?{1,9}([0-9]+)?": "variable.name.positional",
71
+ doc: [
72
+ [/[^\/*]+/, "comment.doc"],
73
+ [/\*\//, "comment.doc", "@pop"],
74
+ [/[\/*]/, "comment.doc"],
75
+ ],
76
+ // ---------------------------------------------------------------- Commands
77
+ // This code block allows to color commands when they are followed by a pipe
78
+ // character "|", this way all new processing commands are color even if
79
+ // they are not part of the command name list.
80
+ processingCommand: [
81
+ [
82
+ /\|/,
83
+ { token: "delimiter.pipe", switchTo: "@beforeMnemonicWhitespace" },
84
+ ],
85
+ ],
86
+ beforeMnemonicWhitespace: [
87
+ { include: "@whitespace" },
88
+ ["", { token: "", switchTo: "@commandName" }],
89
+ ],
90
+ // Matches *command name*, i.e. the mnemonic.
91
+ commandName: [
92
+ // First tries to match all known command names.
93
+ [
94
+ commands.join("|"),
95
+ { token: "keyword.command.name", switchTo: "@root" },
96
+ ],
97
+ // If command name is not well known, just matches the first word.
98
+ [/\w+\b/, { token: "keyword.command.name", switchTo: "@root" }],
99
+ ],
100
+ // ------------------------------------------------------------- Expressions
101
+ expression: [
102
+ { include: "@whitespace" },
103
+ { include: "@literal" },
104
+ // Inline casts: 1.3::INTEGER
105
+ [/::\w+\b/, "type"],
106
+ // strings
107
+ [/"""/, "string.triple", "@string_triple"],
108
+ [/"([^"\\]|\\.)*$/, "string.invalid"], // non-terminated string
109
+ [/'([^'\\]|\\.)*$/, "string.invalid"], // non-terminated string
110
+ [/"/, "string", "@string"],
111
+ // Escaped column parts: nested.`escaped`.column
112
+ [/`/, "string", "@column_escape_part"],
113
+ ],
114
+ literal: [
115
+ { include: "@number" },
116
+ // Params
117
+ [
118
+ /\?{1,9}(([a-zA-Z_][a-zA-Z_0-9]+)|[0-9]+)?/,
119
+ {
120
+ cases: {
121
+ "\\?{1,9}": "variable.name.unnamed",
122
+ "\\?{1,9}([a-zA-Z_][a-zA-Z_0-9]+)?": "variable.name.named",
123
+ "\\?{1,9}([0-9]+)?": "variable.name.positional",
124
+ },
330
125
  },
331
- },
126
+ ],
332
127
  ],
333
- ],
334
- number: [
335
- [/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
336
- [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
337
- [/(@digits)/, "number"],
338
- ],
339
- // Single double-quote strings: "str"
340
- string: [
341
- [/[^\\"]+/, "string"],
342
- [/@escapes/, "string.escape"],
343
- [/\\./, "string.escape.invalid"],
344
- [/"/, "string", "@pop"],
345
- ],
346
- // Triple double-quoted strings: """str"""
347
- string_triple: [
348
- [/"""/, "string.triple", "@pop"],
349
- [/[^"]+/, "string.triple"],
350
- ],
351
- // Backtick quoted "strings". ES|QL does not have back-tick "strings"
352
- // *per se*, but column parts can have backtick-escaped parts.
353
- column_escape_part: [
354
- [/[^`]+/, "string"],
355
- [/@escapes/, "string.escape"],
356
- [/\\./, "string.escape.invalid"],
357
- [/`/, "string", "@pop"],
358
- ],
359
- },
128
+ number: [
129
+ [/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
130
+ [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
131
+ [/(@digits)/, "number"],
132
+ ],
133
+ // Single double-quote strings: "str"
134
+ string: [
135
+ [/[^\\"]+/, "string"],
136
+ [/@escapes/, "string.escape"],
137
+ [/\\./, "string.escape.invalid"],
138
+ [/"/, "string", "@pop"],
139
+ ],
140
+ // Triple double-quoted strings: """str"""
141
+ string_triple: [
142
+ [/"""/, "string.triple", "@pop"],
143
+ [/[^"]+/, "string.triple"],
144
+ ],
145
+ // Backtick quoted "strings". ES|QL does not have back-tick "strings"
146
+ // *per se*, but column parts can have backtick-escaped parts.
147
+ column_escape_part: [
148
+ [/[^`]+/, "string"],
149
+ [/@escapes/, "string.escape"],
150
+ [/\\./, "string.escape.invalid"],
151
+ [/`/, "string", "@pop"],
152
+ ],
153
+ },
154
+ };
360
155
  };
156
+ exports.create = create;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/monaco-esql",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"