();
- const [filters, query, appliedTimeRange] = useBatchedPublishingSubjects(
- api.parentApi?.filters$,
- api.parentApi?.query$,
- appliedTimeRange$
- );
-
- useEffect(() => {
- return () => {
- subscriptions.unsubscribe();
- };
- }, []);
-
- useEffect(() => {
- let ignore = false;
- setError(undefined);
- if (!defaultDataView) {
- return;
- }
- dataLoading$.next(true);
- getCount(defaultDataView, services.data, filters ?? [], query, appliedTimeRange)
- .then((nextCount: number) => {
- if (ignore) {
- return;
- }
- dataLoading$.next(false);
- setCount(nextCount);
- })
- .catch((err) => {
- if (ignore) {
- return;
- }
- dataLoading$.next(false);
- setError(err);
- });
- return () => {
- ignore = true;
- };
- }, [filters, query, appliedTimeRange]);
-
- if (!defaultDataView) {
- return (
-
- Please install a sample data set to run example.
-
- );
- }
-
- if (error) {
- return (
-
- {error.message}
-
- );
- }
-
- return (
-
- Found {count} from {defaultDataView.name}
-
- );
- },
- };
-};
diff --git a/examples/embeddable_examples/public/react_embeddables/search/constants.ts b/examples/embeddable_examples/public/react_embeddables/search/constants.ts
new file mode 100644
index 0000000000000..3ca6c976ef3c0
--- /dev/null
+++ b/examples/embeddable_examples/public/react_embeddables/search/constants.ts
@@ -0,0 +1,10 @@
+/*
+ * 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 const SEARCH_EMBEDDABLE_ID = 'searchEmbeddableDemo';
+export const ADD_SEARCH_ACTION_ID = 'create_search_demo';
diff --git a/examples/embeddable_examples/public/react_embeddables/search/register_add_search_panel_action.tsx b/examples/embeddable_examples/public/react_embeddables/search/register_add_search_panel_action.tsx
index d136a57fd7590..151fa07d77322 100644
--- a/examples/embeddable_examples/public/react_embeddables/search/register_add_search_panel_action.tsx
+++ b/examples/embeddable_examples/public/react_embeddables/search/register_add_search_panel_action.tsx
@@ -9,10 +9,11 @@
import { apiIsPresentationContainer } from '@kbn/presentation-containers';
import { EmbeddableApiContext } from '@kbn/presentation-publishing';
import { IncompatibleActionError, UiActionsStart } from '@kbn/ui-actions-plugin/public';
+import { ADD_SEARCH_ACTION_ID, SEARCH_EMBEDDABLE_ID } from './constants';
export const registerAddSearchPanelAction = (uiActions: UiActionsStart) => {
uiActions.registerAction({
- id: 'CREATE_SEARCH_REACT_EMBEDDABLE',
+ id: ADD_SEARCH_ACTION_ID,
getDisplayName: () => 'Unified search example',
getDisplayNameTooltip: () =>
'Demonstrates how to use global filters, global time range, panel time range, and global query state in an embeddable',
@@ -24,12 +25,12 @@ export const registerAddSearchPanelAction = (uiActions: UiActionsStart) => {
if (!apiIsPresentationContainer(embeddable)) throw new IncompatibleActionError();
embeddable.addNewPanel(
{
- panelType: 'SEARCH_REACT_EMBEDDABLE',
+ panelType: SEARCH_EMBEDDABLE_ID,
initialState: {},
},
true
);
},
});
- uiActions.attachAction('ADD_PANEL_TRIGGER', 'CREATE_SEARCH_REACT_EMBEDDABLE');
+ uiActions.attachAction('ADD_PANEL_TRIGGER', ADD_SEARCH_ACTION_ID);
};
diff --git a/examples/embeddable_examples/public/react_embeddables/search/register_search_embeddable_factory.ts b/examples/embeddable_examples/public/react_embeddables/search/register_search_embeddable_factory.ts
deleted file mode 100644
index a2b4bf7ac6282..0000000000000
--- a/examples/embeddable_examples/public/react_embeddables/search/register_search_embeddable_factory.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 {
- ReactEmbeddableFactory,
- registerReactEmbeddableFactory,
-} from '@kbn/embeddable-plugin/public';
-import { Api, Services, State } from './types';
-
-export const registerSearchEmbeddableFactory = (services: Services) => {
- const factory: ReactEmbeddableFactory = {
- type: 'SEARCH_REACT_EMBEDDABLE',
- deserializeState: (state) => {
- return state.rawState as State;
- },
- buildEmbeddable: async (state, buildApi) => {
- const { buildSearchEmbeddable } = await import('./build_search_embeddable');
- return buildSearchEmbeddable(state, buildApi, services);
- },
- };
-
- registerReactEmbeddableFactory(factory);
-};
diff --git a/examples/embeddable_examples/public/react_embeddables/search/search_react_embeddable.tsx b/examples/embeddable_examples/public/react_embeddables/search/search_react_embeddable.tsx
new file mode 100644
index 0000000000000..e2b9fdea7bbf3
--- /dev/null
+++ b/examples/embeddable_examples/public/react_embeddables/search/search_react_embeddable.tsx
@@ -0,0 +1,128 @@
+/*
+ * 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 { EuiCallOut } from '@elastic/eui';
+import { DataView } from '@kbn/data-views-plugin/common';
+import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
+import { initializeTimeRange, useBatchedPublishingSubjects } from '@kbn/presentation-publishing';
+import React, { useEffect, useState } from 'react';
+import { BehaviorSubject } from 'rxjs';
+import { SEARCH_EMBEDDABLE_ID } from './constants';
+import { getCount } from './get_count';
+import { Api, Services, State } from './types';
+
+export const getSearchEmbeddableFactory = (services: Services) => {
+ const factory: ReactEmbeddableFactory = {
+ type: SEARCH_EMBEDDABLE_ID,
+ deserializeState: (state) => {
+ return state.rawState as State;
+ },
+ buildEmbeddable: async (state, buildApi, uuid, parentApi) => {
+ const {
+ appliedTimeRange$,
+ cleanupTimeRange,
+ serializeTimeRange,
+ timeRangeApi,
+ timeRangeComparators,
+ } = initializeTimeRange(state, parentApi);
+ const defaultDataView = await services.dataViews.getDefaultDataView();
+ const dataViews$ = new BehaviorSubject(
+ defaultDataView ? [defaultDataView] : undefined
+ );
+ const dataLoading$ = new BehaviorSubject(false);
+
+ const api = buildApi(
+ {
+ ...timeRangeApi,
+ dataViews: dataViews$,
+ dataLoading: dataLoading$,
+ serializeState: () => {
+ return {
+ rawState: {
+ ...serializeTimeRange(),
+ },
+ references: [],
+ };
+ },
+ },
+ {
+ ...timeRangeComparators,
+ }
+ );
+
+ return {
+ api,
+ Component: () => {
+ const [count, setCount] = useState(0);
+ const [error, setError] = useState();
+ const [filters, query, appliedTimeRange] = useBatchedPublishingSubjects(
+ api.parentApi?.filters$,
+ api.parentApi?.query$,
+ appliedTimeRange$
+ );
+
+ useEffect(() => {
+ return () => {
+ cleanupTimeRange();
+ };
+ }, []);
+
+ useEffect(() => {
+ let ignore = false;
+ setError(undefined);
+ if (!defaultDataView) {
+ return;
+ }
+ dataLoading$.next(true);
+ getCount(defaultDataView, services.data, filters ?? [], query, appliedTimeRange)
+ .then((nextCount: number) => {
+ if (ignore) {
+ return;
+ }
+ dataLoading$.next(false);
+ setCount(nextCount);
+ })
+ .catch((err) => {
+ if (ignore) {
+ return;
+ }
+ dataLoading$.next(false);
+ setError(err);
+ });
+ return () => {
+ ignore = true;
+ };
+ }, [filters, query, appliedTimeRange]);
+
+ if (!defaultDataView) {
+ return (
+
+ Please install a sample data set to run example.
+
+ );
+ }
+
+ if (error) {
+ return (
+
+ {error.message}
+
+ );
+ }
+
+ return (
+
+ Found {count} from {defaultDataView.name}
+
+ );
+ },
+ };
+ },
+ };
+ return factory;
+};
diff --git a/examples/esql_validation_example/README.md b/examples/esql_validation_example/README.md
new file mode 100644
index 0000000000000..1f4232c13f4b5
--- /dev/null
+++ b/examples/esql_validation_example/README.md
@@ -0,0 +1,9 @@
+# esql_validation_example
+
+Examples of the ES|QL validation service.
+
+To run this example, start kibana with the `--run-examples` flag.
+
+```bash
+yarn start --run-examples
+```
\ No newline at end of file
diff --git a/examples/esql_validation_example/kibana.jsonc b/examples/esql_validation_example/kibana.jsonc
new file mode 100644
index 0000000000000..367f1920ce8b2
--- /dev/null
+++ b/examples/esql_validation_example/kibana.jsonc
@@ -0,0 +1,17 @@
+{
+ "type": "plugin",
+ "id": "@kbn/esql-validation-example-plugin",
+ "owner": "@elastic/kibana-esql",
+ "plugin": {
+ "id": "esqlValidationExample",
+ "server": false,
+ "browser": true,
+ "configPath": [
+ "esql_validation_example"
+ ],
+ "requiredPlugins": [
+ "dataViews",
+ "developerExamples"
+ ]
+ }
+ }
\ No newline at end of file
diff --git a/examples/esql_validation_example/public/app.tsx b/examples/esql_validation_example/public/app.tsx
new file mode 100644
index 0000000000000..918fbd6be79ab
--- /dev/null
+++ b/examples/esql_validation_example/public/app.tsx
@@ -0,0 +1,178 @@
+/*
+ * 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 React, { useEffect, useMemo, useState } from 'react';
+import {
+ EuiPage,
+ EuiPageBody,
+ EuiPageSection,
+ EuiPageHeader,
+ EuiSpacer,
+ EuiFieldText,
+ EuiCheckboxGroup,
+ EuiFormRow,
+ EuiSwitch,
+ EuiForm,
+ EuiCallOut,
+} from '@elastic/eui';
+
+import type { CoreStart } from '@kbn/core/public';
+
+import { ESQLCallbacks, validateQuery } from '@kbn/esql-validation-autocomplete';
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+import type { StartDependencies } from './plugin';
+import { CodeSnippet } from './code_snippet';
+
+export const App = (props: { core: CoreStart; plugins: StartDependencies }) => {
+ const [currentErrors, setErrors] = useState([]);
+ const [currentWarnings, setWarnings] = useState([]);
+ const [currentQuery, setQuery] = useState(
+ 'from index1 | eval var0 = round(numberField, 2) | stats by stringField'
+ );
+
+ const [ignoreErrors, setIgnoreErrors] = useState(false);
+ const [callbacksEnabled, setCallbacksEnabled] = useState<
+ Record<'sources' | 'fields' | 'policies' | 'metaFields', boolean>
+ >({
+ sources: false,
+ fields: true,
+ policies: true,
+ metaFields: true,
+ });
+
+ const callbacks: ESQLCallbacks = useMemo(
+ () => ({
+ getSources: callbacksEnabled.sources
+ ? async () =>
+ ['index1', 'anotherIndex', 'dataStream'].map((name) => ({ name, hidden: false }))
+ : undefined,
+ getFieldsFor: callbacksEnabled.fields
+ ? async () => [
+ { name: 'numberField', type: 'number' },
+ { name: 'stringField', type: 'string' },
+ ]
+ : undefined,
+ getMetaFields: callbacksEnabled.metaFields
+ ? async () => ['_version', '_id', '_index', '_source']
+ : undefined,
+ getPolicies: callbacksEnabled.policies
+ ? async () => [
+ {
+ name: 'my-policy',
+ sourceIndices: ['policyIndex'],
+ matchField: 'otherStringField',
+ enrichFields: ['otherNumberField'],
+ },
+ ]
+ : undefined,
+ }),
+ [callbacksEnabled]
+ );
+
+ useEffect(() => {
+ if (currentQuery === '') {
+ return;
+ }
+ validateQuery(
+ currentQuery,
+ getAstAndSyntaxErrors,
+ { ignoreOnMissingCallbacks: ignoreErrors },
+ callbacks
+ ).then(({ errors: validationErrors, warnings: validationWarnings }) => {
+ // syntax errors come with a slight different format than other validation errors
+ setErrors(validationErrors.map((e) => ('severity' in e ? e.message : e.text)));
+ setWarnings(validationWarnings.map((e) => e.text));
+ });
+ }, [currentQuery, ignoreErrors, callbacks]);
+
+ const checkboxes = [
+ {
+ id: 'sources',
+ label: 'getSources callback => index1, anotherIndex, dataStream',
+ },
+ {
+ id: 'fields',
+ label: 'getFieldsFor callback => numberField, stringField',
+ },
+ {
+ id: 'policies',
+ label: 'getPolicies callback => my-policy',
+ },
+ {
+ id: 'metaFields',
+ label: 'getMetaFields callback => _version, _id, _index, _source',
+ },
+ ];
+
+ return (
+
+
+
+
+ This app shows how to use the ES|QL validation API with all its options
+
+
+
+ {
+ setCallbacksEnabled({
+ ...callbacksEnabled,
+ [optionId]: !callbacksEnabled[optionId as keyof typeof callbacksEnabled],
+ });
+ }}
+ />
+
+
+
+
+ setIgnoreErrors(!ignoreErrors)}
+ />
+
+
+ 0}
+ error={currentErrors}
+ >
+ setQuery(e.target.value)}
+ isInvalid={currentErrors.length > 0}
+ />
+
+ {currentWarnings.length ? (
+
+ Here the list of warnings:
+
+ {currentWarnings.map((message) => (
+ - {message}
+ ))}
+
+
+ ) : null}
+
+
+
+
+
+
+ );
+};
diff --git a/examples/esql_validation_example/public/code_snippet.tsx b/examples/esql_validation_example/public/code_snippet.tsx
new file mode 100644
index 0000000000000..e80b52b4dd378
--- /dev/null
+++ b/examples/esql_validation_example/public/code_snippet.tsx
@@ -0,0 +1,78 @@
+/*
+ * 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 { EuiCodeBlock } from '@elastic/eui';
+import React from 'react';
+
+interface CodeSnippetProps {
+ currentQuery: string;
+ callbacks: Record<'sources' | 'fields' | 'policies' | 'metaFields', boolean>;
+ ignoreErrors: boolean;
+}
+
+function getCallbacksCode(callbacks: CodeSnippetProps['callbacks']) {
+ return `({
+ ${
+ callbacks.sources
+ ? `getSources: async () =>
+ ['index1', 'anotherIndex', 'dataStream'].map((name) => ({ name, hidden: false })),`
+ : ''
+ }
+ ${
+ callbacks.fields
+ ? `
+ // the getFieldsFor callback gets an esql query to get the required fields
+ // note that the query is not optimized yet, so things like "| limit 0"
+ // might be appended to speed up the retrieval.
+ getFieldsFor: async (esqlFieldsQuery: string) => [
+ { name: 'numberField', type: 'number' },
+ { name: 'stringField', type: 'string' },
+ ],`
+ : ''
+ }
+ ${
+ callbacks.metaFields
+ ? `getMetaFields: async () => ['_version', '_id', '_index', '_source'],`
+ : ''
+ }
+ ${
+ callbacks.policies
+ ? `getPolicies: async () => [
+ {
+ name: 'my-policy',
+ sourceIndices: ['policyIndex'],
+ matchField: 'otherStringField',
+ enrichFields: ['otherNumberField'],
+ },
+ ],`
+ : ''
+ }
+})`.replace(/^\s*\n/gm, '');
+}
+
+export function CodeSnippet({ currentQuery, callbacks, ignoreErrors }: CodeSnippetProps) {
+ return (
+
+ {`
+import { ESQLCallbacks, validateQuery } from '@kbn/esql-validation-autocomplete';
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+
+const currentQuery = "${currentQuery}";
+
+const callbacks: ESQLCallbacks = () => ${getCallbacksCode(callbacks)};
+
+const {errors, warnings} = validateQuery(
+ currentQuery,
+ getAstAndSyntaxErrors,
+ { ignoreOnMissingCallbacks: ${Boolean(ignoreErrors)} },
+ callbacks
+);
+`}
+
+ );
+}
diff --git a/examples/esql_validation_example/public/esql_validation_app.png b/examples/esql_validation_example/public/esql_validation_app.png
new file mode 100644
index 0000000000000..b1dd6bc4f3263
Binary files /dev/null and b/examples/esql_validation_example/public/esql_validation_app.png differ
diff --git a/examples/esql_validation_example/public/index.tsx b/examples/esql_validation_example/public/index.tsx
new file mode 100644
index 0000000000000..e025b806f0596
--- /dev/null
+++ b/examples/esql_validation_example/public/index.tsx
@@ -0,0 +1,11 @@
+/*
+ * 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 { ESQLValidationExamplePlugin } from './plugin';
+
+export const plugin = () => new ESQLValidationExamplePlugin();
diff --git a/examples/esql_validation_example/public/mount.tsx b/examples/esql_validation_example/public/mount.tsx
new file mode 100644
index 0000000000000..2133fe83a8406
--- /dev/null
+++ b/examples/esql_validation_example/public/mount.tsx
@@ -0,0 +1,34 @@
+/*
+ * 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 * as React from 'react';
+import { render, unmountComponentAtNode } from 'react-dom';
+
+import type { CoreSetup, AppMountParameters } from '@kbn/core/public';
+import type { StartDependencies } from './plugin';
+
+export const mount =
+ (coreSetup: CoreSetup) =>
+ async ({ element }: AppMountParameters) => {
+ const [core, plugins] = await coreSetup.getStartServices();
+ const { App } = await import('./app');
+
+ const i18nCore = core.i18n;
+
+ const reactElement = (
+
+
+
+ );
+
+ render(reactElement, element);
+ return () => {
+ unmountComponentAtNode(element);
+ plugins.data.search.session.clear();
+ };
+ };
diff --git a/examples/esql_validation_example/public/plugin.ts b/examples/esql_validation_example/public/plugin.ts
new file mode 100644
index 0000000000000..7d68daa81f89b
--- /dev/null
+++ b/examples/esql_validation_example/public/plugin.ts
@@ -0,0 +1,56 @@
+/*
+ * 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 { Plugin, CoreSetup } from '@kbn/core/public';
+import { DataPublicPluginStart } from '@kbn/data-plugin/public';
+import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
+import { DeveloperExamplesSetup } from '@kbn/developer-examples-plugin/public';
+import { mount } from './mount';
+import image from './esql_validation_app.png';
+
+export interface SetupDependencies {
+ developerExamples: DeveloperExamplesSetup;
+}
+
+export interface StartDependencies {
+ data: DataPublicPluginStart;
+ dataViews: DataViewsPublicPluginStart;
+}
+
+export class ESQLValidationExamplePlugin
+ implements Plugin
+{
+ public setup(core: CoreSetup, { developerExamples }: SetupDependencies) {
+ core.application.register({
+ id: 'esql_validation_example',
+ title: 'ES|QL Validation example',
+ visibleIn: [],
+ mount: mount(core),
+ });
+
+ developerExamples.register({
+ appId: 'esql_validation_example',
+ title: 'ES|QL Validation',
+ description: 'Validate ES|QL queries using the @kbn/esql-validation-autocomplete package.',
+ image,
+ links: [
+ {
+ label: 'README',
+ href: 'https://github.com/elastic/kibana/tree/main/packages/kbn-esql-validation-autocomplete/README.md',
+ iconType: 'logoGithub',
+ size: 's',
+ target: '_blank',
+ },
+ ],
+ });
+ }
+
+ public start() {}
+
+ public stop() {}
+}
diff --git a/examples/esql_validation_example/tsconfig.json b/examples/esql_validation_example/tsconfig.json
new file mode 100644
index 0000000000000..84056b3524cc5
--- /dev/null
+++ b/examples/esql_validation_example/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "target/types"
+ },
+ "include": [
+ "index.ts",
+ "public/**/*.ts",
+ "public/**/*.tsx",
+ "server/**/*.ts",
+ "../../../typings/**/*"
+ ],
+ "exclude": [
+ "target/**/*",
+ ],
+ "kbn_references": [
+ "@kbn/core",
+ "@kbn/data-plugin",
+ "@kbn/data-views-plugin",
+ "@kbn/developer-examples-plugin",
+ "@kbn/esql-ast",
+ "@kbn/esql-validation-autocomplete",
+ ]
+}
diff --git a/package.json b/package.json
index 3db9941e2c39c..3bfdb8efd067a 100644
--- a/package.json
+++ b/package.json
@@ -101,12 +101,12 @@
"@dnd-kit/utilities": "^2.0.0",
"@elastic/apm-rum": "^5.16.0",
"@elastic/apm-rum-react": "^2.0.2",
- "@elastic/charts": "64.0.0",
+ "@elastic/charts": "64.0.2",
"@elastic/datemath": "5.0.3",
"@elastic/ecs": "^8.11.1",
"@elastic/elasticsearch": "^8.12.2",
"@elastic/ems-client": "8.5.1",
- "@elastic/eui": "93.4.0",
+ "@elastic/eui": "93.5.1",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
@@ -433,7 +433,10 @@
"@kbn/es-ui-shared-plugin": "link:src/plugins/es_ui_shared",
"@kbn/eso-model-version-example": "link:examples/eso_model_version_example",
"@kbn/eso-plugin": "link:x-pack/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin",
+ "@kbn/esql-ast": "link:packages/kbn-esql-ast",
"@kbn/esql-utils": "link:packages/kbn-esql-utils",
+ "@kbn/esql-validation-autocomplete": "link:packages/kbn-esql-validation-autocomplete",
+ "@kbn/esql-validation-example-plugin": "link:examples/esql_validation_example",
"@kbn/event-annotation-common": "link:packages/kbn-event-annotation-common",
"@kbn/event-annotation-components": "link:packages/kbn-event-annotation-components",
"@kbn/event-annotation-listing-plugin": "link:src/plugins/event_annotation_listing",
@@ -686,6 +689,7 @@
"@kbn/screenshotting-plugin": "link:x-pack/plugins/screenshotting",
"@kbn/search-api-panels": "link:packages/kbn-search-api-panels",
"@kbn/search-connectors": "link:packages/kbn-search-connectors",
+ "@kbn/search-connectors-plugin": "link:x-pack/plugins/search_connectors",
"@kbn/search-errors": "link:packages/kbn-search-errors",
"@kbn/search-examples-plugin": "link:examples/search_examples",
"@kbn/search-index-documents": "link:packages/kbn-search-index-documents",
@@ -936,7 +940,6 @@
"blurhash": "^2.0.1",
"brace": "0.11.1",
"brok": "^5.0.2",
- "buildkite-test-collector": "^1.6.5",
"byte-size": "^8.1.0",
"canvg": "^3.0.9",
"cbor-x": "^1.3.3",
@@ -970,7 +973,7 @@
"deepmerge": "^4.2.2",
"del": "^6.1.0",
"diff": "^5.1.0",
- "elastic-apm-node": "^4.4.1",
+ "elastic-apm-node": "^4.5.0",
"email-addresses": "^5.0.0",
"eventsource-parser": "^1.1.1",
"execa": "^5.1.1",
@@ -1125,7 +1128,7 @@
"suricata-sid-db": "^1.0.2",
"swr": "^2.2.5",
"symbol-observable": "^1.2.0",
- "tar": "^6.1.15",
+ "tar": "^6.2.1",
"textarea-caret": "^3.1.0",
"tinycolor2": "1.4.1",
"tinygradient": "0.4.3",
@@ -1497,7 +1500,7 @@
"@types/styled-components": "^5.1.0",
"@types/supertest": "^2.0.12",
"@types/tapable": "^1.0.6",
- "@types/tar": "^6.1.5",
+ "@types/tar": "^6.1.11",
"@types/testing-library__jest-dom": "^5.14.7",
"@types/textarea-caret": "^3.0.1",
"@types/tinycolor2": "^1.4.1",
@@ -1537,6 +1540,7 @@
"babel-plugin-transform-typescript-metadata": "^0.3.2",
"backport": "^8.9.8",
"blob-polyfill": "^7.0.20220408",
+ "buildkite-test-collector": "^1.7.0",
"callsites": "^3.1.0",
"chance": "1.0.18",
"chromedriver": "^122.0.5",
@@ -1621,6 +1625,7 @@
"minimist": "^1.2.6",
"mocha": "^10.1.0",
"mocha-junit-reporter": "^2.0.2",
+ "mocha-multi-reporters": "^1.5.1",
"mochawesome": "^7.1.3",
"mochawesome-merge": "^4.3.0",
"mock-fs": "^5.1.2",
diff --git a/packages/content-management/table_list_view_table/src/table_list_view_table.tsx b/packages/content-management/table_list_view_table/src/table_list_view_table.tsx
index 762c6eaf68b21..00f28114f3da0 100644
--- a/packages/content-management/table_list_view_table/src/table_list_view_table.tsx
+++ b/packages/content-management/table_list_view_table/src/table_list_view_table.tsx
@@ -450,12 +450,6 @@ function TableListViewTableComp({
}),
},
...ret[item.id],
- delete: {
- enabled: false,
- reason: i18n.translate('contentManagement.tableList.managedItemNoDelete', {
- defaultMessage: 'Elastic manages this item. Deleting it is not possible.',
- }),
- },
};
}
diff --git a/packages/core/apps/core-apps-server-internal/src/core_app.test.ts b/packages/core/apps/core-apps-server-internal/src/core_app.test.ts
index 153a283fe5696..3c5cfa068765c 100644
--- a/packages/core/apps/core-apps-server-internal/src/core_app.test.ts
+++ b/packages/core/apps/core-apps-server-internal/src/core_app.test.ts
@@ -316,7 +316,7 @@ describe('CoreApp', () => {
});
});
- it('registers expected static dirs if there are public plugins', async () => {
+ it('registers expected static dirs for all plugins with static dirs', async () => {
const uiPlugins = emptyPlugins();
uiPlugins.public.set('some-plugin', {
type: PluginType.preboot,
@@ -348,6 +348,12 @@ describe('CoreApp', () => {
requiredBundles: [],
version: '1.0.0',
});
+ uiPlugins.internal.set('some-plugin-3-internal', {
+ publicAssetsDir: '/foo-internal',
+ publicTargetDir: '/bar-internal',
+ requiredBundles: [],
+ version: '1.0.0',
+ });
internalCoreSetup.http.staticAssets.prependServerPath.mockReturnValue('/static-assets-path');
internalCoreSetup.http.staticAssets.getPluginServerPath.mockImplementation(
@@ -356,8 +362,8 @@ describe('CoreApp', () => {
await coreApp.setup(internalCoreSetup, uiPlugins);
expect(internalCoreSetup.http.registerStaticDir).toHaveBeenCalledTimes(
- // Twice for all UI plugins + core's UI asset routes
- uiPlugins.public.size * 2 + 2
+ // Twice for all _internal_ UI plugins + core's UI asset routes
+ uiPlugins.internal.size * 2 + 2
);
expect(internalCoreSetup.http.registerStaticDir).toHaveBeenCalledWith(
'/static-assets-path',
@@ -383,5 +389,14 @@ describe('CoreApp', () => {
'/plugins/some-plugin-2/assets/{path*}', // legacy
expect.any(String)
);
+
+ expect(internalCoreSetup.http.registerStaticDir).toHaveBeenCalledWith(
+ '/static-assets-path/some-plugin-3-internal/{path*}',
+ expect.any(String)
+ );
+ expect(internalCoreSetup.http.registerStaticDir).toHaveBeenCalledWith(
+ '/plugins/some-plugin-3-internal/assets/{path*}', // legacy
+ expect.any(String)
+ );
});
});
diff --git a/packages/core/apps/core-apps-server-internal/src/core_app.ts b/packages/core/apps/core-apps-server-internal/src/core_app.ts
index a65b3373b2e83..2639e15cca05e 100644
--- a/packages/core/apps/core-apps-server-internal/src/core_app.ts
+++ b/packages/core/apps/core-apps-server-internal/src/core_app.ts
@@ -283,9 +283,8 @@ export class CoreAppsService {
);
});
- for (const [pluginName] of uiPlugins.public) {
- const pluginInfo = uiPlugins.internal.get(pluginName);
- if (!pluginInfo) continue; // assuming we will never hit this case; a public entry should have internal info registered
+ for (const [pluginName, pluginInfo] of uiPlugins.internal) {
+ if (!pluginInfo.publicAssetsDir) continue;
/**
* Serve UI from sha-scoped and not-sha-scoped paths to allow time for plugin code to migrate
* Eventually we only want to serve from the sha scoped path
diff --git a/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap b/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap
index 8656c7684ce37..875e9273a0305 100644
--- a/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap
+++ b/packages/core/i18n/core-i18n-browser-internal/src/__snapshots__/i18n_service.test.tsx.snap
@@ -155,6 +155,7 @@ exports[`#start() returns \`Context\` component 1`] = `
"euiHeaderLinks.appNavigation": "App menu",
"euiHeaderLinks.openNavigationMenu": "Open menu",
"euiHue.label": "Select the HSV color mode \\"hue\\" value",
+ "euiIconTip.defaultAriaLabel": "Info",
"euiImageButton.closeFullScreen": "Press Escape or click to close image fullscreen mode",
"euiImageButton.openFullScreen": "Click to open this image in fullscreen mode",
"euiInlineEditForm.activateEditModeDescription": "Click to edit this text inline.",
diff --git a/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx b/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx
index 21069027c6a50..fbb625271aa38 100644
--- a/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx
+++ b/packages/core/i18n/core-i18n-browser-internal/src/i18n_eui_mapping.tsx
@@ -797,6 +797,9 @@ export const getEuiContextMapping = (): EuiTokensObject => {
'euiHue.label': i18n.translate('core.euiHue.label', {
defaultMessage: 'Select the HSV color mode "hue" value',
}),
+ 'euiIconTip.defaultAriaLabel': i18n.translate('core.euiIconTip.defaultAriaLabel', {
+ defaultMessage: 'Info',
+ }),
'euiImageButton.openFullScreen': i18n.translate('core.euiImageButton.openFullScreen', {
defaultMessage: 'Click to open this image in fullscreen mode',
}),
diff --git a/packages/kbn-apm-config-loader/src/config.test.ts b/packages/kbn-apm-config-loader/src/config.test.ts
index caf3b800b444b..3d0bd98bec467 100644
--- a/packages/kbn-apm-config-loader/src/config.test.ts
+++ b/packages/kbn-apm-config-loader/src/config.test.ts
@@ -151,6 +151,7 @@ describe('ApmConfiguration', () => {
delete process.env.ELASTIC_APM_ENVIRONMENT;
delete process.env.ELASTIC_APM_SECRET_TOKEN;
delete process.env.ELASTIC_APM_API_KEY;
+ delete process.env.ELASTIC_APM_KIBANA_FRONTEND_ACTIVE;
delete process.env.ELASTIC_APM_SERVER_URL;
delete process.env.ELASTIC_APM_GLOBAL_LABELS;
delete process.env.NODE_ENV;
@@ -202,6 +203,18 @@ describe('ApmConfiguration', () => {
});
});
+ it('ELASTIC_APM_KIBANA_FRONTEND_ACTIVE', () => {
+ process.env.ELASTIC_APM_KIBANA_FRONTEND_ACTIVE = 'false';
+ const config = new ApmConfiguration(mockedRootDir, {}, false);
+ const serverConfig = config.getConfig('servicesOverrides');
+ // @ts-ignore
+ expect(serverConfig.servicesOverrides).toEqual({
+ 'kibana-frontend': {
+ active: false,
+ },
+ });
+ });
+
it('does not override the environment from NODE_ENV if already set in the config file', () => {
const kibanaConfig = {
elastic: {
diff --git a/packages/kbn-apm-config-loader/src/config.ts b/packages/kbn-apm-config-loader/src/config.ts
index efe228be8157e..583dd8fc58b56 100644
--- a/packages/kbn-apm-config-loader/src/config.ts
+++ b/packages/kbn-apm-config-loader/src/config.ts
@@ -8,7 +8,7 @@
import { join } from 'path';
import deepmerge from 'deepmerge';
-import { merge } from 'lodash';
+import { merge, isEmpty } from 'lodash';
import { execSync } from 'child_process';
import { getDataPath } from '@kbn/utils';
import { readFileSync } from 'fs';
@@ -79,7 +79,8 @@ export class ApmConfiguration {
}
public getConfig(serviceName: string): AgentConfigOptions {
- const { servicesOverrides = {} } = this.getConfigFromKibanaConfig();
+ const kibanaConfig = this.getConfigFromKibanaConfig();
+ const { servicesOverrides = {} } = merge(kibanaConfig, this.getConfigFromEnv(kibanaConfig));
let baseConfig = {
...this.getBaseConfig(),
@@ -139,11 +140,20 @@ export class ApmConfiguration {
*/
private getConfigFromEnv(configFromKibanaConfig: AgentConfigOptions): AgentConfigOptions {
const config: AgentConfigOptions = {};
+ const servicesOverrides: Record = {};
if (process.env.ELASTIC_APM_ACTIVE === 'true') {
config.active = true;
}
+ if (process.env.ELASTIC_APM_KIBANA_FRONTEND_ACTIVE === 'false') {
+ merge(servicesOverrides, {
+ 'kibana-frontend': {
+ active: false,
+ },
+ });
+ }
+
if (process.env.ELASTIC_APM_CONTEXT_PROPAGATION_ONLY === 'true') {
config.contextPropagationOnly = true;
} else if (process.env.ELASTIC_APM_CONTEXT_PROPAGATION_ONLY === 'false') {
@@ -186,6 +196,10 @@ export class ApmConfiguration {
);
}
+ if (!isEmpty(servicesOverrides)) {
+ merge(config, { servicesOverrides });
+ }
+
return config;
}
diff --git a/packages/kbn-chart-icons/index.ts b/packages/kbn-chart-icons/index.ts
index f9f0a5ad8962d..b962185d70589 100644
--- a/packages/kbn-chart-icons/index.ts
+++ b/packages/kbn-chart-icons/index.ts
@@ -40,5 +40,8 @@ export {
IconChartHeatmap,
IconChartHorizontalBullet,
IconChartVerticalBullet,
+ IconChartGaugeSemiCircle,
+ IconChartGaugeArc,
+ IconChartGaugeCircle,
IconChartTagcloud,
} from './src/assets';
diff --git a/packages/kbn-chart-icons/src/assets/chart_gauge_arc.tsx b/packages/kbn-chart-icons/src/assets/chart_gauge_arc.tsx
new file mode 100644
index 0000000000000..a206e5c629407
--- /dev/null
+++ b/packages/kbn-chart-icons/src/assets/chart_gauge_arc.tsx
@@ -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.
+ */
+
+import React from 'react';
+import type { EuiIconProps } from '@elastic/eui';
+import { colors } from './common_styles';
+
+export const IconChartGaugeArc = ({ title, titleId, ...props }: Omit) => {
+ return (
+
+ );
+};
diff --git a/packages/kbn-chart-icons/src/assets/chart_gauge_circle.tsx b/packages/kbn-chart-icons/src/assets/chart_gauge_circle.tsx
new file mode 100644
index 0000000000000..e89dba7297465
--- /dev/null
+++ b/packages/kbn-chart-icons/src/assets/chart_gauge_circle.tsx
@@ -0,0 +1,35 @@
+/*
+ * 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 React from 'react';
+import type { EuiIconProps } from '@elastic/eui';
+import { colors } from './common_styles';
+
+export const IconChartGaugeCircle = ({ title, titleId, ...props }: Omit) => {
+ return (
+
+ );
+};
diff --git a/packages/kbn-chart-icons/src/assets/chart_gauge_semi_circle.tsx b/packages/kbn-chart-icons/src/assets/chart_gauge_semi_circle.tsx
new file mode 100644
index 0000000000000..912516b3d7118
--- /dev/null
+++ b/packages/kbn-chart-icons/src/assets/chart_gauge_semi_circle.tsx
@@ -0,0 +1,40 @@
+/*
+ * 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 React from 'react';
+import type { EuiIconProps } from '@elastic/eui';
+import { colors } from './common_styles';
+
+export const IconChartGaugeSemiCircle = ({
+ title,
+ titleId,
+ ...props
+}: Omit) => {
+ return (
+
+ );
+};
diff --git a/packages/kbn-chart-icons/src/assets/chart_vertical_bullet.tsx b/packages/kbn-chart-icons/src/assets/chart_vertical_bullet.tsx
index 5cf427af7d238..db24e31bf25e8 100644
--- a/packages/kbn-chart-icons/src/assets/chart_vertical_bullet.tsx
+++ b/packages/kbn-chart-icons/src/assets/chart_vertical_bullet.tsx
@@ -27,11 +27,11 @@ export const IconChartVerticalBullet = ({
>
{title ? {title} : null}
diff --git a/packages/kbn-chart-icons/src/assets/index.ts b/packages/kbn-chart-icons/src/assets/index.ts
index 85cc291936b18..0165b2bf0381a 100644
--- a/packages/kbn-chart-icons/src/assets/index.ts
+++ b/packages/kbn-chart-icons/src/assets/index.ts
@@ -40,4 +40,7 @@ export { IconRegionMap } from './region_map';
export { IconChartHeatmap } from './chart_heatmap';
export { IconChartHorizontalBullet } from './chart_horizontal_bullet';
export { IconChartVerticalBullet } from './chart_vertical_bullet';
+export { IconChartGaugeSemiCircle } from './chart_gauge_semi_circle';
+export { IconChartGaugeArc } from './chart_gauge_arc';
+export { IconChartGaugeCircle } from './chart_gauge_circle';
export { IconChartTagcloud } from './chart_tagcloud';
diff --git a/packages/kbn-doc-links/src/get_doc_links.ts b/packages/kbn-doc-links/src/get_doc_links.ts
index d0a78b272128c..98c50c886c1f0 100644
--- a/packages/kbn-doc-links/src/get_doc_links.ts
+++ b/packages/kbn-doc-links/src/get_doc_links.ts
@@ -833,6 +833,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
policySecrets: `${FLEET_DOCS}agent-policy.html#agent-policy-secret-values`,
remoteESOoutput: `${FLEET_DOCS}monitor-elastic-agent.html#external-elasticsearch-monitoring`,
performancePresets: `${FLEET_DOCS}es-output-settings.html#es-output-settings-performance-tuning-settings`,
+ scalingKubernetesResourcesAndLimits: `${FLEET_DOCS}scaling-on-kubernetes.html#_specifying_resources_and_limits_in_agent_manifests`,
},
ecs: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/ecs/current/index.html`,
diff --git a/packages/kbn-doc-links/src/types.ts b/packages/kbn-doc-links/src/types.ts
index df39d8e33e77c..f51445bdac9b9 100644
--- a/packages/kbn-doc-links/src/types.ts
+++ b/packages/kbn-doc-links/src/types.ts
@@ -543,6 +543,7 @@ export interface DocLinks {
policySecrets: string;
remoteESOoutput: string;
performancePresets: string;
+ scalingKubernetesResourcesAndLimits: string;
}>;
readonly ecs: {
readonly guide: string;
diff --git a/packages/kbn-esql-ast/BUILD.bazel b/packages/kbn-esql-ast/BUILD.bazel
new file mode 100644
index 0000000000000..34557089d0db4
--- /dev/null
+++ b/packages/kbn-esql-ast/BUILD.bazel
@@ -0,0 +1,32 @@
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+
+SRCS = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.mock.*",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/mocks/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SHARED_DEPS = [
+ "@npm//antlr4",
+]
+
+js_library(
+ name = "kbn-esql-ast",
+ package_name = "@kbn/esql-ast",
+ srcs = ["package.json"] + SRCS,
+ deps = SHARED_DEPS,
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/kbn-esql-ast/README.md b/packages/kbn-esql-ast/README.md
new file mode 100644
index 0000000000000..76232d371b9cb
--- /dev/null
+++ b/packages/kbn-esql-ast/README.md
@@ -0,0 +1,89 @@
+# ES|QL utility library
+
+## Folder structure
+
+This library brings all the foundation data structure to enable all advanced features within an editor for ES|QL as validation, autocomplete, hover, etc...
+The package is structure as follow:
+
+```
+src
+ |- antlr // => contains the ES|QL grammar files and various compilation assets
+ | ast_factory.ts // => binding to the Antlr that generates the AST data structure
+ | ast_errors.ts // => error translation utility from raw Antlr to something understandable (somewhat)
+ | antlr_error_listener.ts // => The ES|QL syntax error listener
+ | antlr_facade.ts // => getParser and getLexer utilities
+ | ... // => miscellaneas utilities to work with AST
+```
+
+### Basic usage
+
+#### Get AST from a query string
+
+This module contains the entire logic to translate from a query string into the AST data structure.
+The `getAstAndSyntaxErrors` function returns the AST data structure, unless a syntax error happens in which case the `errors` array gets populated with a Syntax error.
+
+##### Usage
+
+```js
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+
+const queryString = "from index | stats 1 + avg(myColumn) ";
+const { ast, errors} = await astProvider(queryString);
+
+if(errors){
+ console.log({ syntaxErrors: errors });
+}
+// do stuff with the ast
+```
+
+## How does it work
+
+The general idea of this package is to provide all ES|QL features on top of a custom compact AST definition (all data structure types defined in `./types.ts`) which is designed to be resilient to many grammar changes.
+The pipeline is the following:
+
+```
+Antlr grammar files
+=> Compiled grammar files (.ts assets in the antlr folder)
+=> AST Factory (Antlr Parser tree => custom AST)
+```
+
+Each feature function works with the combination of the AST and the definition files: the former describe the current statement in a easy to traverse way, while the definitions describe what's the expected behaviour of each node in the AST node (i.e. what arguments should it accept? How many arguments? etc...).
+While AST requires the grammar to be compiled to be updated, definitions are static files which can be dynamically updated without running the ANTLR compile task.
+
+#### AST
+
+The AST is generated by 2 files: `ast_factory.ts` and its buddy `ast_walker.ts`:
+* `ast_factory.ts` is a binding to Antlr and access the Parser tree
+* Parser tree is passed over to `ast_walker` to append new AST nodes
+
+In general Antlr is resilient to grammar errors, in the sense that it can produe a Parser tree up to the point of the error, then stops. This is useful to perform partial tasks even with broken queries and this means that a partial AST can be produced even with an invalid query.
+
+### Keeping ES|QL up to date
+
+In general when operating on changes here use the `yarn kbn watch` in a terminal window to make sure changes are correctly compiled.
+
+### How to add new commands/options
+
+When a new command/option is added to ES|QL it is done via a grammar update.
+Therefore adding them requires a two step phase:
+* Update the grammar with the new one
+ * add/fix all AST generator bindings in case of new/changed TOKENS in the `lexer` grammar file
+* Update the definition files for commands/options
+
+To update the grammar:
+1. Make sure the `lexer` and `parser` files are up to date with their ES counterparts
+ * an existing Kibana CI job is updating them already automatically
+2. Run the script into the `package.json` to compile the ES|QL grammar.
+3. open the `ast_factory.ts` file and add a new `exit` method
+4. write some code in the `ast_walker/ts` to translate the Antlr Parser tree into the custom AST (there are already few utilites for that, but sometimes it is required to write some more code if the `parser` introduced a new flow)
+ * pro tip: use the `http://lab.antlr.org/` to visualize/debug the parser tree for a given statement (copy and paste the grammar files there)
+5. if something goes wrong with new quoted/unquoted identifier token, open the `ast_helpers.ts` and check the ids of the new tokens in the `getQuotedText` and `getUnquotedText` functions - please make sure to leave a comment on the token name
+
+#### Debug and fix grammar changes (tokens, etc...)
+
+On TOKEN renaming or with subtle `lexer` grammar changes it can happens that test breaks, this can be happen for two main issues:
+* A TOKEN name changed so the `ast_walker.ts` doesn't find it any more. Go there and rename the TOKEN name.
+* TOKEN order changed and tests started failing. This probably generated some TOKEN id reorder and there are two functions in `ast_helpers.ts` who rely on hardcoded ids: `getQuotedText` and `getUnquotedText`.
+ * Note that the `getQuotedText` and `getUnquotedText` are automatically updated on grammar changes detected by the Kibana CI sync job.
+ * to fix this just look at the commented tokens and update the ids. If a new token add it and leave a comment to point to the new token name.
+ * This choice was made to reduce the bundle size, as importing the `esql_parser` adds some hundreds of Kbs to the bundle otherwise.
\ No newline at end of file
diff --git a/packages/kbn-esql-ast/index.ts b/packages/kbn-esql-ast/index.ts
new file mode 100644
index 0000000000000..cdbde17692545
--- /dev/null
+++ b/packages/kbn-esql-ast/index.ts
@@ -0,0 +1,37 @@
+/*
+ * 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 type {
+ ESQLAst,
+ ESQLAstItem,
+ ESQLCommand,
+ ESQLCommandOption,
+ ESQLCommandMode,
+ ESQLFunction,
+ ESQLTimeInterval,
+ ESQLLocation,
+ ESQLMessage,
+ ESQLSingleAstItem,
+ ESQLSource,
+ ESQLColumn,
+ ESQLLiteral,
+ AstProviderFn,
+ EditorError,
+} from './src/types';
+
+// Low level functions to parse grammar
+export { getParser, getLexer, ROOT_STATEMENT } from './src/antlr_facade';
+
+/**
+ * ES|QL Query string -> AST data structure
+ * this is the foundational building block for any advanced feature
+ * a developer wants to build on top of the ESQL language
+ **/
+export { getAstAndSyntaxErrors } from './src/ast_parser';
+
+export { ESQLErrorListener } from './src/antlr_error_listener';
diff --git a/packages/kbn-esql-ast/kibana.jsonc b/packages/kbn-esql-ast/kibana.jsonc
new file mode 100644
index 0000000000000..18ab1197119e7
--- /dev/null
+++ b/packages/kbn-esql-ast/kibana.jsonc
@@ -0,0 +1,5 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/esql-ast",
+ "owner": "@elastic/kibana-esql"
+ }
\ No newline at end of file
diff --git a/packages/kbn-esql-ast/package.json b/packages/kbn-esql-ast/package.json
new file mode 100644
index 0000000000000..9783b4bc72938
--- /dev/null
+++ b/packages/kbn-esql-ast/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "@kbn/esql-ast",
+ "version": "1.0.0",
+ "private": true,
+ "license": "SSPL-1.0 OR Elastic License 2.0",
+ "scripts": {
+ "build:antlr4:esql": "antlr -Dlanguage=TypeScript src/antlr/esql_lexer.g4 src/antlr/esql_parser.g4 && node ./scripts/fix_generated_antlr.js && node ./scripts/esql_update_ast_script.js",
+ "prebuild:antlr4": "brew bundle --file=./scripts/antlr4_tools/brewfile",
+ "build:antlr4": "npm run build:antlr4:esql"
+ },
+ "sideEffects": false
+ }
\ No newline at end of file
diff --git a/packages/kbn-esql-ast/scripts/antlr4_tools/.gitignore b/packages/kbn-esql-ast/scripts/antlr4_tools/.gitignore
new file mode 100644
index 0000000000000..e4d4e606cb87a
--- /dev/null
+++ b/packages/kbn-esql-ast/scripts/antlr4_tools/.gitignore
@@ -0,0 +1 @@
+brewfile.lock.json
diff --git a/packages/kbn-esql-ast/scripts/antlr4_tools/README.md b/packages/kbn-esql-ast/scripts/antlr4_tools/README.md
new file mode 100644
index 0000000000000..8bdba8e8d711b
--- /dev/null
+++ b/packages/kbn-esql-ast/scripts/antlr4_tools/README.md
@@ -0,0 +1,3 @@
+## antlr4-tools
+
+defines a fairly quick way to get [antlr](https://github.com/antlr/antlr4) setup on any machine with brew support, simply run `brew bundle` within this directory. On running the aforementioned command, `antlr` should be become available in your path as a valid executable.
diff --git a/packages/kbn-esql-ast/scripts/antlr4_tools/brewfile b/packages/kbn-esql-ast/scripts/antlr4_tools/brewfile
new file mode 100644
index 0000000000000..47f89b17dbb10
--- /dev/null
+++ b/packages/kbn-esql-ast/scripts/antlr4_tools/brewfile
@@ -0,0 +1,2 @@
+brew "openjdk"
+brew "antlr"
diff --git a/packages/kbn-esql-ast/scripts/esql_update_ast_script.js b/packages/kbn-esql-ast/scripts/esql_update_ast_script.js
new file mode 100644
index 0000000000000..78419d758023c
--- /dev/null
+++ b/packages/kbn-esql-ast/scripts/esql_update_ast_script.js
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+const { join } = require('path');
+const { ESLint } = require('eslint');
+const partition = require('lodash/partition');
+const { readdirSync, readFileSync, writeFileSync } = require('fs');
+const ora = require('ora');
+const log = ora('Updating ES|QL AST walker from antlr grammar').start();
+
+async function execute() {
+ const generatedAntlrFolder = join(__dirname, '..', 'src', 'antlr');
+
+ const generatedAntlrFolderContents = readdirSync(generatedAntlrFolder);
+
+ const tokenRegex = /public static readonly (?[A-Z_]*(UN)*QUOTED_[A-Z_]+) = (?\d+);/;
+ const lexerFile = generatedAntlrFolderContents.find((file) => file === 'esql_parser.ts');
+ const lexerFileRows = readFileSync(join(generatedAntlrFolder, lexerFile), 'utf8')
+ .toString()
+ .split('\n');
+ const tokenList = [];
+ for (const row of lexerFileRows) {
+ const match = row.match(tokenRegex);
+ if (match?.groups) {
+ tokenList.push(match.groups);
+ }
+ }
+ const [unquotedList, quotedList] = partition(tokenList, ({ name }) => /UNQUOTED/.test(name));
+
+ // now all quote/unquoted tokens are registered
+ // dump them into the ast_helper file
+ const astHelperFileFolder = join(__dirname, '..', 'src');
+ const astHelperFilename = 'ast_helpers.ts';
+
+ try {
+ const astHelperContentRows = readFileSync(join(astHelperFileFolder, astHelperFilename), 'utf8')
+ .toString()
+ .split('\n');
+
+ const startAutoGeneratedComment = astHelperContentRows.findIndex(
+ (row) => row === '/* SCRIPT_MARKER_START */'
+ );
+ const endAutoGeneratedComment =
+ astHelperContentRows.findIndex((row) => row === '/* SCRIPT_MARKER_END */') + 1;
+
+ const newFunctionsContent = `
+/* SCRIPT_MARKER_START */
+function getQuotedText(ctx: ParserRuleContext) {
+ return [
+ ${quotedList.map(({ name, value }) => `${value} /* esql_parser.${name} */`).join(', ')}
+ ]
+ .map((keyCode) => ctx.getToken(keyCode, 0))
+ .filter(nonNullable)[0];
+ }
+
+function getUnquotedText(ctx: ParserRuleContext) {
+ return [
+ ${unquotedList.map(({ name, value }) => `${value} /* esql_parser.${name} */`).join(', ')}
+
+ ]
+ .map((keyCode) => ctx.getToken(keyCode, 0))
+ .filter(nonNullable)[0];
+}
+/* SCRIPT_MARKER_END */
+`;
+
+ const fileContent = astHelperContentRows
+ .slice(0, startAutoGeneratedComment)
+ .concat(newFunctionsContent.split('\n'), astHelperContentRows.slice(endAutoGeneratedComment));
+
+ const fileContentString = fileContent.join('\n');
+
+ const eslint = new ESLint({
+ fix: true,
+ overrideConfig: {
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ sourceType: 'module',
+ ecmaVersion: 2018,
+ },
+ rules: {
+ '@kbn/imports/no_unresolvable_imports': 'off',
+ 'prettier/prettier': [
+ 'error',
+ {
+ parser: 'typescript',
+ },
+ ],
+ },
+ },
+ });
+
+ const results = await eslint.lintText(fileContentString);
+
+ if (results.some(({ messages }) => messages.length > 0)) {
+ const formatter = await eslint.loadFormatter('stylish');
+ const resultText = formatter.format(results);
+ process.exitCode = 1;
+ return log.fail(resultText);
+ }
+
+ const filePath = join(astHelperFileFolder, astHelperFilename);
+ writeFileSync(filePath, results[0].output || '', { encoding: 'utf8' });
+ } catch (err) {
+ return log.fail(err.message);
+ }
+
+ log.succeed('Updated ES|QL helper from antlr grammar successfully');
+}
+
+execute();
diff --git a/packages/kbn-esql-ast/scripts/fix_generated_antlr.js b/packages/kbn-esql-ast/scripts/fix_generated_antlr.js
new file mode 100644
index 0000000000000..6a55c7acd2fb6
--- /dev/null
+++ b/packages/kbn-esql-ast/scripts/fix_generated_antlr.js
@@ -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.
+ */
+
+const { join } = require('path');
+const { readdirSync, readFileSync, writeFileSync, renameSync } = require('fs');
+const ora = require('ora');
+const log = ora('Updating generated antlr grammar').start();
+
+function execute() {
+ const generatedAntlrFolder = join(__dirname, '..', 'src', 'antlr');
+
+ const generatedAntlrFolderContents = readdirSync(generatedAntlrFolder);
+
+ // The generated TS produces some TS linting errors
+ // This script adds a //@ts-nocheck comment at the top of each generated file
+ // so that the errors can be ignored for now
+ generatedAntlrFolderContents
+ .filter((file) => {
+ const fileExtension = file.split('.')[1];
+ return fileExtension.includes('ts');
+ })
+ .forEach((file) => {
+ try {
+ const fileContentRows = readFileSync(join(generatedAntlrFolder, file), 'utf8')
+ .toString()
+ .split('\n');
+
+ if (!/\@ts-nocheck/.test(fileContentRows[0])) {
+ fileContentRows.unshift('// @ts-nocheck');
+ }
+
+ const filePath = join(generatedAntlrFolder, file);
+ const fileContent = fileContentRows.join('\n');
+
+ writeFileSync(filePath, fileContent, { encoding: 'utf8' });
+ } catch (err) {
+ return log.fail(err.message);
+ }
+ });
+
+ // Rename generated parserListener file to snakecase to satisfy file casing check
+ // There doesn't appear to be a way to fix this OOTB with antlr4
+ try {
+ renameSync(
+ join(generatedAntlrFolder, `esql_parserListener.ts`),
+ join(generatedAntlrFolder, `esql_parser_listener.ts`)
+ );
+ } catch (err) {
+ log.warn(`Unable to rename parserListener file to snake-case: ${err.message}`);
+ }
+
+ log.succeed('Updated generated antlr grammar successfully');
+}
+
+execute();
diff --git a/packages/kbn-monaco/src/esql/antlr/.gitignore b/packages/kbn-esql-ast/src/antlr/.gitignore
similarity index 100%
rename from packages/kbn-monaco/src/esql/antlr/.gitignore
rename to packages/kbn-esql-ast/src/antlr/.gitignore
diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.g4 b/packages/kbn-esql-ast/src/antlr/esql_lexer.g4
new file mode 100644
index 0000000000000..c116f045a19a8
--- /dev/null
+++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.g4
@@ -0,0 +1,436 @@
+/*
+ * 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; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+// DO NOT MODIFY THIS FILE BY HAND. IT IS MANAGED BY A CI JOB.
+
+lexer grammar esql_lexer;
+ options { caseInsensitive = true; }
+
+DISSECT : 'dissect' -> pushMode(EXPRESSION_MODE);
+DROP : 'drop' -> pushMode(PROJECT_MODE);
+ENRICH : 'enrich' -> pushMode(ENRICH_MODE);
+EVAL : 'eval' -> pushMode(EXPRESSION_MODE);
+EXPLAIN : 'explain' -> pushMode(EXPLAIN_MODE);
+FROM : 'from' -> pushMode(FROM_MODE);
+GROK : 'grok' -> pushMode(EXPRESSION_MODE);
+INLINESTATS : 'inlinestats' -> pushMode(EXPRESSION_MODE);
+KEEP : 'keep' -> pushMode(PROJECT_MODE);
+LIMIT : 'limit' -> pushMode(EXPRESSION_MODE);
+META : 'meta' -> pushMode(META_MODE);
+MV_EXPAND : 'mv_expand' -> pushMode(MVEXPAND_MODE);
+RENAME : 'rename' -> pushMode(RENAME_MODE);
+ROW : 'row' -> pushMode(EXPRESSION_MODE);
+SHOW : 'show' -> pushMode(SHOW_MODE);
+SORT : 'sort' -> pushMode(EXPRESSION_MODE);
+STATS : 'stats' -> pushMode(EXPRESSION_MODE);
+WHERE : 'where' -> pushMode(EXPRESSION_MODE);
+UNKNOWN_CMD : ~[ \r\n\t[\]/]+ -> pushMode(EXPRESSION_MODE);
+
+LINE_COMMENT
+ : '//' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
+ ;
+
+MULTILINE_COMMENT
+ : '/*' (MULTILINE_COMMENT|.)*? '*/' -> channel(HIDDEN)
+ ;
+
+WS
+ : [ \r\n\t]+ -> channel(HIDDEN)
+ ;
+//
+// Explain
+//
+mode EXPLAIN_MODE;
+EXPLAIN_OPENING_BRACKET : OPENING_BRACKET -> type(OPENING_BRACKET), pushMode(DEFAULT_MODE);
+EXPLAIN_PIPE : PIPE -> type(PIPE), popMode;
+EXPLAIN_WS : WS -> channel(HIDDEN);
+EXPLAIN_LINE_COMMENT : LINE_COMMENT -> channel(HIDDEN);
+EXPLAIN_MULTILINE_COMMENT : MULTILINE_COMMENT -> channel(HIDDEN);
+
+//
+// Expression - used by most command
+//
+mode EXPRESSION_MODE;
+
+PIPE : '|' -> popMode;
+
+fragment DIGIT
+ : [0-9]
+ ;
+
+fragment LETTER
+ : [A-Za-z]
+ ;
+
+fragment ESCAPE_SEQUENCE
+ : '\\' [tnr"\\]
+ ;
+
+fragment UNESCAPED_CHARS
+ : ~[\r\n"\\]
+ ;
+
+fragment EXPONENT
+ : [Ee] [+-]? DIGIT+
+ ;
+
+fragment ASPERAND
+ : '@'
+ ;
+
+fragment BACKQUOTE
+ : '`'
+ ;
+
+fragment BACKQUOTE_BLOCK
+ : ~'`'
+ | '``'
+ ;
+
+fragment UNDERSCORE
+ : '_'
+ ;
+
+fragment UNQUOTED_ID_BODY
+ : (LETTER | DIGIT | UNDERSCORE)
+ ;
+
+STRING
+ : '"' (ESCAPE_SEQUENCE | UNESCAPED_CHARS)* '"'
+ | '"""' (~[\r\n])*? '"""' '"'? '"'?
+ ;
+
+INTEGER_LITERAL
+ : DIGIT+
+ ;
+
+DECIMAL_LITERAL
+ : DIGIT+ DOT DIGIT*
+ | DOT DIGIT+
+ | DIGIT+ (DOT DIGIT*)? EXPONENT
+ | DOT DIGIT+ EXPONENT
+ ;
+
+BY : 'by';
+
+AND : 'and';
+ASC : 'asc';
+ASSIGN : '=';
+COMMA : ',';
+DESC : 'desc';
+DOT : '.';
+FALSE : 'false';
+FIRST : 'first';
+LAST : 'last';
+LP : '(';
+IN: 'in';
+IS: 'is';
+LIKE: 'like';
+NOT : 'not';
+NULL : 'null';
+NULLS : 'nulls';
+OR : 'or';
+PARAM: '?';
+RLIKE: 'rlike';
+RP : ')';
+TRUE : 'true';
+
+EQ : '==';
+CIEQ : '=~';
+NEQ : '!=';
+LT : '<';
+LTE : '<=';
+GT : '>';
+GTE : '>=';
+
+PLUS : '+';
+MINUS : '-';
+ASTERISK : '*';
+SLASH : '/';
+PERCENT : '%';
+
+// Brackets are funny. We can happen upon a CLOSING_BRACKET in two ways - one
+// way is to start in an explain command which then shifts us to expression
+// mode. Thus, the two popModes on CLOSING_BRACKET. The other way could as
+// the start of a multivalued field constant. To line up with the double pop
+// the explain mode needs, we double push when we see that.
+OPENING_BRACKET : '[' -> pushMode(EXPRESSION_MODE), pushMode(EXPRESSION_MODE);
+CLOSING_BRACKET : ']' -> popMode, popMode;
+
+UNQUOTED_IDENTIFIER
+ : LETTER UNQUOTED_ID_BODY*
+ // only allow @ at beginning of identifier to keep the option to allow @ as infix operator in the future
+ // also, single `_` and `@` characters are not valid identifiers
+ | (UNDERSCORE | ASPERAND) UNQUOTED_ID_BODY+
+ ;
+
+fragment QUOTED_ID
+ : BACKQUOTE BACKQUOTE_BLOCK+ BACKQUOTE
+ ;
+
+QUOTED_IDENTIFIER
+ : QUOTED_ID
+ ;
+
+EXPR_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+EXPR_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+EXPR_WS
+ : WS -> channel(HIDDEN)
+ ;
+//
+// FROM command
+//
+mode FROM_MODE;
+FROM_PIPE : PIPE -> type(PIPE), popMode;
+FROM_OPENING_BRACKET : OPENING_BRACKET -> type(OPENING_BRACKET);
+FROM_CLOSING_BRACKET : CLOSING_BRACKET -> type(CLOSING_BRACKET);
+FROM_COMMA : COMMA -> type(COMMA);
+FROM_ASSIGN : ASSIGN -> type(ASSIGN);
+
+METADATA: 'metadata';
+
+fragment FROM_UNQUOTED_IDENTIFIER_PART
+ : ~[=`|,[\]/ \t\r\n]
+ | '/' ~[*/] // allow single / but not followed by another / or * which would start a comment
+ ;
+
+FROM_UNQUOTED_IDENTIFIER
+ : FROM_UNQUOTED_IDENTIFIER_PART+
+ ;
+
+FROM_QUOTED_IDENTIFIER
+ : QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
+ ;
+
+FROM_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+FROM_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+FROM_WS
+ : WS -> channel(HIDDEN)
+ ;
+//
+// DROP, KEEP
+//
+mode PROJECT_MODE;
+PROJECT_PIPE : PIPE -> type(PIPE), popMode;
+PROJECT_DOT: DOT -> type(DOT);
+PROJECT_COMMA : COMMA -> type(COMMA);
+
+fragment UNQUOTED_ID_BODY_WITH_PATTERN
+ : (LETTER | DIGIT | UNDERSCORE | ASTERISK)
+ ;
+
+fragment UNQUOTED_ID_PATTERN
+ : (LETTER | ASTERISK) UNQUOTED_ID_BODY_WITH_PATTERN*
+ | (UNDERSCORE | ASPERAND) UNQUOTED_ID_BODY_WITH_PATTERN+
+ ;
+
+ID_PATTERN
+ : (UNQUOTED_ID_PATTERN | QUOTED_ID)+
+ ;
+
+PROJECT_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+PROJECT_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+PROJECT_WS
+ : WS -> channel(HIDDEN)
+ ;
+//
+// | RENAME a.b AS x, c AS y
+//
+mode RENAME_MODE;
+RENAME_PIPE : PIPE -> type(PIPE), popMode;
+RENAME_ASSIGN : ASSIGN -> type(ASSIGN);
+RENAME_COMMA : COMMA -> type(COMMA);
+RENAME_DOT: DOT -> type(DOT);
+
+AS : 'as';
+
+RENAME_ID_PATTERN
+ : ID_PATTERN -> type(ID_PATTERN)
+ ;
+
+RENAME_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+RENAME_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+RENAME_WS
+ : WS -> channel(HIDDEN)
+ ;
+
+// | ENRICH ON key WITH fields
+mode ENRICH_MODE;
+ENRICH_PIPE : PIPE -> type(PIPE), popMode;
+ENRICH_OPENING_BRACKET : OPENING_BRACKET -> type(OPENING_BRACKET), pushMode(SETTING_MODE);
+
+ON : 'on' -> pushMode(ENRICH_FIELD_MODE);
+WITH : 'with' -> pushMode(ENRICH_FIELD_MODE);
+
+// similar to that of an index
+// see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html#indices-create-api-path-params
+fragment ENRICH_POLICY_NAME_BODY
+ : ~[\\/?"<>| ,#\t\r\n:]
+ ;
+
+ENRICH_POLICY_NAME
+ // allow prefix for the policy to specify its resolution
+ : (ENRICH_POLICY_NAME_BODY+ COLON)? ENRICH_POLICY_NAME_BODY+
+ ;
+
+ENRICH_QUOTED_IDENTIFIER
+ : QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
+ ;
+
+ENRICH_MODE_UNQUOTED_VALUE
+ : ENRICH_POLICY_NAME -> type(ENRICH_POLICY_NAME)
+ ;
+
+ENRICH_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+ENRICH_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+ENRICH_WS
+ : WS -> channel(HIDDEN)
+ ;
+
+// submode for Enrich to allow different lexing between policy identifier (loose) and field identifiers
+mode ENRICH_FIELD_MODE;
+ENRICH_FIELD_PIPE : PIPE -> type(PIPE), popMode, popMode;
+ENRICH_FIELD_ASSIGN : ASSIGN -> type(ASSIGN);
+ENRICH_FIELD_COMMA : COMMA -> type(COMMA);
+ENRICH_FIELD_DOT: DOT -> type(DOT);
+
+ENRICH_FIELD_WITH : WITH -> type(WITH) ;
+
+ENRICH_FIELD_ID_PATTERN
+ : ID_PATTERN -> type(ID_PATTERN)
+ ;
+
+ENRICH_FIELD_QUOTED_IDENTIFIER
+ : QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
+ ;
+
+ENRICH_FIELD_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+ENRICH_FIELD_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+ENRICH_FIELD_WS
+ : WS -> channel(HIDDEN)
+ ;
+
+mode MVEXPAND_MODE;
+MVEXPAND_PIPE : PIPE -> type(PIPE), popMode;
+MVEXPAND_DOT: DOT -> type(DOT);
+
+MVEXPAND_QUOTED_IDENTIFIER
+ : QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
+ ;
+
+MVEXPAND_UNQUOTED_IDENTIFIER
+ : UNQUOTED_IDENTIFIER -> type(UNQUOTED_IDENTIFIER)
+ ;
+
+MVEXPAND_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+MVEXPAND_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+MVEXPAND_WS
+ : WS -> channel(HIDDEN)
+ ;
+
+//
+// SHOW commands
+//
+mode SHOW_MODE;
+SHOW_PIPE : PIPE -> type(PIPE), popMode;
+
+INFO : 'info';
+
+SHOW_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+SHOW_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+SHOW_WS
+ : WS -> channel(HIDDEN)
+ ;
+
+//
+// META commands
+//
+mode META_MODE;
+META_PIPE : PIPE -> type(PIPE), popMode;
+
+FUNCTIONS : 'functions';
+
+META_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+META_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+META_WS
+ : WS -> channel(HIDDEN)
+ ;
+
+mode SETTING_MODE;
+SETTING_CLOSING_BRACKET : CLOSING_BRACKET -> type(CLOSING_BRACKET), popMode;
+
+COLON : ':';
+
+SETTING
+ : (ASPERAND | DIGIT| DOT | LETTER | UNDERSCORE)+
+ ;
+
+SETTING_LINE_COMMENT
+ : LINE_COMMENT -> channel(HIDDEN)
+ ;
+
+SETTTING_MULTILINE_COMMENT
+ : MULTILINE_COMMENT -> channel(HIDDEN)
+ ;
+
+SETTING_WS
+ : WS -> channel(HIDDEN)
+ ;
\ No newline at end of file
diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.interp b/packages/kbn-esql-ast/src/antlr/esql_lexer.interp
new file mode 100644
index 0000000000000..ecf5ef0f4ffd5
--- /dev/null
+++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.interp
@@ -0,0 +1,401 @@
+token literal names:
+null
+'dissect'
+'drop'
+'enrich'
+'eval'
+'explain'
+'from'
+'grok'
+'inlinestats'
+'keep'
+'limit'
+'meta'
+'mv_expand'
+'rename'
+'row'
+'show'
+'sort'
+'stats'
+'where'
+null
+null
+null
+null
+null
+null
+null
+'|'
+null
+null
+null
+'by'
+'and'
+'asc'
+'='
+','
+'desc'
+'.'
+'false'
+'first'
+'last'
+'('
+'in'
+'is'
+'like'
+'not'
+'null'
+'nulls'
+'or'
+'?'
+'rlike'
+')'
+'true'
+'=='
+'=~'
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'/'
+'%'
+null
+']'
+null
+null
+null
+null
+null
+'metadata'
+null
+null
+null
+null
+null
+null
+null
+null
+'as'
+null
+null
+null
+'on'
+'with'
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+'info'
+null
+null
+null
+'functions'
+null
+null
+null
+':'
+null
+null
+null
+null
+
+token symbolic names:
+null
+DISSECT
+DROP
+ENRICH
+EVAL
+EXPLAIN
+FROM
+GROK
+INLINESTATS
+KEEP
+LIMIT
+META
+MV_EXPAND
+RENAME
+ROW
+SHOW
+SORT
+STATS
+WHERE
+UNKNOWN_CMD
+LINE_COMMENT
+MULTILINE_COMMENT
+WS
+EXPLAIN_WS
+EXPLAIN_LINE_COMMENT
+EXPLAIN_MULTILINE_COMMENT
+PIPE
+STRING
+INTEGER_LITERAL
+DECIMAL_LITERAL
+BY
+AND
+ASC
+ASSIGN
+COMMA
+DESC
+DOT
+FALSE
+FIRST
+LAST
+LP
+IN
+IS
+LIKE
+NOT
+NULL
+NULLS
+OR
+PARAM
+RLIKE
+RP
+TRUE
+EQ
+CIEQ
+NEQ
+LT
+LTE
+GT
+GTE
+PLUS
+MINUS
+ASTERISK
+SLASH
+PERCENT
+OPENING_BRACKET
+CLOSING_BRACKET
+UNQUOTED_IDENTIFIER
+QUOTED_IDENTIFIER
+EXPR_LINE_COMMENT
+EXPR_MULTILINE_COMMENT
+EXPR_WS
+METADATA
+FROM_UNQUOTED_IDENTIFIER
+FROM_LINE_COMMENT
+FROM_MULTILINE_COMMENT
+FROM_WS
+ID_PATTERN
+PROJECT_LINE_COMMENT
+PROJECT_MULTILINE_COMMENT
+PROJECT_WS
+AS
+RENAME_LINE_COMMENT
+RENAME_MULTILINE_COMMENT
+RENAME_WS
+ON
+WITH
+ENRICH_POLICY_NAME
+ENRICH_LINE_COMMENT
+ENRICH_MULTILINE_COMMENT
+ENRICH_WS
+ENRICH_FIELD_LINE_COMMENT
+ENRICH_FIELD_MULTILINE_COMMENT
+ENRICH_FIELD_WS
+MVEXPAND_LINE_COMMENT
+MVEXPAND_MULTILINE_COMMENT
+MVEXPAND_WS
+INFO
+SHOW_LINE_COMMENT
+SHOW_MULTILINE_COMMENT
+SHOW_WS
+FUNCTIONS
+META_LINE_COMMENT
+META_MULTILINE_COMMENT
+META_WS
+COLON
+SETTING
+SETTING_LINE_COMMENT
+SETTTING_MULTILINE_COMMENT
+SETTING_WS
+
+rule names:
+DISSECT
+DROP
+ENRICH
+EVAL
+EXPLAIN
+FROM
+GROK
+INLINESTATS
+KEEP
+LIMIT
+META
+MV_EXPAND
+RENAME
+ROW
+SHOW
+SORT
+STATS
+WHERE
+UNKNOWN_CMD
+LINE_COMMENT
+MULTILINE_COMMENT
+WS
+EXPLAIN_OPENING_BRACKET
+EXPLAIN_PIPE
+EXPLAIN_WS
+EXPLAIN_LINE_COMMENT
+EXPLAIN_MULTILINE_COMMENT
+PIPE
+DIGIT
+LETTER
+ESCAPE_SEQUENCE
+UNESCAPED_CHARS
+EXPONENT
+ASPERAND
+BACKQUOTE
+BACKQUOTE_BLOCK
+UNDERSCORE
+UNQUOTED_ID_BODY
+STRING
+INTEGER_LITERAL
+DECIMAL_LITERAL
+BY
+AND
+ASC
+ASSIGN
+COMMA
+DESC
+DOT
+FALSE
+FIRST
+LAST
+LP
+IN
+IS
+LIKE
+NOT
+NULL
+NULLS
+OR
+PARAM
+RLIKE
+RP
+TRUE
+EQ
+CIEQ
+NEQ
+LT
+LTE
+GT
+GTE
+PLUS
+MINUS
+ASTERISK
+SLASH
+PERCENT
+OPENING_BRACKET
+CLOSING_BRACKET
+UNQUOTED_IDENTIFIER
+QUOTED_ID
+QUOTED_IDENTIFIER
+EXPR_LINE_COMMENT
+EXPR_MULTILINE_COMMENT
+EXPR_WS
+FROM_PIPE
+FROM_OPENING_BRACKET
+FROM_CLOSING_BRACKET
+FROM_COMMA
+FROM_ASSIGN
+METADATA
+FROM_UNQUOTED_IDENTIFIER_PART
+FROM_UNQUOTED_IDENTIFIER
+FROM_QUOTED_IDENTIFIER
+FROM_LINE_COMMENT
+FROM_MULTILINE_COMMENT
+FROM_WS
+PROJECT_PIPE
+PROJECT_DOT
+PROJECT_COMMA
+UNQUOTED_ID_BODY_WITH_PATTERN
+UNQUOTED_ID_PATTERN
+ID_PATTERN
+PROJECT_LINE_COMMENT
+PROJECT_MULTILINE_COMMENT
+PROJECT_WS
+RENAME_PIPE
+RENAME_ASSIGN
+RENAME_COMMA
+RENAME_DOT
+AS
+RENAME_ID_PATTERN
+RENAME_LINE_COMMENT
+RENAME_MULTILINE_COMMENT
+RENAME_WS
+ENRICH_PIPE
+ENRICH_OPENING_BRACKET
+ON
+WITH
+ENRICH_POLICY_NAME_BODY
+ENRICH_POLICY_NAME
+ENRICH_QUOTED_IDENTIFIER
+ENRICH_MODE_UNQUOTED_VALUE
+ENRICH_LINE_COMMENT
+ENRICH_MULTILINE_COMMENT
+ENRICH_WS
+ENRICH_FIELD_PIPE
+ENRICH_FIELD_ASSIGN
+ENRICH_FIELD_COMMA
+ENRICH_FIELD_DOT
+ENRICH_FIELD_WITH
+ENRICH_FIELD_ID_PATTERN
+ENRICH_FIELD_QUOTED_IDENTIFIER
+ENRICH_FIELD_LINE_COMMENT
+ENRICH_FIELD_MULTILINE_COMMENT
+ENRICH_FIELD_WS
+MVEXPAND_PIPE
+MVEXPAND_DOT
+MVEXPAND_QUOTED_IDENTIFIER
+MVEXPAND_UNQUOTED_IDENTIFIER
+MVEXPAND_LINE_COMMENT
+MVEXPAND_MULTILINE_COMMENT
+MVEXPAND_WS
+SHOW_PIPE
+INFO
+SHOW_LINE_COMMENT
+SHOW_MULTILINE_COMMENT
+SHOW_WS
+META_PIPE
+FUNCTIONS
+META_LINE_COMMENT
+META_MULTILINE_COMMENT
+META_WS
+SETTING_CLOSING_BRACKET
+COLON
+SETTING
+SETTING_LINE_COMMENT
+SETTTING_MULTILINE_COMMENT
+SETTING_WS
+
+channel names:
+DEFAULT_TOKEN_CHANNEL
+HIDDEN
+
+mode names:
+DEFAULT_MODE
+EXPLAIN_MODE
+EXPRESSION_MODE
+FROM_MODE
+PROJECT_MODE
+RENAME_MODE
+ENRICH_MODE
+ENRICH_FIELD_MODE
+MVEXPAND_MODE
+SHOW_MODE
+META_MODE
+SETTING_MODE
+
+atn:
+[4, 0, 108, 1182, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 4, 18, 478, 8, 18, 11, 18, 12, 18, 479, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 488, 8, 19, 10, 19, 12, 19, 491, 9, 19, 1, 19, 3, 19, 494, 8, 19, 1, 19, 3, 19, 497, 8, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 506, 8, 20, 10, 20, 12, 20, 509, 9, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 4, 21, 517, 8, 21, 11, 21, 12, 21, 518, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 3, 32, 560, 8, 32, 1, 32, 4, 32, 563, 8, 32, 11, 32, 12, 32, 564, 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 3, 35, 574, 8, 35, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 3, 37, 581, 8, 37, 1, 38, 1, 38, 1, 38, 5, 38, 586, 8, 38, 10, 38, 12, 38, 589, 9, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 597, 8, 38, 10, 38, 12, 38, 600, 9, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 607, 8, 38, 1, 38, 3, 38, 610, 8, 38, 3, 38, 612, 8, 38, 1, 39, 4, 39, 615, 8, 39, 11, 39, 12, 39, 616, 1, 40, 4, 40, 620, 8, 40, 11, 40, 12, 40, 621, 1, 40, 1, 40, 5, 40, 626, 8, 40, 10, 40, 12, 40, 629, 9, 40, 1, 40, 1, 40, 4, 40, 633, 8, 40, 11, 40, 12, 40, 634, 1, 40, 4, 40, 638, 8, 40, 11, 40, 12, 40, 639, 1, 40, 1, 40, 5, 40, 644, 8, 40, 10, 40, 12, 40, 647, 9, 40, 3, 40, 649, 8, 40, 1, 40, 1, 40, 1, 40, 1, 40, 4, 40, 655, 8, 40, 11, 40, 12, 40, 656, 1, 40, 1, 40, 3, 40, 661, 8, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 5, 77, 789, 8, 77, 10, 77, 12, 77, 792, 9, 77, 1, 77, 1, 77, 3, 77, 796, 8, 77, 1, 77, 4, 77, 799, 8, 77, 11, 77, 12, 77, 800, 3, 77, 803, 8, 77, 1, 78, 1, 78, 4, 78, 807, 8, 78, 11, 78, 12, 78, 808, 1, 78, 1, 78, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 3, 89, 860, 8, 89, 1, 90, 4, 90, 863, 8, 90, 11, 90, 12, 90, 864, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 3, 98, 900, 8, 98, 1, 99, 1, 99, 3, 99, 904, 8, 99, 1, 99, 5, 99, 907, 8, 99, 10, 99, 12, 99, 910, 9, 99, 1, 99, 1, 99, 3, 99, 914, 8, 99, 1, 99, 4, 99, 917, 8, 99, 11, 99, 12, 99, 918, 3, 99, 921, 8, 99, 1, 100, 1, 100, 4, 100, 925, 8, 100, 11, 100, 12, 100, 926, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 118, 4, 118, 1002, 8, 118, 11, 118, 12, 118, 1003, 1, 118, 1, 118, 3, 118, 1008, 8, 118, 1, 118, 4, 118, 1011, 8, 118, 11, 118, 12, 118, 1012, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 4, 153, 1167, 8, 153, 11, 153, 12, 153, 1168, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 2, 507, 598, 0, 157, 12, 1, 14, 2, 16, 3, 18, 4, 20, 5, 22, 6, 24, 7, 26, 8, 28, 9, 30, 10, 32, 11, 34, 12, 36, 13, 38, 14, 40, 15, 42, 16, 44, 17, 46, 18, 48, 19, 50, 20, 52, 21, 54, 22, 56, 0, 58, 0, 60, 23, 62, 24, 64, 25, 66, 26, 68, 0, 70, 0, 72, 0, 74, 0, 76, 0, 78, 0, 80, 0, 82, 0, 84, 0, 86, 0, 88, 27, 90, 28, 92, 29, 94, 30, 96, 31, 98, 32, 100, 33, 102, 34, 104, 35, 106, 36, 108, 37, 110, 38, 112, 39, 114, 40, 116, 41, 118, 42, 120, 43, 122, 44, 124, 45, 126, 46, 128, 47, 130, 48, 132, 49, 134, 50, 136, 51, 138, 52, 140, 53, 142, 54, 144, 55, 146, 56, 148, 57, 150, 58, 152, 59, 154, 60, 156, 61, 158, 62, 160, 63, 162, 64, 164, 65, 166, 66, 168, 0, 170, 67, 172, 68, 174, 69, 176, 70, 178, 0, 180, 0, 182, 0, 184, 0, 186, 0, 188, 71, 190, 0, 192, 72, 194, 0, 196, 73, 198, 74, 200, 75, 202, 0, 204, 0, 206, 0, 208, 0, 210, 0, 212, 76, 214, 77, 216, 78, 218, 79, 220, 0, 222, 0, 224, 0, 226, 0, 228, 80, 230, 0, 232, 81, 234, 82, 236, 83, 238, 0, 240, 0, 242, 84, 244, 85, 246, 0, 248, 86, 250, 0, 252, 0, 254, 87, 256, 88, 258, 89, 260, 0, 262, 0, 264, 0, 266, 0, 268, 0, 270, 0, 272, 0, 274, 90, 276, 91, 278, 92, 280, 0, 282, 0, 284, 0, 286, 0, 288, 93, 290, 94, 292, 95, 294, 0, 296, 96, 298, 97, 300, 98, 302, 99, 304, 0, 306, 100, 308, 101, 310, 102, 312, 103, 314, 0, 316, 104, 318, 105, 320, 106, 322, 107, 324, 108, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 35, 2, 0, 68, 68, 100, 100, 2, 0, 73, 73, 105, 105, 2, 0, 83, 83, 115, 115, 2, 0, 69, 69, 101, 101, 2, 0, 67, 67, 99, 99, 2, 0, 84, 84, 116, 116, 2, 0, 82, 82, 114, 114, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 78, 78, 110, 110, 2, 0, 72, 72, 104, 104, 2, 0, 86, 86, 118, 118, 2, 0, 65, 65, 97, 97, 2, 0, 76, 76, 108, 108, 2, 0, 88, 88, 120, 120, 2, 0, 70, 70, 102, 102, 2, 0, 77, 77, 109, 109, 2, 0, 71, 71, 103, 103, 2, 0, 75, 75, 107, 107, 2, 0, 87, 87, 119, 119, 6, 0, 9, 10, 13, 13, 32, 32, 47, 47, 91, 91, 93, 93, 2, 0, 10, 10, 13, 13, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 8, 0, 34, 34, 78, 78, 82, 82, 84, 84, 92, 92, 110, 110, 114, 114, 116, 116, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 2, 0, 43, 43, 45, 45, 1, 0, 96, 96, 2, 0, 66, 66, 98, 98, 2, 0, 89, 89, 121, 121, 2, 0, 85, 85, 117, 117, 10, 0, 9, 10, 13, 13, 32, 32, 44, 44, 47, 47, 61, 61, 91, 91, 93, 93, 96, 96, 124, 124, 2, 0, 42, 42, 47, 47, 11, 0, 9, 10, 13, 13, 32, 32, 34, 35, 44, 44, 47, 47, 58, 58, 60, 60, 62, 63, 92, 92, 124, 124, 1209, 0, 12, 1, 0, 0, 0, 0, 14, 1, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 26, 1, 0, 0, 0, 0, 28, 1, 0, 0, 0, 0, 30, 1, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 34, 1, 0, 0, 0, 0, 36, 1, 0, 0, 0, 0, 38, 1, 0, 0, 0, 0, 40, 1, 0, 0, 0, 0, 42, 1, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0, 46, 1, 0, 0, 0, 0, 48, 1, 0, 0, 0, 0, 50, 1, 0, 0, 0, 0, 52, 1, 0, 0, 0, 0, 54, 1, 0, 0, 0, 1, 56, 1, 0, 0, 0, 1, 58, 1, 0, 0, 0, 1, 60, 1, 0, 0, 0, 1, 62, 1, 0, 0, 0, 1, 64, 1, 0, 0, 0, 2, 66, 1, 0, 0, 0, 2, 88, 1, 0, 0, 0, 2, 90, 1, 0, 0, 0, 2, 92, 1, 0, 0, 0, 2, 94, 1, 0, 0, 0, 2, 96, 1, 0, 0, 0, 2, 98, 1, 0, 0, 0, 2, 100, 1, 0, 0, 0, 2, 102, 1, 0, 0, 0, 2, 104, 1, 0, 0, 0, 2, 106, 1, 0, 0, 0, 2, 108, 1, 0, 0, 0, 2, 110, 1, 0, 0, 0, 2, 112, 1, 0, 0, 0, 2, 114, 1, 0, 0, 0, 2, 116, 1, 0, 0, 0, 2, 118, 1, 0, 0, 0, 2, 120, 1, 0, 0, 0, 2, 122, 1, 0, 0, 0, 2, 124, 1, 0, 0, 0, 2, 126, 1, 0, 0, 0, 2, 128, 1, 0, 0, 0, 2, 130, 1, 0, 0, 0, 2, 132, 1, 0, 0, 0, 2, 134, 1, 0, 0, 0, 2, 136, 1, 0, 0, 0, 2, 138, 1, 0, 0, 0, 2, 140, 1, 0, 0, 0, 2, 142, 1, 0, 0, 0, 2, 144, 1, 0, 0, 0, 2, 146, 1, 0, 0, 0, 2, 148, 1, 0, 0, 0, 2, 150, 1, 0, 0, 0, 2, 152, 1, 0, 0, 0, 2, 154, 1, 0, 0, 0, 2, 156, 1, 0, 0, 0, 2, 158, 1, 0, 0, 0, 2, 160, 1, 0, 0, 0, 2, 162, 1, 0, 0, 0, 2, 164, 1, 0, 0, 0, 2, 166, 1, 0, 0, 0, 2, 170, 1, 0, 0, 0, 2, 172, 1, 0, 0, 0, 2, 174, 1, 0, 0, 0, 2, 176, 1, 0, 0, 0, 3, 178, 1, 0, 0, 0, 3, 180, 1, 0, 0, 0, 3, 182, 1, 0, 0, 0, 3, 184, 1, 0, 0, 0, 3, 186, 1, 0, 0, 0, 3, 188, 1, 0, 0, 0, 3, 192, 1, 0, 0, 0, 3, 194, 1, 0, 0, 0, 3, 196, 1, 0, 0, 0, 3, 198, 1, 0, 0, 0, 3, 200, 1, 0, 0, 0, 4, 202, 1, 0, 0, 0, 4, 204, 1, 0, 0, 0, 4, 206, 1, 0, 0, 0, 4, 212, 1, 0, 0, 0, 4, 214, 1, 0, 0, 0, 4, 216, 1, 0, 0, 0, 4, 218, 1, 0, 0, 0, 5, 220, 1, 0, 0, 0, 5, 222, 1, 0, 0, 0, 5, 224, 1, 0, 0, 0, 5, 226, 1, 0, 0, 0, 5, 228, 1, 0, 0, 0, 5, 230, 1, 0, 0, 0, 5, 232, 1, 0, 0, 0, 5, 234, 1, 0, 0, 0, 5, 236, 1, 0, 0, 0, 6, 238, 1, 0, 0, 0, 6, 240, 1, 0, 0, 0, 6, 242, 1, 0, 0, 0, 6, 244, 1, 0, 0, 0, 6, 248, 1, 0, 0, 0, 6, 250, 1, 0, 0, 0, 6, 252, 1, 0, 0, 0, 6, 254, 1, 0, 0, 0, 6, 256, 1, 0, 0, 0, 6, 258, 1, 0, 0, 0, 7, 260, 1, 0, 0, 0, 7, 262, 1, 0, 0, 0, 7, 264, 1, 0, 0, 0, 7, 266, 1, 0, 0, 0, 7, 268, 1, 0, 0, 0, 7, 270, 1, 0, 0, 0, 7, 272, 1, 0, 0, 0, 7, 274, 1, 0, 0, 0, 7, 276, 1, 0, 0, 0, 7, 278, 1, 0, 0, 0, 8, 280, 1, 0, 0, 0, 8, 282, 1, 0, 0, 0, 8, 284, 1, 0, 0, 0, 8, 286, 1, 0, 0, 0, 8, 288, 1, 0, 0, 0, 8, 290, 1, 0, 0, 0, 8, 292, 1, 0, 0, 0, 9, 294, 1, 0, 0, 0, 9, 296, 1, 0, 0, 0, 9, 298, 1, 0, 0, 0, 9, 300, 1, 0, 0, 0, 9, 302, 1, 0, 0, 0, 10, 304, 1, 0, 0, 0, 10, 306, 1, 0, 0, 0, 10, 308, 1, 0, 0, 0, 10, 310, 1, 0, 0, 0, 10, 312, 1, 0, 0, 0, 11, 314, 1, 0, 0, 0, 11, 316, 1, 0, 0, 0, 11, 318, 1, 0, 0, 0, 11, 320, 1, 0, 0, 0, 11, 322, 1, 0, 0, 0, 11, 324, 1, 0, 0, 0, 12, 326, 1, 0, 0, 0, 14, 336, 1, 0, 0, 0, 16, 343, 1, 0, 0, 0, 18, 352, 1, 0, 0, 0, 20, 359, 1, 0, 0, 0, 22, 369, 1, 0, 0, 0, 24, 376, 1, 0, 0, 0, 26, 383, 1, 0, 0, 0, 28, 397, 1, 0, 0, 0, 30, 404, 1, 0, 0, 0, 32, 412, 1, 0, 0, 0, 34, 419, 1, 0, 0, 0, 36, 431, 1, 0, 0, 0, 38, 440, 1, 0, 0, 0, 40, 446, 1, 0, 0, 0, 42, 453, 1, 0, 0, 0, 44, 460, 1, 0, 0, 0, 46, 468, 1, 0, 0, 0, 48, 477, 1, 0, 0, 0, 50, 483, 1, 0, 0, 0, 52, 500, 1, 0, 0, 0, 54, 516, 1, 0, 0, 0, 56, 522, 1, 0, 0, 0, 58, 527, 1, 0, 0, 0, 60, 532, 1, 0, 0, 0, 62, 536, 1, 0, 0, 0, 64, 540, 1, 0, 0, 0, 66, 544, 1, 0, 0, 0, 68, 548, 1, 0, 0, 0, 70, 550, 1, 0, 0, 0, 72, 552, 1, 0, 0, 0, 74, 555, 1, 0, 0, 0, 76, 557, 1, 0, 0, 0, 78, 566, 1, 0, 0, 0, 80, 568, 1, 0, 0, 0, 82, 573, 1, 0, 0, 0, 84, 575, 1, 0, 0, 0, 86, 580, 1, 0, 0, 0, 88, 611, 1, 0, 0, 0, 90, 614, 1, 0, 0, 0, 92, 660, 1, 0, 0, 0, 94, 662, 1, 0, 0, 0, 96, 665, 1, 0, 0, 0, 98, 669, 1, 0, 0, 0, 100, 673, 1, 0, 0, 0, 102, 675, 1, 0, 0, 0, 104, 677, 1, 0, 0, 0, 106, 682, 1, 0, 0, 0, 108, 684, 1, 0, 0, 0, 110, 690, 1, 0, 0, 0, 112, 696, 1, 0, 0, 0, 114, 701, 1, 0, 0, 0, 116, 703, 1, 0, 0, 0, 118, 706, 1, 0, 0, 0, 120, 709, 1, 0, 0, 0, 122, 714, 1, 0, 0, 0, 124, 718, 1, 0, 0, 0, 126, 723, 1, 0, 0, 0, 128, 729, 1, 0, 0, 0, 130, 732, 1, 0, 0, 0, 132, 734, 1, 0, 0, 0, 134, 740, 1, 0, 0, 0, 136, 742, 1, 0, 0, 0, 138, 747, 1, 0, 0, 0, 140, 750, 1, 0, 0, 0, 142, 753, 1, 0, 0, 0, 144, 756, 1, 0, 0, 0, 146, 758, 1, 0, 0, 0, 148, 761, 1, 0, 0, 0, 150, 763, 1, 0, 0, 0, 152, 766, 1, 0, 0, 0, 154, 768, 1, 0, 0, 0, 156, 770, 1, 0, 0, 0, 158, 772, 1, 0, 0, 0, 160, 774, 1, 0, 0, 0, 162, 776, 1, 0, 0, 0, 164, 781, 1, 0, 0, 0, 166, 802, 1, 0, 0, 0, 168, 804, 1, 0, 0, 0, 170, 812, 1, 0, 0, 0, 172, 814, 1, 0, 0, 0, 174, 818, 1, 0, 0, 0, 176, 822, 1, 0, 0, 0, 178, 826, 1, 0, 0, 0, 180, 831, 1, 0, 0, 0, 182, 835, 1, 0, 0, 0, 184, 839, 1, 0, 0, 0, 186, 843, 1, 0, 0, 0, 188, 847, 1, 0, 0, 0, 190, 859, 1, 0, 0, 0, 192, 862, 1, 0, 0, 0, 194, 866, 1, 0, 0, 0, 196, 870, 1, 0, 0, 0, 198, 874, 1, 0, 0, 0, 200, 878, 1, 0, 0, 0, 202, 882, 1, 0, 0, 0, 204, 887, 1, 0, 0, 0, 206, 891, 1, 0, 0, 0, 208, 899, 1, 0, 0, 0, 210, 920, 1, 0, 0, 0, 212, 924, 1, 0, 0, 0, 214, 928, 1, 0, 0, 0, 216, 932, 1, 0, 0, 0, 218, 936, 1, 0, 0, 0, 220, 940, 1, 0, 0, 0, 222, 945, 1, 0, 0, 0, 224, 949, 1, 0, 0, 0, 226, 953, 1, 0, 0, 0, 228, 957, 1, 0, 0, 0, 230, 960, 1, 0, 0, 0, 232, 964, 1, 0, 0, 0, 234, 968, 1, 0, 0, 0, 236, 972, 1, 0, 0, 0, 238, 976, 1, 0, 0, 0, 240, 981, 1, 0, 0, 0, 242, 986, 1, 0, 0, 0, 244, 991, 1, 0, 0, 0, 246, 998, 1, 0, 0, 0, 248, 1007, 1, 0, 0, 0, 250, 1014, 1, 0, 0, 0, 252, 1018, 1, 0, 0, 0, 254, 1022, 1, 0, 0, 0, 256, 1026, 1, 0, 0, 0, 258, 1030, 1, 0, 0, 0, 260, 1034, 1, 0, 0, 0, 262, 1040, 1, 0, 0, 0, 264, 1044, 1, 0, 0, 0, 266, 1048, 1, 0, 0, 0, 268, 1052, 1, 0, 0, 0, 270, 1056, 1, 0, 0, 0, 272, 1060, 1, 0, 0, 0, 274, 1064, 1, 0, 0, 0, 276, 1068, 1, 0, 0, 0, 278, 1072, 1, 0, 0, 0, 280, 1076, 1, 0, 0, 0, 282, 1081, 1, 0, 0, 0, 284, 1085, 1, 0, 0, 0, 286, 1089, 1, 0, 0, 0, 288, 1093, 1, 0, 0, 0, 290, 1097, 1, 0, 0, 0, 292, 1101, 1, 0, 0, 0, 294, 1105, 1, 0, 0, 0, 296, 1110, 1, 0, 0, 0, 298, 1115, 1, 0, 0, 0, 300, 1119, 1, 0, 0, 0, 302, 1123, 1, 0, 0, 0, 304, 1127, 1, 0, 0, 0, 306, 1132, 1, 0, 0, 0, 308, 1142, 1, 0, 0, 0, 310, 1146, 1, 0, 0, 0, 312, 1150, 1, 0, 0, 0, 314, 1154, 1, 0, 0, 0, 316, 1159, 1, 0, 0, 0, 318, 1166, 1, 0, 0, 0, 320, 1170, 1, 0, 0, 0, 322, 1174, 1, 0, 0, 0, 324, 1178, 1, 0, 0, 0, 326, 327, 7, 0, 0, 0, 327, 328, 7, 1, 0, 0, 328, 329, 7, 2, 0, 0, 329, 330, 7, 2, 0, 0, 330, 331, 7, 3, 0, 0, 331, 332, 7, 4, 0, 0, 332, 333, 7, 5, 0, 0, 333, 334, 1, 0, 0, 0, 334, 335, 6, 0, 0, 0, 335, 13, 1, 0, 0, 0, 336, 337, 7, 0, 0, 0, 337, 338, 7, 6, 0, 0, 338, 339, 7, 7, 0, 0, 339, 340, 7, 8, 0, 0, 340, 341, 1, 0, 0, 0, 341, 342, 6, 1, 1, 0, 342, 15, 1, 0, 0, 0, 343, 344, 7, 3, 0, 0, 344, 345, 7, 9, 0, 0, 345, 346, 7, 6, 0, 0, 346, 347, 7, 1, 0, 0, 347, 348, 7, 4, 0, 0, 348, 349, 7, 10, 0, 0, 349, 350, 1, 0, 0, 0, 350, 351, 6, 2, 2, 0, 351, 17, 1, 0, 0, 0, 352, 353, 7, 3, 0, 0, 353, 354, 7, 11, 0, 0, 354, 355, 7, 12, 0, 0, 355, 356, 7, 13, 0, 0, 356, 357, 1, 0, 0, 0, 357, 358, 6, 3, 0, 0, 358, 19, 1, 0, 0, 0, 359, 360, 7, 3, 0, 0, 360, 361, 7, 14, 0, 0, 361, 362, 7, 8, 0, 0, 362, 363, 7, 13, 0, 0, 363, 364, 7, 12, 0, 0, 364, 365, 7, 1, 0, 0, 365, 366, 7, 9, 0, 0, 366, 367, 1, 0, 0, 0, 367, 368, 6, 4, 3, 0, 368, 21, 1, 0, 0, 0, 369, 370, 7, 15, 0, 0, 370, 371, 7, 6, 0, 0, 371, 372, 7, 7, 0, 0, 372, 373, 7, 16, 0, 0, 373, 374, 1, 0, 0, 0, 374, 375, 6, 5, 4, 0, 375, 23, 1, 0, 0, 0, 376, 377, 7, 17, 0, 0, 377, 378, 7, 6, 0, 0, 378, 379, 7, 7, 0, 0, 379, 380, 7, 18, 0, 0, 380, 381, 1, 0, 0, 0, 381, 382, 6, 6, 0, 0, 382, 25, 1, 0, 0, 0, 383, 384, 7, 1, 0, 0, 384, 385, 7, 9, 0, 0, 385, 386, 7, 13, 0, 0, 386, 387, 7, 1, 0, 0, 387, 388, 7, 9, 0, 0, 388, 389, 7, 3, 0, 0, 389, 390, 7, 2, 0, 0, 390, 391, 7, 5, 0, 0, 391, 392, 7, 12, 0, 0, 392, 393, 7, 5, 0, 0, 393, 394, 7, 2, 0, 0, 394, 395, 1, 0, 0, 0, 395, 396, 6, 7, 0, 0, 396, 27, 1, 0, 0, 0, 397, 398, 7, 18, 0, 0, 398, 399, 7, 3, 0, 0, 399, 400, 7, 3, 0, 0, 400, 401, 7, 8, 0, 0, 401, 402, 1, 0, 0, 0, 402, 403, 6, 8, 1, 0, 403, 29, 1, 0, 0, 0, 404, 405, 7, 13, 0, 0, 405, 406, 7, 1, 0, 0, 406, 407, 7, 16, 0, 0, 407, 408, 7, 1, 0, 0, 408, 409, 7, 5, 0, 0, 409, 410, 1, 0, 0, 0, 410, 411, 6, 9, 0, 0, 411, 31, 1, 0, 0, 0, 412, 413, 7, 16, 0, 0, 413, 414, 7, 3, 0, 0, 414, 415, 7, 5, 0, 0, 415, 416, 7, 12, 0, 0, 416, 417, 1, 0, 0, 0, 417, 418, 6, 10, 5, 0, 418, 33, 1, 0, 0, 0, 419, 420, 7, 16, 0, 0, 420, 421, 7, 11, 0, 0, 421, 422, 5, 95, 0, 0, 422, 423, 7, 3, 0, 0, 423, 424, 7, 14, 0, 0, 424, 425, 7, 8, 0, 0, 425, 426, 7, 12, 0, 0, 426, 427, 7, 9, 0, 0, 427, 428, 7, 0, 0, 0, 428, 429, 1, 0, 0, 0, 429, 430, 6, 11, 6, 0, 430, 35, 1, 0, 0, 0, 431, 432, 7, 6, 0, 0, 432, 433, 7, 3, 0, 0, 433, 434, 7, 9, 0, 0, 434, 435, 7, 12, 0, 0, 435, 436, 7, 16, 0, 0, 436, 437, 7, 3, 0, 0, 437, 438, 1, 0, 0, 0, 438, 439, 6, 12, 7, 0, 439, 37, 1, 0, 0, 0, 440, 441, 7, 6, 0, 0, 441, 442, 7, 7, 0, 0, 442, 443, 7, 19, 0, 0, 443, 444, 1, 0, 0, 0, 444, 445, 6, 13, 0, 0, 445, 39, 1, 0, 0, 0, 446, 447, 7, 2, 0, 0, 447, 448, 7, 10, 0, 0, 448, 449, 7, 7, 0, 0, 449, 450, 7, 19, 0, 0, 450, 451, 1, 0, 0, 0, 451, 452, 6, 14, 8, 0, 452, 41, 1, 0, 0, 0, 453, 454, 7, 2, 0, 0, 454, 455, 7, 7, 0, 0, 455, 456, 7, 6, 0, 0, 456, 457, 7, 5, 0, 0, 457, 458, 1, 0, 0, 0, 458, 459, 6, 15, 0, 0, 459, 43, 1, 0, 0, 0, 460, 461, 7, 2, 0, 0, 461, 462, 7, 5, 0, 0, 462, 463, 7, 12, 0, 0, 463, 464, 7, 5, 0, 0, 464, 465, 7, 2, 0, 0, 465, 466, 1, 0, 0, 0, 466, 467, 6, 16, 0, 0, 467, 45, 1, 0, 0, 0, 468, 469, 7, 19, 0, 0, 469, 470, 7, 10, 0, 0, 470, 471, 7, 3, 0, 0, 471, 472, 7, 6, 0, 0, 472, 473, 7, 3, 0, 0, 473, 474, 1, 0, 0, 0, 474, 475, 6, 17, 0, 0, 475, 47, 1, 0, 0, 0, 476, 478, 8, 20, 0, 0, 477, 476, 1, 0, 0, 0, 478, 479, 1, 0, 0, 0, 479, 477, 1, 0, 0, 0, 479, 480, 1, 0, 0, 0, 480, 481, 1, 0, 0, 0, 481, 482, 6, 18, 0, 0, 482, 49, 1, 0, 0, 0, 483, 484, 5, 47, 0, 0, 484, 485, 5, 47, 0, 0, 485, 489, 1, 0, 0, 0, 486, 488, 8, 21, 0, 0, 487, 486, 1, 0, 0, 0, 488, 491, 1, 0, 0, 0, 489, 487, 1, 0, 0, 0, 489, 490, 1, 0, 0, 0, 490, 493, 1, 0, 0, 0, 491, 489, 1, 0, 0, 0, 492, 494, 5, 13, 0, 0, 493, 492, 1, 0, 0, 0, 493, 494, 1, 0, 0, 0, 494, 496, 1, 0, 0, 0, 495, 497, 5, 10, 0, 0, 496, 495, 1, 0, 0, 0, 496, 497, 1, 0, 0, 0, 497, 498, 1, 0, 0, 0, 498, 499, 6, 19, 9, 0, 499, 51, 1, 0, 0, 0, 500, 501, 5, 47, 0, 0, 501, 502, 5, 42, 0, 0, 502, 507, 1, 0, 0, 0, 503, 506, 3, 52, 20, 0, 504, 506, 9, 0, 0, 0, 505, 503, 1, 0, 0, 0, 505, 504, 1, 0, 0, 0, 506, 509, 1, 0, 0, 0, 507, 508, 1, 0, 0, 0, 507, 505, 1, 0, 0, 0, 508, 510, 1, 0, 0, 0, 509, 507, 1, 0, 0, 0, 510, 511, 5, 42, 0, 0, 511, 512, 5, 47, 0, 0, 512, 513, 1, 0, 0, 0, 513, 514, 6, 20, 9, 0, 514, 53, 1, 0, 0, 0, 515, 517, 7, 22, 0, 0, 516, 515, 1, 0, 0, 0, 517, 518, 1, 0, 0, 0, 518, 516, 1, 0, 0, 0, 518, 519, 1, 0, 0, 0, 519, 520, 1, 0, 0, 0, 520, 521, 6, 21, 9, 0, 521, 55, 1, 0, 0, 0, 522, 523, 3, 162, 75, 0, 523, 524, 1, 0, 0, 0, 524, 525, 6, 22, 10, 0, 525, 526, 6, 22, 11, 0, 526, 57, 1, 0, 0, 0, 527, 528, 3, 66, 27, 0, 528, 529, 1, 0, 0, 0, 529, 530, 6, 23, 12, 0, 530, 531, 6, 23, 13, 0, 531, 59, 1, 0, 0, 0, 532, 533, 3, 54, 21, 0, 533, 534, 1, 0, 0, 0, 534, 535, 6, 24, 9, 0, 535, 61, 1, 0, 0, 0, 536, 537, 3, 50, 19, 0, 537, 538, 1, 0, 0, 0, 538, 539, 6, 25, 9, 0, 539, 63, 1, 0, 0, 0, 540, 541, 3, 52, 20, 0, 541, 542, 1, 0, 0, 0, 542, 543, 6, 26, 9, 0, 543, 65, 1, 0, 0, 0, 544, 545, 5, 124, 0, 0, 545, 546, 1, 0, 0, 0, 546, 547, 6, 27, 13, 0, 547, 67, 1, 0, 0, 0, 548, 549, 7, 23, 0, 0, 549, 69, 1, 0, 0, 0, 550, 551, 7, 24, 0, 0, 551, 71, 1, 0, 0, 0, 552, 553, 5, 92, 0, 0, 553, 554, 7, 25, 0, 0, 554, 73, 1, 0, 0, 0, 555, 556, 8, 26, 0, 0, 556, 75, 1, 0, 0, 0, 557, 559, 7, 3, 0, 0, 558, 560, 7, 27, 0, 0, 559, 558, 1, 0, 0, 0, 559, 560, 1, 0, 0, 0, 560, 562, 1, 0, 0, 0, 561, 563, 3, 68, 28, 0, 562, 561, 1, 0, 0, 0, 563, 564, 1, 0, 0, 0, 564, 562, 1, 0, 0, 0, 564, 565, 1, 0, 0, 0, 565, 77, 1, 0, 0, 0, 566, 567, 5, 64, 0, 0, 567, 79, 1, 0, 0, 0, 568, 569, 5, 96, 0, 0, 569, 81, 1, 0, 0, 0, 570, 574, 8, 28, 0, 0, 571, 572, 5, 96, 0, 0, 572, 574, 5, 96, 0, 0, 573, 570, 1, 0, 0, 0, 573, 571, 1, 0, 0, 0, 574, 83, 1, 0, 0, 0, 575, 576, 5, 95, 0, 0, 576, 85, 1, 0, 0, 0, 577, 581, 3, 70, 29, 0, 578, 581, 3, 68, 28, 0, 579, 581, 3, 84, 36, 0, 580, 577, 1, 0, 0, 0, 580, 578, 1, 0, 0, 0, 580, 579, 1, 0, 0, 0, 581, 87, 1, 0, 0, 0, 582, 587, 5, 34, 0, 0, 583, 586, 3, 72, 30, 0, 584, 586, 3, 74, 31, 0, 585, 583, 1, 0, 0, 0, 585, 584, 1, 0, 0, 0, 586, 589, 1, 0, 0, 0, 587, 585, 1, 0, 0, 0, 587, 588, 1, 0, 0, 0, 588, 590, 1, 0, 0, 0, 589, 587, 1, 0, 0, 0, 590, 612, 5, 34, 0, 0, 591, 592, 5, 34, 0, 0, 592, 593, 5, 34, 0, 0, 593, 594, 5, 34, 0, 0, 594, 598, 1, 0, 0, 0, 595, 597, 8, 21, 0, 0, 596, 595, 1, 0, 0, 0, 597, 600, 1, 0, 0, 0, 598, 599, 1, 0, 0, 0, 598, 596, 1, 0, 0, 0, 599, 601, 1, 0, 0, 0, 600, 598, 1, 0, 0, 0, 601, 602, 5, 34, 0, 0, 602, 603, 5, 34, 0, 0, 603, 604, 5, 34, 0, 0, 604, 606, 1, 0, 0, 0, 605, 607, 5, 34, 0, 0, 606, 605, 1, 0, 0, 0, 606, 607, 1, 0, 0, 0, 607, 609, 1, 0, 0, 0, 608, 610, 5, 34, 0, 0, 609, 608, 1, 0, 0, 0, 609, 610, 1, 0, 0, 0, 610, 612, 1, 0, 0, 0, 611, 582, 1, 0, 0, 0, 611, 591, 1, 0, 0, 0, 612, 89, 1, 0, 0, 0, 613, 615, 3, 68, 28, 0, 614, 613, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 614, 1, 0, 0, 0, 616, 617, 1, 0, 0, 0, 617, 91, 1, 0, 0, 0, 618, 620, 3, 68, 28, 0, 619, 618, 1, 0, 0, 0, 620, 621, 1, 0, 0, 0, 621, 619, 1, 0, 0, 0, 621, 622, 1, 0, 0, 0, 622, 623, 1, 0, 0, 0, 623, 627, 3, 106, 47, 0, 624, 626, 3, 68, 28, 0, 625, 624, 1, 0, 0, 0, 626, 629, 1, 0, 0, 0, 627, 625, 1, 0, 0, 0, 627, 628, 1, 0, 0, 0, 628, 661, 1, 0, 0, 0, 629, 627, 1, 0, 0, 0, 630, 632, 3, 106, 47, 0, 631, 633, 3, 68, 28, 0, 632, 631, 1, 0, 0, 0, 633, 634, 1, 0, 0, 0, 634, 632, 1, 0, 0, 0, 634, 635, 1, 0, 0, 0, 635, 661, 1, 0, 0, 0, 636, 638, 3, 68, 28, 0, 637, 636, 1, 0, 0, 0, 638, 639, 1, 0, 0, 0, 639, 637, 1, 0, 0, 0, 639, 640, 1, 0, 0, 0, 640, 648, 1, 0, 0, 0, 641, 645, 3, 106, 47, 0, 642, 644, 3, 68, 28, 0, 643, 642, 1, 0, 0, 0, 644, 647, 1, 0, 0, 0, 645, 643, 1, 0, 0, 0, 645, 646, 1, 0, 0, 0, 646, 649, 1, 0, 0, 0, 647, 645, 1, 0, 0, 0, 648, 641, 1, 0, 0, 0, 648, 649, 1, 0, 0, 0, 649, 650, 1, 0, 0, 0, 650, 651, 3, 76, 32, 0, 651, 661, 1, 0, 0, 0, 652, 654, 3, 106, 47, 0, 653, 655, 3, 68, 28, 0, 654, 653, 1, 0, 0, 0, 655, 656, 1, 0, 0, 0, 656, 654, 1, 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 658, 1, 0, 0, 0, 658, 659, 3, 76, 32, 0, 659, 661, 1, 0, 0, 0, 660, 619, 1, 0, 0, 0, 660, 630, 1, 0, 0, 0, 660, 637, 1, 0, 0, 0, 660, 652, 1, 0, 0, 0, 661, 93, 1, 0, 0, 0, 662, 663, 7, 29, 0, 0, 663, 664, 7, 30, 0, 0, 664, 95, 1, 0, 0, 0, 665, 666, 7, 12, 0, 0, 666, 667, 7, 9, 0, 0, 667, 668, 7, 0, 0, 0, 668, 97, 1, 0, 0, 0, 669, 670, 7, 12, 0, 0, 670, 671, 7, 2, 0, 0, 671, 672, 7, 4, 0, 0, 672, 99, 1, 0, 0, 0, 673, 674, 5, 61, 0, 0, 674, 101, 1, 0, 0, 0, 675, 676, 5, 44, 0, 0, 676, 103, 1, 0, 0, 0, 677, 678, 7, 0, 0, 0, 678, 679, 7, 3, 0, 0, 679, 680, 7, 2, 0, 0, 680, 681, 7, 4, 0, 0, 681, 105, 1, 0, 0, 0, 682, 683, 5, 46, 0, 0, 683, 107, 1, 0, 0, 0, 684, 685, 7, 15, 0, 0, 685, 686, 7, 12, 0, 0, 686, 687, 7, 13, 0, 0, 687, 688, 7, 2, 0, 0, 688, 689, 7, 3, 0, 0, 689, 109, 1, 0, 0, 0, 690, 691, 7, 15, 0, 0, 691, 692, 7, 1, 0, 0, 692, 693, 7, 6, 0, 0, 693, 694, 7, 2, 0, 0, 694, 695, 7, 5, 0, 0, 695, 111, 1, 0, 0, 0, 696, 697, 7, 13, 0, 0, 697, 698, 7, 12, 0, 0, 698, 699, 7, 2, 0, 0, 699, 700, 7, 5, 0, 0, 700, 113, 1, 0, 0, 0, 701, 702, 5, 40, 0, 0, 702, 115, 1, 0, 0, 0, 703, 704, 7, 1, 0, 0, 704, 705, 7, 9, 0, 0, 705, 117, 1, 0, 0, 0, 706, 707, 7, 1, 0, 0, 707, 708, 7, 2, 0, 0, 708, 119, 1, 0, 0, 0, 709, 710, 7, 13, 0, 0, 710, 711, 7, 1, 0, 0, 711, 712, 7, 18, 0, 0, 712, 713, 7, 3, 0, 0, 713, 121, 1, 0, 0, 0, 714, 715, 7, 9, 0, 0, 715, 716, 7, 7, 0, 0, 716, 717, 7, 5, 0, 0, 717, 123, 1, 0, 0, 0, 718, 719, 7, 9, 0, 0, 719, 720, 7, 31, 0, 0, 720, 721, 7, 13, 0, 0, 721, 722, 7, 13, 0, 0, 722, 125, 1, 0, 0, 0, 723, 724, 7, 9, 0, 0, 724, 725, 7, 31, 0, 0, 725, 726, 7, 13, 0, 0, 726, 727, 7, 13, 0, 0, 727, 728, 7, 2, 0, 0, 728, 127, 1, 0, 0, 0, 729, 730, 7, 7, 0, 0, 730, 731, 7, 6, 0, 0, 731, 129, 1, 0, 0, 0, 732, 733, 5, 63, 0, 0, 733, 131, 1, 0, 0, 0, 734, 735, 7, 6, 0, 0, 735, 736, 7, 13, 0, 0, 736, 737, 7, 1, 0, 0, 737, 738, 7, 18, 0, 0, 738, 739, 7, 3, 0, 0, 739, 133, 1, 0, 0, 0, 740, 741, 5, 41, 0, 0, 741, 135, 1, 0, 0, 0, 742, 743, 7, 5, 0, 0, 743, 744, 7, 6, 0, 0, 744, 745, 7, 31, 0, 0, 745, 746, 7, 3, 0, 0, 746, 137, 1, 0, 0, 0, 747, 748, 5, 61, 0, 0, 748, 749, 5, 61, 0, 0, 749, 139, 1, 0, 0, 0, 750, 751, 5, 61, 0, 0, 751, 752, 5, 126, 0, 0, 752, 141, 1, 0, 0, 0, 753, 754, 5, 33, 0, 0, 754, 755, 5, 61, 0, 0, 755, 143, 1, 0, 0, 0, 756, 757, 5, 60, 0, 0, 757, 145, 1, 0, 0, 0, 758, 759, 5, 60, 0, 0, 759, 760, 5, 61, 0, 0, 760, 147, 1, 0, 0, 0, 761, 762, 5, 62, 0, 0, 762, 149, 1, 0, 0, 0, 763, 764, 5, 62, 0, 0, 764, 765, 5, 61, 0, 0, 765, 151, 1, 0, 0, 0, 766, 767, 5, 43, 0, 0, 767, 153, 1, 0, 0, 0, 768, 769, 5, 45, 0, 0, 769, 155, 1, 0, 0, 0, 770, 771, 5, 42, 0, 0, 771, 157, 1, 0, 0, 0, 772, 773, 5, 47, 0, 0, 773, 159, 1, 0, 0, 0, 774, 775, 5, 37, 0, 0, 775, 161, 1, 0, 0, 0, 776, 777, 5, 91, 0, 0, 777, 778, 1, 0, 0, 0, 778, 779, 6, 75, 0, 0, 779, 780, 6, 75, 0, 0, 780, 163, 1, 0, 0, 0, 781, 782, 5, 93, 0, 0, 782, 783, 1, 0, 0, 0, 783, 784, 6, 76, 13, 0, 784, 785, 6, 76, 13, 0, 785, 165, 1, 0, 0, 0, 786, 790, 3, 70, 29, 0, 787, 789, 3, 86, 37, 0, 788, 787, 1, 0, 0, 0, 789, 792, 1, 0, 0, 0, 790, 788, 1, 0, 0, 0, 790, 791, 1, 0, 0, 0, 791, 803, 1, 0, 0, 0, 792, 790, 1, 0, 0, 0, 793, 796, 3, 84, 36, 0, 794, 796, 3, 78, 33, 0, 795, 793, 1, 0, 0, 0, 795, 794, 1, 0, 0, 0, 796, 798, 1, 0, 0, 0, 797, 799, 3, 86, 37, 0, 798, 797, 1, 0, 0, 0, 799, 800, 1, 0, 0, 0, 800, 798, 1, 0, 0, 0, 800, 801, 1, 0, 0, 0, 801, 803, 1, 0, 0, 0, 802, 786, 1, 0, 0, 0, 802, 795, 1, 0, 0, 0, 803, 167, 1, 0, 0, 0, 804, 806, 3, 80, 34, 0, 805, 807, 3, 82, 35, 0, 806, 805, 1, 0, 0, 0, 807, 808, 1, 0, 0, 0, 808, 806, 1, 0, 0, 0, 808, 809, 1, 0, 0, 0, 809, 810, 1, 0, 0, 0, 810, 811, 3, 80, 34, 0, 811, 169, 1, 0, 0, 0, 812, 813, 3, 168, 78, 0, 813, 171, 1, 0, 0, 0, 814, 815, 3, 50, 19, 0, 815, 816, 1, 0, 0, 0, 816, 817, 6, 80, 9, 0, 817, 173, 1, 0, 0, 0, 818, 819, 3, 52, 20, 0, 819, 820, 1, 0, 0, 0, 820, 821, 6, 81, 9, 0, 821, 175, 1, 0, 0, 0, 822, 823, 3, 54, 21, 0, 823, 824, 1, 0, 0, 0, 824, 825, 6, 82, 9, 0, 825, 177, 1, 0, 0, 0, 826, 827, 3, 66, 27, 0, 827, 828, 1, 0, 0, 0, 828, 829, 6, 83, 12, 0, 829, 830, 6, 83, 13, 0, 830, 179, 1, 0, 0, 0, 831, 832, 3, 162, 75, 0, 832, 833, 1, 0, 0, 0, 833, 834, 6, 84, 10, 0, 834, 181, 1, 0, 0, 0, 835, 836, 3, 164, 76, 0, 836, 837, 1, 0, 0, 0, 837, 838, 6, 85, 14, 0, 838, 183, 1, 0, 0, 0, 839, 840, 3, 102, 45, 0, 840, 841, 1, 0, 0, 0, 841, 842, 6, 86, 15, 0, 842, 185, 1, 0, 0, 0, 843, 844, 3, 100, 44, 0, 844, 845, 1, 0, 0, 0, 845, 846, 6, 87, 16, 0, 846, 187, 1, 0, 0, 0, 847, 848, 7, 16, 0, 0, 848, 849, 7, 3, 0, 0, 849, 850, 7, 5, 0, 0, 850, 851, 7, 12, 0, 0, 851, 852, 7, 0, 0, 0, 852, 853, 7, 12, 0, 0, 853, 854, 7, 5, 0, 0, 854, 855, 7, 12, 0, 0, 855, 189, 1, 0, 0, 0, 856, 860, 8, 32, 0, 0, 857, 858, 5, 47, 0, 0, 858, 860, 8, 33, 0, 0, 859, 856, 1, 0, 0, 0, 859, 857, 1, 0, 0, 0, 860, 191, 1, 0, 0, 0, 861, 863, 3, 190, 89, 0, 862, 861, 1, 0, 0, 0, 863, 864, 1, 0, 0, 0, 864, 862, 1, 0, 0, 0, 864, 865, 1, 0, 0, 0, 865, 193, 1, 0, 0, 0, 866, 867, 3, 170, 79, 0, 867, 868, 1, 0, 0, 0, 868, 869, 6, 91, 17, 0, 869, 195, 1, 0, 0, 0, 870, 871, 3, 50, 19, 0, 871, 872, 1, 0, 0, 0, 872, 873, 6, 92, 9, 0, 873, 197, 1, 0, 0, 0, 874, 875, 3, 52, 20, 0, 875, 876, 1, 0, 0, 0, 876, 877, 6, 93, 9, 0, 877, 199, 1, 0, 0, 0, 878, 879, 3, 54, 21, 0, 879, 880, 1, 0, 0, 0, 880, 881, 6, 94, 9, 0, 881, 201, 1, 0, 0, 0, 882, 883, 3, 66, 27, 0, 883, 884, 1, 0, 0, 0, 884, 885, 6, 95, 12, 0, 885, 886, 6, 95, 13, 0, 886, 203, 1, 0, 0, 0, 887, 888, 3, 106, 47, 0, 888, 889, 1, 0, 0, 0, 889, 890, 6, 96, 18, 0, 890, 205, 1, 0, 0, 0, 891, 892, 3, 102, 45, 0, 892, 893, 1, 0, 0, 0, 893, 894, 6, 97, 15, 0, 894, 207, 1, 0, 0, 0, 895, 900, 3, 70, 29, 0, 896, 900, 3, 68, 28, 0, 897, 900, 3, 84, 36, 0, 898, 900, 3, 156, 72, 0, 899, 895, 1, 0, 0, 0, 899, 896, 1, 0, 0, 0, 899, 897, 1, 0, 0, 0, 899, 898, 1, 0, 0, 0, 900, 209, 1, 0, 0, 0, 901, 904, 3, 70, 29, 0, 902, 904, 3, 156, 72, 0, 903, 901, 1, 0, 0, 0, 903, 902, 1, 0, 0, 0, 904, 908, 1, 0, 0, 0, 905, 907, 3, 208, 98, 0, 906, 905, 1, 0, 0, 0, 907, 910, 1, 0, 0, 0, 908, 906, 1, 0, 0, 0, 908, 909, 1, 0, 0, 0, 909, 921, 1, 0, 0, 0, 910, 908, 1, 0, 0, 0, 911, 914, 3, 84, 36, 0, 912, 914, 3, 78, 33, 0, 913, 911, 1, 0, 0, 0, 913, 912, 1, 0, 0, 0, 914, 916, 1, 0, 0, 0, 915, 917, 3, 208, 98, 0, 916, 915, 1, 0, 0, 0, 917, 918, 1, 0, 0, 0, 918, 916, 1, 0, 0, 0, 918, 919, 1, 0, 0, 0, 919, 921, 1, 0, 0, 0, 920, 903, 1, 0, 0, 0, 920, 913, 1, 0, 0, 0, 921, 211, 1, 0, 0, 0, 922, 925, 3, 210, 99, 0, 923, 925, 3, 168, 78, 0, 924, 922, 1, 0, 0, 0, 924, 923, 1, 0, 0, 0, 925, 926, 1, 0, 0, 0, 926, 924, 1, 0, 0, 0, 926, 927, 1, 0, 0, 0, 927, 213, 1, 0, 0, 0, 928, 929, 3, 50, 19, 0, 929, 930, 1, 0, 0, 0, 930, 931, 6, 101, 9, 0, 931, 215, 1, 0, 0, 0, 932, 933, 3, 52, 20, 0, 933, 934, 1, 0, 0, 0, 934, 935, 6, 102, 9, 0, 935, 217, 1, 0, 0, 0, 936, 937, 3, 54, 21, 0, 937, 938, 1, 0, 0, 0, 938, 939, 6, 103, 9, 0, 939, 219, 1, 0, 0, 0, 940, 941, 3, 66, 27, 0, 941, 942, 1, 0, 0, 0, 942, 943, 6, 104, 12, 0, 943, 944, 6, 104, 13, 0, 944, 221, 1, 0, 0, 0, 945, 946, 3, 100, 44, 0, 946, 947, 1, 0, 0, 0, 947, 948, 6, 105, 16, 0, 948, 223, 1, 0, 0, 0, 949, 950, 3, 102, 45, 0, 950, 951, 1, 0, 0, 0, 951, 952, 6, 106, 15, 0, 952, 225, 1, 0, 0, 0, 953, 954, 3, 106, 47, 0, 954, 955, 1, 0, 0, 0, 955, 956, 6, 107, 18, 0, 956, 227, 1, 0, 0, 0, 957, 958, 7, 12, 0, 0, 958, 959, 7, 2, 0, 0, 959, 229, 1, 0, 0, 0, 960, 961, 3, 212, 100, 0, 961, 962, 1, 0, 0, 0, 962, 963, 6, 109, 19, 0, 963, 231, 1, 0, 0, 0, 964, 965, 3, 50, 19, 0, 965, 966, 1, 0, 0, 0, 966, 967, 6, 110, 9, 0, 967, 233, 1, 0, 0, 0, 968, 969, 3, 52, 20, 0, 969, 970, 1, 0, 0, 0, 970, 971, 6, 111, 9, 0, 971, 235, 1, 0, 0, 0, 972, 973, 3, 54, 21, 0, 973, 974, 1, 0, 0, 0, 974, 975, 6, 112, 9, 0, 975, 237, 1, 0, 0, 0, 976, 977, 3, 66, 27, 0, 977, 978, 1, 0, 0, 0, 978, 979, 6, 113, 12, 0, 979, 980, 6, 113, 13, 0, 980, 239, 1, 0, 0, 0, 981, 982, 3, 162, 75, 0, 982, 983, 1, 0, 0, 0, 983, 984, 6, 114, 10, 0, 984, 985, 6, 114, 20, 0, 985, 241, 1, 0, 0, 0, 986, 987, 7, 7, 0, 0, 987, 988, 7, 9, 0, 0, 988, 989, 1, 0, 0, 0, 989, 990, 6, 115, 21, 0, 990, 243, 1, 0, 0, 0, 991, 992, 7, 19, 0, 0, 992, 993, 7, 1, 0, 0, 993, 994, 7, 5, 0, 0, 994, 995, 7, 10, 0, 0, 995, 996, 1, 0, 0, 0, 996, 997, 6, 116, 21, 0, 997, 245, 1, 0, 0, 0, 998, 999, 8, 34, 0, 0, 999, 247, 1, 0, 0, 0, 1000, 1002, 3, 246, 117, 0, 1001, 1000, 1, 0, 0, 0, 1002, 1003, 1, 0, 0, 0, 1003, 1001, 1, 0, 0, 0, 1003, 1004, 1, 0, 0, 0, 1004, 1005, 1, 0, 0, 0, 1005, 1006, 3, 316, 152, 0, 1006, 1008, 1, 0, 0, 0, 1007, 1001, 1, 0, 0, 0, 1007, 1008, 1, 0, 0, 0, 1008, 1010, 1, 0, 0, 0, 1009, 1011, 3, 246, 117, 0, 1010, 1009, 1, 0, 0, 0, 1011, 1012, 1, 0, 0, 0, 1012, 1010, 1, 0, 0, 0, 1012, 1013, 1, 0, 0, 0, 1013, 249, 1, 0, 0, 0, 1014, 1015, 3, 170, 79, 0, 1015, 1016, 1, 0, 0, 0, 1016, 1017, 6, 119, 17, 0, 1017, 251, 1, 0, 0, 0, 1018, 1019, 3, 248, 118, 0, 1019, 1020, 1, 0, 0, 0, 1020, 1021, 6, 120, 22, 0, 1021, 253, 1, 0, 0, 0, 1022, 1023, 3, 50, 19, 0, 1023, 1024, 1, 0, 0, 0, 1024, 1025, 6, 121, 9, 0, 1025, 255, 1, 0, 0, 0, 1026, 1027, 3, 52, 20, 0, 1027, 1028, 1, 0, 0, 0, 1028, 1029, 6, 122, 9, 0, 1029, 257, 1, 0, 0, 0, 1030, 1031, 3, 54, 21, 0, 1031, 1032, 1, 0, 0, 0, 1032, 1033, 6, 123, 9, 0, 1033, 259, 1, 0, 0, 0, 1034, 1035, 3, 66, 27, 0, 1035, 1036, 1, 0, 0, 0, 1036, 1037, 6, 124, 12, 0, 1037, 1038, 6, 124, 13, 0, 1038, 1039, 6, 124, 13, 0, 1039, 261, 1, 0, 0, 0, 1040, 1041, 3, 100, 44, 0, 1041, 1042, 1, 0, 0, 0, 1042, 1043, 6, 125, 16, 0, 1043, 263, 1, 0, 0, 0, 1044, 1045, 3, 102, 45, 0, 1045, 1046, 1, 0, 0, 0, 1046, 1047, 6, 126, 15, 0, 1047, 265, 1, 0, 0, 0, 1048, 1049, 3, 106, 47, 0, 1049, 1050, 1, 0, 0, 0, 1050, 1051, 6, 127, 18, 0, 1051, 267, 1, 0, 0, 0, 1052, 1053, 3, 244, 116, 0, 1053, 1054, 1, 0, 0, 0, 1054, 1055, 6, 128, 23, 0, 1055, 269, 1, 0, 0, 0, 1056, 1057, 3, 212, 100, 0, 1057, 1058, 1, 0, 0, 0, 1058, 1059, 6, 129, 19, 0, 1059, 271, 1, 0, 0, 0, 1060, 1061, 3, 170, 79, 0, 1061, 1062, 1, 0, 0, 0, 1062, 1063, 6, 130, 17, 0, 1063, 273, 1, 0, 0, 0, 1064, 1065, 3, 50, 19, 0, 1065, 1066, 1, 0, 0, 0, 1066, 1067, 6, 131, 9, 0, 1067, 275, 1, 0, 0, 0, 1068, 1069, 3, 52, 20, 0, 1069, 1070, 1, 0, 0, 0, 1070, 1071, 6, 132, 9, 0, 1071, 277, 1, 0, 0, 0, 1072, 1073, 3, 54, 21, 0, 1073, 1074, 1, 0, 0, 0, 1074, 1075, 6, 133, 9, 0, 1075, 279, 1, 0, 0, 0, 1076, 1077, 3, 66, 27, 0, 1077, 1078, 1, 0, 0, 0, 1078, 1079, 6, 134, 12, 0, 1079, 1080, 6, 134, 13, 0, 1080, 281, 1, 0, 0, 0, 1081, 1082, 3, 106, 47, 0, 1082, 1083, 1, 0, 0, 0, 1083, 1084, 6, 135, 18, 0, 1084, 283, 1, 0, 0, 0, 1085, 1086, 3, 170, 79, 0, 1086, 1087, 1, 0, 0, 0, 1087, 1088, 6, 136, 17, 0, 1088, 285, 1, 0, 0, 0, 1089, 1090, 3, 166, 77, 0, 1090, 1091, 1, 0, 0, 0, 1091, 1092, 6, 137, 24, 0, 1092, 287, 1, 0, 0, 0, 1093, 1094, 3, 50, 19, 0, 1094, 1095, 1, 0, 0, 0, 1095, 1096, 6, 138, 9, 0, 1096, 289, 1, 0, 0, 0, 1097, 1098, 3, 52, 20, 0, 1098, 1099, 1, 0, 0, 0, 1099, 1100, 6, 139, 9, 0, 1100, 291, 1, 0, 0, 0, 1101, 1102, 3, 54, 21, 0, 1102, 1103, 1, 0, 0, 0, 1103, 1104, 6, 140, 9, 0, 1104, 293, 1, 0, 0, 0, 1105, 1106, 3, 66, 27, 0, 1106, 1107, 1, 0, 0, 0, 1107, 1108, 6, 141, 12, 0, 1108, 1109, 6, 141, 13, 0, 1109, 295, 1, 0, 0, 0, 1110, 1111, 7, 1, 0, 0, 1111, 1112, 7, 9, 0, 0, 1112, 1113, 7, 15, 0, 0, 1113, 1114, 7, 7, 0, 0, 1114, 297, 1, 0, 0, 0, 1115, 1116, 3, 50, 19, 0, 1116, 1117, 1, 0, 0, 0, 1117, 1118, 6, 143, 9, 0, 1118, 299, 1, 0, 0, 0, 1119, 1120, 3, 52, 20, 0, 1120, 1121, 1, 0, 0, 0, 1121, 1122, 6, 144, 9, 0, 1122, 301, 1, 0, 0, 0, 1123, 1124, 3, 54, 21, 0, 1124, 1125, 1, 0, 0, 0, 1125, 1126, 6, 145, 9, 0, 1126, 303, 1, 0, 0, 0, 1127, 1128, 3, 66, 27, 0, 1128, 1129, 1, 0, 0, 0, 1129, 1130, 6, 146, 12, 0, 1130, 1131, 6, 146, 13, 0, 1131, 305, 1, 0, 0, 0, 1132, 1133, 7, 15, 0, 0, 1133, 1134, 7, 31, 0, 0, 1134, 1135, 7, 9, 0, 0, 1135, 1136, 7, 4, 0, 0, 1136, 1137, 7, 5, 0, 0, 1137, 1138, 7, 1, 0, 0, 1138, 1139, 7, 7, 0, 0, 1139, 1140, 7, 9, 0, 0, 1140, 1141, 7, 2, 0, 0, 1141, 307, 1, 0, 0, 0, 1142, 1143, 3, 50, 19, 0, 1143, 1144, 1, 0, 0, 0, 1144, 1145, 6, 148, 9, 0, 1145, 309, 1, 0, 0, 0, 1146, 1147, 3, 52, 20, 0, 1147, 1148, 1, 0, 0, 0, 1148, 1149, 6, 149, 9, 0, 1149, 311, 1, 0, 0, 0, 1150, 1151, 3, 54, 21, 0, 1151, 1152, 1, 0, 0, 0, 1152, 1153, 6, 150, 9, 0, 1153, 313, 1, 0, 0, 0, 1154, 1155, 3, 164, 76, 0, 1155, 1156, 1, 0, 0, 0, 1156, 1157, 6, 151, 14, 0, 1157, 1158, 6, 151, 13, 0, 1158, 315, 1, 0, 0, 0, 1159, 1160, 5, 58, 0, 0, 1160, 317, 1, 0, 0, 0, 1161, 1167, 3, 78, 33, 0, 1162, 1167, 3, 68, 28, 0, 1163, 1167, 3, 106, 47, 0, 1164, 1167, 3, 70, 29, 0, 1165, 1167, 3, 84, 36, 0, 1166, 1161, 1, 0, 0, 0, 1166, 1162, 1, 0, 0, 0, 1166, 1163, 1, 0, 0, 0, 1166, 1164, 1, 0, 0, 0, 1166, 1165, 1, 0, 0, 0, 1167, 1168, 1, 0, 0, 0, 1168, 1166, 1, 0, 0, 0, 1168, 1169, 1, 0, 0, 0, 1169, 319, 1, 0, 0, 0, 1170, 1171, 3, 50, 19, 0, 1171, 1172, 1, 0, 0, 0, 1172, 1173, 6, 154, 9, 0, 1173, 321, 1, 0, 0, 0, 1174, 1175, 3, 52, 20, 0, 1175, 1176, 1, 0, 0, 0, 1176, 1177, 6, 155, 9, 0, 1177, 323, 1, 0, 0, 0, 1178, 1179, 3, 54, 21, 0, 1179, 1180, 1, 0, 0, 0, 1180, 1181, 6, 156, 9, 0, 1181, 325, 1, 0, 0, 0, 58, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 479, 489, 493, 496, 505, 507, 518, 559, 564, 573, 580, 585, 587, 598, 606, 609, 611, 616, 621, 627, 634, 639, 645, 648, 656, 660, 790, 795, 800, 802, 808, 859, 864, 899, 903, 908, 913, 918, 920, 924, 926, 1003, 1007, 1012, 1166, 1168, 25, 5, 2, 0, 5, 4, 0, 5, 6, 0, 5, 1, 0, 5, 3, 0, 5, 10, 0, 5, 8, 0, 5, 5, 0, 5, 9, 0, 0, 1, 0, 7, 64, 0, 5, 0, 0, 7, 26, 0, 4, 0, 0, 7, 65, 0, 7, 34, 0, 7, 33, 0, 7, 67, 0, 7, 36, 0, 7, 76, 0, 5, 11, 0, 5, 7, 0, 7, 86, 0, 7, 85, 0, 7, 66, 0]
\ No newline at end of file
diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.tokens b/packages/kbn-esql-ast/src/antlr/esql_lexer.tokens
new file mode 100644
index 0000000000000..5edc646fad10e
--- /dev/null
+++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.tokens
@@ -0,0 +1,169 @@
+DISSECT=1
+DROP=2
+ENRICH=3
+EVAL=4
+EXPLAIN=5
+FROM=6
+GROK=7
+INLINESTATS=8
+KEEP=9
+LIMIT=10
+META=11
+MV_EXPAND=12
+RENAME=13
+ROW=14
+SHOW=15
+SORT=16
+STATS=17
+WHERE=18
+UNKNOWN_CMD=19
+LINE_COMMENT=20
+MULTILINE_COMMENT=21
+WS=22
+EXPLAIN_WS=23
+EXPLAIN_LINE_COMMENT=24
+EXPLAIN_MULTILINE_COMMENT=25
+PIPE=26
+STRING=27
+INTEGER_LITERAL=28
+DECIMAL_LITERAL=29
+BY=30
+AND=31
+ASC=32
+ASSIGN=33
+COMMA=34
+DESC=35
+DOT=36
+FALSE=37
+FIRST=38
+LAST=39
+LP=40
+IN=41
+IS=42
+LIKE=43
+NOT=44
+NULL=45
+NULLS=46
+OR=47
+PARAM=48
+RLIKE=49
+RP=50
+TRUE=51
+EQ=52
+CIEQ=53
+NEQ=54
+LT=55
+LTE=56
+GT=57
+GTE=58
+PLUS=59
+MINUS=60
+ASTERISK=61
+SLASH=62
+PERCENT=63
+OPENING_BRACKET=64
+CLOSING_BRACKET=65
+UNQUOTED_IDENTIFIER=66
+QUOTED_IDENTIFIER=67
+EXPR_LINE_COMMENT=68
+EXPR_MULTILINE_COMMENT=69
+EXPR_WS=70
+METADATA=71
+FROM_UNQUOTED_IDENTIFIER=72
+FROM_LINE_COMMENT=73
+FROM_MULTILINE_COMMENT=74
+FROM_WS=75
+ID_PATTERN=76
+PROJECT_LINE_COMMENT=77
+PROJECT_MULTILINE_COMMENT=78
+PROJECT_WS=79
+AS=80
+RENAME_LINE_COMMENT=81
+RENAME_MULTILINE_COMMENT=82
+RENAME_WS=83
+ON=84
+WITH=85
+ENRICH_POLICY_NAME=86
+ENRICH_LINE_COMMENT=87
+ENRICH_MULTILINE_COMMENT=88
+ENRICH_WS=89
+ENRICH_FIELD_LINE_COMMENT=90
+ENRICH_FIELD_MULTILINE_COMMENT=91
+ENRICH_FIELD_WS=92
+MVEXPAND_LINE_COMMENT=93
+MVEXPAND_MULTILINE_COMMENT=94
+MVEXPAND_WS=95
+INFO=96
+SHOW_LINE_COMMENT=97
+SHOW_MULTILINE_COMMENT=98
+SHOW_WS=99
+FUNCTIONS=100
+META_LINE_COMMENT=101
+META_MULTILINE_COMMENT=102
+META_WS=103
+COLON=104
+SETTING=105
+SETTING_LINE_COMMENT=106
+SETTTING_MULTILINE_COMMENT=107
+SETTING_WS=108
+'dissect'=1
+'drop'=2
+'enrich'=3
+'eval'=4
+'explain'=5
+'from'=6
+'grok'=7
+'inlinestats'=8
+'keep'=9
+'limit'=10
+'meta'=11
+'mv_expand'=12
+'rename'=13
+'row'=14
+'show'=15
+'sort'=16
+'stats'=17
+'where'=18
+'|'=26
+'by'=30
+'and'=31
+'asc'=32
+'='=33
+','=34
+'desc'=35
+'.'=36
+'false'=37
+'first'=38
+'last'=39
+'('=40
+'in'=41
+'is'=42
+'like'=43
+'not'=44
+'null'=45
+'nulls'=46
+'or'=47
+'?'=48
+'rlike'=49
+')'=50
+'true'=51
+'=='=52
+'=~'=53
+'!='=54
+'<'=55
+'<='=56
+'>'=57
+'>='=58
+'+'=59
+'-'=60
+'*'=61
+'/'=62
+'%'=63
+']'=65
+'metadata'=71
+'as'=80
+'on'=84
+'with'=85
+'info'=96
+'functions'=100
+':'=104
diff --git a/packages/kbn-esql-ast/src/antlr/esql_lexer.ts b/packages/kbn-esql-ast/src/antlr/esql_lexer.ts
new file mode 100644
index 0000000000000..5603ea84b7c00
--- /dev/null
+++ b/packages/kbn-esql-ast/src/antlr/esql_lexer.ts
@@ -0,0 +1,738 @@
+// @ts-nocheck
+// Generated from src/antlr/esql_lexer.g4 by ANTLR 4.13.1
+// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
+import {
+ ATN,
+ ATNDeserializer,
+ CharStream,
+ DecisionState, DFA,
+ Lexer,
+ LexerATNSimulator,
+ RuleContext,
+ PredictionContextCache,
+ Token
+} from "antlr4";
+export default class esql_lexer extends Lexer {
+ public static readonly DISSECT = 1;
+ public static readonly DROP = 2;
+ public static readonly ENRICH = 3;
+ public static readonly EVAL = 4;
+ public static readonly EXPLAIN = 5;
+ public static readonly FROM = 6;
+ public static readonly GROK = 7;
+ public static readonly INLINESTATS = 8;
+ public static readonly KEEP = 9;
+ public static readonly LIMIT = 10;
+ public static readonly META = 11;
+ public static readonly MV_EXPAND = 12;
+ public static readonly RENAME = 13;
+ public static readonly ROW = 14;
+ public static readonly SHOW = 15;
+ public static readonly SORT = 16;
+ public static readonly STATS = 17;
+ public static readonly WHERE = 18;
+ public static readonly UNKNOWN_CMD = 19;
+ public static readonly LINE_COMMENT = 20;
+ public static readonly MULTILINE_COMMENT = 21;
+ public static readonly WS = 22;
+ public static readonly EXPLAIN_WS = 23;
+ public static readonly EXPLAIN_LINE_COMMENT = 24;
+ public static readonly EXPLAIN_MULTILINE_COMMENT = 25;
+ public static readonly PIPE = 26;
+ public static readonly STRING = 27;
+ public static readonly INTEGER_LITERAL = 28;
+ public static readonly DECIMAL_LITERAL = 29;
+ public static readonly BY = 30;
+ public static readonly AND = 31;
+ public static readonly ASC = 32;
+ public static readonly ASSIGN = 33;
+ public static readonly COMMA = 34;
+ public static readonly DESC = 35;
+ public static readonly DOT = 36;
+ public static readonly FALSE = 37;
+ public static readonly FIRST = 38;
+ public static readonly LAST = 39;
+ public static readonly LP = 40;
+ public static readonly IN = 41;
+ public static readonly IS = 42;
+ public static readonly LIKE = 43;
+ public static readonly NOT = 44;
+ public static readonly NULL = 45;
+ public static readonly NULLS = 46;
+ public static readonly OR = 47;
+ public static readonly PARAM = 48;
+ public static readonly RLIKE = 49;
+ public static readonly RP = 50;
+ public static readonly TRUE = 51;
+ public static readonly EQ = 52;
+ public static readonly CIEQ = 53;
+ public static readonly NEQ = 54;
+ public static readonly LT = 55;
+ public static readonly LTE = 56;
+ public static readonly GT = 57;
+ public static readonly GTE = 58;
+ public static readonly PLUS = 59;
+ public static readonly MINUS = 60;
+ public static readonly ASTERISK = 61;
+ public static readonly SLASH = 62;
+ public static readonly PERCENT = 63;
+ public static readonly OPENING_BRACKET = 64;
+ public static readonly CLOSING_BRACKET = 65;
+ public static readonly UNQUOTED_IDENTIFIER = 66;
+ public static readonly QUOTED_IDENTIFIER = 67;
+ public static readonly EXPR_LINE_COMMENT = 68;
+ public static readonly EXPR_MULTILINE_COMMENT = 69;
+ public static readonly EXPR_WS = 70;
+ public static readonly METADATA = 71;
+ public static readonly FROM_UNQUOTED_IDENTIFIER = 72;
+ public static readonly FROM_LINE_COMMENT = 73;
+ public static readonly FROM_MULTILINE_COMMENT = 74;
+ public static readonly FROM_WS = 75;
+ public static readonly ID_PATTERN = 76;
+ public static readonly PROJECT_LINE_COMMENT = 77;
+ public static readonly PROJECT_MULTILINE_COMMENT = 78;
+ public static readonly PROJECT_WS = 79;
+ public static readonly AS = 80;
+ public static readonly RENAME_LINE_COMMENT = 81;
+ public static readonly RENAME_MULTILINE_COMMENT = 82;
+ public static readonly RENAME_WS = 83;
+ public static readonly ON = 84;
+ public static readonly WITH = 85;
+ public static readonly ENRICH_POLICY_NAME = 86;
+ public static readonly ENRICH_LINE_COMMENT = 87;
+ public static readonly ENRICH_MULTILINE_COMMENT = 88;
+ public static readonly ENRICH_WS = 89;
+ public static readonly ENRICH_FIELD_LINE_COMMENT = 90;
+ public static readonly ENRICH_FIELD_MULTILINE_COMMENT = 91;
+ public static readonly ENRICH_FIELD_WS = 92;
+ public static readonly MVEXPAND_LINE_COMMENT = 93;
+ public static readonly MVEXPAND_MULTILINE_COMMENT = 94;
+ public static readonly MVEXPAND_WS = 95;
+ public static readonly INFO = 96;
+ public static readonly SHOW_LINE_COMMENT = 97;
+ public static readonly SHOW_MULTILINE_COMMENT = 98;
+ public static readonly SHOW_WS = 99;
+ public static readonly FUNCTIONS = 100;
+ public static readonly META_LINE_COMMENT = 101;
+ public static readonly META_MULTILINE_COMMENT = 102;
+ public static readonly META_WS = 103;
+ public static readonly COLON = 104;
+ public static readonly SETTING = 105;
+ public static readonly SETTING_LINE_COMMENT = 106;
+ public static readonly SETTTING_MULTILINE_COMMENT = 107;
+ public static readonly SETTING_WS = 108;
+ public static readonly EOF = Token.EOF;
+ public static readonly EXPLAIN_MODE = 1;
+ public static readonly EXPRESSION_MODE = 2;
+ public static readonly FROM_MODE = 3;
+ public static readonly PROJECT_MODE = 4;
+ public static readonly RENAME_MODE = 5;
+ public static readonly ENRICH_MODE = 6;
+ public static readonly ENRICH_FIELD_MODE = 7;
+ public static readonly MVEXPAND_MODE = 8;
+ public static readonly SHOW_MODE = 9;
+ public static readonly META_MODE = 10;
+ public static readonly SETTING_MODE = 11;
+
+ public static readonly channelNames: string[] = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
+ public static readonly literalNames: (string | null)[] = [ null, "'dissect'",
+ "'drop'", "'enrich'",
+ "'eval'", "'explain'",
+ "'from'", "'grok'",
+ "'inlinestats'",
+ "'keep'", "'limit'",
+ "'meta'", "'mv_expand'",
+ "'rename'",
+ "'row'", "'show'",
+ "'sort'", "'stats'",
+ "'where'", null,
+ null, null,
+ null, null,
+ null, null,
+ "'|'", null,
+ null, null,
+ "'by'", "'and'",
+ "'asc'", "'='",
+ "','", "'desc'",
+ "'.'", "'false'",
+ "'first'", "'last'",
+ "'('", "'in'",
+ "'is'", "'like'",
+ "'not'", "'null'",
+ "'nulls'", "'or'",
+ "'?'", "'rlike'",
+ "')'", "'true'",
+ "'=='", "'=~'",
+ "'!='", "'<'",
+ "'<='", "'>'",
+ "'>='", "'+'",
+ "'-'", "'*'",
+ "'/'", "'%'",
+ null, "']'",
+ null, null,
+ null, null,
+ null, "'metadata'",
+ null, null,
+ null, null,
+ null, null,
+ null, null,
+ "'as'", null,
+ null, null,
+ "'on'", "'with'",
+ null, null,
+ null, null,
+ null, null,
+ null, null,
+ null, null,
+ "'info'", null,
+ null, null,
+ "'functions'",
+ null, null,
+ null, "':'" ];
+ public static readonly symbolicNames: (string | null)[] = [ null, "DISSECT",
+ "DROP", "ENRICH",
+ "EVAL", "EXPLAIN",
+ "FROM", "GROK",
+ "INLINESTATS",
+ "KEEP", "LIMIT",
+ "META", "MV_EXPAND",
+ "RENAME", "ROW",
+ "SHOW", "SORT",
+ "STATS", "WHERE",
+ "UNKNOWN_CMD",
+ "LINE_COMMENT",
+ "MULTILINE_COMMENT",
+ "WS", "EXPLAIN_WS",
+ "EXPLAIN_LINE_COMMENT",
+ "EXPLAIN_MULTILINE_COMMENT",
+ "PIPE", "STRING",
+ "INTEGER_LITERAL",
+ "DECIMAL_LITERAL",
+ "BY", "AND",
+ "ASC", "ASSIGN",
+ "COMMA", "DESC",
+ "DOT", "FALSE",
+ "FIRST", "LAST",
+ "LP", "IN",
+ "IS", "LIKE",
+ "NOT", "NULL",
+ "NULLS", "OR",
+ "PARAM", "RLIKE",
+ "RP", "TRUE",
+ "EQ", "CIEQ",
+ "NEQ", "LT",
+ "LTE", "GT",
+ "GTE", "PLUS",
+ "MINUS", "ASTERISK",
+ "SLASH", "PERCENT",
+ "OPENING_BRACKET",
+ "CLOSING_BRACKET",
+ "UNQUOTED_IDENTIFIER",
+ "QUOTED_IDENTIFIER",
+ "EXPR_LINE_COMMENT",
+ "EXPR_MULTILINE_COMMENT",
+ "EXPR_WS",
+ "METADATA",
+ "FROM_UNQUOTED_IDENTIFIER",
+ "FROM_LINE_COMMENT",
+ "FROM_MULTILINE_COMMENT",
+ "FROM_WS",
+ "ID_PATTERN",
+ "PROJECT_LINE_COMMENT",
+ "PROJECT_MULTILINE_COMMENT",
+ "PROJECT_WS",
+ "AS", "RENAME_LINE_COMMENT",
+ "RENAME_MULTILINE_COMMENT",
+ "RENAME_WS",
+ "ON", "WITH",
+ "ENRICH_POLICY_NAME",
+ "ENRICH_LINE_COMMENT",
+ "ENRICH_MULTILINE_COMMENT",
+ "ENRICH_WS",
+ "ENRICH_FIELD_LINE_COMMENT",
+ "ENRICH_FIELD_MULTILINE_COMMENT",
+ "ENRICH_FIELD_WS",
+ "MVEXPAND_LINE_COMMENT",
+ "MVEXPAND_MULTILINE_COMMENT",
+ "MVEXPAND_WS",
+ "INFO", "SHOW_LINE_COMMENT",
+ "SHOW_MULTILINE_COMMENT",
+ "SHOW_WS",
+ "FUNCTIONS",
+ "META_LINE_COMMENT",
+ "META_MULTILINE_COMMENT",
+ "META_WS",
+ "COLON", "SETTING",
+ "SETTING_LINE_COMMENT",
+ "SETTTING_MULTILINE_COMMENT",
+ "SETTING_WS" ];
+ public static readonly modeNames: string[] = [ "DEFAULT_MODE", "EXPLAIN_MODE",
+ "EXPRESSION_MODE", "FROM_MODE",
+ "PROJECT_MODE", "RENAME_MODE",
+ "ENRICH_MODE", "ENRICH_FIELD_MODE",
+ "MVEXPAND_MODE", "SHOW_MODE",
+ "META_MODE", "SETTING_MODE", ];
+
+ public static readonly ruleNames: string[] = [
+ "DISSECT", "DROP", "ENRICH", "EVAL", "EXPLAIN", "FROM", "GROK", "INLINESTATS",
+ "KEEP", "LIMIT", "META", "MV_EXPAND", "RENAME", "ROW", "SHOW", "SORT",
+ "STATS", "WHERE", "UNKNOWN_CMD", "LINE_COMMENT", "MULTILINE_COMMENT",
+ "WS", "EXPLAIN_OPENING_BRACKET", "EXPLAIN_PIPE", "EXPLAIN_WS", "EXPLAIN_LINE_COMMENT",
+ "EXPLAIN_MULTILINE_COMMENT", "PIPE", "DIGIT", "LETTER", "ESCAPE_SEQUENCE",
+ "UNESCAPED_CHARS", "EXPONENT", "ASPERAND", "BACKQUOTE", "BACKQUOTE_BLOCK",
+ "UNDERSCORE", "UNQUOTED_ID_BODY", "STRING", "INTEGER_LITERAL", "DECIMAL_LITERAL",
+ "BY", "AND", "ASC", "ASSIGN", "COMMA", "DESC", "DOT", "FALSE", "FIRST",
+ "LAST", "LP", "IN", "IS", "LIKE", "NOT", "NULL", "NULLS", "OR", "PARAM",
+ "RLIKE", "RP", "TRUE", "EQ", "CIEQ", "NEQ", "LT", "LTE", "GT", "GTE",
+ "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "OPENING_BRACKET", "CLOSING_BRACKET",
+ "UNQUOTED_IDENTIFIER", "QUOTED_ID", "QUOTED_IDENTIFIER", "EXPR_LINE_COMMENT",
+ "EXPR_MULTILINE_COMMENT", "EXPR_WS", "FROM_PIPE", "FROM_OPENING_BRACKET",
+ "FROM_CLOSING_BRACKET", "FROM_COMMA", "FROM_ASSIGN", "METADATA", "FROM_UNQUOTED_IDENTIFIER_PART",
+ "FROM_UNQUOTED_IDENTIFIER", "FROM_QUOTED_IDENTIFIER", "FROM_LINE_COMMENT",
+ "FROM_MULTILINE_COMMENT", "FROM_WS", "PROJECT_PIPE", "PROJECT_DOT", "PROJECT_COMMA",
+ "UNQUOTED_ID_BODY_WITH_PATTERN", "UNQUOTED_ID_PATTERN", "ID_PATTERN",
+ "PROJECT_LINE_COMMENT", "PROJECT_MULTILINE_COMMENT", "PROJECT_WS", "RENAME_PIPE",
+ "RENAME_ASSIGN", "RENAME_COMMA", "RENAME_DOT", "AS", "RENAME_ID_PATTERN",
+ "RENAME_LINE_COMMENT", "RENAME_MULTILINE_COMMENT", "RENAME_WS", "ENRICH_PIPE",
+ "ENRICH_OPENING_BRACKET", "ON", "WITH", "ENRICH_POLICY_NAME_BODY", "ENRICH_POLICY_NAME",
+ "ENRICH_QUOTED_IDENTIFIER", "ENRICH_MODE_UNQUOTED_VALUE", "ENRICH_LINE_COMMENT",
+ "ENRICH_MULTILINE_COMMENT", "ENRICH_WS", "ENRICH_FIELD_PIPE", "ENRICH_FIELD_ASSIGN",
+ "ENRICH_FIELD_COMMA", "ENRICH_FIELD_DOT", "ENRICH_FIELD_WITH", "ENRICH_FIELD_ID_PATTERN",
+ "ENRICH_FIELD_QUOTED_IDENTIFIER", "ENRICH_FIELD_LINE_COMMENT", "ENRICH_FIELD_MULTILINE_COMMENT",
+ "ENRICH_FIELD_WS", "MVEXPAND_PIPE", "MVEXPAND_DOT", "MVEXPAND_QUOTED_IDENTIFIER",
+ "MVEXPAND_UNQUOTED_IDENTIFIER", "MVEXPAND_LINE_COMMENT", "MVEXPAND_MULTILINE_COMMENT",
+ "MVEXPAND_WS", "SHOW_PIPE", "INFO", "SHOW_LINE_COMMENT", "SHOW_MULTILINE_COMMENT",
+ "SHOW_WS", "META_PIPE", "FUNCTIONS", "META_LINE_COMMENT", "META_MULTILINE_COMMENT",
+ "META_WS", "SETTING_CLOSING_BRACKET", "COLON", "SETTING", "SETTING_LINE_COMMENT",
+ "SETTTING_MULTILINE_COMMENT", "SETTING_WS",
+ ];
+
+
+ constructor(input: CharStream) {
+ super(input);
+ this._interp = new LexerATNSimulator(this, esql_lexer._ATN, esql_lexer.DecisionsToDFA, new PredictionContextCache());
+ }
+
+ public get grammarFileName(): string { return "esql_lexer.g4"; }
+
+ public get literalNames(): (string | null)[] { return esql_lexer.literalNames; }
+ public get symbolicNames(): (string | null)[] { return esql_lexer.symbolicNames; }
+ public get ruleNames(): string[] { return esql_lexer.ruleNames; }
+
+ public get serializedATN(): number[] { return esql_lexer._serializedATN; }
+
+ public get channelNames(): string[] { return esql_lexer.channelNames; }
+
+ public get modeNames(): string[] { return esql_lexer.modeNames; }
+
+ public static readonly _serializedATN: number[] = [4,0,108,1182,6,-1,6,
+ -1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,2,0,7,0,2,1,7,1,2,
+ 2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,
+ 2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,
+ 18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,
+ 7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,
+ 32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,
+ 2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,
+ 47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,
+ 7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,
+ 61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,
+ 2,69,7,69,2,70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,
+ 76,7,76,2,77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,
+ 7,83,2,84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,
+ 90,2,91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,
+ 2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104,
+ 7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,7,109,2,110,
+ 7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114,2,115,7,115,2,116,
+ 7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,7,120,2,121,7,121,2,122,
+ 7,122,2,123,7,123,2,124,7,124,2,125,7,125,2,126,7,126,2,127,7,127,2,128,
+ 7,128,2,129,7,129,2,130,7,130,2,131,7,131,2,132,7,132,2,133,7,133,2,134,
+ 7,134,2,135,7,135,2,136,7,136,2,137,7,137,2,138,7,138,2,139,7,139,2,140,
+ 7,140,2,141,7,141,2,142,7,142,2,143,7,143,2,144,7,144,2,145,7,145,2,146,
+ 7,146,2,147,7,147,2,148,7,148,2,149,7,149,2,150,7,150,2,151,7,151,2,152,
+ 7,152,2,153,7,153,2,154,7,154,2,155,7,155,2,156,7,156,1,0,1,0,1,0,1,0,1,
+ 0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,
+ 2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,
+ 4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,
+ 7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,
+ 8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,
+ 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,
+ 12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,
+ 1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,
+ 16,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,18,
+ 4,18,478,8,18,11,18,12,18,479,1,18,1,18,1,19,1,19,1,19,1,19,5,19,488,8,
+ 19,10,19,12,19,491,9,19,1,19,3,19,494,8,19,1,19,3,19,497,8,19,1,19,1,19,
+ 1,20,1,20,1,20,1,20,1,20,5,20,506,8,20,10,20,12,20,509,9,20,1,20,1,20,1,
+ 20,1,20,1,20,1,21,4,21,517,8,21,11,21,12,21,518,1,21,1,21,1,22,1,22,1,22,
+ 1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1,24,1,25,1,25,1,25,1,
+ 25,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,28,1,28,1,29,1,29,1,30,1,30,
+ 1,30,1,31,1,31,1,32,1,32,3,32,560,8,32,1,32,4,32,563,8,32,11,32,12,32,564,
+ 1,33,1,33,1,34,1,34,1,35,1,35,1,35,3,35,574,8,35,1,36,1,36,1,37,1,37,1,
+ 37,3,37,581,8,37,1,38,1,38,1,38,5,38,586,8,38,10,38,12,38,589,9,38,1,38,
+ 1,38,1,38,1,38,1,38,1,38,5,38,597,8,38,10,38,12,38,600,9,38,1,38,1,38,1,
+ 38,1,38,1,38,3,38,607,8,38,1,38,3,38,610,8,38,3,38,612,8,38,1,39,4,39,615,
+ 8,39,11,39,12,39,616,1,40,4,40,620,8,40,11,40,12,40,621,1,40,1,40,5,40,
+ 626,8,40,10,40,12,40,629,9,40,1,40,1,40,4,40,633,8,40,11,40,12,40,634,1,
+ 40,4,40,638,8,40,11,40,12,40,639,1,40,1,40,5,40,644,8,40,10,40,12,40,647,
+ 9,40,3,40,649,8,40,1,40,1,40,1,40,1,40,4,40,655,8,40,11,40,12,40,656,1,
+ 40,1,40,3,40,661,8,40,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,43,1,43,1,43,
+ 1,43,1,44,1,44,1,45,1,45,1,46,1,46,1,46,1,46,1,46,1,47,1,47,1,48,1,48,1,
+ 48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49,1,50,1,50,1,50,1,50,1,50,
+ 1,51,1,51,1,52,1,52,1,52,1,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54,1,55,1,
+ 55,1,55,1,55,1,56,1,56,1,56,1,56,1,56,1,57,1,57,1,57,1,57,1,57,1,57,1,58,
+ 1,58,1,58,1,59,1,59,1,60,1,60,1,60,1,60,1,60,1,60,1,61,1,61,1,62,1,62,1,
+ 62,1,62,1,62,1,63,1,63,1,63,1,64,1,64,1,64,1,65,1,65,1,65,1,66,1,66,1,67,
+ 1,67,1,67,1,68,1,68,1,69,1,69,1,69,1,70,1,70,1,71,1,71,1,72,1,72,1,73,1,
+ 73,1,74,1,74,1,75,1,75,1,75,1,75,1,75,1,76,1,76,1,76,1,76,1,76,1,77,1,77,
+ 5,77,789,8,77,10,77,12,77,792,9,77,1,77,1,77,3,77,796,8,77,1,77,4,77,799,
+ 8,77,11,77,12,77,800,3,77,803,8,77,1,78,1,78,4,78,807,8,78,11,78,12,78,
+ 808,1,78,1,78,1,79,1,79,1,80,1,80,1,80,1,80,1,81,1,81,1,81,1,81,1,82,1,
+ 82,1,82,1,82,1,83,1,83,1,83,1,83,1,83,1,84,1,84,1,84,1,84,1,85,1,85,1,85,
+ 1,85,1,86,1,86,1,86,1,86,1,87,1,87,1,87,1,87,1,88,1,88,1,88,1,88,1,88,1,
+ 88,1,88,1,88,1,88,1,89,1,89,1,89,3,89,860,8,89,1,90,4,90,863,8,90,11,90,
+ 12,90,864,1,91,1,91,1,91,1,91,1,92,1,92,1,92,1,92,1,93,1,93,1,93,1,93,1,
+ 94,1,94,1,94,1,94,1,95,1,95,1,95,1,95,1,95,1,96,1,96,1,96,1,96,1,97,1,97,
+ 1,97,1,97,1,98,1,98,1,98,1,98,3,98,900,8,98,1,99,1,99,3,99,904,8,99,1,99,
+ 5,99,907,8,99,10,99,12,99,910,9,99,1,99,1,99,3,99,914,8,99,1,99,4,99,917,
+ 8,99,11,99,12,99,918,3,99,921,8,99,1,100,1,100,4,100,925,8,100,11,100,12,
+ 100,926,1,101,1,101,1,101,1,101,1,102,1,102,1,102,1,102,1,103,1,103,1,103,
+ 1,103,1,104,1,104,1,104,1,104,1,104,1,105,1,105,1,105,1,105,1,106,1,106,
+ 1,106,1,106,1,107,1,107,1,107,1,107,1,108,1,108,1,108,1,109,1,109,1,109,
+ 1,109,1,110,1,110,1,110,1,110,1,111,1,111,1,111,1,111,1,112,1,112,1,112,
+ 1,112,1,113,1,113,1,113,1,113,1,113,1,114,1,114,1,114,1,114,1,114,1,115,
+ 1,115,1,115,1,115,1,115,1,116,1,116,1,116,1,116,1,116,1,116,1,116,1,117,
+ 1,117,1,118,4,118,1002,8,118,11,118,12,118,1003,1,118,1,118,3,118,1008,
+ 8,118,1,118,4,118,1011,8,118,11,118,12,118,1012,1,119,1,119,1,119,1,119,
+ 1,120,1,120,1,120,1,120,1,121,1,121,1,121,1,121,1,122,1,122,1,122,1,122,
+ 1,123,1,123,1,123,1,123,1,124,1,124,1,124,1,124,1,124,1,124,1,125,1,125,
+ 1,125,1,125,1,126,1,126,1,126,1,126,1,127,1,127,1,127,1,127,1,128,1,128,
+ 1,128,1,128,1,129,1,129,1,129,1,129,1,130,1,130,1,130,1,130,1,131,1,131,
+ 1,131,1,131,1,132,1,132,1,132,1,132,1,133,1,133,1,133,1,133,1,134,1,134,
+ 1,134,1,134,1,134,1,135,1,135,1,135,1,135,1,136,1,136,1,136,1,136,1,137,
+ 1,137,1,137,1,137,1,138,1,138,1,138,1,138,1,139,1,139,1,139,1,139,1,140,
+ 1,140,1,140,1,140,1,141,1,141,1,141,1,141,1,141,1,142,1,142,1,142,1,142,
+ 1,142,1,143,1,143,1,143,1,143,1,144,1,144,1,144,1,144,1,145,1,145,1,145,
+ 1,145,1,146,1,146,1,146,1,146,1,146,1,147,1,147,1,147,1,147,1,147,1,147,
+ 1,147,1,147,1,147,1,147,1,148,1,148,1,148,1,148,1,149,1,149,1,149,1,149,
+ 1,150,1,150,1,150,1,150,1,151,1,151,1,151,1,151,1,151,1,152,1,152,1,153,
+ 1,153,1,153,1,153,1,153,4,153,1167,8,153,11,153,12,153,1168,1,154,1,154,
+ 1,154,1,154,1,155,1,155,1,155,1,155,1,156,1,156,1,156,1,156,2,507,598,0,
+ 157,12,1,14,2,16,3,18,4,20,5,22,6,24,7,26,8,28,9,30,10,32,11,34,12,36,13,
+ 38,14,40,15,42,16,44,17,46,18,48,19,50,20,52,21,54,22,56,0,58,0,60,23,62,
+ 24,64,25,66,26,68,0,70,0,72,0,74,0,76,0,78,0,80,0,82,0,84,0,86,0,88,27,
+ 90,28,92,29,94,30,96,31,98,32,100,33,102,34,104,35,106,36,108,37,110,38,
+ 112,39,114,40,116,41,118,42,120,43,122,44,124,45,126,46,128,47,130,48,132,
+ 49,134,50,136,51,138,52,140,53,142,54,144,55,146,56,148,57,150,58,152,59,
+ 154,60,156,61,158,62,160,63,162,64,164,65,166,66,168,0,170,67,172,68,174,
+ 69,176,70,178,0,180,0,182,0,184,0,186,0,188,71,190,0,192,72,194,0,196,73,
+ 198,74,200,75,202,0,204,0,206,0,208,0,210,0,212,76,214,77,216,78,218,79,
+ 220,0,222,0,224,0,226,0,228,80,230,0,232,81,234,82,236,83,238,0,240,0,242,
+ 84,244,85,246,0,248,86,250,0,252,0,254,87,256,88,258,89,260,0,262,0,264,
+ 0,266,0,268,0,270,0,272,0,274,90,276,91,278,92,280,0,282,0,284,0,286,0,
+ 288,93,290,94,292,95,294,0,296,96,298,97,300,98,302,99,304,0,306,100,308,
+ 101,310,102,312,103,314,0,316,104,318,105,320,106,322,107,324,108,12,0,
+ 1,2,3,4,5,6,7,8,9,10,11,35,2,0,68,68,100,100,2,0,73,73,105,105,2,0,83,83,
+ 115,115,2,0,69,69,101,101,2,0,67,67,99,99,2,0,84,84,116,116,2,0,82,82,114,
+ 114,2,0,79,79,111,111,2,0,80,80,112,112,2,0,78,78,110,110,2,0,72,72,104,
+ 104,2,0,86,86,118,118,2,0,65,65,97,97,2,0,76,76,108,108,2,0,88,88,120,120,
+ 2,0,70,70,102,102,2,0,77,77,109,109,2,0,71,71,103,103,2,0,75,75,107,107,
+ 2,0,87,87,119,119,6,0,9,10,13,13,32,32,47,47,91,91,93,93,2,0,10,10,13,13,
+ 3,0,9,10,13,13,32,32,1,0,48,57,2,0,65,90,97,122,8,0,34,34,78,78,82,82,84,
+ 84,92,92,110,110,114,114,116,116,4,0,10,10,13,13,34,34,92,92,2,0,43,43,
+ 45,45,1,0,96,96,2,0,66,66,98,98,2,0,89,89,121,121,2,0,85,85,117,117,10,
+ 0,9,10,13,13,32,32,44,44,47,47,61,61,91,91,93,93,96,96,124,124,2,0,42,42,
+ 47,47,11,0,9,10,13,13,32,32,34,35,44,44,47,47,58,58,60,60,62,63,92,92,124,
+ 124,1209,0,12,1,0,0,0,0,14,1,0,0,0,0,16,1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,
+ 0,0,22,1,0,0,0,0,24,1,0,0,0,0,26,1,0,0,0,0,28,1,0,0,0,0,30,1,0,0,0,0,32,
+ 1,0,0,0,0,34,1,0,0,0,0,36,1,0,0,0,0,38,1,0,0,0,0,40,1,0,0,0,0,42,1,0,0,
+ 0,0,44,1,0,0,0,0,46,1,0,0,0,0,48,1,0,0,0,0,50,1,0,0,0,0,52,1,0,0,0,0,54,
+ 1,0,0,0,1,56,1,0,0,0,1,58,1,0,0,0,1,60,1,0,0,0,1,62,1,0,0,0,1,64,1,0,0,
+ 0,2,66,1,0,0,0,2,88,1,0,0,0,2,90,1,0,0,0,2,92,1,0,0,0,2,94,1,0,0,0,2,96,
+ 1,0,0,0,2,98,1,0,0,0,2,100,1,0,0,0,2,102,1,0,0,0,2,104,1,0,0,0,2,106,1,
+ 0,0,0,2,108,1,0,0,0,2,110,1,0,0,0,2,112,1,0,0,0,2,114,1,0,0,0,2,116,1,0,
+ 0,0,2,118,1,0,0,0,2,120,1,0,0,0,2,122,1,0,0,0,2,124,1,0,0,0,2,126,1,0,0,
+ 0,2,128,1,0,0,0,2,130,1,0,0,0,2,132,1,0,0,0,2,134,1,0,0,0,2,136,1,0,0,0,
+ 2,138,1,0,0,0,2,140,1,0,0,0,2,142,1,0,0,0,2,144,1,0,0,0,2,146,1,0,0,0,2,
+ 148,1,0,0,0,2,150,1,0,0,0,2,152,1,0,0,0,2,154,1,0,0,0,2,156,1,0,0,0,2,158,
+ 1,0,0,0,2,160,1,0,0,0,2,162,1,0,0,0,2,164,1,0,0,0,2,166,1,0,0,0,2,170,1,
+ 0,0,0,2,172,1,0,0,0,2,174,1,0,0,0,2,176,1,0,0,0,3,178,1,0,0,0,3,180,1,0,
+ 0,0,3,182,1,0,0,0,3,184,1,0,0,0,3,186,1,0,0,0,3,188,1,0,0,0,3,192,1,0,0,
+ 0,3,194,1,0,0,0,3,196,1,0,0,0,3,198,1,0,0,0,3,200,1,0,0,0,4,202,1,0,0,0,
+ 4,204,1,0,0,0,4,206,1,0,0,0,4,212,1,0,0,0,4,214,1,0,0,0,4,216,1,0,0,0,4,
+ 218,1,0,0,0,5,220,1,0,0,0,5,222,1,0,0,0,5,224,1,0,0,0,5,226,1,0,0,0,5,228,
+ 1,0,0,0,5,230,1,0,0,0,5,232,1,0,0,0,5,234,1,0,0,0,5,236,1,0,0,0,6,238,1,
+ 0,0,0,6,240,1,0,0,0,6,242,1,0,0,0,6,244,1,0,0,0,6,248,1,0,0,0,6,250,1,0,
+ 0,0,6,252,1,0,0,0,6,254,1,0,0,0,6,256,1,0,0,0,6,258,1,0,0,0,7,260,1,0,0,
+ 0,7,262,1,0,0,0,7,264,1,0,0,0,7,266,1,0,0,0,7,268,1,0,0,0,7,270,1,0,0,0,
+ 7,272,1,0,0,0,7,274,1,0,0,0,7,276,1,0,0,0,7,278,1,0,0,0,8,280,1,0,0,0,8,
+ 282,1,0,0,0,8,284,1,0,0,0,8,286,1,0,0,0,8,288,1,0,0,0,8,290,1,0,0,0,8,292,
+ 1,0,0,0,9,294,1,0,0,0,9,296,1,0,0,0,9,298,1,0,0,0,9,300,1,0,0,0,9,302,1,
+ 0,0,0,10,304,1,0,0,0,10,306,1,0,0,0,10,308,1,0,0,0,10,310,1,0,0,0,10,312,
+ 1,0,0,0,11,314,1,0,0,0,11,316,1,0,0,0,11,318,1,0,0,0,11,320,1,0,0,0,11,
+ 322,1,0,0,0,11,324,1,0,0,0,12,326,1,0,0,0,14,336,1,0,0,0,16,343,1,0,0,0,
+ 18,352,1,0,0,0,20,359,1,0,0,0,22,369,1,0,0,0,24,376,1,0,0,0,26,383,1,0,
+ 0,0,28,397,1,0,0,0,30,404,1,0,0,0,32,412,1,0,0,0,34,419,1,0,0,0,36,431,
+ 1,0,0,0,38,440,1,0,0,0,40,446,1,0,0,0,42,453,1,0,0,0,44,460,1,0,0,0,46,
+ 468,1,0,0,0,48,477,1,0,0,0,50,483,1,0,0,0,52,500,1,0,0,0,54,516,1,0,0,0,
+ 56,522,1,0,0,0,58,527,1,0,0,0,60,532,1,0,0,0,62,536,1,0,0,0,64,540,1,0,
+ 0,0,66,544,1,0,0,0,68,548,1,0,0,0,70,550,1,0,0,0,72,552,1,0,0,0,74,555,
+ 1,0,0,0,76,557,1,0,0,0,78,566,1,0,0,0,80,568,1,0,0,0,82,573,1,0,0,0,84,
+ 575,1,0,0,0,86,580,1,0,0,0,88,611,1,0,0,0,90,614,1,0,0,0,92,660,1,0,0,0,
+ 94,662,1,0,0,0,96,665,1,0,0,0,98,669,1,0,0,0,100,673,1,0,0,0,102,675,1,
+ 0,0,0,104,677,1,0,0,0,106,682,1,0,0,0,108,684,1,0,0,0,110,690,1,0,0,0,112,
+ 696,1,0,0,0,114,701,1,0,0,0,116,703,1,0,0,0,118,706,1,0,0,0,120,709,1,0,
+ 0,0,122,714,1,0,0,0,124,718,1,0,0,0,126,723,1,0,0,0,128,729,1,0,0,0,130,
+ 732,1,0,0,0,132,734,1,0,0,0,134,740,1,0,0,0,136,742,1,0,0,0,138,747,1,0,
+ 0,0,140,750,1,0,0,0,142,753,1,0,0,0,144,756,1,0,0,0,146,758,1,0,0,0,148,
+ 761,1,0,0,0,150,763,1,0,0,0,152,766,1,0,0,0,154,768,1,0,0,0,156,770,1,0,
+ 0,0,158,772,1,0,0,0,160,774,1,0,0,0,162,776,1,0,0,0,164,781,1,0,0,0,166,
+ 802,1,0,0,0,168,804,1,0,0,0,170,812,1,0,0,0,172,814,1,0,0,0,174,818,1,0,
+ 0,0,176,822,1,0,0,0,178,826,1,0,0,0,180,831,1,0,0,0,182,835,1,0,0,0,184,
+ 839,1,0,0,0,186,843,1,0,0,0,188,847,1,0,0,0,190,859,1,0,0,0,192,862,1,0,
+ 0,0,194,866,1,0,0,0,196,870,1,0,0,0,198,874,1,0,0,0,200,878,1,0,0,0,202,
+ 882,1,0,0,0,204,887,1,0,0,0,206,891,1,0,0,0,208,899,1,0,0,0,210,920,1,0,
+ 0,0,212,924,1,0,0,0,214,928,1,0,0,0,216,932,1,0,0,0,218,936,1,0,0,0,220,
+ 940,1,0,0,0,222,945,1,0,0,0,224,949,1,0,0,0,226,953,1,0,0,0,228,957,1,0,
+ 0,0,230,960,1,0,0,0,232,964,1,0,0,0,234,968,1,0,0,0,236,972,1,0,0,0,238,
+ 976,1,0,0,0,240,981,1,0,0,0,242,986,1,0,0,0,244,991,1,0,0,0,246,998,1,0,
+ 0,0,248,1007,1,0,0,0,250,1014,1,0,0,0,252,1018,1,0,0,0,254,1022,1,0,0,0,
+ 256,1026,1,0,0,0,258,1030,1,0,0,0,260,1034,1,0,0,0,262,1040,1,0,0,0,264,
+ 1044,1,0,0,0,266,1048,1,0,0,0,268,1052,1,0,0,0,270,1056,1,0,0,0,272,1060,
+ 1,0,0,0,274,1064,1,0,0,0,276,1068,1,0,0,0,278,1072,1,0,0,0,280,1076,1,0,
+ 0,0,282,1081,1,0,0,0,284,1085,1,0,0,0,286,1089,1,0,0,0,288,1093,1,0,0,0,
+ 290,1097,1,0,0,0,292,1101,1,0,0,0,294,1105,1,0,0,0,296,1110,1,0,0,0,298,
+ 1115,1,0,0,0,300,1119,1,0,0,0,302,1123,1,0,0,0,304,1127,1,0,0,0,306,1132,
+ 1,0,0,0,308,1142,1,0,0,0,310,1146,1,0,0,0,312,1150,1,0,0,0,314,1154,1,0,
+ 0,0,316,1159,1,0,0,0,318,1166,1,0,0,0,320,1170,1,0,0,0,322,1174,1,0,0,0,
+ 324,1178,1,0,0,0,326,327,7,0,0,0,327,328,7,1,0,0,328,329,7,2,0,0,329,330,
+ 7,2,0,0,330,331,7,3,0,0,331,332,7,4,0,0,332,333,7,5,0,0,333,334,1,0,0,0,
+ 334,335,6,0,0,0,335,13,1,0,0,0,336,337,7,0,0,0,337,338,7,6,0,0,338,339,
+ 7,7,0,0,339,340,7,8,0,0,340,341,1,0,0,0,341,342,6,1,1,0,342,15,1,0,0,0,
+ 343,344,7,3,0,0,344,345,7,9,0,0,345,346,7,6,0,0,346,347,7,1,0,0,347,348,
+ 7,4,0,0,348,349,7,10,0,0,349,350,1,0,0,0,350,351,6,2,2,0,351,17,1,0,0,0,
+ 352,353,7,3,0,0,353,354,7,11,0,0,354,355,7,12,0,0,355,356,7,13,0,0,356,
+ 357,1,0,0,0,357,358,6,3,0,0,358,19,1,0,0,0,359,360,7,3,0,0,360,361,7,14,
+ 0,0,361,362,7,8,0,0,362,363,7,13,0,0,363,364,7,12,0,0,364,365,7,1,0,0,365,
+ 366,7,9,0,0,366,367,1,0,0,0,367,368,6,4,3,0,368,21,1,0,0,0,369,370,7,15,
+ 0,0,370,371,7,6,0,0,371,372,7,7,0,0,372,373,7,16,0,0,373,374,1,0,0,0,374,
+ 375,6,5,4,0,375,23,1,0,0,0,376,377,7,17,0,0,377,378,7,6,0,0,378,379,7,7,
+ 0,0,379,380,7,18,0,0,380,381,1,0,0,0,381,382,6,6,0,0,382,25,1,0,0,0,383,
+ 384,7,1,0,0,384,385,7,9,0,0,385,386,7,13,0,0,386,387,7,1,0,0,387,388,7,
+ 9,0,0,388,389,7,3,0,0,389,390,7,2,0,0,390,391,7,5,0,0,391,392,7,12,0,0,
+ 392,393,7,5,0,0,393,394,7,2,0,0,394,395,1,0,0,0,395,396,6,7,0,0,396,27,
+ 1,0,0,0,397,398,7,18,0,0,398,399,7,3,0,0,399,400,7,3,0,0,400,401,7,8,0,
+ 0,401,402,1,0,0,0,402,403,6,8,1,0,403,29,1,0,0,0,404,405,7,13,0,0,405,406,
+ 7,1,0,0,406,407,7,16,0,0,407,408,7,1,0,0,408,409,7,5,0,0,409,410,1,0,0,
+ 0,410,411,6,9,0,0,411,31,1,0,0,0,412,413,7,16,0,0,413,414,7,3,0,0,414,415,
+ 7,5,0,0,415,416,7,12,0,0,416,417,1,0,0,0,417,418,6,10,5,0,418,33,1,0,0,
+ 0,419,420,7,16,0,0,420,421,7,11,0,0,421,422,5,95,0,0,422,423,7,3,0,0,423,
+ 424,7,14,0,0,424,425,7,8,0,0,425,426,7,12,0,0,426,427,7,9,0,0,427,428,7,
+ 0,0,0,428,429,1,0,0,0,429,430,6,11,6,0,430,35,1,0,0,0,431,432,7,6,0,0,432,
+ 433,7,3,0,0,433,434,7,9,0,0,434,435,7,12,0,0,435,436,7,16,0,0,436,437,7,
+ 3,0,0,437,438,1,0,0,0,438,439,6,12,7,0,439,37,1,0,0,0,440,441,7,6,0,0,441,
+ 442,7,7,0,0,442,443,7,19,0,0,443,444,1,0,0,0,444,445,6,13,0,0,445,39,1,
+ 0,0,0,446,447,7,2,0,0,447,448,7,10,0,0,448,449,7,7,0,0,449,450,7,19,0,0,
+ 450,451,1,0,0,0,451,452,6,14,8,0,452,41,1,0,0,0,453,454,7,2,0,0,454,455,
+ 7,7,0,0,455,456,7,6,0,0,456,457,7,5,0,0,457,458,1,0,0,0,458,459,6,15,0,
+ 0,459,43,1,0,0,0,460,461,7,2,0,0,461,462,7,5,0,0,462,463,7,12,0,0,463,464,
+ 7,5,0,0,464,465,7,2,0,0,465,466,1,0,0,0,466,467,6,16,0,0,467,45,1,0,0,0,
+ 468,469,7,19,0,0,469,470,7,10,0,0,470,471,7,3,0,0,471,472,7,6,0,0,472,473,
+ 7,3,0,0,473,474,1,0,0,0,474,475,6,17,0,0,475,47,1,0,0,0,476,478,8,20,0,
+ 0,477,476,1,0,0,0,478,479,1,0,0,0,479,477,1,0,0,0,479,480,1,0,0,0,480,481,
+ 1,0,0,0,481,482,6,18,0,0,482,49,1,0,0,0,483,484,5,47,0,0,484,485,5,47,0,
+ 0,485,489,1,0,0,0,486,488,8,21,0,0,487,486,1,0,0,0,488,491,1,0,0,0,489,
+ 487,1,0,0,0,489,490,1,0,0,0,490,493,1,0,0,0,491,489,1,0,0,0,492,494,5,13,
+ 0,0,493,492,1,0,0,0,493,494,1,0,0,0,494,496,1,0,0,0,495,497,5,10,0,0,496,
+ 495,1,0,0,0,496,497,1,0,0,0,497,498,1,0,0,0,498,499,6,19,9,0,499,51,1,0,
+ 0,0,500,501,5,47,0,0,501,502,5,42,0,0,502,507,1,0,0,0,503,506,3,52,20,0,
+ 504,506,9,0,0,0,505,503,1,0,0,0,505,504,1,0,0,0,506,509,1,0,0,0,507,508,
+ 1,0,0,0,507,505,1,0,0,0,508,510,1,0,0,0,509,507,1,0,0,0,510,511,5,42,0,
+ 0,511,512,5,47,0,0,512,513,1,0,0,0,513,514,6,20,9,0,514,53,1,0,0,0,515,
+ 517,7,22,0,0,516,515,1,0,0,0,517,518,1,0,0,0,518,516,1,0,0,0,518,519,1,
+ 0,0,0,519,520,1,0,0,0,520,521,6,21,9,0,521,55,1,0,0,0,522,523,3,162,75,
+ 0,523,524,1,0,0,0,524,525,6,22,10,0,525,526,6,22,11,0,526,57,1,0,0,0,527,
+ 528,3,66,27,0,528,529,1,0,0,0,529,530,6,23,12,0,530,531,6,23,13,0,531,59,
+ 1,0,0,0,532,533,3,54,21,0,533,534,1,0,0,0,534,535,6,24,9,0,535,61,1,0,0,
+ 0,536,537,3,50,19,0,537,538,1,0,0,0,538,539,6,25,9,0,539,63,1,0,0,0,540,
+ 541,3,52,20,0,541,542,1,0,0,0,542,543,6,26,9,0,543,65,1,0,0,0,544,545,5,
+ 124,0,0,545,546,1,0,0,0,546,547,6,27,13,0,547,67,1,0,0,0,548,549,7,23,0,
+ 0,549,69,1,0,0,0,550,551,7,24,0,0,551,71,1,0,0,0,552,553,5,92,0,0,553,554,
+ 7,25,0,0,554,73,1,0,0,0,555,556,8,26,0,0,556,75,1,0,0,0,557,559,7,3,0,0,
+ 558,560,7,27,0,0,559,558,1,0,0,0,559,560,1,0,0,0,560,562,1,0,0,0,561,563,
+ 3,68,28,0,562,561,1,0,0,0,563,564,1,0,0,0,564,562,1,0,0,0,564,565,1,0,0,
+ 0,565,77,1,0,0,0,566,567,5,64,0,0,567,79,1,0,0,0,568,569,5,96,0,0,569,81,
+ 1,0,0,0,570,574,8,28,0,0,571,572,5,96,0,0,572,574,5,96,0,0,573,570,1,0,
+ 0,0,573,571,1,0,0,0,574,83,1,0,0,0,575,576,5,95,0,0,576,85,1,0,0,0,577,
+ 581,3,70,29,0,578,581,3,68,28,0,579,581,3,84,36,0,580,577,1,0,0,0,580,578,
+ 1,0,0,0,580,579,1,0,0,0,581,87,1,0,0,0,582,587,5,34,0,0,583,586,3,72,30,
+ 0,584,586,3,74,31,0,585,583,1,0,0,0,585,584,1,0,0,0,586,589,1,0,0,0,587,
+ 585,1,0,0,0,587,588,1,0,0,0,588,590,1,0,0,0,589,587,1,0,0,0,590,612,5,34,
+ 0,0,591,592,5,34,0,0,592,593,5,34,0,0,593,594,5,34,0,0,594,598,1,0,0,0,
+ 595,597,8,21,0,0,596,595,1,0,0,0,597,600,1,0,0,0,598,599,1,0,0,0,598,596,
+ 1,0,0,0,599,601,1,0,0,0,600,598,1,0,0,0,601,602,5,34,0,0,602,603,5,34,0,
+ 0,603,604,5,34,0,0,604,606,1,0,0,0,605,607,5,34,0,0,606,605,1,0,0,0,606,
+ 607,1,0,0,0,607,609,1,0,0,0,608,610,5,34,0,0,609,608,1,0,0,0,609,610,1,
+ 0,0,0,610,612,1,0,0,0,611,582,1,0,0,0,611,591,1,0,0,0,612,89,1,0,0,0,613,
+ 615,3,68,28,0,614,613,1,0,0,0,615,616,1,0,0,0,616,614,1,0,0,0,616,617,1,
+ 0,0,0,617,91,1,0,0,0,618,620,3,68,28,0,619,618,1,0,0,0,620,621,1,0,0,0,
+ 621,619,1,0,0,0,621,622,1,0,0,0,622,623,1,0,0,0,623,627,3,106,47,0,624,
+ 626,3,68,28,0,625,624,1,0,0,0,626,629,1,0,0,0,627,625,1,0,0,0,627,628,1,
+ 0,0,0,628,661,1,0,0,0,629,627,1,0,0,0,630,632,3,106,47,0,631,633,3,68,28,
+ 0,632,631,1,0,0,0,633,634,1,0,0,0,634,632,1,0,0,0,634,635,1,0,0,0,635,661,
+ 1,0,0,0,636,638,3,68,28,0,637,636,1,0,0,0,638,639,1,0,0,0,639,637,1,0,0,
+ 0,639,640,1,0,0,0,640,648,1,0,0,0,641,645,3,106,47,0,642,644,3,68,28,0,
+ 643,642,1,0,0,0,644,647,1,0,0,0,645,643,1,0,0,0,645,646,1,0,0,0,646,649,
+ 1,0,0,0,647,645,1,0,0,0,648,641,1,0,0,0,648,649,1,0,0,0,649,650,1,0,0,0,
+ 650,651,3,76,32,0,651,661,1,0,0,0,652,654,3,106,47,0,653,655,3,68,28,0,
+ 654,653,1,0,0,0,655,656,1,0,0,0,656,654,1,0,0,0,656,657,1,0,0,0,657,658,
+ 1,0,0,0,658,659,3,76,32,0,659,661,1,0,0,0,660,619,1,0,0,0,660,630,1,0,0,
+ 0,660,637,1,0,0,0,660,652,1,0,0,0,661,93,1,0,0,0,662,663,7,29,0,0,663,664,
+ 7,30,0,0,664,95,1,0,0,0,665,666,7,12,0,0,666,667,7,9,0,0,667,668,7,0,0,
+ 0,668,97,1,0,0,0,669,670,7,12,0,0,670,671,7,2,0,0,671,672,7,4,0,0,672,99,
+ 1,0,0,0,673,674,5,61,0,0,674,101,1,0,0,0,675,676,5,44,0,0,676,103,1,0,0,
+ 0,677,678,7,0,0,0,678,679,7,3,0,0,679,680,7,2,0,0,680,681,7,4,0,0,681,105,
+ 1,0,0,0,682,683,5,46,0,0,683,107,1,0,0,0,684,685,7,15,0,0,685,686,7,12,
+ 0,0,686,687,7,13,0,0,687,688,7,2,0,0,688,689,7,3,0,0,689,109,1,0,0,0,690,
+ 691,7,15,0,0,691,692,7,1,0,0,692,693,7,6,0,0,693,694,7,2,0,0,694,695,7,
+ 5,0,0,695,111,1,0,0,0,696,697,7,13,0,0,697,698,7,12,0,0,698,699,7,2,0,0,
+ 699,700,7,5,0,0,700,113,1,0,0,0,701,702,5,40,0,0,702,115,1,0,0,0,703,704,
+ 7,1,0,0,704,705,7,9,0,0,705,117,1,0,0,0,706,707,7,1,0,0,707,708,7,2,0,0,
+ 708,119,1,0,0,0,709,710,7,13,0,0,710,711,7,1,0,0,711,712,7,18,0,0,712,713,
+ 7,3,0,0,713,121,1,0,0,0,714,715,7,9,0,0,715,716,7,7,0,0,716,717,7,5,0,0,
+ 717,123,1,0,0,0,718,719,7,9,0,0,719,720,7,31,0,0,720,721,7,13,0,0,721,722,
+ 7,13,0,0,722,125,1,0,0,0,723,724,7,9,0,0,724,725,7,31,0,0,725,726,7,13,
+ 0,0,726,727,7,13,0,0,727,728,7,2,0,0,728,127,1,0,0,0,729,730,7,7,0,0,730,
+ 731,7,6,0,0,731,129,1,0,0,0,732,733,5,63,0,0,733,131,1,0,0,0,734,735,7,
+ 6,0,0,735,736,7,13,0,0,736,737,7,1,0,0,737,738,7,18,0,0,738,739,7,3,0,0,
+ 739,133,1,0,0,0,740,741,5,41,0,0,741,135,1,0,0,0,742,743,7,5,0,0,743,744,
+ 7,6,0,0,744,745,7,31,0,0,745,746,7,3,0,0,746,137,1,0,0,0,747,748,5,61,0,
+ 0,748,749,5,61,0,0,749,139,1,0,0,0,750,751,5,61,0,0,751,752,5,126,0,0,752,
+ 141,1,0,0,0,753,754,5,33,0,0,754,755,5,61,0,0,755,143,1,0,0,0,756,757,5,
+ 60,0,0,757,145,1,0,0,0,758,759,5,60,0,0,759,760,5,61,0,0,760,147,1,0,0,
+ 0,761,762,5,62,0,0,762,149,1,0,0,0,763,764,5,62,0,0,764,765,5,61,0,0,765,
+ 151,1,0,0,0,766,767,5,43,0,0,767,153,1,0,0,0,768,769,5,45,0,0,769,155,1,
+ 0,0,0,770,771,5,42,0,0,771,157,1,0,0,0,772,773,5,47,0,0,773,159,1,0,0,0,
+ 774,775,5,37,0,0,775,161,1,0,0,0,776,777,5,91,0,0,777,778,1,0,0,0,778,779,
+ 6,75,0,0,779,780,6,75,0,0,780,163,1,0,0,0,781,782,5,93,0,0,782,783,1,0,
+ 0,0,783,784,6,76,13,0,784,785,6,76,13,0,785,165,1,0,0,0,786,790,3,70,29,
+ 0,787,789,3,86,37,0,788,787,1,0,0,0,789,792,1,0,0,0,790,788,1,0,0,0,790,
+ 791,1,0,0,0,791,803,1,0,0,0,792,790,1,0,0,0,793,796,3,84,36,0,794,796,3,
+ 78,33,0,795,793,1,0,0,0,795,794,1,0,0,0,796,798,1,0,0,0,797,799,3,86,37,
+ 0,798,797,1,0,0,0,799,800,1,0,0,0,800,798,1,0,0,0,800,801,1,0,0,0,801,803,
+ 1,0,0,0,802,786,1,0,0,0,802,795,1,0,0,0,803,167,1,0,0,0,804,806,3,80,34,
+ 0,805,807,3,82,35,0,806,805,1,0,0,0,807,808,1,0,0,0,808,806,1,0,0,0,808,
+ 809,1,0,0,0,809,810,1,0,0,0,810,811,3,80,34,0,811,169,1,0,0,0,812,813,3,
+ 168,78,0,813,171,1,0,0,0,814,815,3,50,19,0,815,816,1,0,0,0,816,817,6,80,
+ 9,0,817,173,1,0,0,0,818,819,3,52,20,0,819,820,1,0,0,0,820,821,6,81,9,0,
+ 821,175,1,0,0,0,822,823,3,54,21,0,823,824,1,0,0,0,824,825,6,82,9,0,825,
+ 177,1,0,0,0,826,827,3,66,27,0,827,828,1,0,0,0,828,829,6,83,12,0,829,830,
+ 6,83,13,0,830,179,1,0,0,0,831,832,3,162,75,0,832,833,1,0,0,0,833,834,6,
+ 84,10,0,834,181,1,0,0,0,835,836,3,164,76,0,836,837,1,0,0,0,837,838,6,85,
+ 14,0,838,183,1,0,0,0,839,840,3,102,45,0,840,841,1,0,0,0,841,842,6,86,15,
+ 0,842,185,1,0,0,0,843,844,3,100,44,0,844,845,1,0,0,0,845,846,6,87,16,0,
+ 846,187,1,0,0,0,847,848,7,16,0,0,848,849,7,3,0,0,849,850,7,5,0,0,850,851,
+ 7,12,0,0,851,852,7,0,0,0,852,853,7,12,0,0,853,854,7,5,0,0,854,855,7,12,
+ 0,0,855,189,1,0,0,0,856,860,8,32,0,0,857,858,5,47,0,0,858,860,8,33,0,0,
+ 859,856,1,0,0,0,859,857,1,0,0,0,860,191,1,0,0,0,861,863,3,190,89,0,862,
+ 861,1,0,0,0,863,864,1,0,0,0,864,862,1,0,0,0,864,865,1,0,0,0,865,193,1,0,
+ 0,0,866,867,3,170,79,0,867,868,1,0,0,0,868,869,6,91,17,0,869,195,1,0,0,
+ 0,870,871,3,50,19,0,871,872,1,0,0,0,872,873,6,92,9,0,873,197,1,0,0,0,874,
+ 875,3,52,20,0,875,876,1,0,0,0,876,877,6,93,9,0,877,199,1,0,0,0,878,879,
+ 3,54,21,0,879,880,1,0,0,0,880,881,6,94,9,0,881,201,1,0,0,0,882,883,3,66,
+ 27,0,883,884,1,0,0,0,884,885,6,95,12,0,885,886,6,95,13,0,886,203,1,0,0,
+ 0,887,888,3,106,47,0,888,889,1,0,0,0,889,890,6,96,18,0,890,205,1,0,0,0,
+ 891,892,3,102,45,0,892,893,1,0,0,0,893,894,6,97,15,0,894,207,1,0,0,0,895,
+ 900,3,70,29,0,896,900,3,68,28,0,897,900,3,84,36,0,898,900,3,156,72,0,899,
+ 895,1,0,0,0,899,896,1,0,0,0,899,897,1,0,0,0,899,898,1,0,0,0,900,209,1,0,
+ 0,0,901,904,3,70,29,0,902,904,3,156,72,0,903,901,1,0,0,0,903,902,1,0,0,
+ 0,904,908,1,0,0,0,905,907,3,208,98,0,906,905,1,0,0,0,907,910,1,0,0,0,908,
+ 906,1,0,0,0,908,909,1,0,0,0,909,921,1,0,0,0,910,908,1,0,0,0,911,914,3,84,
+ 36,0,912,914,3,78,33,0,913,911,1,0,0,0,913,912,1,0,0,0,914,916,1,0,0,0,
+ 915,917,3,208,98,0,916,915,1,0,0,0,917,918,1,0,0,0,918,916,1,0,0,0,918,
+ 919,1,0,0,0,919,921,1,0,0,0,920,903,1,0,0,0,920,913,1,0,0,0,921,211,1,0,
+ 0,0,922,925,3,210,99,0,923,925,3,168,78,0,924,922,1,0,0,0,924,923,1,0,0,
+ 0,925,926,1,0,0,0,926,924,1,0,0,0,926,927,1,0,0,0,927,213,1,0,0,0,928,929,
+ 3,50,19,0,929,930,1,0,0,0,930,931,6,101,9,0,931,215,1,0,0,0,932,933,3,52,
+ 20,0,933,934,1,0,0,0,934,935,6,102,9,0,935,217,1,0,0,0,936,937,3,54,21,
+ 0,937,938,1,0,0,0,938,939,6,103,9,0,939,219,1,0,0,0,940,941,3,66,27,0,941,
+ 942,1,0,0,0,942,943,6,104,12,0,943,944,6,104,13,0,944,221,1,0,0,0,945,946,
+ 3,100,44,0,946,947,1,0,0,0,947,948,6,105,16,0,948,223,1,0,0,0,949,950,3,
+ 102,45,0,950,951,1,0,0,0,951,952,6,106,15,0,952,225,1,0,0,0,953,954,3,106,
+ 47,0,954,955,1,0,0,0,955,956,6,107,18,0,956,227,1,0,0,0,957,958,7,12,0,
+ 0,958,959,7,2,0,0,959,229,1,0,0,0,960,961,3,212,100,0,961,962,1,0,0,0,962,
+ 963,6,109,19,0,963,231,1,0,0,0,964,965,3,50,19,0,965,966,1,0,0,0,966,967,
+ 6,110,9,0,967,233,1,0,0,0,968,969,3,52,20,0,969,970,1,0,0,0,970,971,6,111,
+ 9,0,971,235,1,0,0,0,972,973,3,54,21,0,973,974,1,0,0,0,974,975,6,112,9,0,
+ 975,237,1,0,0,0,976,977,3,66,27,0,977,978,1,0,0,0,978,979,6,113,12,0,979,
+ 980,6,113,13,0,980,239,1,0,0,0,981,982,3,162,75,0,982,983,1,0,0,0,983,984,
+ 6,114,10,0,984,985,6,114,20,0,985,241,1,0,0,0,986,987,7,7,0,0,987,988,7,
+ 9,0,0,988,989,1,0,0,0,989,990,6,115,21,0,990,243,1,0,0,0,991,992,7,19,0,
+ 0,992,993,7,1,0,0,993,994,7,5,0,0,994,995,7,10,0,0,995,996,1,0,0,0,996,
+ 997,6,116,21,0,997,245,1,0,0,0,998,999,8,34,0,0,999,247,1,0,0,0,1000,1002,
+ 3,246,117,0,1001,1000,1,0,0,0,1002,1003,1,0,0,0,1003,1001,1,0,0,0,1003,
+ 1004,1,0,0,0,1004,1005,1,0,0,0,1005,1006,3,316,152,0,1006,1008,1,0,0,0,
+ 1007,1001,1,0,0,0,1007,1008,1,0,0,0,1008,1010,1,0,0,0,1009,1011,3,246,117,
+ 0,1010,1009,1,0,0,0,1011,1012,1,0,0,0,1012,1010,1,0,0,0,1012,1013,1,0,0,
+ 0,1013,249,1,0,0,0,1014,1015,3,170,79,0,1015,1016,1,0,0,0,1016,1017,6,119,
+ 17,0,1017,251,1,0,0,0,1018,1019,3,248,118,0,1019,1020,1,0,0,0,1020,1021,
+ 6,120,22,0,1021,253,1,0,0,0,1022,1023,3,50,19,0,1023,1024,1,0,0,0,1024,
+ 1025,6,121,9,0,1025,255,1,0,0,0,1026,1027,3,52,20,0,1027,1028,1,0,0,0,1028,
+ 1029,6,122,9,0,1029,257,1,0,0,0,1030,1031,3,54,21,0,1031,1032,1,0,0,0,1032,
+ 1033,6,123,9,0,1033,259,1,0,0,0,1034,1035,3,66,27,0,1035,1036,1,0,0,0,1036,
+ 1037,6,124,12,0,1037,1038,6,124,13,0,1038,1039,6,124,13,0,1039,261,1,0,
+ 0,0,1040,1041,3,100,44,0,1041,1042,1,0,0,0,1042,1043,6,125,16,0,1043,263,
+ 1,0,0,0,1044,1045,3,102,45,0,1045,1046,1,0,0,0,1046,1047,6,126,15,0,1047,
+ 265,1,0,0,0,1048,1049,3,106,47,0,1049,1050,1,0,0,0,1050,1051,6,127,18,0,
+ 1051,267,1,0,0,0,1052,1053,3,244,116,0,1053,1054,1,0,0,0,1054,1055,6,128,
+ 23,0,1055,269,1,0,0,0,1056,1057,3,212,100,0,1057,1058,1,0,0,0,1058,1059,
+ 6,129,19,0,1059,271,1,0,0,0,1060,1061,3,170,79,0,1061,1062,1,0,0,0,1062,
+ 1063,6,130,17,0,1063,273,1,0,0,0,1064,1065,3,50,19,0,1065,1066,1,0,0,0,
+ 1066,1067,6,131,9,0,1067,275,1,0,0,0,1068,1069,3,52,20,0,1069,1070,1,0,
+ 0,0,1070,1071,6,132,9,0,1071,277,1,0,0,0,1072,1073,3,54,21,0,1073,1074,
+ 1,0,0,0,1074,1075,6,133,9,0,1075,279,1,0,0,0,1076,1077,3,66,27,0,1077,1078,
+ 1,0,0,0,1078,1079,6,134,12,0,1079,1080,6,134,13,0,1080,281,1,0,0,0,1081,
+ 1082,3,106,47,0,1082,1083,1,0,0,0,1083,1084,6,135,18,0,1084,283,1,0,0,0,
+ 1085,1086,3,170,79,0,1086,1087,1,0,0,0,1087,1088,6,136,17,0,1088,285,1,
+ 0,0,0,1089,1090,3,166,77,0,1090,1091,1,0,0,0,1091,1092,6,137,24,0,1092,
+ 287,1,0,0,0,1093,1094,3,50,19,0,1094,1095,1,0,0,0,1095,1096,6,138,9,0,1096,
+ 289,1,0,0,0,1097,1098,3,52,20,0,1098,1099,1,0,0,0,1099,1100,6,139,9,0,1100,
+ 291,1,0,0,0,1101,1102,3,54,21,0,1102,1103,1,0,0,0,1103,1104,6,140,9,0,1104,
+ 293,1,0,0,0,1105,1106,3,66,27,0,1106,1107,1,0,0,0,1107,1108,6,141,12,0,
+ 1108,1109,6,141,13,0,1109,295,1,0,0,0,1110,1111,7,1,0,0,1111,1112,7,9,0,
+ 0,1112,1113,7,15,0,0,1113,1114,7,7,0,0,1114,297,1,0,0,0,1115,1116,3,50,
+ 19,0,1116,1117,1,0,0,0,1117,1118,6,143,9,0,1118,299,1,0,0,0,1119,1120,3,
+ 52,20,0,1120,1121,1,0,0,0,1121,1122,6,144,9,0,1122,301,1,0,0,0,1123,1124,
+ 3,54,21,0,1124,1125,1,0,0,0,1125,1126,6,145,9,0,1126,303,1,0,0,0,1127,1128,
+ 3,66,27,0,1128,1129,1,0,0,0,1129,1130,6,146,12,0,1130,1131,6,146,13,0,1131,
+ 305,1,0,0,0,1132,1133,7,15,0,0,1133,1134,7,31,0,0,1134,1135,7,9,0,0,1135,
+ 1136,7,4,0,0,1136,1137,7,5,0,0,1137,1138,7,1,0,0,1138,1139,7,7,0,0,1139,
+ 1140,7,9,0,0,1140,1141,7,2,0,0,1141,307,1,0,0,0,1142,1143,3,50,19,0,1143,
+ 1144,1,0,0,0,1144,1145,6,148,9,0,1145,309,1,0,0,0,1146,1147,3,52,20,0,1147,
+ 1148,1,0,0,0,1148,1149,6,149,9,0,1149,311,1,0,0,0,1150,1151,3,54,21,0,1151,
+ 1152,1,0,0,0,1152,1153,6,150,9,0,1153,313,1,0,0,0,1154,1155,3,164,76,0,
+ 1155,1156,1,0,0,0,1156,1157,6,151,14,0,1157,1158,6,151,13,0,1158,315,1,
+ 0,0,0,1159,1160,5,58,0,0,1160,317,1,0,0,0,1161,1167,3,78,33,0,1162,1167,
+ 3,68,28,0,1163,1167,3,106,47,0,1164,1167,3,70,29,0,1165,1167,3,84,36,0,
+ 1166,1161,1,0,0,0,1166,1162,1,0,0,0,1166,1163,1,0,0,0,1166,1164,1,0,0,0,
+ 1166,1165,1,0,0,0,1167,1168,1,0,0,0,1168,1166,1,0,0,0,1168,1169,1,0,0,0,
+ 1169,319,1,0,0,0,1170,1171,3,50,19,0,1171,1172,1,0,0,0,1172,1173,6,154,
+ 9,0,1173,321,1,0,0,0,1174,1175,3,52,20,0,1175,1176,1,0,0,0,1176,1177,6,
+ 155,9,0,1177,323,1,0,0,0,1178,1179,3,54,21,0,1179,1180,1,0,0,0,1180,1181,
+ 6,156,9,0,1181,325,1,0,0,0,58,0,1,2,3,4,5,6,7,8,9,10,11,479,489,493,496,
+ 505,507,518,559,564,573,580,585,587,598,606,609,611,616,621,627,634,639,
+ 645,648,656,660,790,795,800,802,808,859,864,899,903,908,913,918,920,924,
+ 926,1003,1007,1012,1166,1168,25,5,2,0,5,4,0,5,6,0,5,1,0,5,3,0,5,10,0,5,
+ 8,0,5,5,0,5,9,0,0,1,0,7,64,0,5,0,0,7,26,0,4,0,0,7,65,0,7,34,0,7,33,0,7,
+ 67,0,7,36,0,7,76,0,5,11,0,5,7,0,7,86,0,7,85,0,7,66,0];
+
+ private static __ATN: ATN;
+ public static get _ATN(): ATN {
+ if (!esql_lexer.__ATN) {
+ esql_lexer.__ATN = new ATNDeserializer().deserialize(esql_lexer._serializedATN);
+ }
+
+ return esql_lexer.__ATN;
+ }
+
+
+ static DecisionsToDFA = esql_lexer._ATN.decisionToState.map( (ds: DecisionState, index: number) => new DFA(ds, index) );
+}
\ No newline at end of file
diff --git a/packages/kbn-monaco/src/esql/antlr/esql_parser.g4 b/packages/kbn-esql-ast/src/antlr/esql_parser.g4
similarity index 93%
rename from packages/kbn-monaco/src/esql/antlr/esql_parser.g4
rename to packages/kbn-esql-ast/src/antlr/esql_parser.g4
index 0c7cf96f5a2e1..b79e6314eedda 100644
--- a/packages/kbn-monaco/src/esql/antlr/esql_parser.g4
+++ b/packages/kbn-esql-ast/src/antlr/esql_parser.g4
@@ -1,3 +1,12 @@
+/*
+ * 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; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+// DO NOT MODIFY THIS FILE BY HAND. IT IS MANAGED BY A CI JOB.
+
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -24,6 +33,7 @@ sourceCommand
| fromCommand
| rowCommand
| showCommand
+ | metaCommand
;
processingCommand
@@ -114,7 +124,6 @@ deprecated_metadata
: OPENING_BRACKET metadataOption CLOSING_BRACKET
;
-
evalCommand
: EVAL fields
;
@@ -149,11 +158,6 @@ identifierPattern
: ID_PATTERN
;
-idPattern
- : UNQUOTED_ID_PATTERN
- | QUOTED_IDENTIFIER
- ;
-
constant
: NULL #nullLiteral
| integerValue UNQUOTED_IDENTIFIER #qualifiedIntegerLiteral
@@ -250,7 +254,10 @@ subqueryExpression
showCommand
: SHOW INFO #showInfo
- | SHOW FUNCTIONS #showFunctions
+ ;
+
+metaCommand
+ : META FUNCTIONS #metaFunctions
;
enrichCommand
diff --git a/packages/kbn-esql-ast/src/antlr/esql_parser.interp b/packages/kbn-esql-ast/src/antlr/esql_parser.interp
new file mode 100644
index 0000000000000..b8c5f609e75e5
--- /dev/null
+++ b/packages/kbn-esql-ast/src/antlr/esql_parser.interp
@@ -0,0 +1,278 @@
+token literal names:
+null
+'dissect'
+'drop'
+'enrich'
+'eval'
+'explain'
+'from'
+'grok'
+'inlinestats'
+'keep'
+'limit'
+'meta'
+'mv_expand'
+'rename'
+'row'
+'show'
+'sort'
+'stats'
+'where'
+null
+null
+null
+null
+null
+null
+null
+'|'
+null
+null
+null
+'by'
+'and'
+'asc'
+'='
+','
+'desc'
+'.'
+'false'
+'first'
+'last'
+'('
+'in'
+'is'
+'like'
+'not'
+'null'
+'nulls'
+'or'
+'?'
+'rlike'
+')'
+'true'
+'=='
+'=~'
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'/'
+'%'
+null
+']'
+null
+null
+null
+null
+null
+'metadata'
+null
+null
+null
+null
+null
+null
+null
+null
+'as'
+null
+null
+null
+'on'
+'with'
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+'info'
+null
+null
+null
+'functions'
+null
+null
+null
+':'
+null
+null
+null
+null
+
+token symbolic names:
+null
+DISSECT
+DROP
+ENRICH
+EVAL
+EXPLAIN
+FROM
+GROK
+INLINESTATS
+KEEP
+LIMIT
+META
+MV_EXPAND
+RENAME
+ROW
+SHOW
+SORT
+STATS
+WHERE
+UNKNOWN_CMD
+LINE_COMMENT
+MULTILINE_COMMENT
+WS
+EXPLAIN_WS
+EXPLAIN_LINE_COMMENT
+EXPLAIN_MULTILINE_COMMENT
+PIPE
+STRING
+INTEGER_LITERAL
+DECIMAL_LITERAL
+BY
+AND
+ASC
+ASSIGN
+COMMA
+DESC
+DOT
+FALSE
+FIRST
+LAST
+LP
+IN
+IS
+LIKE
+NOT
+NULL
+NULLS
+OR
+PARAM
+RLIKE
+RP
+TRUE
+EQ
+CIEQ
+NEQ
+LT
+LTE
+GT
+GTE
+PLUS
+MINUS
+ASTERISK
+SLASH
+PERCENT
+OPENING_BRACKET
+CLOSING_BRACKET
+UNQUOTED_IDENTIFIER
+QUOTED_IDENTIFIER
+EXPR_LINE_COMMENT
+EXPR_MULTILINE_COMMENT
+EXPR_WS
+METADATA
+FROM_UNQUOTED_IDENTIFIER
+FROM_LINE_COMMENT
+FROM_MULTILINE_COMMENT
+FROM_WS
+ID_PATTERN
+PROJECT_LINE_COMMENT
+PROJECT_MULTILINE_COMMENT
+PROJECT_WS
+AS
+RENAME_LINE_COMMENT
+RENAME_MULTILINE_COMMENT
+RENAME_WS
+ON
+WITH
+ENRICH_POLICY_NAME
+ENRICH_LINE_COMMENT
+ENRICH_MULTILINE_COMMENT
+ENRICH_WS
+ENRICH_FIELD_LINE_COMMENT
+ENRICH_FIELD_MULTILINE_COMMENT
+ENRICH_FIELD_WS
+MVEXPAND_LINE_COMMENT
+MVEXPAND_MULTILINE_COMMENT
+MVEXPAND_WS
+INFO
+SHOW_LINE_COMMENT
+SHOW_MULTILINE_COMMENT
+SHOW_WS
+FUNCTIONS
+META_LINE_COMMENT
+META_MULTILINE_COMMENT
+META_WS
+COLON
+SETTING
+SETTING_LINE_COMMENT
+SETTTING_MULTILINE_COMMENT
+SETTING_WS
+
+rule names:
+singleStatement
+query
+sourceCommand
+processingCommand
+whereCommand
+booleanExpression
+regexBooleanExpression
+valueExpression
+operatorExpression
+primaryExpression
+functionExpression
+rowCommand
+fields
+field
+fromCommand
+metadata
+metadataOption
+deprecated_metadata
+evalCommand
+statsCommand
+inlinestatsCommand
+fromIdentifier
+qualifiedName
+qualifiedNamePattern
+identifier
+identifierPattern
+constant
+limitCommand
+sortCommand
+orderExpression
+keepCommand
+dropCommand
+renameCommand
+renameClause
+dissectCommand
+grokCommand
+mvExpandCommand
+commandOptions
+commandOption
+booleanValue
+numericValue
+decimalValue
+integerValue
+string
+comparisonOperator
+explainCommand
+subqueryExpression
+showCommand
+metaCommand
+enrichCommand
+enrichWithClause
+
+
+atn:
+[4, 1, 108, 510, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 112, 8, 1, 10, 1, 12, 1, 115, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 122, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 137, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 149, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 156, 8, 5, 10, 5, 12, 5, 159, 9, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 166, 8, 5, 1, 5, 1, 5, 3, 5, 170, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 178, 8, 5, 10, 5, 12, 5, 181, 9, 5, 1, 6, 1, 6, 3, 6, 185, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 192, 8, 6, 1, 6, 1, 6, 1, 6, 3, 6, 197, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 204, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 210, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 218, 8, 8, 10, 8, 12, 8, 221, 9, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 230, 8, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 238, 8, 10, 10, 10, 12, 10, 241, 9, 10, 3, 10, 243, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 5, 12, 253, 8, 12, 10, 12, 12, 12, 256, 9, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 263, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 269, 8, 14, 10, 14, 12, 14, 272, 9, 14, 1, 14, 3, 14, 275, 8, 14, 1, 15, 1, 15, 3, 15, 279, 8, 15, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 285, 8, 16, 10, 16, 12, 16, 288, 9, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 3, 19, 299, 8, 19, 1, 19, 1, 19, 3, 19, 303, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 309, 8, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 5, 22, 316, 8, 22, 10, 22, 12, 22, 319, 9, 22, 1, 23, 1, 23, 1, 23, 5, 23, 324, 8, 23, 10, 23, 12, 23, 327, 9, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 346, 8, 26, 10, 26, 12, 26, 349, 9, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 357, 8, 26, 10, 26, 12, 26, 360, 9, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 368, 8, 26, 10, 26, 12, 26, 371, 9, 26, 1, 26, 1, 26, 3, 26, 375, 8, 26, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 384, 8, 28, 10, 28, 12, 28, 387, 9, 28, 1, 29, 1, 29, 3, 29, 391, 8, 29, 1, 29, 1, 29, 3, 29, 395, 8, 29, 1, 30, 1, 30, 1, 30, 1, 30, 5, 30, 401, 8, 30, 10, 30, 12, 30, 404, 9, 30, 1, 31, 1, 31, 1, 31, 1, 31, 5, 31, 410, 8, 31, 10, 31, 12, 31, 413, 9, 31, 1, 32, 1, 32, 1, 32, 1, 32, 5, 32, 419, 8, 32, 10, 32, 12, 32, 422, 9, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 432, 8, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 5, 37, 444, 8, 37, 10, 37, 12, 37, 447, 9, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 3, 40, 457, 8, 40, 1, 41, 3, 41, 460, 8, 41, 1, 41, 1, 41, 1, 42, 3, 42, 465, 8, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 490, 8, 49, 1, 49, 1, 49, 1, 49, 1, 49, 5, 49, 496, 8, 49, 10, 49, 12, 49, 499, 9, 49, 3, 49, 501, 8, 49, 1, 50, 1, 50, 1, 50, 3, 50, 506, 8, 50, 1, 50, 1, 50, 1, 50, 0, 3, 2, 10, 16, 51, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 0, 8, 1, 0, 59, 60, 1, 0, 61, 63, 2, 0, 67, 67, 72, 72, 1, 0, 66, 67, 2, 0, 32, 32, 35, 35, 1, 0, 38, 39, 2, 0, 37, 37, 51, 51, 2, 0, 52, 52, 54, 58, 535, 0, 102, 1, 0, 0, 0, 2, 105, 1, 0, 0, 0, 4, 121, 1, 0, 0, 0, 6, 136, 1, 0, 0, 0, 8, 138, 1, 0, 0, 0, 10, 169, 1, 0, 0, 0, 12, 196, 1, 0, 0, 0, 14, 203, 1, 0, 0, 0, 16, 209, 1, 0, 0, 0, 18, 229, 1, 0, 0, 0, 20, 231, 1, 0, 0, 0, 22, 246, 1, 0, 0, 0, 24, 249, 1, 0, 0, 0, 26, 262, 1, 0, 0, 0, 28, 264, 1, 0, 0, 0, 30, 278, 1, 0, 0, 0, 32, 280, 1, 0, 0, 0, 34, 289, 1, 0, 0, 0, 36, 293, 1, 0, 0, 0, 38, 296, 1, 0, 0, 0, 40, 304, 1, 0, 0, 0, 42, 310, 1, 0, 0, 0, 44, 312, 1, 0, 0, 0, 46, 320, 1, 0, 0, 0, 48, 328, 1, 0, 0, 0, 50, 330, 1, 0, 0, 0, 52, 374, 1, 0, 0, 0, 54, 376, 1, 0, 0, 0, 56, 379, 1, 0, 0, 0, 58, 388, 1, 0, 0, 0, 60, 396, 1, 0, 0, 0, 62, 405, 1, 0, 0, 0, 64, 414, 1, 0, 0, 0, 66, 423, 1, 0, 0, 0, 68, 427, 1, 0, 0, 0, 70, 433, 1, 0, 0, 0, 72, 437, 1, 0, 0, 0, 74, 440, 1, 0, 0, 0, 76, 448, 1, 0, 0, 0, 78, 452, 1, 0, 0, 0, 80, 456, 1, 0, 0, 0, 82, 459, 1, 0, 0, 0, 84, 464, 1, 0, 0, 0, 86, 468, 1, 0, 0, 0, 88, 470, 1, 0, 0, 0, 90, 472, 1, 0, 0, 0, 92, 475, 1, 0, 0, 0, 94, 479, 1, 0, 0, 0, 96, 482, 1, 0, 0, 0, 98, 485, 1, 0, 0, 0, 100, 505, 1, 0, 0, 0, 102, 103, 3, 2, 1, 0, 103, 104, 5, 0, 0, 1, 104, 1, 1, 0, 0, 0, 105, 106, 6, 1, -1, 0, 106, 107, 3, 4, 2, 0, 107, 113, 1, 0, 0, 0, 108, 109, 10, 1, 0, 0, 109, 110, 5, 26, 0, 0, 110, 112, 3, 6, 3, 0, 111, 108, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 3, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 122, 3, 90, 45, 0, 117, 122, 3, 28, 14, 0, 118, 122, 3, 22, 11, 0, 119, 122, 3, 94, 47, 0, 120, 122, 3, 96, 48, 0, 121, 116, 1, 0, 0, 0, 121, 117, 1, 0, 0, 0, 121, 118, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 121, 120, 1, 0, 0, 0, 122, 5, 1, 0, 0, 0, 123, 137, 3, 36, 18, 0, 124, 137, 3, 40, 20, 0, 125, 137, 3, 54, 27, 0, 126, 137, 3, 60, 30, 0, 127, 137, 3, 56, 28, 0, 128, 137, 3, 38, 19, 0, 129, 137, 3, 8, 4, 0, 130, 137, 3, 62, 31, 0, 131, 137, 3, 64, 32, 0, 132, 137, 3, 68, 34, 0, 133, 137, 3, 70, 35, 0, 134, 137, 3, 98, 49, 0, 135, 137, 3, 72, 36, 0, 136, 123, 1, 0, 0, 0, 136, 124, 1, 0, 0, 0, 136, 125, 1, 0, 0, 0, 136, 126, 1, 0, 0, 0, 136, 127, 1, 0, 0, 0, 136, 128, 1, 0, 0, 0, 136, 129, 1, 0, 0, 0, 136, 130, 1, 0, 0, 0, 136, 131, 1, 0, 0, 0, 136, 132, 1, 0, 0, 0, 136, 133, 1, 0, 0, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 7, 1, 0, 0, 0, 138, 139, 5, 18, 0, 0, 139, 140, 3, 10, 5, 0, 140, 9, 1, 0, 0, 0, 141, 142, 6, 5, -1, 0, 142, 143, 5, 44, 0, 0, 143, 170, 3, 10, 5, 7, 144, 170, 3, 14, 7, 0, 145, 170, 3, 12, 6, 0, 146, 148, 3, 14, 7, 0, 147, 149, 5, 44, 0, 0, 148, 147, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 151, 5, 41, 0, 0, 151, 152, 5, 40, 0, 0, 152, 157, 3, 14, 7, 0, 153, 154, 5, 34, 0, 0, 154, 156, 3, 14, 7, 0, 155, 153, 1, 0, 0, 0, 156, 159, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 157, 158, 1, 0, 0, 0, 158, 160, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 160, 161, 5, 50, 0, 0, 161, 170, 1, 0, 0, 0, 162, 163, 3, 14, 7, 0, 163, 165, 5, 42, 0, 0, 164, 166, 5, 44, 0, 0, 165, 164, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 168, 5, 45, 0, 0, 168, 170, 1, 0, 0, 0, 169, 141, 1, 0, 0, 0, 169, 144, 1, 0, 0, 0, 169, 145, 1, 0, 0, 0, 169, 146, 1, 0, 0, 0, 169, 162, 1, 0, 0, 0, 170, 179, 1, 0, 0, 0, 171, 172, 10, 4, 0, 0, 172, 173, 5, 31, 0, 0, 173, 178, 3, 10, 5, 5, 174, 175, 10, 3, 0, 0, 175, 176, 5, 47, 0, 0, 176, 178, 3, 10, 5, 4, 177, 171, 1, 0, 0, 0, 177, 174, 1, 0, 0, 0, 178, 181, 1, 0, 0, 0, 179, 177, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 11, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, 182, 184, 3, 14, 7, 0, 183, 185, 5, 44, 0, 0, 184, 183, 1, 0, 0, 0, 184, 185, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 187, 5, 43, 0, 0, 187, 188, 3, 86, 43, 0, 188, 197, 1, 0, 0, 0, 189, 191, 3, 14, 7, 0, 190, 192, 5, 44, 0, 0, 191, 190, 1, 0, 0, 0, 191, 192, 1, 0, 0, 0, 192, 193, 1, 0, 0, 0, 193, 194, 5, 49, 0, 0, 194, 195, 3, 86, 43, 0, 195, 197, 1, 0, 0, 0, 196, 182, 1, 0, 0, 0, 196, 189, 1, 0, 0, 0, 197, 13, 1, 0, 0, 0, 198, 204, 3, 16, 8, 0, 199, 200, 3, 16, 8, 0, 200, 201, 3, 88, 44, 0, 201, 202, 3, 16, 8, 0, 202, 204, 1, 0, 0, 0, 203, 198, 1, 0, 0, 0, 203, 199, 1, 0, 0, 0, 204, 15, 1, 0, 0, 0, 205, 206, 6, 8, -1, 0, 206, 210, 3, 18, 9, 0, 207, 208, 7, 0, 0, 0, 208, 210, 3, 16, 8, 3, 209, 205, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 210, 219, 1, 0, 0, 0, 211, 212, 10, 2, 0, 0, 212, 213, 7, 1, 0, 0, 213, 218, 3, 16, 8, 3, 214, 215, 10, 1, 0, 0, 215, 216, 7, 0, 0, 0, 216, 218, 3, 16, 8, 2, 217, 211, 1, 0, 0, 0, 217, 214, 1, 0, 0, 0, 218, 221, 1, 0, 0, 0, 219, 217, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 17, 1, 0, 0, 0, 221, 219, 1, 0, 0, 0, 222, 230, 3, 52, 26, 0, 223, 230, 3, 44, 22, 0, 224, 230, 3, 20, 10, 0, 225, 226, 5, 40, 0, 0, 226, 227, 3, 10, 5, 0, 227, 228, 5, 50, 0, 0, 228, 230, 1, 0, 0, 0, 229, 222, 1, 0, 0, 0, 229, 223, 1, 0, 0, 0, 229, 224, 1, 0, 0, 0, 229, 225, 1, 0, 0, 0, 230, 19, 1, 0, 0, 0, 231, 232, 3, 48, 24, 0, 232, 242, 5, 40, 0, 0, 233, 243, 5, 61, 0, 0, 234, 239, 3, 10, 5, 0, 235, 236, 5, 34, 0, 0, 236, 238, 3, 10, 5, 0, 237, 235, 1, 0, 0, 0, 238, 241, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 239, 240, 1, 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 242, 233, 1, 0, 0, 0, 242, 234, 1, 0, 0, 0, 242, 243, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 245, 5, 50, 0, 0, 245, 21, 1, 0, 0, 0, 246, 247, 5, 14, 0, 0, 247, 248, 3, 24, 12, 0, 248, 23, 1, 0, 0, 0, 249, 254, 3, 26, 13, 0, 250, 251, 5, 34, 0, 0, 251, 253, 3, 26, 13, 0, 252, 250, 1, 0, 0, 0, 253, 256, 1, 0, 0, 0, 254, 252, 1, 0, 0, 0, 254, 255, 1, 0, 0, 0, 255, 25, 1, 0, 0, 0, 256, 254, 1, 0, 0, 0, 257, 263, 3, 10, 5, 0, 258, 259, 3, 44, 22, 0, 259, 260, 5, 33, 0, 0, 260, 261, 3, 10, 5, 0, 261, 263, 1, 0, 0, 0, 262, 257, 1, 0, 0, 0, 262, 258, 1, 0, 0, 0, 263, 27, 1, 0, 0, 0, 264, 265, 5, 6, 0, 0, 265, 270, 3, 42, 21, 0, 266, 267, 5, 34, 0, 0, 267, 269, 3, 42, 21, 0, 268, 266, 1, 0, 0, 0, 269, 272, 1, 0, 0, 0, 270, 268, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 274, 1, 0, 0, 0, 272, 270, 1, 0, 0, 0, 273, 275, 3, 30, 15, 0, 274, 273, 1, 0, 0, 0, 274, 275, 1, 0, 0, 0, 275, 29, 1, 0, 0, 0, 276, 279, 3, 32, 16, 0, 277, 279, 3, 34, 17, 0, 278, 276, 1, 0, 0, 0, 278, 277, 1, 0, 0, 0, 279, 31, 1, 0, 0, 0, 280, 281, 5, 71, 0, 0, 281, 286, 3, 42, 21, 0, 282, 283, 5, 34, 0, 0, 283, 285, 3, 42, 21, 0, 284, 282, 1, 0, 0, 0, 285, 288, 1, 0, 0, 0, 286, 284, 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 33, 1, 0, 0, 0, 288, 286, 1, 0, 0, 0, 289, 290, 5, 64, 0, 0, 290, 291, 3, 32, 16, 0, 291, 292, 5, 65, 0, 0, 292, 35, 1, 0, 0, 0, 293, 294, 5, 4, 0, 0, 294, 295, 3, 24, 12, 0, 295, 37, 1, 0, 0, 0, 296, 298, 5, 17, 0, 0, 297, 299, 3, 24, 12, 0, 298, 297, 1, 0, 0, 0, 298, 299, 1, 0, 0, 0, 299, 302, 1, 0, 0, 0, 300, 301, 5, 30, 0, 0, 301, 303, 3, 24, 12, 0, 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 39, 1, 0, 0, 0, 304, 305, 5, 8, 0, 0, 305, 308, 3, 24, 12, 0, 306, 307, 5, 30, 0, 0, 307, 309, 3, 24, 12, 0, 308, 306, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 41, 1, 0, 0, 0, 310, 311, 7, 2, 0, 0, 311, 43, 1, 0, 0, 0, 312, 317, 3, 48, 24, 0, 313, 314, 5, 36, 0, 0, 314, 316, 3, 48, 24, 0, 315, 313, 1, 0, 0, 0, 316, 319, 1, 0, 0, 0, 317, 315, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 45, 1, 0, 0, 0, 319, 317, 1, 0, 0, 0, 320, 325, 3, 50, 25, 0, 321, 322, 5, 36, 0, 0, 322, 324, 3, 50, 25, 0, 323, 321, 1, 0, 0, 0, 324, 327, 1, 0, 0, 0, 325, 323, 1, 0, 0, 0, 325, 326, 1, 0, 0, 0, 326, 47, 1, 0, 0, 0, 327, 325, 1, 0, 0, 0, 328, 329, 7, 3, 0, 0, 329, 49, 1, 0, 0, 0, 330, 331, 5, 76, 0, 0, 331, 51, 1, 0, 0, 0, 332, 375, 5, 45, 0, 0, 333, 334, 3, 84, 42, 0, 334, 335, 5, 66, 0, 0, 335, 375, 1, 0, 0, 0, 336, 375, 3, 82, 41, 0, 337, 375, 3, 84, 42, 0, 338, 375, 3, 78, 39, 0, 339, 375, 5, 48, 0, 0, 340, 375, 3, 86, 43, 0, 341, 342, 5, 64, 0, 0, 342, 347, 3, 80, 40, 0, 343, 344, 5, 34, 0, 0, 344, 346, 3, 80, 40, 0, 345, 343, 1, 0, 0, 0, 346, 349, 1, 0, 0, 0, 347, 345, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 350, 1, 0, 0, 0, 349, 347, 1, 0, 0, 0, 350, 351, 5, 65, 0, 0, 351, 375, 1, 0, 0, 0, 352, 353, 5, 64, 0, 0, 353, 358, 3, 78, 39, 0, 354, 355, 5, 34, 0, 0, 355, 357, 3, 78, 39, 0, 356, 354, 1, 0, 0, 0, 357, 360, 1, 0, 0, 0, 358, 356, 1, 0, 0, 0, 358, 359, 1, 0, 0, 0, 359, 361, 1, 0, 0, 0, 360, 358, 1, 0, 0, 0, 361, 362, 5, 65, 0, 0, 362, 375, 1, 0, 0, 0, 363, 364, 5, 64, 0, 0, 364, 369, 3, 86, 43, 0, 365, 366, 5, 34, 0, 0, 366, 368, 3, 86, 43, 0, 367, 365, 1, 0, 0, 0, 368, 371, 1, 0, 0, 0, 369, 367, 1, 0, 0, 0, 369, 370, 1, 0, 0, 0, 370, 372, 1, 0, 0, 0, 371, 369, 1, 0, 0, 0, 372, 373, 5, 65, 0, 0, 373, 375, 1, 0, 0, 0, 374, 332, 1, 0, 0, 0, 374, 333, 1, 0, 0, 0, 374, 336, 1, 0, 0, 0, 374, 337, 1, 0, 0, 0, 374, 338, 1, 0, 0, 0, 374, 339, 1, 0, 0, 0, 374, 340, 1, 0, 0, 0, 374, 341, 1, 0, 0, 0, 374, 352, 1, 0, 0, 0, 374, 363, 1, 0, 0, 0, 375, 53, 1, 0, 0, 0, 376, 377, 5, 10, 0, 0, 377, 378, 5, 28, 0, 0, 378, 55, 1, 0, 0, 0, 379, 380, 5, 16, 0, 0, 380, 385, 3, 58, 29, 0, 381, 382, 5, 34, 0, 0, 382, 384, 3, 58, 29, 0, 383, 381, 1, 0, 0, 0, 384, 387, 1, 0, 0, 0, 385, 383, 1, 0, 0, 0, 385, 386, 1, 0, 0, 0, 386, 57, 1, 0, 0, 0, 387, 385, 1, 0, 0, 0, 388, 390, 3, 10, 5, 0, 389, 391, 7, 4, 0, 0, 390, 389, 1, 0, 0, 0, 390, 391, 1, 0, 0, 0, 391, 394, 1, 0, 0, 0, 392, 393, 5, 46, 0, 0, 393, 395, 7, 5, 0, 0, 394, 392, 1, 0, 0, 0, 394, 395, 1, 0, 0, 0, 395, 59, 1, 0, 0, 0, 396, 397, 5, 9, 0, 0, 397, 402, 3, 46, 23, 0, 398, 399, 5, 34, 0, 0, 399, 401, 3, 46, 23, 0, 400, 398, 1, 0, 0, 0, 401, 404, 1, 0, 0, 0, 402, 400, 1, 0, 0, 0, 402, 403, 1, 0, 0, 0, 403, 61, 1, 0, 0, 0, 404, 402, 1, 0, 0, 0, 405, 406, 5, 2, 0, 0, 406, 411, 3, 46, 23, 0, 407, 408, 5, 34, 0, 0, 408, 410, 3, 46, 23, 0, 409, 407, 1, 0, 0, 0, 410, 413, 1, 0, 0, 0, 411, 409, 1, 0, 0, 0, 411, 412, 1, 0, 0, 0, 412, 63, 1, 0, 0, 0, 413, 411, 1, 0, 0, 0, 414, 415, 5, 13, 0, 0, 415, 420, 3, 66, 33, 0, 416, 417, 5, 34, 0, 0, 417, 419, 3, 66, 33, 0, 418, 416, 1, 0, 0, 0, 419, 422, 1, 0, 0, 0, 420, 418, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, 65, 1, 0, 0, 0, 422, 420, 1, 0, 0, 0, 423, 424, 3, 46, 23, 0, 424, 425, 5, 80, 0, 0, 425, 426, 3, 46, 23, 0, 426, 67, 1, 0, 0, 0, 427, 428, 5, 1, 0, 0, 428, 429, 3, 18, 9, 0, 429, 431, 3, 86, 43, 0, 430, 432, 3, 74, 37, 0, 431, 430, 1, 0, 0, 0, 431, 432, 1, 0, 0, 0, 432, 69, 1, 0, 0, 0, 433, 434, 5, 7, 0, 0, 434, 435, 3, 18, 9, 0, 435, 436, 3, 86, 43, 0, 436, 71, 1, 0, 0, 0, 437, 438, 5, 12, 0, 0, 438, 439, 3, 44, 22, 0, 439, 73, 1, 0, 0, 0, 440, 445, 3, 76, 38, 0, 441, 442, 5, 34, 0, 0, 442, 444, 3, 76, 38, 0, 443, 441, 1, 0, 0, 0, 444, 447, 1, 0, 0, 0, 445, 443, 1, 0, 0, 0, 445, 446, 1, 0, 0, 0, 446, 75, 1, 0, 0, 0, 447, 445, 1, 0, 0, 0, 448, 449, 3, 48, 24, 0, 449, 450, 5, 33, 0, 0, 450, 451, 3, 52, 26, 0, 451, 77, 1, 0, 0, 0, 452, 453, 7, 6, 0, 0, 453, 79, 1, 0, 0, 0, 454, 457, 3, 82, 41, 0, 455, 457, 3, 84, 42, 0, 456, 454, 1, 0, 0, 0, 456, 455, 1, 0, 0, 0, 457, 81, 1, 0, 0, 0, 458, 460, 7, 0, 0, 0, 459, 458, 1, 0, 0, 0, 459, 460, 1, 0, 0, 0, 460, 461, 1, 0, 0, 0, 461, 462, 5, 29, 0, 0, 462, 83, 1, 0, 0, 0, 463, 465, 7, 0, 0, 0, 464, 463, 1, 0, 0, 0, 464, 465, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 467, 5, 28, 0, 0, 467, 85, 1, 0, 0, 0, 468, 469, 5, 27, 0, 0, 469, 87, 1, 0, 0, 0, 470, 471, 7, 7, 0, 0, 471, 89, 1, 0, 0, 0, 472, 473, 5, 5, 0, 0, 473, 474, 3, 92, 46, 0, 474, 91, 1, 0, 0, 0, 475, 476, 5, 64, 0, 0, 476, 477, 3, 2, 1, 0, 477, 478, 5, 65, 0, 0, 478, 93, 1, 0, 0, 0, 479, 480, 5, 15, 0, 0, 480, 481, 5, 96, 0, 0, 481, 95, 1, 0, 0, 0, 482, 483, 5, 11, 0, 0, 483, 484, 5, 100, 0, 0, 484, 97, 1, 0, 0, 0, 485, 486, 5, 3, 0, 0, 486, 489, 5, 86, 0, 0, 487, 488, 5, 84, 0, 0, 488, 490, 3, 46, 23, 0, 489, 487, 1, 0, 0, 0, 489, 490, 1, 0, 0, 0, 490, 500, 1, 0, 0, 0, 491, 492, 5, 85, 0, 0, 492, 497, 3, 100, 50, 0, 493, 494, 5, 34, 0, 0, 494, 496, 3, 100, 50, 0, 495, 493, 1, 0, 0, 0, 496, 499, 1, 0, 0, 0, 497, 495, 1, 0, 0, 0, 497, 498, 1, 0, 0, 0, 498, 501, 1, 0, 0, 0, 499, 497, 1, 0, 0, 0, 500, 491, 1, 0, 0, 0, 500, 501, 1, 0, 0, 0, 501, 99, 1, 0, 0, 0, 502, 503, 3, 46, 23, 0, 503, 504, 5, 33, 0, 0, 504, 506, 1, 0, 0, 0, 505, 502, 1, 0, 0, 0, 505, 506, 1, 0, 0, 0, 506, 507, 1, 0, 0, 0, 507, 508, 3, 46, 23, 0, 508, 101, 1, 0, 0, 0, 49, 113, 121, 136, 148, 157, 165, 169, 177, 179, 184, 191, 196, 203, 209, 217, 219, 229, 239, 242, 254, 262, 270, 274, 278, 286, 298, 302, 308, 317, 325, 347, 358, 369, 374, 385, 390, 394, 402, 411, 420, 431, 445, 456, 459, 464, 489, 497, 500, 505]
\ No newline at end of file
diff --git a/packages/kbn-esql-ast/src/antlr/esql_parser.tokens b/packages/kbn-esql-ast/src/antlr/esql_parser.tokens
new file mode 100644
index 0000000000000..5edc646fad10e
--- /dev/null
+++ b/packages/kbn-esql-ast/src/antlr/esql_parser.tokens
@@ -0,0 +1,169 @@
+DISSECT=1
+DROP=2
+ENRICH=3
+EVAL=4
+EXPLAIN=5
+FROM=6
+GROK=7
+INLINESTATS=8
+KEEP=9
+LIMIT=10
+META=11
+MV_EXPAND=12
+RENAME=13
+ROW=14
+SHOW=15
+SORT=16
+STATS=17
+WHERE=18
+UNKNOWN_CMD=19
+LINE_COMMENT=20
+MULTILINE_COMMENT=21
+WS=22
+EXPLAIN_WS=23
+EXPLAIN_LINE_COMMENT=24
+EXPLAIN_MULTILINE_COMMENT=25
+PIPE=26
+STRING=27
+INTEGER_LITERAL=28
+DECIMAL_LITERAL=29
+BY=30
+AND=31
+ASC=32
+ASSIGN=33
+COMMA=34
+DESC=35
+DOT=36
+FALSE=37
+FIRST=38
+LAST=39
+LP=40
+IN=41
+IS=42
+LIKE=43
+NOT=44
+NULL=45
+NULLS=46
+OR=47
+PARAM=48
+RLIKE=49
+RP=50
+TRUE=51
+EQ=52
+CIEQ=53
+NEQ=54
+LT=55
+LTE=56
+GT=57
+GTE=58
+PLUS=59
+MINUS=60
+ASTERISK=61
+SLASH=62
+PERCENT=63
+OPENING_BRACKET=64
+CLOSING_BRACKET=65
+UNQUOTED_IDENTIFIER=66
+QUOTED_IDENTIFIER=67
+EXPR_LINE_COMMENT=68
+EXPR_MULTILINE_COMMENT=69
+EXPR_WS=70
+METADATA=71
+FROM_UNQUOTED_IDENTIFIER=72
+FROM_LINE_COMMENT=73
+FROM_MULTILINE_COMMENT=74
+FROM_WS=75
+ID_PATTERN=76
+PROJECT_LINE_COMMENT=77
+PROJECT_MULTILINE_COMMENT=78
+PROJECT_WS=79
+AS=80
+RENAME_LINE_COMMENT=81
+RENAME_MULTILINE_COMMENT=82
+RENAME_WS=83
+ON=84
+WITH=85
+ENRICH_POLICY_NAME=86
+ENRICH_LINE_COMMENT=87
+ENRICH_MULTILINE_COMMENT=88
+ENRICH_WS=89
+ENRICH_FIELD_LINE_COMMENT=90
+ENRICH_FIELD_MULTILINE_COMMENT=91
+ENRICH_FIELD_WS=92
+MVEXPAND_LINE_COMMENT=93
+MVEXPAND_MULTILINE_COMMENT=94
+MVEXPAND_WS=95
+INFO=96
+SHOW_LINE_COMMENT=97
+SHOW_MULTILINE_COMMENT=98
+SHOW_WS=99
+FUNCTIONS=100
+META_LINE_COMMENT=101
+META_MULTILINE_COMMENT=102
+META_WS=103
+COLON=104
+SETTING=105
+SETTING_LINE_COMMENT=106
+SETTTING_MULTILINE_COMMENT=107
+SETTING_WS=108
+'dissect'=1
+'drop'=2
+'enrich'=3
+'eval'=4
+'explain'=5
+'from'=6
+'grok'=7
+'inlinestats'=8
+'keep'=9
+'limit'=10
+'meta'=11
+'mv_expand'=12
+'rename'=13
+'row'=14
+'show'=15
+'sort'=16
+'stats'=17
+'where'=18
+'|'=26
+'by'=30
+'and'=31
+'asc'=32
+'='=33
+','=34
+'desc'=35
+'.'=36
+'false'=37
+'first'=38
+'last'=39
+'('=40
+'in'=41
+'is'=42
+'like'=43
+'not'=44
+'null'=45
+'nulls'=46
+'or'=47
+'?'=48
+'rlike'=49
+')'=50
+'true'=51
+'=='=52
+'=~'=53
+'!='=54
+'<'=55
+'<='=56
+'>'=57
+'>='=58
+'+'=59
+'-'=60
+'*'=61
+'/'=62
+'%'=63
+']'=65
+'metadata'=71
+'as'=80
+'on'=84
+'with'=85
+'info'=96
+'functions'=100
+':'=104
diff --git a/packages/kbn-monaco/src/esql/antlr/esql_parser.ts b/packages/kbn-esql-ast/src/antlr/esql_parser.ts
similarity index 84%
rename from packages/kbn-monaco/src/esql/antlr/esql_parser.ts
rename to packages/kbn-esql-ast/src/antlr/esql_parser.ts
index 954f16ec3d8df..40f3843403617 100644
--- a/packages/kbn-monaco/src/esql/antlr/esql_parser.ts
+++ b/packages/kbn-esql-ast/src/antlr/esql_parser.ts
@@ -1,5 +1,5 @@
// @ts-nocheck
-// Generated from src/esql/antlr/esql_parser.g4 by ANTLR 4.13.1
+// Generated from src/antlr/esql_parser.g4 by ANTLR 4.13.1
// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
import {
@@ -28,101 +28,104 @@ export default class esql_parser extends Parser {
public static readonly INLINESTATS = 8;
public static readonly KEEP = 9;
public static readonly LIMIT = 10;
- public static readonly MV_EXPAND = 11;
- public static readonly RENAME = 12;
- public static readonly ROW = 13;
- public static readonly SHOW = 14;
- public static readonly SORT = 15;
- public static readonly STATS = 16;
- public static readonly WHERE = 17;
- public static readonly UNKNOWN_CMD = 18;
- public static readonly LINE_COMMENT = 19;
- public static readonly MULTILINE_COMMENT = 20;
- public static readonly WS = 21;
- public static readonly EXPLAIN_WS = 22;
- public static readonly EXPLAIN_LINE_COMMENT = 23;
- public static readonly EXPLAIN_MULTILINE_COMMENT = 24;
- public static readonly PIPE = 25;
- public static readonly STRING = 26;
- public static readonly INTEGER_LITERAL = 27;
- public static readonly DECIMAL_LITERAL = 28;
- public static readonly BY = 29;
- public static readonly AND = 30;
- public static readonly ASC = 31;
- public static readonly ASSIGN = 32;
- public static readonly COMMA = 33;
- public static readonly DESC = 34;
- public static readonly DOT = 35;
- public static readonly FALSE = 36;
- public static readonly FIRST = 37;
- public static readonly LAST = 38;
- public static readonly LP = 39;
- public static readonly IN = 40;
- public static readonly IS = 41;
- public static readonly LIKE = 42;
- public static readonly NOT = 43;
- public static readonly NULL = 44;
- public static readonly NULLS = 45;
- public static readonly OR = 46;
- public static readonly PARAM = 47;
- public static readonly RLIKE = 48;
- public static readonly RP = 49;
- public static readonly TRUE = 50;
- public static readonly EQ = 51;
- public static readonly CIEQ = 52;
- public static readonly NEQ = 53;
- public static readonly LT = 54;
- public static readonly LTE = 55;
- public static readonly GT = 56;
- public static readonly GTE = 57;
- public static readonly PLUS = 58;
- public static readonly MINUS = 59;
- public static readonly ASTERISK = 60;
- public static readonly SLASH = 61;
- public static readonly PERCENT = 62;
- public static readonly OPENING_BRACKET = 63;
- public static readonly CLOSING_BRACKET = 64;
- public static readonly UNQUOTED_IDENTIFIER = 65;
- public static readonly QUOTED_IDENTIFIER = 66;
- public static readonly EXPR_LINE_COMMENT = 67;
- public static readonly EXPR_MULTILINE_COMMENT = 68;
- public static readonly EXPR_WS = 69;
- public static readonly METADATA = 70;
- public static readonly FROM_UNQUOTED_IDENTIFIER = 71;
- public static readonly FROM_LINE_COMMENT = 72;
- public static readonly FROM_MULTILINE_COMMENT = 73;
- public static readonly FROM_WS = 74;
- public static readonly ID_PATTERN = 75;
- public static readonly PROJECT_LINE_COMMENT = 76;
- public static readonly PROJECT_MULTILINE_COMMENT = 77;
- public static readonly PROJECT_WS = 78;
- public static readonly AS = 79;
- public static readonly RENAME_LINE_COMMENT = 80;
- public static readonly RENAME_MULTILINE_COMMENT = 81;
- public static readonly RENAME_WS = 82;
- public static readonly ON = 83;
- public static readonly WITH = 84;
- public static readonly ENRICH_POLICY_NAME = 85;
- public static readonly ENRICH_LINE_COMMENT = 86;
- public static readonly ENRICH_MULTILINE_COMMENT = 87;
- public static readonly ENRICH_WS = 88;
- public static readonly ENRICH_FIELD_LINE_COMMENT = 89;
- public static readonly ENRICH_FIELD_MULTILINE_COMMENT = 90;
- public static readonly ENRICH_FIELD_WS = 91;
- public static readonly MVEXPAND_LINE_COMMENT = 92;
- public static readonly MVEXPAND_MULTILINE_COMMENT = 93;
- public static readonly MVEXPAND_WS = 94;
- public static readonly INFO = 95;
- public static readonly FUNCTIONS = 96;
+ public static readonly META = 11;
+ public static readonly MV_EXPAND = 12;
+ public static readonly RENAME = 13;
+ public static readonly ROW = 14;
+ public static readonly SHOW = 15;
+ public static readonly SORT = 16;
+ public static readonly STATS = 17;
+ public static readonly WHERE = 18;
+ public static readonly UNKNOWN_CMD = 19;
+ public static readonly LINE_COMMENT = 20;
+ public static readonly MULTILINE_COMMENT = 21;
+ public static readonly WS = 22;
+ public static readonly EXPLAIN_WS = 23;
+ public static readonly EXPLAIN_LINE_COMMENT = 24;
+ public static readonly EXPLAIN_MULTILINE_COMMENT = 25;
+ public static readonly PIPE = 26;
+ public static readonly STRING = 27;
+ public static readonly INTEGER_LITERAL = 28;
+ public static readonly DECIMAL_LITERAL = 29;
+ public static readonly BY = 30;
+ public static readonly AND = 31;
+ public static readonly ASC = 32;
+ public static readonly ASSIGN = 33;
+ public static readonly COMMA = 34;
+ public static readonly DESC = 35;
+ public static readonly DOT = 36;
+ public static readonly FALSE = 37;
+ public static readonly FIRST = 38;
+ public static readonly LAST = 39;
+ public static readonly LP = 40;
+ public static readonly IN = 41;
+ public static readonly IS = 42;
+ public static readonly LIKE = 43;
+ public static readonly NOT = 44;
+ public static readonly NULL = 45;
+ public static readonly NULLS = 46;
+ public static readonly OR = 47;
+ public static readonly PARAM = 48;
+ public static readonly RLIKE = 49;
+ public static readonly RP = 50;
+ public static readonly TRUE = 51;
+ public static readonly EQ = 52;
+ public static readonly CIEQ = 53;
+ public static readonly NEQ = 54;
+ public static readonly LT = 55;
+ public static readonly LTE = 56;
+ public static readonly GT = 57;
+ public static readonly GTE = 58;
+ public static readonly PLUS = 59;
+ public static readonly MINUS = 60;
+ public static readonly ASTERISK = 61;
+ public static readonly SLASH = 62;
+ public static readonly PERCENT = 63;
+ public static readonly OPENING_BRACKET = 64;
+ public static readonly CLOSING_BRACKET = 65;
+ public static readonly UNQUOTED_IDENTIFIER = 66;
+ public static readonly QUOTED_IDENTIFIER = 67;
+ public static readonly EXPR_LINE_COMMENT = 68;
+ public static readonly EXPR_MULTILINE_COMMENT = 69;
+ public static readonly EXPR_WS = 70;
+ public static readonly METADATA = 71;
+ public static readonly FROM_UNQUOTED_IDENTIFIER = 72;
+ public static readonly FROM_LINE_COMMENT = 73;
+ public static readonly FROM_MULTILINE_COMMENT = 74;
+ public static readonly FROM_WS = 75;
+ public static readonly ID_PATTERN = 76;
+ public static readonly PROJECT_LINE_COMMENT = 77;
+ public static readonly PROJECT_MULTILINE_COMMENT = 78;
+ public static readonly PROJECT_WS = 79;
+ public static readonly AS = 80;
+ public static readonly RENAME_LINE_COMMENT = 81;
+ public static readonly RENAME_MULTILINE_COMMENT = 82;
+ public static readonly RENAME_WS = 83;
+ public static readonly ON = 84;
+ public static readonly WITH = 85;
+ public static readonly ENRICH_POLICY_NAME = 86;
+ public static readonly ENRICH_LINE_COMMENT = 87;
+ public static readonly ENRICH_MULTILINE_COMMENT = 88;
+ public static readonly ENRICH_WS = 89;
+ public static readonly ENRICH_FIELD_LINE_COMMENT = 90;
+ public static readonly ENRICH_FIELD_MULTILINE_COMMENT = 91;
+ public static readonly ENRICH_FIELD_WS = 92;
+ public static readonly MVEXPAND_LINE_COMMENT = 93;
+ public static readonly MVEXPAND_MULTILINE_COMMENT = 94;
+ public static readonly MVEXPAND_WS = 95;
+ public static readonly INFO = 96;
public static readonly SHOW_LINE_COMMENT = 97;
public static readonly SHOW_MULTILINE_COMMENT = 98;
public static readonly SHOW_WS = 99;
- public static readonly COLON = 100;
- public static readonly SETTING = 101;
- public static readonly SETTING_LINE_COMMENT = 102;
- public static readonly SETTTING_MULTILINE_COMMENT = 103;
- public static readonly SETTING_WS = 104;
- public static readonly UNQUOTED_ID_PATTERN = 105;
+ public static readonly FUNCTIONS = 100;
+ public static readonly META_LINE_COMMENT = 101;
+ public static readonly META_MULTILINE_COMMENT = 102;
+ public static readonly META_WS = 103;
+ public static readonly COLON = 104;
+ public static readonly SETTING = 105;
+ public static readonly SETTING_LINE_COMMENT = 106;
+ public static readonly SETTTING_MULTILINE_COMMENT = 107;
+ public static readonly SETTING_WS = 108;
public static readonly EOF = Token.EOF;
public static readonly RULE_singleStatement = 0;
public static readonly RULE_query = 1;
@@ -150,29 +153,29 @@ export default class esql_parser extends Parser {
public static readonly RULE_qualifiedNamePattern = 23;
public static readonly RULE_identifier = 24;
public static readonly RULE_identifierPattern = 25;
- public static readonly RULE_idPattern = 26;
- public static readonly RULE_constant = 27;
- public static readonly RULE_limitCommand = 28;
- public static readonly RULE_sortCommand = 29;
- public static readonly RULE_orderExpression = 30;
- public static readonly RULE_keepCommand = 31;
- public static readonly RULE_dropCommand = 32;
- public static readonly RULE_renameCommand = 33;
- public static readonly RULE_renameClause = 34;
- public static readonly RULE_dissectCommand = 35;
- public static readonly RULE_grokCommand = 36;
- public static readonly RULE_mvExpandCommand = 37;
- public static readonly RULE_commandOptions = 38;
- public static readonly RULE_commandOption = 39;
- public static readonly RULE_booleanValue = 40;
- public static readonly RULE_numericValue = 41;
- public static readonly RULE_decimalValue = 42;
- public static readonly RULE_integerValue = 43;
- public static readonly RULE_string = 44;
- public static readonly RULE_comparisonOperator = 45;
- public static readonly RULE_explainCommand = 46;
- public static readonly RULE_subqueryExpression = 47;
- public static readonly RULE_showCommand = 48;
+ public static readonly RULE_constant = 26;
+ public static readonly RULE_limitCommand = 27;
+ public static readonly RULE_sortCommand = 28;
+ public static readonly RULE_orderExpression = 29;
+ public static readonly RULE_keepCommand = 30;
+ public static readonly RULE_dropCommand = 31;
+ public static readonly RULE_renameCommand = 32;
+ public static readonly RULE_renameClause = 33;
+ public static readonly RULE_dissectCommand = 34;
+ public static readonly RULE_grokCommand = 35;
+ public static readonly RULE_mvExpandCommand = 36;
+ public static readonly RULE_commandOptions = 37;
+ public static readonly RULE_commandOption = 38;
+ public static readonly RULE_booleanValue = 39;
+ public static readonly RULE_numericValue = 40;
+ public static readonly RULE_decimalValue = 41;
+ public static readonly RULE_integerValue = 42;
+ public static readonly RULE_string = 43;
+ public static readonly RULE_comparisonOperator = 44;
+ public static readonly RULE_explainCommand = 45;
+ public static readonly RULE_subqueryExpression = 46;
+ public static readonly RULE_showCommand = 47;
+ public static readonly RULE_metaCommand = 48;
public static readonly RULE_enrichCommand = 49;
public static readonly RULE_enrichWithClause = 50;
public static readonly literalNames: (string | null)[] = [ null, "'dissect'",
@@ -181,7 +184,7 @@ export default class esql_parser extends Parser {
"'from'", "'grok'",
"'inlinestats'",
"'keep'", "'limit'",
- "'mv_expand'",
+ "'meta'", "'mv_expand'",
"'rename'",
"'row'", "'show'",
"'sort'", "'stats'",
@@ -224,7 +227,9 @@ export default class esql_parser extends Parser {
null, null,
null, null,
null, null,
- "'info'", "'functions'",
+ "'info'", null,
+ null, null,
+ "'functions'",
null, null,
null, "':'" ];
public static readonly symbolicNames: (string | null)[] = [ null, "DISSECT",
@@ -233,7 +238,7 @@ export default class esql_parser extends Parser {
"FROM", "GROK",
"INLINESTATS",
"KEEP", "LIMIT",
- "MV_EXPAND",
+ "META", "MV_EXPAND",
"RENAME", "ROW",
"SHOW", "SORT",
"STATS", "WHERE",
@@ -293,15 +298,17 @@ export default class esql_parser extends Parser {
"MVEXPAND_LINE_COMMENT",
"MVEXPAND_MULTILINE_COMMENT",
"MVEXPAND_WS",
- "INFO", "FUNCTIONS",
- "SHOW_LINE_COMMENT",
+ "INFO", "SHOW_LINE_COMMENT",
"SHOW_MULTILINE_COMMENT",
"SHOW_WS",
+ "FUNCTIONS",
+ "META_LINE_COMMENT",
+ "META_MULTILINE_COMMENT",
+ "META_WS",
"COLON", "SETTING",
"SETTING_LINE_COMMENT",
"SETTTING_MULTILINE_COMMENT",
- "SETTING_WS",
- "UNQUOTED_ID_PATTERN" ];
+ "SETTING_WS" ];
// tslint:disable:no-trailing-whitespace
public static readonly ruleNames: string[] = [
"singleStatement", "query", "sourceCommand", "processingCommand", "whereCommand",
@@ -309,13 +316,12 @@ export default class esql_parser extends Parser {
"primaryExpression", "functionExpression", "rowCommand", "fields", "field",
"fromCommand", "metadata", "metadataOption", "deprecated_metadata", "evalCommand",
"statsCommand", "inlinestatsCommand", "fromIdentifier", "qualifiedName",
- "qualifiedNamePattern", "identifier", "identifierPattern", "idPattern",
- "constant", "limitCommand", "sortCommand", "orderExpression", "keepCommand",
- "dropCommand", "renameCommand", "renameClause", "dissectCommand", "grokCommand",
- "mvExpandCommand", "commandOptions", "commandOption", "booleanValue",
- "numericValue", "decimalValue", "integerValue", "string", "comparisonOperator",
- "explainCommand", "subqueryExpression", "showCommand", "enrichCommand",
- "enrichWithClause",
+ "qualifiedNamePattern", "identifier", "identifierPattern", "constant",
+ "limitCommand", "sortCommand", "orderExpression", "keepCommand", "dropCommand",
+ "renameCommand", "renameClause", "dissectCommand", "grokCommand", "mvExpandCommand",
+ "commandOptions", "commandOption", "booleanValue", "numericValue", "decimalValue",
+ "integerValue", "string", "comparisonOperator", "explainCommand", "subqueryExpression",
+ "showCommand", "metaCommand", "enrichCommand", "enrichWithClause",
];
public get grammarFileName(): string { return "esql_parser.g4"; }
public get literalNames(): (string | null)[] { return esql_parser.literalNames; }
@@ -435,7 +441,7 @@ export default class esql_parser extends Parser {
let localctx: SourceCommandContext = new SourceCommandContext(this, this._ctx, this.state);
this.enterRule(localctx, 4, esql_parser.RULE_sourceCommand);
try {
- this.state = 120;
+ this.state = 121;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case 5:
@@ -452,20 +458,27 @@ export default class esql_parser extends Parser {
this.fromCommand();
}
break;
- case 13:
+ case 14:
this.enterOuterAlt(localctx, 3);
{
this.state = 118;
this.rowCommand();
}
break;
- case 14:
+ case 15:
this.enterOuterAlt(localctx, 4);
{
this.state = 119;
this.showCommand();
}
break;
+ case 11:
+ this.enterOuterAlt(localctx, 5);
+ {
+ this.state = 120;
+ this.metaCommand();
+ }
+ break;
default:
throw new NoViableAltException(this);
}
@@ -489,97 +502,97 @@ export default class esql_parser extends Parser {
let localctx: ProcessingCommandContext = new ProcessingCommandContext(this, this._ctx, this.state);
this.enterRule(localctx, 6, esql_parser.RULE_processingCommand);
try {
- this.state = 135;
+ this.state = 136;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case 4:
this.enterOuterAlt(localctx, 1);
{
- this.state = 122;
+ this.state = 123;
this.evalCommand();
}
break;
case 8:
this.enterOuterAlt(localctx, 2);
{
- this.state = 123;
+ this.state = 124;
this.inlinestatsCommand();
}
break;
case 10:
this.enterOuterAlt(localctx, 3);
{
- this.state = 124;
+ this.state = 125;
this.limitCommand();
}
break;
case 9:
this.enterOuterAlt(localctx, 4);
{
- this.state = 125;
+ this.state = 126;
this.keepCommand();
}
break;
- case 15:
+ case 16:
this.enterOuterAlt(localctx, 5);
{
- this.state = 126;
+ this.state = 127;
this.sortCommand();
}
break;
- case 16:
+ case 17:
this.enterOuterAlt(localctx, 6);
{
- this.state = 127;
+ this.state = 128;
this.statsCommand();
}
break;
- case 17:
+ case 18:
this.enterOuterAlt(localctx, 7);
{
- this.state = 128;
+ this.state = 129;
this.whereCommand();
}
break;
case 2:
this.enterOuterAlt(localctx, 8);
{
- this.state = 129;
+ this.state = 130;
this.dropCommand();
}
break;
- case 12:
+ case 13:
this.enterOuterAlt(localctx, 9);
{
- this.state = 130;
+ this.state = 131;
this.renameCommand();
}
break;
case 1:
this.enterOuterAlt(localctx, 10);
{
- this.state = 131;
+ this.state = 132;
this.dissectCommand();
}
break;
case 7:
this.enterOuterAlt(localctx, 11);
{
- this.state = 132;
+ this.state = 133;
this.grokCommand();
}
break;
case 3:
this.enterOuterAlt(localctx, 12);
{
- this.state = 133;
+ this.state = 134;
this.enrichCommand();
}
break;
- case 11:
+ case 12:
this.enterOuterAlt(localctx, 13);
{
- this.state = 134;
+ this.state = 135;
this.mvExpandCommand();
}
break;
@@ -608,9 +621,9 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 137;
- this.match(esql_parser.WHERE);
this.state = 138;
+ this.match(esql_parser.WHERE);
+ this.state = 139;
this.booleanExpression(0);
}
}
@@ -648,7 +661,7 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 168;
+ this.state = 169;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 6, this._ctx) ) {
case 1:
@@ -657,9 +670,9 @@ export default class esql_parser extends Parser {
this._ctx = localctx;
_prevctx = localctx;
- this.state = 141;
- this.match(esql_parser.NOT);
this.state = 142;
+ this.match(esql_parser.NOT);
+ this.state = 143;
this.booleanExpression(7);
}
break;
@@ -668,7 +681,7 @@ export default class esql_parser extends Parser {
localctx = new BooleanDefaultContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
- this.state = 143;
+ this.state = 144;
this.valueExpression();
}
break;
@@ -677,7 +690,7 @@ export default class esql_parser extends Parser {
localctx = new RegexExpressionContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
- this.state = 144;
+ this.state = 145;
this.regexBooleanExpression();
}
break;
@@ -686,41 +699,41 @@ export default class esql_parser extends Parser {
localctx = new LogicalInContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
- this.state = 145;
+ this.state = 146;
this.valueExpression();
- this.state = 147;
+ this.state = 148;
this._errHandler.sync(this);
_la = this._input.LA(1);
- if (_la===43) {
+ if (_la===44) {
{
- this.state = 146;
+ this.state = 147;
this.match(esql_parser.NOT);
}
}
- this.state = 149;
- this.match(esql_parser.IN);
this.state = 150;
- this.match(esql_parser.LP);
+ this.match(esql_parser.IN);
this.state = 151;
+ this.match(esql_parser.LP);
+ this.state = 152;
this.valueExpression();
- this.state = 156;
+ this.state = 157;
this._errHandler.sync(this);
_la = this._input.LA(1);
- while (_la===33) {
+ while (_la===34) {
{
{
- this.state = 152;
- this.match(esql_parser.COMMA);
this.state = 153;
+ this.match(esql_parser.COMMA);
+ this.state = 154;
this.valueExpression();
}
}
- this.state = 158;
+ this.state = 159;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
- this.state = 159;
+ this.state = 160;
this.match(esql_parser.RP);
}
break;
@@ -729,27 +742,27 @@ export default class esql_parser extends Parser {
localctx = new IsNullContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
- this.state = 161;
- this.valueExpression();
this.state = 162;
+ this.valueExpression();
+ this.state = 163;
this.match(esql_parser.IS);
- this.state = 164;
+ this.state = 165;
this._errHandler.sync(this);
_la = this._input.LA(1);
- if (_la===43) {
+ if (_la===44) {
{
- this.state = 163;
+ this.state = 164;
this.match(esql_parser.NOT);
}
}
- this.state = 166;
+ this.state = 167;
this.match(esql_parser.NULL);
}
break;
}
this._ctx.stop = this._input.LT(-1);
- this.state = 178;
+ this.state = 179;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 8, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
@@ -759,7 +772,7 @@ export default class esql_parser extends Parser {
}
_prevctx = localctx;
{
- this.state = 176;
+ this.state = 177;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 7, this._ctx) ) {
case 1:
@@ -767,13 +780,13 @@ export default class esql_parser extends Parser {
localctx = new LogicalBinaryContext(this, new BooleanExpressionContext(this, _parentctx, _parentState));
(localctx as LogicalBinaryContext)._left = _prevctx;
this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_booleanExpression);
- this.state = 170;
+ this.state = 171;
if (!(this.precpred(this._ctx, 4))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");
}
- this.state = 171;
- (localctx as LogicalBinaryContext)._operator = this.match(esql_parser.AND);
this.state = 172;
+ (localctx as LogicalBinaryContext)._operator = this.match(esql_parser.AND);
+ this.state = 173;
(localctx as LogicalBinaryContext)._right = this.booleanExpression(5);
}
break;
@@ -782,20 +795,20 @@ export default class esql_parser extends Parser {
localctx = new LogicalBinaryContext(this, new BooleanExpressionContext(this, _parentctx, _parentState));
(localctx as LogicalBinaryContext)._left = _prevctx;
this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_booleanExpression);
- this.state = 173;
+ this.state = 174;
if (!(this.precpred(this._ctx, 3))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");
}
- this.state = 174;
- (localctx as LogicalBinaryContext)._operator = this.match(esql_parser.OR);
this.state = 175;
+ (localctx as LogicalBinaryContext)._operator = this.match(esql_parser.OR);
+ this.state = 176;
(localctx as LogicalBinaryContext)._right = this.booleanExpression(4);
}
break;
}
}
}
- this.state = 180;
+ this.state = 181;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 8, this._ctx);
}
@@ -821,48 +834,48 @@ export default class esql_parser extends Parser {
this.enterRule(localctx, 12, esql_parser.RULE_regexBooleanExpression);
let _la: number;
try {
- this.state = 195;
+ this.state = 196;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 11, this._ctx) ) {
case 1:
this.enterOuterAlt(localctx, 1);
{
- this.state = 181;
+ this.state = 182;
this.valueExpression();
- this.state = 183;
+ this.state = 184;
this._errHandler.sync(this);
_la = this._input.LA(1);
- if (_la===43) {
+ if (_la===44) {
{
- this.state = 182;
+ this.state = 183;
this.match(esql_parser.NOT);
}
}
- this.state = 185;
- localctx._kind = this.match(esql_parser.LIKE);
this.state = 186;
+ localctx._kind = this.match(esql_parser.LIKE);
+ this.state = 187;
localctx._pattern = this.string_();
}
break;
case 2:
this.enterOuterAlt(localctx, 2);
{
- this.state = 188;
+ this.state = 189;
this.valueExpression();
- this.state = 190;
+ this.state = 191;
this._errHandler.sync(this);
_la = this._input.LA(1);
- if (_la===43) {
+ if (_la===44) {
{
- this.state = 189;
+ this.state = 190;
this.match(esql_parser.NOT);
}
}
- this.state = 192;
- localctx._kind = this.match(esql_parser.RLIKE);
this.state = 193;
+ localctx._kind = this.match(esql_parser.RLIKE);
+ this.state = 194;
localctx._pattern = this.string_();
}
break;
@@ -887,14 +900,14 @@ export default class esql_parser extends Parser {
let localctx: ValueExpressionContext = new ValueExpressionContext(this, this._ctx, this.state);
this.enterRule(localctx, 14, esql_parser.RULE_valueExpression);
try {
- this.state = 202;
+ this.state = 203;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 12, this._ctx) ) {
case 1:
localctx = new ValueExpressionDefaultContext(this, localctx);
this.enterOuterAlt(localctx, 1);
{
- this.state = 197;
+ this.state = 198;
this.operatorExpression(0);
}
break;
@@ -902,11 +915,11 @@ export default class esql_parser extends Parser {
localctx = new ComparisonContext(this, localctx);
this.enterOuterAlt(localctx, 2);
{
- this.state = 198;
- (localctx as ComparisonContext)._left = this.operatorExpression(0);
this.state = 199;
- this.comparisonOperator();
+ (localctx as ComparisonContext)._left = this.operatorExpression(0);
this.state = 200;
+ this.comparisonOperator();
+ this.state = 201;
(localctx as ComparisonContext)._right = this.operatorExpression(0);
}
break;
@@ -946,7 +959,7 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 208;
+ this.state = 209;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 13, this._ctx) ) {
case 1:
@@ -955,7 +968,7 @@ export default class esql_parser extends Parser {
this._ctx = localctx;
_prevctx = localctx;
- this.state = 205;
+ this.state = 206;
this.primaryExpression();
}
break;
@@ -964,23 +977,23 @@ export default class esql_parser extends Parser {
localctx = new ArithmeticUnaryContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
- this.state = 206;
+ this.state = 207;
(localctx as ArithmeticUnaryContext)._operator = this._input.LT(1);
_la = this._input.LA(1);
- if(!(_la===58 || _la===59)) {
+ if(!(_la===59 || _la===60)) {
(localctx as ArithmeticUnaryContext)._operator = this._errHandler.recoverInline(this);
}
else {
this._errHandler.reportMatch(this);
this.consume();
}
- this.state = 207;
+ this.state = 208;
this.operatorExpression(3);
}
break;
}
this._ctx.stop = this._input.LT(-1);
- this.state = 218;
+ this.state = 219;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 15, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
@@ -990,7 +1003,7 @@ export default class esql_parser extends Parser {
}
_prevctx = localctx;
{
- this.state = 216;
+ this.state = 217;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 14, this._ctx) ) {
case 1:
@@ -998,21 +1011,21 @@ export default class esql_parser extends Parser {
localctx = new ArithmeticBinaryContext(this, new OperatorExpressionContext(this, _parentctx, _parentState));
(localctx as ArithmeticBinaryContext)._left = _prevctx;
this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_operatorExpression);
- this.state = 210;
+ this.state = 211;
if (!(this.precpred(this._ctx, 2))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");
}
- this.state = 211;
+ this.state = 212;
(localctx as ArithmeticBinaryContext)._operator = this._input.LT(1);
_la = this._input.LA(1);
- if(!(((((_la - 60)) & ~0x1F) === 0 && ((1 << (_la - 60)) & 7) !== 0))) {
+ if(!(((((_la - 61)) & ~0x1F) === 0 && ((1 << (_la - 61)) & 7) !== 0))) {
(localctx as ArithmeticBinaryContext)._operator = this._errHandler.recoverInline(this);
}
else {
this._errHandler.reportMatch(this);
this.consume();
}
- this.state = 212;
+ this.state = 213;
(localctx as ArithmeticBinaryContext)._right = this.operatorExpression(3);
}
break;
@@ -1021,28 +1034,28 @@ export default class esql_parser extends Parser {
localctx = new ArithmeticBinaryContext(this, new OperatorExpressionContext(this, _parentctx, _parentState));
(localctx as ArithmeticBinaryContext)._left = _prevctx;
this.pushNewRecursionContext(localctx, _startState, esql_parser.RULE_operatorExpression);
- this.state = 213;
+ this.state = 214;
if (!(this.precpred(this._ctx, 1))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 1)");
}
- this.state = 214;
+ this.state = 215;
(localctx as ArithmeticBinaryContext)._operator = this._input.LT(1);
_la = this._input.LA(1);
- if(!(_la===58 || _la===59)) {
+ if(!(_la===59 || _la===60)) {
(localctx as ArithmeticBinaryContext)._operator = this._errHandler.recoverInline(this);
}
else {
this._errHandler.reportMatch(this);
this.consume();
}
- this.state = 215;
+ this.state = 216;
(localctx as ArithmeticBinaryContext)._right = this.operatorExpression(2);
}
break;
}
}
}
- this.state = 220;
+ this.state = 221;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 15, this._ctx);
}
@@ -1067,14 +1080,14 @@ export default class esql_parser extends Parser {
let localctx: PrimaryExpressionContext = new PrimaryExpressionContext(this, this._ctx, this.state);
this.enterRule(localctx, 18, esql_parser.RULE_primaryExpression);
try {
- this.state = 228;
+ this.state = 229;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 16, this._ctx) ) {
case 1:
localctx = new ConstantDefaultContext(this, localctx);
this.enterOuterAlt(localctx, 1);
{
- this.state = 221;
+ this.state = 222;
this.constant();
}
break;
@@ -1082,7 +1095,7 @@ export default class esql_parser extends Parser {
localctx = new DereferenceContext(this, localctx);
this.enterOuterAlt(localctx, 2);
{
- this.state = 222;
+ this.state = 223;
this.qualifiedName();
}
break;
@@ -1090,7 +1103,7 @@ export default class esql_parser extends Parser {
localctx = new FunctionContext(this, localctx);
this.enterOuterAlt(localctx, 3);
{
- this.state = 223;
+ this.state = 224;
this.functionExpression();
}
break;
@@ -1098,11 +1111,11 @@ export default class esql_parser extends Parser {
localctx = new ParenthesizedExpressionContext(this, localctx);
this.enterOuterAlt(localctx, 4);
{
- this.state = 224;
- this.match(esql_parser.LP);
this.state = 225;
- this.booleanExpression(0);
+ this.match(esql_parser.LP);
this.state = 226;
+ this.booleanExpression(0);
+ this.state = 227;
this.match(esql_parser.RP);
}
break;
@@ -1130,62 +1143,62 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 230;
- this.identifier();
this.state = 231;
+ this.identifier();
+ this.state = 232;
this.match(esql_parser.LP);
- this.state = 241;
+ this.state = 242;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
- case 60:
+ case 61:
{
- this.state = 232;
+ this.state = 233;
this.match(esql_parser.ASTERISK);
}
break;
- case 26:
case 27:
case 28:
- case 36:
- case 39:
- case 43:
+ case 29:
+ case 37:
+ case 40:
case 44:
- case 47:
- case 50:
- case 58:
+ case 45:
+ case 48:
+ case 51:
case 59:
- case 63:
- case 65:
+ case 60:
+ case 64:
case 66:
+ case 67:
{
{
- this.state = 233;
+ this.state = 234;
this.booleanExpression(0);
- this.state = 238;
+ this.state = 239;
this._errHandler.sync(this);
_la = this._input.LA(1);
- while (_la===33) {
+ while (_la===34) {
{
{
- this.state = 234;
- this.match(esql_parser.COMMA);
this.state = 235;
+ this.match(esql_parser.COMMA);
+ this.state = 236;
this.booleanExpression(0);
}
}
- this.state = 240;
+ this.state = 241;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
}
}
break;
- case 49:
+ case 50:
break;
default:
break;
}
- this.state = 243;
+ this.state = 244;
this.match(esql_parser.RP);
}
}
@@ -1210,9 +1223,9 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 245;
- this.match(esql_parser.ROW);
this.state = 246;
+ this.match(esql_parser.ROW);
+ this.state = 247;
this.fields();
}
}
@@ -1238,23 +1251,23 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 248;
+ this.state = 249;
this.field();
- this.state = 253;
+ this.state = 254;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 19, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 249;
- this.match(esql_parser.COMMA);
this.state = 250;
+ this.match(esql_parser.COMMA);
+ this.state = 251;
this.field();
}
}
}
- this.state = 255;
+ this.state = 256;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 19, this._ctx);
}
@@ -1279,24 +1292,24 @@ export default class esql_parser extends Parser {
let localctx: FieldContext = new FieldContext(this, this._ctx, this.state);
this.enterRule(localctx, 26, esql_parser.RULE_field);
try {
- this.state = 261;
+ this.state = 262;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 20, this._ctx) ) {
case 1:
this.enterOuterAlt(localctx, 1);
{
- this.state = 256;
+ this.state = 257;
this.booleanExpression(0);
}
break;
case 2:
this.enterOuterAlt(localctx, 2);
{
- this.state = 257;
- this.qualifiedName();
this.state = 258;
- this.match(esql_parser.ASSIGN);
+ this.qualifiedName();
this.state = 259;
+ this.match(esql_parser.ASSIGN);
+ this.state = 260;
this.booleanExpression(0);
}
break;
@@ -1324,34 +1337,34 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 263;
- this.match(esql_parser.FROM);
this.state = 264;
+ this.match(esql_parser.FROM);
+ this.state = 265;
this.fromIdentifier();
- this.state = 269;
+ this.state = 270;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 21, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 265;
- this.match(esql_parser.COMMA);
this.state = 266;
+ this.match(esql_parser.COMMA);
+ this.state = 267;
this.fromIdentifier();
}
}
}
- this.state = 271;
+ this.state = 272;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 21, this._ctx);
}
- this.state = 273;
+ this.state = 274;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 22, this._ctx) ) {
case 1:
{
- this.state = 272;
+ this.state = 273;
this.metadata();
}
break;
@@ -1377,20 +1390,20 @@ export default class esql_parser extends Parser {
let localctx: MetadataContext = new MetadataContext(this, this._ctx, this.state);
this.enterRule(localctx, 30, esql_parser.RULE_metadata);
try {
- this.state = 277;
+ this.state = 278;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
- case 70:
+ case 71:
this.enterOuterAlt(localctx, 1);
{
- this.state = 275;
+ this.state = 276;
this.metadataOption();
}
break;
- case 63:
+ case 64:
this.enterOuterAlt(localctx, 2);
{
- this.state = 276;
+ this.state = 277;
this.deprecated_metadata();
}
break;
@@ -1420,25 +1433,25 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 279;
- this.match(esql_parser.METADATA);
this.state = 280;
+ this.match(esql_parser.METADATA);
+ this.state = 281;
this.fromIdentifier();
- this.state = 285;
+ this.state = 286;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 24, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 281;
- this.match(esql_parser.COMMA);
this.state = 282;
+ this.match(esql_parser.COMMA);
+ this.state = 283;
this.fromIdentifier();
}
}
}
- this.state = 287;
+ this.state = 288;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 24, this._ctx);
}
@@ -1465,11 +1478,11 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 288;
- this.match(esql_parser.OPENING_BRACKET);
this.state = 289;
- this.metadataOption();
+ this.match(esql_parser.OPENING_BRACKET);
this.state = 290;
+ this.metadataOption();
+ this.state = 291;
this.match(esql_parser.CLOSING_BRACKET);
}
}
@@ -1494,9 +1507,9 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 292;
- this.match(esql_parser.EVAL);
this.state = 293;
+ this.match(esql_parser.EVAL);
+ this.state = 294;
this.fields();
}
}
@@ -1521,26 +1534,26 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 295;
+ this.state = 296;
this.match(esql_parser.STATS);
- this.state = 297;
+ this.state = 298;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 25, this._ctx) ) {
case 1:
{
- this.state = 296;
+ this.state = 297;
localctx._stats = this.fields();
}
break;
}
- this.state = 301;
+ this.state = 302;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 26, this._ctx) ) {
case 1:
{
- this.state = 299;
- this.match(esql_parser.BY);
this.state = 300;
+ this.match(esql_parser.BY);
+ this.state = 301;
localctx._grouping = this.fields();
}
break;
@@ -1568,18 +1581,18 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 303;
- this.match(esql_parser.INLINESTATS);
this.state = 304;
+ this.match(esql_parser.INLINESTATS);
+ this.state = 305;
localctx._stats = this.fields();
- this.state = 307;
+ this.state = 308;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 27, this._ctx) ) {
case 1:
{
- this.state = 305;
- this.match(esql_parser.BY);
this.state = 306;
+ this.match(esql_parser.BY);
+ this.state = 307;
localctx._grouping = this.fields();
}
break;
@@ -1608,9 +1621,9 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 309;
+ this.state = 310;
_la = this._input.LA(1);
- if(!(_la===66 || _la===71)) {
+ if(!(_la===67 || _la===72)) {
this._errHandler.recoverInline(this);
}
else {
@@ -1641,23 +1654,23 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 311;
+ this.state = 312;
this.identifier();
- this.state = 316;
+ this.state = 317;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 28, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 312;
- this.match(esql_parser.DOT);
this.state = 313;
+ this.match(esql_parser.DOT);
+ this.state = 314;
this.identifier();
}
}
}
- this.state = 318;
+ this.state = 319;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 28, this._ctx);
}
@@ -1685,23 +1698,23 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 319;
+ this.state = 320;
this.identifierPattern();
- this.state = 324;
+ this.state = 325;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 29, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 320;
- this.match(esql_parser.DOT);
this.state = 321;
+ this.match(esql_parser.DOT);
+ this.state = 322;
this.identifierPattern();
}
}
}
- this.state = 326;
+ this.state = 327;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 29, this._ctx);
}
@@ -1729,9 +1742,9 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 327;
+ this.state = 328;
_la = this._input.LA(1);
- if(!(_la===65 || _la===66)) {
+ if(!(_la===66 || _la===67)) {
this._errHandler.recoverInline(this);
}
else {
@@ -1761,7 +1774,7 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 329;
+ this.state = 330;
this.match(esql_parser.ID_PATTERN);
}
}
@@ -1780,52 +1793,19 @@ export default class esql_parser extends Parser {
return localctx;
}
// @RuleVersion(0)
- public idPattern(): IdPatternContext {
- let localctx: IdPatternContext = new IdPatternContext(this, this._ctx, this.state);
- this.enterRule(localctx, 52, esql_parser.RULE_idPattern);
- let _la: number;
- try {
- this.enterOuterAlt(localctx, 1);
- {
- this.state = 331;
- _la = this._input.LA(1);
- if(!(_la===66 || _la===105)) {
- this._errHandler.recoverInline(this);
- }
- else {
- this._errHandler.reportMatch(this);
- this.consume();
- }
- }
- }
- catch (re) {
- if (re instanceof RecognitionException) {
- localctx.exception = re;
- this._errHandler.reportError(this, re);
- this._errHandler.recover(this, re);
- } else {
- throw re;
- }
- }
- finally {
- this.exitRule();
- }
- return localctx;
- }
- // @RuleVersion(0)
public constant(): ConstantContext {
let localctx: ConstantContext = new ConstantContext(this, this._ctx, this.state);
- this.enterRule(localctx, 54, esql_parser.RULE_constant);
+ this.enterRule(localctx, 52, esql_parser.RULE_constant);
let _la: number;
try {
- this.state = 375;
+ this.state = 374;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 33, this._ctx) ) {
case 1:
localctx = new NullLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 1);
{
- this.state = 333;
+ this.state = 332;
this.match(esql_parser.NULL);
}
break;
@@ -1833,9 +1813,9 @@ export default class esql_parser extends Parser {
localctx = new QualifiedIntegerLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 2);
{
- this.state = 334;
+ this.state = 333;
this.integerValue();
- this.state = 335;
+ this.state = 334;
this.match(esql_parser.UNQUOTED_IDENTIFIER);
}
break;
@@ -1843,7 +1823,7 @@ export default class esql_parser extends Parser {
localctx = new DecimalLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 3);
{
- this.state = 337;
+ this.state = 336;
this.decimalValue();
}
break;
@@ -1851,7 +1831,7 @@ export default class esql_parser extends Parser {
localctx = new IntegerLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 4);
{
- this.state = 338;
+ this.state = 337;
this.integerValue();
}
break;
@@ -1859,7 +1839,7 @@ export default class esql_parser extends Parser {
localctx = new BooleanLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 5);
{
- this.state = 339;
+ this.state = 338;
this.booleanValue();
}
break;
@@ -1867,7 +1847,7 @@ export default class esql_parser extends Parser {
localctx = new InputParamContext(this, localctx);
this.enterOuterAlt(localctx, 6);
{
- this.state = 340;
+ this.state = 339;
this.match(esql_parser.PARAM);
}
break;
@@ -1875,7 +1855,7 @@ export default class esql_parser extends Parser {
localctx = new StringLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 7);
{
- this.state = 341;
+ this.state = 340;
this.string_();
}
break;
@@ -1883,27 +1863,27 @@ export default class esql_parser extends Parser {
localctx = new NumericArrayLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 8);
{
- this.state = 342;
+ this.state = 341;
this.match(esql_parser.OPENING_BRACKET);
- this.state = 343;
+ this.state = 342;
this.numericValue();
- this.state = 348;
+ this.state = 347;
this._errHandler.sync(this);
_la = this._input.LA(1);
- while (_la===33) {
+ while (_la===34) {
{
{
- this.state = 344;
+ this.state = 343;
this.match(esql_parser.COMMA);
- this.state = 345;
+ this.state = 344;
this.numericValue();
}
}
- this.state = 350;
+ this.state = 349;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
- this.state = 351;
+ this.state = 350;
this.match(esql_parser.CLOSING_BRACKET);
}
break;
@@ -1911,27 +1891,27 @@ export default class esql_parser extends Parser {
localctx = new BooleanArrayLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 9);
{
- this.state = 353;
+ this.state = 352;
this.match(esql_parser.OPENING_BRACKET);
- this.state = 354;
+ this.state = 353;
this.booleanValue();
- this.state = 359;
+ this.state = 358;
this._errHandler.sync(this);
_la = this._input.LA(1);
- while (_la===33) {
+ while (_la===34) {
{
{
- this.state = 355;
+ this.state = 354;
this.match(esql_parser.COMMA);
- this.state = 356;
+ this.state = 355;
this.booleanValue();
}
}
- this.state = 361;
+ this.state = 360;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
- this.state = 362;
+ this.state = 361;
this.match(esql_parser.CLOSING_BRACKET);
}
break;
@@ -1939,27 +1919,27 @@ export default class esql_parser extends Parser {
localctx = new StringArrayLiteralContext(this, localctx);
this.enterOuterAlt(localctx, 10);
{
- this.state = 364;
+ this.state = 363;
this.match(esql_parser.OPENING_BRACKET);
- this.state = 365;
+ this.state = 364;
this.string_();
- this.state = 370;
+ this.state = 369;
this._errHandler.sync(this);
_la = this._input.LA(1);
- while (_la===33) {
+ while (_la===34) {
{
{
- this.state = 366;
+ this.state = 365;
this.match(esql_parser.COMMA);
- this.state = 367;
+ this.state = 366;
this.string_();
}
}
- this.state = 372;
+ this.state = 371;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
- this.state = 373;
+ this.state = 372;
this.match(esql_parser.CLOSING_BRACKET);
}
break;
@@ -1982,13 +1962,13 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public limitCommand(): LimitCommandContext {
let localctx: LimitCommandContext = new LimitCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 56, esql_parser.RULE_limitCommand);
+ this.enterRule(localctx, 54, esql_parser.RULE_limitCommand);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 377;
+ this.state = 376;
this.match(esql_parser.LIMIT);
- this.state = 378;
+ this.state = 377;
this.match(esql_parser.INTEGER_LITERAL);
}
}
@@ -2009,30 +1989,30 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public sortCommand(): SortCommandContext {
let localctx: SortCommandContext = new SortCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 58, esql_parser.RULE_sortCommand);
+ this.enterRule(localctx, 56, esql_parser.RULE_sortCommand);
try {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 380;
+ this.state = 379;
this.match(esql_parser.SORT);
- this.state = 381;
+ this.state = 380;
this.orderExpression();
- this.state = 386;
+ this.state = 385;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 34, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 382;
+ this.state = 381;
this.match(esql_parser.COMMA);
- this.state = 383;
+ this.state = 382;
this.orderExpression();
}
}
}
- this.state = 388;
+ this.state = 387;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 34, this._ctx);
}
@@ -2055,22 +2035,22 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public orderExpression(): OrderExpressionContext {
let localctx: OrderExpressionContext = new OrderExpressionContext(this, this._ctx, this.state);
- this.enterRule(localctx, 60, esql_parser.RULE_orderExpression);
+ this.enterRule(localctx, 58, esql_parser.RULE_orderExpression);
let _la: number;
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 389;
+ this.state = 388;
this.booleanExpression(0);
- this.state = 391;
+ this.state = 390;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 35, this._ctx) ) {
case 1:
{
- this.state = 390;
+ this.state = 389;
localctx._ordering = this._input.LT(1);
_la = this._input.LA(1);
- if(!(_la===31 || _la===34)) {
+ if(!(_la===32 || _la===35)) {
localctx._ordering = this._errHandler.recoverInline(this);
}
else {
@@ -2080,17 +2060,17 @@ export default class esql_parser extends Parser {
}
break;
}
- this.state = 395;
+ this.state = 394;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 36, this._ctx) ) {
case 1:
{
- this.state = 393;
+ this.state = 392;
this.match(esql_parser.NULLS);
- this.state = 394;
+ this.state = 393;
localctx._nullOrdering = this._input.LT(1);
_la = this._input.LA(1);
- if(!(_la===37 || _la===38)) {
+ if(!(_la===38 || _la===39)) {
localctx._nullOrdering = this._errHandler.recoverInline(this);
}
else {
@@ -2119,30 +2099,30 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public keepCommand(): KeepCommandContext {
let localctx: KeepCommandContext = new KeepCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 62, esql_parser.RULE_keepCommand);
+ this.enterRule(localctx, 60, esql_parser.RULE_keepCommand);
try {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 397;
+ this.state = 396;
this.match(esql_parser.KEEP);
- this.state = 398;
+ this.state = 397;
this.qualifiedNamePattern();
- this.state = 403;
+ this.state = 402;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 37, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 399;
+ this.state = 398;
this.match(esql_parser.COMMA);
- this.state = 400;
+ this.state = 399;
this.qualifiedNamePattern();
}
}
}
- this.state = 405;
+ this.state = 404;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 37, this._ctx);
}
@@ -2165,30 +2145,30 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public dropCommand(): DropCommandContext {
let localctx: DropCommandContext = new DropCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 64, esql_parser.RULE_dropCommand);
+ this.enterRule(localctx, 62, esql_parser.RULE_dropCommand);
try {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 406;
+ this.state = 405;
this.match(esql_parser.DROP);
- this.state = 407;
+ this.state = 406;
this.qualifiedNamePattern();
- this.state = 412;
+ this.state = 411;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 38, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 408;
+ this.state = 407;
this.match(esql_parser.COMMA);
- this.state = 409;
+ this.state = 408;
this.qualifiedNamePattern();
}
}
}
- this.state = 414;
+ this.state = 413;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 38, this._ctx);
}
@@ -2211,30 +2191,30 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public renameCommand(): RenameCommandContext {
let localctx: RenameCommandContext = new RenameCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 66, esql_parser.RULE_renameCommand);
+ this.enterRule(localctx, 64, esql_parser.RULE_renameCommand);
try {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 415;
+ this.state = 414;
this.match(esql_parser.RENAME);
- this.state = 416;
+ this.state = 415;
this.renameClause();
- this.state = 421;
+ this.state = 420;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 39, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 417;
+ this.state = 416;
this.match(esql_parser.COMMA);
- this.state = 418;
+ this.state = 417;
this.renameClause();
}
}
}
- this.state = 423;
+ this.state = 422;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 39, this._ctx);
}
@@ -2257,15 +2237,15 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public renameClause(): RenameClauseContext {
let localctx: RenameClauseContext = new RenameClauseContext(this, this._ctx, this.state);
- this.enterRule(localctx, 68, esql_parser.RULE_renameClause);
+ this.enterRule(localctx, 66, esql_parser.RULE_renameClause);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 424;
+ this.state = 423;
localctx._oldName = this.qualifiedNamePattern();
- this.state = 425;
+ this.state = 424;
this.match(esql_parser.AS);
- this.state = 426;
+ this.state = 425;
localctx._newName = this.qualifiedNamePattern();
}
}
@@ -2286,22 +2266,22 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public dissectCommand(): DissectCommandContext {
let localctx: DissectCommandContext = new DissectCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 70, esql_parser.RULE_dissectCommand);
+ this.enterRule(localctx, 68, esql_parser.RULE_dissectCommand);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 428;
+ this.state = 427;
this.match(esql_parser.DISSECT);
- this.state = 429;
+ this.state = 428;
this.primaryExpression();
- this.state = 430;
+ this.state = 429;
this.string_();
- this.state = 432;
+ this.state = 431;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 40, this._ctx) ) {
case 1:
{
- this.state = 431;
+ this.state = 430;
this.commandOptions();
}
break;
@@ -2325,15 +2305,15 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public grokCommand(): GrokCommandContext {
let localctx: GrokCommandContext = new GrokCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 72, esql_parser.RULE_grokCommand);
+ this.enterRule(localctx, 70, esql_parser.RULE_grokCommand);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 434;
+ this.state = 433;
this.match(esql_parser.GROK);
- this.state = 435;
+ this.state = 434;
this.primaryExpression();
- this.state = 436;
+ this.state = 435;
this.string_();
}
}
@@ -2354,13 +2334,13 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public mvExpandCommand(): MvExpandCommandContext {
let localctx: MvExpandCommandContext = new MvExpandCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 74, esql_parser.RULE_mvExpandCommand);
+ this.enterRule(localctx, 72, esql_parser.RULE_mvExpandCommand);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 438;
+ this.state = 437;
this.match(esql_parser.MV_EXPAND);
- this.state = 439;
+ this.state = 438;
this.qualifiedName();
}
}
@@ -2381,28 +2361,28 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public commandOptions(): CommandOptionsContext {
let localctx: CommandOptionsContext = new CommandOptionsContext(this, this._ctx, this.state);
- this.enterRule(localctx, 76, esql_parser.RULE_commandOptions);
+ this.enterRule(localctx, 74, esql_parser.RULE_commandOptions);
try {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 441;
+ this.state = 440;
this.commandOption();
- this.state = 446;
+ this.state = 445;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 41, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 442;
+ this.state = 441;
this.match(esql_parser.COMMA);
- this.state = 443;
+ this.state = 442;
this.commandOption();
}
}
}
- this.state = 448;
+ this.state = 447;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 41, this._ctx);
}
@@ -2425,15 +2405,15 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public commandOption(): CommandOptionContext {
let localctx: CommandOptionContext = new CommandOptionContext(this, this._ctx, this.state);
- this.enterRule(localctx, 78, esql_parser.RULE_commandOption);
+ this.enterRule(localctx, 76, esql_parser.RULE_commandOption);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 449;
+ this.state = 448;
this.identifier();
- this.state = 450;
+ this.state = 449;
this.match(esql_parser.ASSIGN);
- this.state = 451;
+ this.state = 450;
this.constant();
}
}
@@ -2454,14 +2434,14 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public booleanValue(): BooleanValueContext {
let localctx: BooleanValueContext = new BooleanValueContext(this, this._ctx, this.state);
- this.enterRule(localctx, 80, esql_parser.RULE_booleanValue);
+ this.enterRule(localctx, 78, esql_parser.RULE_booleanValue);
let _la: number;
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 453;
+ this.state = 452;
_la = this._input.LA(1);
- if(!(_la===36 || _la===50)) {
+ if(!(_la===37 || _la===51)) {
this._errHandler.recoverInline(this);
}
else {
@@ -2487,22 +2467,22 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public numericValue(): NumericValueContext {
let localctx: NumericValueContext = new NumericValueContext(this, this._ctx, this.state);
- this.enterRule(localctx, 82, esql_parser.RULE_numericValue);
+ this.enterRule(localctx, 80, esql_parser.RULE_numericValue);
try {
- this.state = 457;
+ this.state = 456;
this._errHandler.sync(this);
switch ( this._interp.adaptivePredict(this._input, 42, this._ctx) ) {
case 1:
this.enterOuterAlt(localctx, 1);
{
- this.state = 455;
+ this.state = 454;
this.decimalValue();
}
break;
case 2:
this.enterOuterAlt(localctx, 2);
{
- this.state = 456;
+ this.state = 455;
this.integerValue();
}
break;
@@ -2525,19 +2505,19 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public decimalValue(): DecimalValueContext {
let localctx: DecimalValueContext = new DecimalValueContext(this, this._ctx, this.state);
- this.enterRule(localctx, 84, esql_parser.RULE_decimalValue);
+ this.enterRule(localctx, 82, esql_parser.RULE_decimalValue);
let _la: number;
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 460;
+ this.state = 459;
this._errHandler.sync(this);
_la = this._input.LA(1);
- if (_la===58 || _la===59) {
+ if (_la===59 || _la===60) {
{
- this.state = 459;
+ this.state = 458;
_la = this._input.LA(1);
- if(!(_la===58 || _la===59)) {
+ if(!(_la===59 || _la===60)) {
this._errHandler.recoverInline(this);
}
else {
@@ -2547,7 +2527,7 @@ export default class esql_parser extends Parser {
}
}
- this.state = 462;
+ this.state = 461;
this.match(esql_parser.DECIMAL_LITERAL);
}
}
@@ -2568,19 +2548,19 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public integerValue(): IntegerValueContext {
let localctx: IntegerValueContext = new IntegerValueContext(this, this._ctx, this.state);
- this.enterRule(localctx, 86, esql_parser.RULE_integerValue);
+ this.enterRule(localctx, 84, esql_parser.RULE_integerValue);
let _la: number;
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 465;
+ this.state = 464;
this._errHandler.sync(this);
_la = this._input.LA(1);
- if (_la===58 || _la===59) {
+ if (_la===59 || _la===60) {
{
- this.state = 464;
+ this.state = 463;
_la = this._input.LA(1);
- if(!(_la===58 || _la===59)) {
+ if(!(_la===59 || _la===60)) {
this._errHandler.recoverInline(this);
}
else {
@@ -2590,7 +2570,7 @@ export default class esql_parser extends Parser {
}
}
- this.state = 467;
+ this.state = 466;
this.match(esql_parser.INTEGER_LITERAL);
}
}
@@ -2611,11 +2591,11 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public string_(): StringContext {
let localctx: StringContext = new StringContext(this, this._ctx, this.state);
- this.enterRule(localctx, 88, esql_parser.RULE_string);
+ this.enterRule(localctx, 86, esql_parser.RULE_string);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 469;
+ this.state = 468;
this.match(esql_parser.STRING);
}
}
@@ -2636,14 +2616,14 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public comparisonOperator(): ComparisonOperatorContext {
let localctx: ComparisonOperatorContext = new ComparisonOperatorContext(this, this._ctx, this.state);
- this.enterRule(localctx, 90, esql_parser.RULE_comparisonOperator);
+ this.enterRule(localctx, 88, esql_parser.RULE_comparisonOperator);
let _la: number;
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 471;
+ this.state = 470;
_la = this._input.LA(1);
- if(!(((((_la - 51)) & ~0x1F) === 0 && ((1 << (_la - 51)) & 125) !== 0))) {
+ if(!(((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 125) !== 0))) {
this._errHandler.recoverInline(this);
}
else {
@@ -2669,13 +2649,13 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public explainCommand(): ExplainCommandContext {
let localctx: ExplainCommandContext = new ExplainCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 92, esql_parser.RULE_explainCommand);
+ this.enterRule(localctx, 90, esql_parser.RULE_explainCommand);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 473;
+ this.state = 472;
this.match(esql_parser.EXPLAIN);
- this.state = 474;
+ this.state = 473;
this.subqueryExpression();
}
}
@@ -2696,15 +2676,15 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public subqueryExpression(): SubqueryExpressionContext {
let localctx: SubqueryExpressionContext = new SubqueryExpressionContext(this, this._ctx, this.state);
- this.enterRule(localctx, 94, esql_parser.RULE_subqueryExpression);
+ this.enterRule(localctx, 92, esql_parser.RULE_subqueryExpression);
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 476;
+ this.state = 475;
this.match(esql_parser.OPENING_BRACKET);
- this.state = 477;
+ this.state = 476;
this.query(0);
- this.state = 478;
+ this.state = 477;
this.match(esql_parser.CLOSING_BRACKET);
}
}
@@ -2725,31 +2705,43 @@ export default class esql_parser extends Parser {
// @RuleVersion(0)
public showCommand(): ShowCommandContext {
let localctx: ShowCommandContext = new ShowCommandContext(this, this._ctx, this.state);
- this.enterRule(localctx, 96, esql_parser.RULE_showCommand);
+ this.enterRule(localctx, 94, esql_parser.RULE_showCommand);
try {
- this.state = 484;
- this._errHandler.sync(this);
- switch ( this._interp.adaptivePredict(this._input, 45, this._ctx) ) {
- case 1:
- localctx = new ShowInfoContext(this, localctx);
- this.enterOuterAlt(localctx, 1);
- {
- this.state = 480;
- this.match(esql_parser.SHOW);
- this.state = 481;
- this.match(esql_parser.INFO);
- }
- break;
- case 2:
- localctx = new ShowFunctionsContext(this, localctx);
- this.enterOuterAlt(localctx, 2);
- {
- this.state = 482;
- this.match(esql_parser.SHOW);
- this.state = 483;
- this.match(esql_parser.FUNCTIONS);
- }
- break;
+ localctx = new ShowInfoContext(this, localctx);
+ this.enterOuterAlt(localctx, 1);
+ {
+ this.state = 479;
+ this.match(esql_parser.SHOW);
+ this.state = 480;
+ this.match(esql_parser.INFO);
+ }
+ }
+ catch (re) {
+ if (re instanceof RecognitionException) {
+ localctx.exception = re;
+ this._errHandler.reportError(this, re);
+ this._errHandler.recover(this, re);
+ } else {
+ throw re;
+ }
+ }
+ finally {
+ this.exitRule();
+ }
+ return localctx;
+ }
+ // @RuleVersion(0)
+ public metaCommand(): MetaCommandContext {
+ let localctx: MetaCommandContext = new MetaCommandContext(this, this._ctx, this.state);
+ this.enterRule(localctx, 96, esql_parser.RULE_metaCommand);
+ try {
+ localctx = new MetaFunctionsContext(this, localctx);
+ this.enterOuterAlt(localctx, 1);
+ {
+ this.state = 482;
+ this.match(esql_parser.META);
+ this.state = 483;
+ this.match(esql_parser.FUNCTIONS);
}
}
catch (re) {
@@ -2774,48 +2766,48 @@ export default class esql_parser extends Parser {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
- this.state = 486;
+ this.state = 485;
this.match(esql_parser.ENRICH);
- this.state = 487;
+ this.state = 486;
localctx._policyName = this.match(esql_parser.ENRICH_POLICY_NAME);
- this.state = 490;
+ this.state = 489;
this._errHandler.sync(this);
- switch ( this._interp.adaptivePredict(this._input, 46, this._ctx) ) {
+ switch ( this._interp.adaptivePredict(this._input, 45, this._ctx) ) {
case 1:
{
- this.state = 488;
+ this.state = 487;
this.match(esql_parser.ON);
- this.state = 489;
+ this.state = 488;
localctx._matchField = this.qualifiedNamePattern();
}
break;
}
- this.state = 501;
+ this.state = 500;
this._errHandler.sync(this);
- switch ( this._interp.adaptivePredict(this._input, 48, this._ctx) ) {
+ switch ( this._interp.adaptivePredict(this._input, 47, this._ctx) ) {
case 1:
{
- this.state = 492;
+ this.state = 491;
this.match(esql_parser.WITH);
- this.state = 493;
+ this.state = 492;
this.enrichWithClause();
- this.state = 498;
+ this.state = 497;
this._errHandler.sync(this);
- _alt = this._interp.adaptivePredict(this._input, 47, this._ctx);
+ _alt = this._interp.adaptivePredict(this._input, 46, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
- this.state = 494;
+ this.state = 493;
this.match(esql_parser.COMMA);
- this.state = 495;
+ this.state = 494;
this.enrichWithClause();
}
}
}
- this.state = 500;
+ this.state = 499;
this._errHandler.sync(this);
- _alt = this._interp.adaptivePredict(this._input, 47, this._ctx);
+ _alt = this._interp.adaptivePredict(this._input, 46, this._ctx);
}
}
break;
@@ -2843,19 +2835,19 @@ export default class esql_parser extends Parser {
try {
this.enterOuterAlt(localctx, 1);
{
- this.state = 506;
+ this.state = 505;
this._errHandler.sync(this);
- switch ( this._interp.adaptivePredict(this._input, 49, this._ctx) ) {
+ switch ( this._interp.adaptivePredict(this._input, 48, this._ctx) ) {
case 1:
{
- this.state = 503;
+ this.state = 502;
localctx._newName = this.qualifiedNamePattern();
- this.state = 504;
+ this.state = 503;
this.match(esql_parser.ASSIGN);
}
break;
}
- this.state = 508;
+ this.state = 507;
localctx._enrichField = this.qualifiedNamePattern();
}
}
@@ -2911,7 +2903,7 @@ export default class esql_parser extends Parser {
return true;
}
- public static readonly _serializedATN: number[] = [4,1,105,511,2,0,7,0,
+ public static readonly _serializedATN: number[] = [4,1,108,510,2,0,7,0,
2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,
2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,
17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,
@@ -2919,165 +2911,165 @@ export default class esql_parser extends Parser {
31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,
2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,
46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,1,0,1,0,1,0,1,1,1,1,1,1,
- 1,1,1,1,1,1,5,1,112,8,1,10,1,12,1,115,9,1,1,2,1,2,1,2,1,2,3,2,121,8,2,1,
- 3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,136,8,3,1,4,1,4,1,
- 4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,148,8,5,1,5,1,5,1,5,1,5,1,5,5,5,155,8,
- 5,10,5,12,5,158,9,5,1,5,1,5,1,5,1,5,1,5,3,5,165,8,5,1,5,1,5,3,5,169,8,5,
- 1,5,1,5,1,5,1,5,1,5,1,5,5,5,177,8,5,10,5,12,5,180,9,5,1,6,1,6,3,6,184,8,
- 6,1,6,1,6,1,6,1,6,1,6,3,6,191,8,6,1,6,1,6,1,6,3,6,196,8,6,1,7,1,7,1,7,1,
- 7,1,7,3,7,203,8,7,1,8,1,8,1,8,1,8,3,8,209,8,8,1,8,1,8,1,8,1,8,1,8,1,8,5,
- 8,217,8,8,10,8,12,8,220,9,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,3,9,229,8,9,1,10,
- 1,10,1,10,1,10,1,10,1,10,5,10,237,8,10,10,10,12,10,240,9,10,3,10,242,8,
- 10,1,10,1,10,1,11,1,11,1,11,1,12,1,12,1,12,5,12,252,8,12,10,12,12,12,255,
- 9,12,1,13,1,13,1,13,1,13,1,13,3,13,262,8,13,1,14,1,14,1,14,1,14,5,14,268,
- 8,14,10,14,12,14,271,9,14,1,14,3,14,274,8,14,1,15,1,15,3,15,278,8,15,1,
- 16,1,16,1,16,1,16,5,16,284,8,16,10,16,12,16,287,9,16,1,17,1,17,1,17,1,17,
- 1,18,1,18,1,18,1,19,1,19,3,19,298,8,19,1,19,1,19,3,19,302,8,19,1,20,1,20,
- 1,20,1,20,3,20,308,8,20,1,21,1,21,1,22,1,22,1,22,5,22,315,8,22,10,22,12,
- 22,318,9,22,1,23,1,23,1,23,5,23,323,8,23,10,23,12,23,326,9,23,1,24,1,24,
- 1,25,1,25,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,
- 27,1,27,1,27,5,27,347,8,27,10,27,12,27,350,9,27,1,27,1,27,1,27,1,27,1,27,
- 1,27,5,27,358,8,27,10,27,12,27,361,9,27,1,27,1,27,1,27,1,27,1,27,1,27,5,
- 27,369,8,27,10,27,12,27,372,9,27,1,27,1,27,3,27,376,8,27,1,28,1,28,1,28,
- 1,29,1,29,1,29,1,29,5,29,385,8,29,10,29,12,29,388,9,29,1,30,1,30,3,30,392,
- 8,30,1,30,1,30,3,30,396,8,30,1,31,1,31,1,31,1,31,5,31,402,8,31,10,31,12,
- 31,405,9,31,1,32,1,32,1,32,1,32,5,32,411,8,32,10,32,12,32,414,9,32,1,33,
- 1,33,1,33,1,33,5,33,420,8,33,10,33,12,33,423,9,33,1,34,1,34,1,34,1,34,1,
- 35,1,35,1,35,1,35,3,35,433,8,35,1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,38,
- 1,38,1,38,5,38,445,8,38,10,38,12,38,448,9,38,1,39,1,39,1,39,1,39,1,40,1,
- 40,1,41,1,41,3,41,458,8,41,1,42,3,42,461,8,42,1,42,1,42,1,43,3,43,466,8,
- 43,1,43,1,43,1,44,1,44,1,45,1,45,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,48,
- 1,48,1,48,1,48,3,48,485,8,48,1,49,1,49,1,49,1,49,3,49,491,8,49,1,49,1,49,
- 1,49,1,49,5,49,497,8,49,10,49,12,49,500,9,49,3,49,502,8,49,1,50,1,50,1,
- 50,3,50,507,8,50,1,50,1,50,1,50,0,3,2,10,16,51,0,2,4,6,8,10,12,14,16,18,
- 20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,
- 68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,0,9,1,0,58,59,1,0,60,
- 62,2,0,66,66,71,71,1,0,65,66,2,0,66,66,105,105,2,0,31,31,34,34,1,0,37,38,
- 2,0,36,36,50,50,2,0,51,51,53,57,536,0,102,1,0,0,0,2,105,1,0,0,0,4,120,1,
- 0,0,0,6,135,1,0,0,0,8,137,1,0,0,0,10,168,1,0,0,0,12,195,1,0,0,0,14,202,
- 1,0,0,0,16,208,1,0,0,0,18,228,1,0,0,0,20,230,1,0,0,0,22,245,1,0,0,0,24,
- 248,1,0,0,0,26,261,1,0,0,0,28,263,1,0,0,0,30,277,1,0,0,0,32,279,1,0,0,0,
- 34,288,1,0,0,0,36,292,1,0,0,0,38,295,1,0,0,0,40,303,1,0,0,0,42,309,1,0,
- 0,0,44,311,1,0,0,0,46,319,1,0,0,0,48,327,1,0,0,0,50,329,1,0,0,0,52,331,
- 1,0,0,0,54,375,1,0,0,0,56,377,1,0,0,0,58,380,1,0,0,0,60,389,1,0,0,0,62,
- 397,1,0,0,0,64,406,1,0,0,0,66,415,1,0,0,0,68,424,1,0,0,0,70,428,1,0,0,0,
- 72,434,1,0,0,0,74,438,1,0,0,0,76,441,1,0,0,0,78,449,1,0,0,0,80,453,1,0,
- 0,0,82,457,1,0,0,0,84,460,1,0,0,0,86,465,1,0,0,0,88,469,1,0,0,0,90,471,
- 1,0,0,0,92,473,1,0,0,0,94,476,1,0,0,0,96,484,1,0,0,0,98,486,1,0,0,0,100,
- 506,1,0,0,0,102,103,3,2,1,0,103,104,5,0,0,1,104,1,1,0,0,0,105,106,6,1,-1,
- 0,106,107,3,4,2,0,107,113,1,0,0,0,108,109,10,1,0,0,109,110,5,25,0,0,110,
- 112,3,6,3,0,111,108,1,0,0,0,112,115,1,0,0,0,113,111,1,0,0,0,113,114,1,0,
- 0,0,114,3,1,0,0,0,115,113,1,0,0,0,116,121,3,92,46,0,117,121,3,28,14,0,118,
- 121,3,22,11,0,119,121,3,96,48,0,120,116,1,0,0,0,120,117,1,0,0,0,120,118,
- 1,0,0,0,120,119,1,0,0,0,121,5,1,0,0,0,122,136,3,36,18,0,123,136,3,40,20,
- 0,124,136,3,56,28,0,125,136,3,62,31,0,126,136,3,58,29,0,127,136,3,38,19,
- 0,128,136,3,8,4,0,129,136,3,64,32,0,130,136,3,66,33,0,131,136,3,70,35,0,
- 132,136,3,72,36,0,133,136,3,98,49,0,134,136,3,74,37,0,135,122,1,0,0,0,135,
- 123,1,0,0,0,135,124,1,0,0,0,135,125,1,0,0,0,135,126,1,0,0,0,135,127,1,0,
- 0,0,135,128,1,0,0,0,135,129,1,0,0,0,135,130,1,0,0,0,135,131,1,0,0,0,135,
- 132,1,0,0,0,135,133,1,0,0,0,135,134,1,0,0,0,136,7,1,0,0,0,137,138,5,17,
- 0,0,138,139,3,10,5,0,139,9,1,0,0,0,140,141,6,5,-1,0,141,142,5,43,0,0,142,
- 169,3,10,5,7,143,169,3,14,7,0,144,169,3,12,6,0,145,147,3,14,7,0,146,148,
- 5,43,0,0,147,146,1,0,0,0,147,148,1,0,0,0,148,149,1,0,0,0,149,150,5,40,0,
- 0,150,151,5,39,0,0,151,156,3,14,7,0,152,153,5,33,0,0,153,155,3,14,7,0,154,
- 152,1,0,0,0,155,158,1,0,0,0,156,154,1,0,0,0,156,157,1,0,0,0,157,159,1,0,
- 0,0,158,156,1,0,0,0,159,160,5,49,0,0,160,169,1,0,0,0,161,162,3,14,7,0,162,
- 164,5,41,0,0,163,165,5,43,0,0,164,163,1,0,0,0,164,165,1,0,0,0,165,166,1,
- 0,0,0,166,167,5,44,0,0,167,169,1,0,0,0,168,140,1,0,0,0,168,143,1,0,0,0,
- 168,144,1,0,0,0,168,145,1,0,0,0,168,161,1,0,0,0,169,178,1,0,0,0,170,171,
- 10,4,0,0,171,172,5,30,0,0,172,177,3,10,5,5,173,174,10,3,0,0,174,175,5,46,
- 0,0,175,177,3,10,5,4,176,170,1,0,0,0,176,173,1,0,0,0,177,180,1,0,0,0,178,
- 176,1,0,0,0,178,179,1,0,0,0,179,11,1,0,0,0,180,178,1,0,0,0,181,183,3,14,
- 7,0,182,184,5,43,0,0,183,182,1,0,0,0,183,184,1,0,0,0,184,185,1,0,0,0,185,
- 186,5,42,0,0,186,187,3,88,44,0,187,196,1,0,0,0,188,190,3,14,7,0,189,191,
- 5,43,0,0,190,189,1,0,0,0,190,191,1,0,0,0,191,192,1,0,0,0,192,193,5,48,0,
- 0,193,194,3,88,44,0,194,196,1,0,0,0,195,181,1,0,0,0,195,188,1,0,0,0,196,
- 13,1,0,0,0,197,203,3,16,8,0,198,199,3,16,8,0,199,200,3,90,45,0,200,201,
- 3,16,8,0,201,203,1,0,0,0,202,197,1,0,0,0,202,198,1,0,0,0,203,15,1,0,0,0,
- 204,205,6,8,-1,0,205,209,3,18,9,0,206,207,7,0,0,0,207,209,3,16,8,3,208,
- 204,1,0,0,0,208,206,1,0,0,0,209,218,1,0,0,0,210,211,10,2,0,0,211,212,7,
- 1,0,0,212,217,3,16,8,3,213,214,10,1,0,0,214,215,7,0,0,0,215,217,3,16,8,
- 2,216,210,1,0,0,0,216,213,1,0,0,0,217,220,1,0,0,0,218,216,1,0,0,0,218,219,
- 1,0,0,0,219,17,1,0,0,0,220,218,1,0,0,0,221,229,3,54,27,0,222,229,3,44,22,
- 0,223,229,3,20,10,0,224,225,5,39,0,0,225,226,3,10,5,0,226,227,5,49,0,0,
- 227,229,1,0,0,0,228,221,1,0,0,0,228,222,1,0,0,0,228,223,1,0,0,0,228,224,
- 1,0,0,0,229,19,1,0,0,0,230,231,3,48,24,0,231,241,5,39,0,0,232,242,5,60,
- 0,0,233,238,3,10,5,0,234,235,5,33,0,0,235,237,3,10,5,0,236,234,1,0,0,0,
- 237,240,1,0,0,0,238,236,1,0,0,0,238,239,1,0,0,0,239,242,1,0,0,0,240,238,
- 1,0,0,0,241,232,1,0,0,0,241,233,1,0,0,0,241,242,1,0,0,0,242,243,1,0,0,0,
- 243,244,5,49,0,0,244,21,1,0,0,0,245,246,5,13,0,0,246,247,3,24,12,0,247,
- 23,1,0,0,0,248,253,3,26,13,0,249,250,5,33,0,0,250,252,3,26,13,0,251,249,
- 1,0,0,0,252,255,1,0,0,0,253,251,1,0,0,0,253,254,1,0,0,0,254,25,1,0,0,0,
- 255,253,1,0,0,0,256,262,3,10,5,0,257,258,3,44,22,0,258,259,5,32,0,0,259,
- 260,3,10,5,0,260,262,1,0,0,0,261,256,1,0,0,0,261,257,1,0,0,0,262,27,1,0,
- 0,0,263,264,5,6,0,0,264,269,3,42,21,0,265,266,5,33,0,0,266,268,3,42,21,
- 0,267,265,1,0,0,0,268,271,1,0,0,0,269,267,1,0,0,0,269,270,1,0,0,0,270,273,
- 1,0,0,0,271,269,1,0,0,0,272,274,3,30,15,0,273,272,1,0,0,0,273,274,1,0,0,
- 0,274,29,1,0,0,0,275,278,3,32,16,0,276,278,3,34,17,0,277,275,1,0,0,0,277,
- 276,1,0,0,0,278,31,1,0,0,0,279,280,5,70,0,0,280,285,3,42,21,0,281,282,5,
- 33,0,0,282,284,3,42,21,0,283,281,1,0,0,0,284,287,1,0,0,0,285,283,1,0,0,
- 0,285,286,1,0,0,0,286,33,1,0,0,0,287,285,1,0,0,0,288,289,5,63,0,0,289,290,
- 3,32,16,0,290,291,5,64,0,0,291,35,1,0,0,0,292,293,5,4,0,0,293,294,3,24,
- 12,0,294,37,1,0,0,0,295,297,5,16,0,0,296,298,3,24,12,0,297,296,1,0,0,0,
- 297,298,1,0,0,0,298,301,1,0,0,0,299,300,5,29,0,0,300,302,3,24,12,0,301,
- 299,1,0,0,0,301,302,1,0,0,0,302,39,1,0,0,0,303,304,5,8,0,0,304,307,3,24,
- 12,0,305,306,5,29,0,0,306,308,3,24,12,0,307,305,1,0,0,0,307,308,1,0,0,0,
- 308,41,1,0,0,0,309,310,7,2,0,0,310,43,1,0,0,0,311,316,3,48,24,0,312,313,
- 5,35,0,0,313,315,3,48,24,0,314,312,1,0,0,0,315,318,1,0,0,0,316,314,1,0,
- 0,0,316,317,1,0,0,0,317,45,1,0,0,0,318,316,1,0,0,0,319,324,3,50,25,0,320,
- 321,5,35,0,0,321,323,3,50,25,0,322,320,1,0,0,0,323,326,1,0,0,0,324,322,
- 1,0,0,0,324,325,1,0,0,0,325,47,1,0,0,0,326,324,1,0,0,0,327,328,7,3,0,0,
- 328,49,1,0,0,0,329,330,5,75,0,0,330,51,1,0,0,0,331,332,7,4,0,0,332,53,1,
- 0,0,0,333,376,5,44,0,0,334,335,3,86,43,0,335,336,5,65,0,0,336,376,1,0,0,
- 0,337,376,3,84,42,0,338,376,3,86,43,0,339,376,3,80,40,0,340,376,5,47,0,
- 0,341,376,3,88,44,0,342,343,5,63,0,0,343,348,3,82,41,0,344,345,5,33,0,0,
- 345,347,3,82,41,0,346,344,1,0,0,0,347,350,1,0,0,0,348,346,1,0,0,0,348,349,
- 1,0,0,0,349,351,1,0,0,0,350,348,1,0,0,0,351,352,5,64,0,0,352,376,1,0,0,
- 0,353,354,5,63,0,0,354,359,3,80,40,0,355,356,5,33,0,0,356,358,3,80,40,0,
- 357,355,1,0,0,0,358,361,1,0,0,0,359,357,1,0,0,0,359,360,1,0,0,0,360,362,
- 1,0,0,0,361,359,1,0,0,0,362,363,5,64,0,0,363,376,1,0,0,0,364,365,5,63,0,
- 0,365,370,3,88,44,0,366,367,5,33,0,0,367,369,3,88,44,0,368,366,1,0,0,0,
- 369,372,1,0,0,0,370,368,1,0,0,0,370,371,1,0,0,0,371,373,1,0,0,0,372,370,
- 1,0,0,0,373,374,5,64,0,0,374,376,1,0,0,0,375,333,1,0,0,0,375,334,1,0,0,
- 0,375,337,1,0,0,0,375,338,1,0,0,0,375,339,1,0,0,0,375,340,1,0,0,0,375,341,
- 1,0,0,0,375,342,1,0,0,0,375,353,1,0,0,0,375,364,1,0,0,0,376,55,1,0,0,0,
- 377,378,5,10,0,0,378,379,5,27,0,0,379,57,1,0,0,0,380,381,5,15,0,0,381,386,
- 3,60,30,0,382,383,5,33,0,0,383,385,3,60,30,0,384,382,1,0,0,0,385,388,1,
- 0,0,0,386,384,1,0,0,0,386,387,1,0,0,0,387,59,1,0,0,0,388,386,1,0,0,0,389,
- 391,3,10,5,0,390,392,7,5,0,0,391,390,1,0,0,0,391,392,1,0,0,0,392,395,1,
- 0,0,0,393,394,5,45,0,0,394,396,7,6,0,0,395,393,1,0,0,0,395,396,1,0,0,0,
- 396,61,1,0,0,0,397,398,5,9,0,0,398,403,3,46,23,0,399,400,5,33,0,0,400,402,
- 3,46,23,0,401,399,1,0,0,0,402,405,1,0,0,0,403,401,1,0,0,0,403,404,1,0,0,
- 0,404,63,1,0,0,0,405,403,1,0,0,0,406,407,5,2,0,0,407,412,3,46,23,0,408,
- 409,5,33,0,0,409,411,3,46,23,0,410,408,1,0,0,0,411,414,1,0,0,0,412,410,
- 1,0,0,0,412,413,1,0,0,0,413,65,1,0,0,0,414,412,1,0,0,0,415,416,5,12,0,0,
- 416,421,3,68,34,0,417,418,5,33,0,0,418,420,3,68,34,0,419,417,1,0,0,0,420,
- 423,1,0,0,0,421,419,1,0,0,0,421,422,1,0,0,0,422,67,1,0,0,0,423,421,1,0,
- 0,0,424,425,3,46,23,0,425,426,5,79,0,0,426,427,3,46,23,0,427,69,1,0,0,0,
- 428,429,5,1,0,0,429,430,3,18,9,0,430,432,3,88,44,0,431,433,3,76,38,0,432,
- 431,1,0,0,0,432,433,1,0,0,0,433,71,1,0,0,0,434,435,5,7,0,0,435,436,3,18,
- 9,0,436,437,3,88,44,0,437,73,1,0,0,0,438,439,5,11,0,0,439,440,3,44,22,0,
- 440,75,1,0,0,0,441,446,3,78,39,0,442,443,5,33,0,0,443,445,3,78,39,0,444,
- 442,1,0,0,0,445,448,1,0,0,0,446,444,1,0,0,0,446,447,1,0,0,0,447,77,1,0,
- 0,0,448,446,1,0,0,0,449,450,3,48,24,0,450,451,5,32,0,0,451,452,3,54,27,
- 0,452,79,1,0,0,0,453,454,7,7,0,0,454,81,1,0,0,0,455,458,3,84,42,0,456,458,
- 3,86,43,0,457,455,1,0,0,0,457,456,1,0,0,0,458,83,1,0,0,0,459,461,7,0,0,
- 0,460,459,1,0,0,0,460,461,1,0,0,0,461,462,1,0,0,0,462,463,5,28,0,0,463,
- 85,1,0,0,0,464,466,7,0,0,0,465,464,1,0,0,0,465,466,1,0,0,0,466,467,1,0,
- 0,0,467,468,5,27,0,0,468,87,1,0,0,0,469,470,5,26,0,0,470,89,1,0,0,0,471,
- 472,7,8,0,0,472,91,1,0,0,0,473,474,5,5,0,0,474,475,3,94,47,0,475,93,1,0,
- 0,0,476,477,5,63,0,0,477,478,3,2,1,0,478,479,5,64,0,0,479,95,1,0,0,0,480,
- 481,5,14,0,0,481,485,5,95,0,0,482,483,5,14,0,0,483,485,5,96,0,0,484,480,
- 1,0,0,0,484,482,1,0,0,0,485,97,1,0,0,0,486,487,5,3,0,0,487,490,5,85,0,0,
- 488,489,5,83,0,0,489,491,3,46,23,0,490,488,1,0,0,0,490,491,1,0,0,0,491,
- 501,1,0,0,0,492,493,5,84,0,0,493,498,3,100,50,0,494,495,5,33,0,0,495,497,
- 3,100,50,0,496,494,1,0,0,0,497,500,1,0,0,0,498,496,1,0,0,0,498,499,1,0,
- 0,0,499,502,1,0,0,0,500,498,1,0,0,0,501,492,1,0,0,0,501,502,1,0,0,0,502,
- 99,1,0,0,0,503,504,3,46,23,0,504,505,5,32,0,0,505,507,1,0,0,0,506,503,1,
- 0,0,0,506,507,1,0,0,0,507,508,1,0,0,0,508,509,3,46,23,0,509,101,1,0,0,0,
- 50,113,120,135,147,156,164,168,176,178,183,190,195,202,208,216,218,228,
- 238,241,253,261,269,273,277,285,297,301,307,316,324,348,359,370,375,386,
- 391,395,403,412,421,432,446,457,460,465,484,490,498,501,506];
+ 1,1,1,1,1,1,5,1,112,8,1,10,1,12,1,115,9,1,1,2,1,2,1,2,1,2,1,2,3,2,122,8,
+ 2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,137,8,3,1,4,1,
+ 4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,149,8,5,1,5,1,5,1,5,1,5,1,5,5,5,156,
+ 8,5,10,5,12,5,159,9,5,1,5,1,5,1,5,1,5,1,5,3,5,166,8,5,1,5,1,5,3,5,170,8,
+ 5,1,5,1,5,1,5,1,5,1,5,1,5,5,5,178,8,5,10,5,12,5,181,9,5,1,6,1,6,3,6,185,
+ 8,6,1,6,1,6,1,6,1,6,1,6,3,6,192,8,6,1,6,1,6,1,6,3,6,197,8,6,1,7,1,7,1,7,
+ 1,7,1,7,3,7,204,8,7,1,8,1,8,1,8,1,8,3,8,210,8,8,1,8,1,8,1,8,1,8,1,8,1,8,
+ 5,8,218,8,8,10,8,12,8,221,9,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,3,9,230,8,9,1,
+ 10,1,10,1,10,1,10,1,10,1,10,5,10,238,8,10,10,10,12,10,241,9,10,3,10,243,
+ 8,10,1,10,1,10,1,11,1,11,1,11,1,12,1,12,1,12,5,12,253,8,12,10,12,12,12,
+ 256,9,12,1,13,1,13,1,13,1,13,1,13,3,13,263,8,13,1,14,1,14,1,14,1,14,5,14,
+ 269,8,14,10,14,12,14,272,9,14,1,14,3,14,275,8,14,1,15,1,15,3,15,279,8,15,
+ 1,16,1,16,1,16,1,16,5,16,285,8,16,10,16,12,16,288,9,16,1,17,1,17,1,17,1,
+ 17,1,18,1,18,1,18,1,19,1,19,3,19,299,8,19,1,19,1,19,3,19,303,8,19,1,20,
+ 1,20,1,20,1,20,3,20,309,8,20,1,21,1,21,1,22,1,22,1,22,5,22,316,8,22,10,
+ 22,12,22,319,9,22,1,23,1,23,1,23,5,23,324,8,23,10,23,12,23,327,9,23,1,24,
+ 1,24,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,
+ 26,1,26,5,26,346,8,26,10,26,12,26,349,9,26,1,26,1,26,1,26,1,26,1,26,1,26,
+ 5,26,357,8,26,10,26,12,26,360,9,26,1,26,1,26,1,26,1,26,1,26,1,26,5,26,368,
+ 8,26,10,26,12,26,371,9,26,1,26,1,26,3,26,375,8,26,1,27,1,27,1,27,1,28,1,
+ 28,1,28,1,28,5,28,384,8,28,10,28,12,28,387,9,28,1,29,1,29,3,29,391,8,29,
+ 1,29,1,29,3,29,395,8,29,1,30,1,30,1,30,1,30,5,30,401,8,30,10,30,12,30,404,
+ 9,30,1,31,1,31,1,31,1,31,5,31,410,8,31,10,31,12,31,413,9,31,1,32,1,32,1,
+ 32,1,32,5,32,419,8,32,10,32,12,32,422,9,32,1,33,1,33,1,33,1,33,1,34,1,34,
+ 1,34,1,34,3,34,432,8,34,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,37,1,37,1,
+ 37,5,37,444,8,37,10,37,12,37,447,9,37,1,38,1,38,1,38,1,38,1,39,1,39,1,40,
+ 1,40,3,40,457,8,40,1,41,3,41,460,8,41,1,41,1,41,1,42,3,42,465,8,42,1,42,
+ 1,42,1,43,1,43,1,44,1,44,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,47,1,47,1,
+ 47,1,48,1,48,1,48,1,49,1,49,1,49,1,49,3,49,490,8,49,1,49,1,49,1,49,1,49,
+ 5,49,496,8,49,10,49,12,49,499,9,49,3,49,501,8,49,1,50,1,50,1,50,3,50,506,
+ 8,50,1,50,1,50,1,50,0,3,2,10,16,51,0,2,4,6,8,10,12,14,16,18,20,22,24,26,
+ 28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,
+ 76,78,80,82,84,86,88,90,92,94,96,98,100,0,8,1,0,59,60,1,0,61,63,2,0,67,
+ 67,72,72,1,0,66,67,2,0,32,32,35,35,1,0,38,39,2,0,37,37,51,51,2,0,52,52,
+ 54,58,535,0,102,1,0,0,0,2,105,1,0,0,0,4,121,1,0,0,0,6,136,1,0,0,0,8,138,
+ 1,0,0,0,10,169,1,0,0,0,12,196,1,0,0,0,14,203,1,0,0,0,16,209,1,0,0,0,18,
+ 229,1,0,0,0,20,231,1,0,0,0,22,246,1,0,0,0,24,249,1,0,0,0,26,262,1,0,0,0,
+ 28,264,1,0,0,0,30,278,1,0,0,0,32,280,1,0,0,0,34,289,1,0,0,0,36,293,1,0,
+ 0,0,38,296,1,0,0,0,40,304,1,0,0,0,42,310,1,0,0,0,44,312,1,0,0,0,46,320,
+ 1,0,0,0,48,328,1,0,0,0,50,330,1,0,0,0,52,374,1,0,0,0,54,376,1,0,0,0,56,
+ 379,1,0,0,0,58,388,1,0,0,0,60,396,1,0,0,0,62,405,1,0,0,0,64,414,1,0,0,0,
+ 66,423,1,0,0,0,68,427,1,0,0,0,70,433,1,0,0,0,72,437,1,0,0,0,74,440,1,0,
+ 0,0,76,448,1,0,0,0,78,452,1,0,0,0,80,456,1,0,0,0,82,459,1,0,0,0,84,464,
+ 1,0,0,0,86,468,1,0,0,0,88,470,1,0,0,0,90,472,1,0,0,0,92,475,1,0,0,0,94,
+ 479,1,0,0,0,96,482,1,0,0,0,98,485,1,0,0,0,100,505,1,0,0,0,102,103,3,2,1,
+ 0,103,104,5,0,0,1,104,1,1,0,0,0,105,106,6,1,-1,0,106,107,3,4,2,0,107,113,
+ 1,0,0,0,108,109,10,1,0,0,109,110,5,26,0,0,110,112,3,6,3,0,111,108,1,0,0,
+ 0,112,115,1,0,0,0,113,111,1,0,0,0,113,114,1,0,0,0,114,3,1,0,0,0,115,113,
+ 1,0,0,0,116,122,3,90,45,0,117,122,3,28,14,0,118,122,3,22,11,0,119,122,3,
+ 94,47,0,120,122,3,96,48,0,121,116,1,0,0,0,121,117,1,0,0,0,121,118,1,0,0,
+ 0,121,119,1,0,0,0,121,120,1,0,0,0,122,5,1,0,0,0,123,137,3,36,18,0,124,137,
+ 3,40,20,0,125,137,3,54,27,0,126,137,3,60,30,0,127,137,3,56,28,0,128,137,
+ 3,38,19,0,129,137,3,8,4,0,130,137,3,62,31,0,131,137,3,64,32,0,132,137,3,
+ 68,34,0,133,137,3,70,35,0,134,137,3,98,49,0,135,137,3,72,36,0,136,123,1,
+ 0,0,0,136,124,1,0,0,0,136,125,1,0,0,0,136,126,1,0,0,0,136,127,1,0,0,0,136,
+ 128,1,0,0,0,136,129,1,0,0,0,136,130,1,0,0,0,136,131,1,0,0,0,136,132,1,0,
+ 0,0,136,133,1,0,0,0,136,134,1,0,0,0,136,135,1,0,0,0,137,7,1,0,0,0,138,139,
+ 5,18,0,0,139,140,3,10,5,0,140,9,1,0,0,0,141,142,6,5,-1,0,142,143,5,44,0,
+ 0,143,170,3,10,5,7,144,170,3,14,7,0,145,170,3,12,6,0,146,148,3,14,7,0,147,
+ 149,5,44,0,0,148,147,1,0,0,0,148,149,1,0,0,0,149,150,1,0,0,0,150,151,5,
+ 41,0,0,151,152,5,40,0,0,152,157,3,14,7,0,153,154,5,34,0,0,154,156,3,14,
+ 7,0,155,153,1,0,0,0,156,159,1,0,0,0,157,155,1,0,0,0,157,158,1,0,0,0,158,
+ 160,1,0,0,0,159,157,1,0,0,0,160,161,5,50,0,0,161,170,1,0,0,0,162,163,3,
+ 14,7,0,163,165,5,42,0,0,164,166,5,44,0,0,165,164,1,0,0,0,165,166,1,0,0,
+ 0,166,167,1,0,0,0,167,168,5,45,0,0,168,170,1,0,0,0,169,141,1,0,0,0,169,
+ 144,1,0,0,0,169,145,1,0,0,0,169,146,1,0,0,0,169,162,1,0,0,0,170,179,1,0,
+ 0,0,171,172,10,4,0,0,172,173,5,31,0,0,173,178,3,10,5,5,174,175,10,3,0,0,
+ 175,176,5,47,0,0,176,178,3,10,5,4,177,171,1,0,0,0,177,174,1,0,0,0,178,181,
+ 1,0,0,0,179,177,1,0,0,0,179,180,1,0,0,0,180,11,1,0,0,0,181,179,1,0,0,0,
+ 182,184,3,14,7,0,183,185,5,44,0,0,184,183,1,0,0,0,184,185,1,0,0,0,185,186,
+ 1,0,0,0,186,187,5,43,0,0,187,188,3,86,43,0,188,197,1,0,0,0,189,191,3,14,
+ 7,0,190,192,5,44,0,0,191,190,1,0,0,0,191,192,1,0,0,0,192,193,1,0,0,0,193,
+ 194,5,49,0,0,194,195,3,86,43,0,195,197,1,0,0,0,196,182,1,0,0,0,196,189,
+ 1,0,0,0,197,13,1,0,0,0,198,204,3,16,8,0,199,200,3,16,8,0,200,201,3,88,44,
+ 0,201,202,3,16,8,0,202,204,1,0,0,0,203,198,1,0,0,0,203,199,1,0,0,0,204,
+ 15,1,0,0,0,205,206,6,8,-1,0,206,210,3,18,9,0,207,208,7,0,0,0,208,210,3,
+ 16,8,3,209,205,1,0,0,0,209,207,1,0,0,0,210,219,1,0,0,0,211,212,10,2,0,0,
+ 212,213,7,1,0,0,213,218,3,16,8,3,214,215,10,1,0,0,215,216,7,0,0,0,216,218,
+ 3,16,8,2,217,211,1,0,0,0,217,214,1,0,0,0,218,221,1,0,0,0,219,217,1,0,0,
+ 0,219,220,1,0,0,0,220,17,1,0,0,0,221,219,1,0,0,0,222,230,3,52,26,0,223,
+ 230,3,44,22,0,224,230,3,20,10,0,225,226,5,40,0,0,226,227,3,10,5,0,227,228,
+ 5,50,0,0,228,230,1,0,0,0,229,222,1,0,0,0,229,223,1,0,0,0,229,224,1,0,0,
+ 0,229,225,1,0,0,0,230,19,1,0,0,0,231,232,3,48,24,0,232,242,5,40,0,0,233,
+ 243,5,61,0,0,234,239,3,10,5,0,235,236,5,34,0,0,236,238,3,10,5,0,237,235,
+ 1,0,0,0,238,241,1,0,0,0,239,237,1,0,0,0,239,240,1,0,0,0,240,243,1,0,0,0,
+ 241,239,1,0,0,0,242,233,1,0,0,0,242,234,1,0,0,0,242,243,1,0,0,0,243,244,
+ 1,0,0,0,244,245,5,50,0,0,245,21,1,0,0,0,246,247,5,14,0,0,247,248,3,24,12,
+ 0,248,23,1,0,0,0,249,254,3,26,13,0,250,251,5,34,0,0,251,253,3,26,13,0,252,
+ 250,1,0,0,0,253,256,1,0,0,0,254,252,1,0,0,0,254,255,1,0,0,0,255,25,1,0,
+ 0,0,256,254,1,0,0,0,257,263,3,10,5,0,258,259,3,44,22,0,259,260,5,33,0,0,
+ 260,261,3,10,5,0,261,263,1,0,0,0,262,257,1,0,0,0,262,258,1,0,0,0,263,27,
+ 1,0,0,0,264,265,5,6,0,0,265,270,3,42,21,0,266,267,5,34,0,0,267,269,3,42,
+ 21,0,268,266,1,0,0,0,269,272,1,0,0,0,270,268,1,0,0,0,270,271,1,0,0,0,271,
+ 274,1,0,0,0,272,270,1,0,0,0,273,275,3,30,15,0,274,273,1,0,0,0,274,275,1,
+ 0,0,0,275,29,1,0,0,0,276,279,3,32,16,0,277,279,3,34,17,0,278,276,1,0,0,
+ 0,278,277,1,0,0,0,279,31,1,0,0,0,280,281,5,71,0,0,281,286,3,42,21,0,282,
+ 283,5,34,0,0,283,285,3,42,21,0,284,282,1,0,0,0,285,288,1,0,0,0,286,284,
+ 1,0,0,0,286,287,1,0,0,0,287,33,1,0,0,0,288,286,1,0,0,0,289,290,5,64,0,0,
+ 290,291,3,32,16,0,291,292,5,65,0,0,292,35,1,0,0,0,293,294,5,4,0,0,294,295,
+ 3,24,12,0,295,37,1,0,0,0,296,298,5,17,0,0,297,299,3,24,12,0,298,297,1,0,
+ 0,0,298,299,1,0,0,0,299,302,1,0,0,0,300,301,5,30,0,0,301,303,3,24,12,0,
+ 302,300,1,0,0,0,302,303,1,0,0,0,303,39,1,0,0,0,304,305,5,8,0,0,305,308,
+ 3,24,12,0,306,307,5,30,0,0,307,309,3,24,12,0,308,306,1,0,0,0,308,309,1,
+ 0,0,0,309,41,1,0,0,0,310,311,7,2,0,0,311,43,1,0,0,0,312,317,3,48,24,0,313,
+ 314,5,36,0,0,314,316,3,48,24,0,315,313,1,0,0,0,316,319,1,0,0,0,317,315,
+ 1,0,0,0,317,318,1,0,0,0,318,45,1,0,0,0,319,317,1,0,0,0,320,325,3,50,25,
+ 0,321,322,5,36,0,0,322,324,3,50,25,0,323,321,1,0,0,0,324,327,1,0,0,0,325,
+ 323,1,0,0,0,325,326,1,0,0,0,326,47,1,0,0,0,327,325,1,0,0,0,328,329,7,3,
+ 0,0,329,49,1,0,0,0,330,331,5,76,0,0,331,51,1,0,0,0,332,375,5,45,0,0,333,
+ 334,3,84,42,0,334,335,5,66,0,0,335,375,1,0,0,0,336,375,3,82,41,0,337,375,
+ 3,84,42,0,338,375,3,78,39,0,339,375,5,48,0,0,340,375,3,86,43,0,341,342,
+ 5,64,0,0,342,347,3,80,40,0,343,344,5,34,0,0,344,346,3,80,40,0,345,343,1,
+ 0,0,0,346,349,1,0,0,0,347,345,1,0,0,0,347,348,1,0,0,0,348,350,1,0,0,0,349,
+ 347,1,0,0,0,350,351,5,65,0,0,351,375,1,0,0,0,352,353,5,64,0,0,353,358,3,
+ 78,39,0,354,355,5,34,0,0,355,357,3,78,39,0,356,354,1,0,0,0,357,360,1,0,
+ 0,0,358,356,1,0,0,0,358,359,1,0,0,0,359,361,1,0,0,0,360,358,1,0,0,0,361,
+ 362,5,65,0,0,362,375,1,0,0,0,363,364,5,64,0,0,364,369,3,86,43,0,365,366,
+ 5,34,0,0,366,368,3,86,43,0,367,365,1,0,0,0,368,371,1,0,0,0,369,367,1,0,
+ 0,0,369,370,1,0,0,0,370,372,1,0,0,0,371,369,1,0,0,0,372,373,5,65,0,0,373,
+ 375,1,0,0,0,374,332,1,0,0,0,374,333,1,0,0,0,374,336,1,0,0,0,374,337,1,0,
+ 0,0,374,338,1,0,0,0,374,339,1,0,0,0,374,340,1,0,0,0,374,341,1,0,0,0,374,
+ 352,1,0,0,0,374,363,1,0,0,0,375,53,1,0,0,0,376,377,5,10,0,0,377,378,5,28,
+ 0,0,378,55,1,0,0,0,379,380,5,16,0,0,380,385,3,58,29,0,381,382,5,34,0,0,
+ 382,384,3,58,29,0,383,381,1,0,0,0,384,387,1,0,0,0,385,383,1,0,0,0,385,386,
+ 1,0,0,0,386,57,1,0,0,0,387,385,1,0,0,0,388,390,3,10,5,0,389,391,7,4,0,0,
+ 390,389,1,0,0,0,390,391,1,0,0,0,391,394,1,0,0,0,392,393,5,46,0,0,393,395,
+ 7,5,0,0,394,392,1,0,0,0,394,395,1,0,0,0,395,59,1,0,0,0,396,397,5,9,0,0,
+ 397,402,3,46,23,0,398,399,5,34,0,0,399,401,3,46,23,0,400,398,1,0,0,0,401,
+ 404,1,0,0,0,402,400,1,0,0,0,402,403,1,0,0,0,403,61,1,0,0,0,404,402,1,0,
+ 0,0,405,406,5,2,0,0,406,411,3,46,23,0,407,408,5,34,0,0,408,410,3,46,23,
+ 0,409,407,1,0,0,0,410,413,1,0,0,0,411,409,1,0,0,0,411,412,1,0,0,0,412,63,
+ 1,0,0,0,413,411,1,0,0,0,414,415,5,13,0,0,415,420,3,66,33,0,416,417,5,34,
+ 0,0,417,419,3,66,33,0,418,416,1,0,0,0,419,422,1,0,0,0,420,418,1,0,0,0,420,
+ 421,1,0,0,0,421,65,1,0,0,0,422,420,1,0,0,0,423,424,3,46,23,0,424,425,5,
+ 80,0,0,425,426,3,46,23,0,426,67,1,0,0,0,427,428,5,1,0,0,428,429,3,18,9,
+ 0,429,431,3,86,43,0,430,432,3,74,37,0,431,430,1,0,0,0,431,432,1,0,0,0,432,
+ 69,1,0,0,0,433,434,5,7,0,0,434,435,3,18,9,0,435,436,3,86,43,0,436,71,1,
+ 0,0,0,437,438,5,12,0,0,438,439,3,44,22,0,439,73,1,0,0,0,440,445,3,76,38,
+ 0,441,442,5,34,0,0,442,444,3,76,38,0,443,441,1,0,0,0,444,447,1,0,0,0,445,
+ 443,1,0,0,0,445,446,1,0,0,0,446,75,1,0,0,0,447,445,1,0,0,0,448,449,3,48,
+ 24,0,449,450,5,33,0,0,450,451,3,52,26,0,451,77,1,0,0,0,452,453,7,6,0,0,
+ 453,79,1,0,0,0,454,457,3,82,41,0,455,457,3,84,42,0,456,454,1,0,0,0,456,
+ 455,1,0,0,0,457,81,1,0,0,0,458,460,7,0,0,0,459,458,1,0,0,0,459,460,1,0,
+ 0,0,460,461,1,0,0,0,461,462,5,29,0,0,462,83,1,0,0,0,463,465,7,0,0,0,464,
+ 463,1,0,0,0,464,465,1,0,0,0,465,466,1,0,0,0,466,467,5,28,0,0,467,85,1,0,
+ 0,0,468,469,5,27,0,0,469,87,1,0,0,0,470,471,7,7,0,0,471,89,1,0,0,0,472,
+ 473,5,5,0,0,473,474,3,92,46,0,474,91,1,0,0,0,475,476,5,64,0,0,476,477,3,
+ 2,1,0,477,478,5,65,0,0,478,93,1,0,0,0,479,480,5,15,0,0,480,481,5,96,0,0,
+ 481,95,1,0,0,0,482,483,5,11,0,0,483,484,5,100,0,0,484,97,1,0,0,0,485,486,
+ 5,3,0,0,486,489,5,86,0,0,487,488,5,84,0,0,488,490,3,46,23,0,489,487,1,0,
+ 0,0,489,490,1,0,0,0,490,500,1,0,0,0,491,492,5,85,0,0,492,497,3,100,50,0,
+ 493,494,5,34,0,0,494,496,3,100,50,0,495,493,1,0,0,0,496,499,1,0,0,0,497,
+ 495,1,0,0,0,497,498,1,0,0,0,498,501,1,0,0,0,499,497,1,0,0,0,500,491,1,0,
+ 0,0,500,501,1,0,0,0,501,99,1,0,0,0,502,503,3,46,23,0,503,504,5,33,0,0,504,
+ 506,1,0,0,0,505,502,1,0,0,0,505,506,1,0,0,0,506,507,1,0,0,0,507,508,3,46,
+ 23,0,508,101,1,0,0,0,49,113,121,136,148,157,165,169,177,179,184,191,196,
+ 203,209,217,219,229,239,242,254,262,270,274,278,286,298,302,308,317,325,
+ 347,358,369,374,385,390,394,402,411,420,431,445,456,459,464,489,497,500,
+ 505];
private static __ATN: ATN;
public static get _ATN(): ATN {
@@ -3195,6 +3187,9 @@ export class SourceCommandContext extends ParserRuleContext {
public showCommand(): ShowCommandContext {
return this.getTypedRuleContext(ShowCommandContext, 0) as ShowCommandContext;
}
+ public metaCommand(): MetaCommandContext {
+ return this.getTypedRuleContext(MetaCommandContext, 0) as MetaCommandContext;
+ }
public get ruleIndex(): number {
return esql_parser.RULE_sourceCommand;
}
@@ -4272,33 +4267,6 @@ export class IdentifierPatternContext extends ParserRuleContext {
}
-export class IdPatternContext extends ParserRuleContext {
- constructor(parser?: esql_parser, parent?: ParserRuleContext, invokingState?: number) {
- super(parent, invokingState);
- this.parser = parser;
- }
- public UNQUOTED_ID_PATTERN(): TerminalNode {
- return this.getToken(esql_parser.UNQUOTED_ID_PATTERN, 0);
- }
- public QUOTED_IDENTIFIER(): TerminalNode {
- return this.getToken(esql_parser.QUOTED_IDENTIFIER, 0);
- }
- public get ruleIndex(): number {
- return esql_parser.RULE_idPattern;
- }
- public enterRule(listener: esql_parserListener): void {
- if(listener.enterIdPattern) {
- listener.enterIdPattern(this);
- }
- }
- public exitRule(listener: esql_parserListener): void {
- if(listener.exitIdPattern) {
- listener.exitIdPattern(this);
- }
- }
-}
-
-
export class ConstantContext extends ParserRuleContext {
constructor(parser?: esql_parser, parent?: ParserRuleContext, invokingState?: number) {
super(parent, invokingState);
@@ -5216,25 +5184,39 @@ export class ShowInfoContext extends ShowCommandContext {
}
}
}
-export class ShowFunctionsContext extends ShowCommandContext {
- constructor(parser: esql_parser, ctx: ShowCommandContext) {
+
+
+export class MetaCommandContext extends ParserRuleContext {
+ constructor(parser?: esql_parser, parent?: ParserRuleContext, invokingState?: number) {
+ super(parent, invokingState);
+ this.parser = parser;
+ }
+ public get ruleIndex(): number {
+ return esql_parser.RULE_metaCommand;
+ }
+ public copyFrom(ctx: MetaCommandContext): void {
+ super.copyFrom(ctx);
+ }
+}
+export class MetaFunctionsContext extends MetaCommandContext {
+ constructor(parser: esql_parser, ctx: MetaCommandContext) {
super(parser, ctx.parentCtx, ctx.invokingState);
super.copyFrom(ctx);
}
- public SHOW(): TerminalNode {
- return this.getToken(esql_parser.SHOW, 0);
+ public META(): TerminalNode {
+ return this.getToken(esql_parser.META, 0);
}
public FUNCTIONS(): TerminalNode {
return this.getToken(esql_parser.FUNCTIONS, 0);
}
public enterRule(listener: esql_parserListener): void {
- if(listener.enterShowFunctions) {
- listener.enterShowFunctions(this);
+ if(listener.enterMetaFunctions) {
+ listener.enterMetaFunctions(this);
}
}
public exitRule(listener: esql_parserListener): void {
- if(listener.exitShowFunctions) {
- listener.exitShowFunctions(this);
+ if(listener.exitMetaFunctions) {
+ listener.exitMetaFunctions(this);
}
}
}
diff --git a/packages/kbn-monaco/src/esql/antlr/esql_parser_listener.ts b/packages/kbn-esql-ast/src/antlr/esql_parser_listener.ts
similarity index 97%
rename from packages/kbn-monaco/src/esql/antlr/esql_parser_listener.ts
rename to packages/kbn-esql-ast/src/antlr/esql_parser_listener.ts
index d340b1176084d..fb3741dc94a8d 100644
--- a/packages/kbn-monaco/src/esql/antlr/esql_parser_listener.ts
+++ b/packages/kbn-esql-ast/src/antlr/esql_parser_listener.ts
@@ -1,5 +1,5 @@
// @ts-nocheck
-// Generated from src/esql/antlr/esql_parser.g4 by ANTLR 4.13.1
+// Generated from src/antlr/esql_parser.g4 by ANTLR 4.13.1
import {ParseTreeListener} from "antlr4";
@@ -42,7 +42,6 @@ import { QualifiedNameContext } from "./esql_parser";
import { QualifiedNamePatternContext } from "./esql_parser";
import { IdentifierContext } from "./esql_parser";
import { IdentifierPatternContext } from "./esql_parser";
-import { IdPatternContext } from "./esql_parser";
import { NullLiteralContext } from "./esql_parser";
import { QualifiedIntegerLiteralContext } from "./esql_parser";
import { DecimalLiteralContext } from "./esql_parser";
@@ -74,7 +73,7 @@ import { ComparisonOperatorContext } from "./esql_parser";
import { ExplainCommandContext } from "./esql_parser";
import { SubqueryExpressionContext } from "./esql_parser";
import { ShowInfoContext } from "./esql_parser";
-import { ShowFunctionsContext } from "./esql_parser";
+import { MetaFunctionsContext } from "./esql_parser";
import { EnrichCommandContext } from "./esql_parser";
import { EnrichWithClauseContext } from "./esql_parser";
@@ -498,16 +497,6 @@ export default class esql_parserListener extends ParseTreeListener {
* @param ctx the parse tree
*/
exitIdentifierPattern?: (ctx: IdentifierPatternContext) => void;
- /**
- * Enter a parse tree produced by `esql_parser.idPattern`.
- * @param ctx the parse tree
- */
- enterIdPattern?: (ctx: IdPatternContext) => void;
- /**
- * Exit a parse tree produced by `esql_parser.idPattern`.
- * @param ctx the parse tree
- */
- exitIdPattern?: (ctx: IdPatternContext) => void;
/**
* Enter a parse tree produced by the `nullLiteral`
* labeled alternative in `esql_parser.constant`.
@@ -841,17 +830,17 @@ export default class esql_parserListener extends ParseTreeListener {
*/
exitShowInfo?: (ctx: ShowInfoContext) => void;
/**
- * Enter a parse tree produced by the `showFunctions`
- * labeled alternative in `esql_parser.showCommand`.
+ * Enter a parse tree produced by the `metaFunctions`
+ * labeled alternative in `esql_parser.metaCommand`.
* @param ctx the parse tree
*/
- enterShowFunctions?: (ctx: ShowFunctionsContext) => void;
+ enterMetaFunctions?: (ctx: MetaFunctionsContext) => void;
/**
- * Exit a parse tree produced by the `showFunctions`
- * labeled alternative in `esql_parser.showCommand`.
+ * Exit a parse tree produced by the `metaFunctions`
+ * labeled alternative in `esql_parser.metaCommand`.
* @param ctx the parse tree
*/
- exitShowFunctions?: (ctx: ShowFunctionsContext) => void;
+ exitMetaFunctions?: (ctx: MetaFunctionsContext) => void;
/**
* Enter a parse tree produced by `esql_parser.enrichCommand`.
* @param ctx the parse tree
diff --git a/packages/kbn-monaco/src/esql/lib/monaco/esql_error_listener.ts b/packages/kbn-esql-ast/src/antlr_error_listener.ts
similarity index 75%
rename from packages/kbn-monaco/src/esql/lib/monaco/esql_error_listener.ts
rename to packages/kbn-esql-ast/src/antlr_error_listener.ts
index c6c68b6e73909..0bb2912e2d235 100644
--- a/packages/kbn-monaco/src/esql/lib/monaco/esql_error_listener.ts
+++ b/packages/kbn-esql-ast/src/antlr_error_listener.ts
@@ -7,10 +7,13 @@
*/
import type { Recognizer, RecognitionException } from 'antlr4';
-import { ANTLRErrorListener } from '../../../common/error_listener';
-import { getPosition } from '../ast/ast_position_utils';
+import { ErrorListener } from 'antlr4';
+import type { EditorError } from './types';
+import { getPosition } from './ast_position_utils';
+
+export class ESQLErrorListener extends ErrorListener {
+ protected errors: EditorError[] = [];
-export class ESQLErrorListener extends ANTLRErrorListener {
syntaxError(
recognizer: Recognizer,
offendingSymbol: any,
@@ -31,7 +34,11 @@ export class ESQLErrorListener extends ANTLRErrorListener {
startColumn,
endColumn,
message: textMessage,
- severity: 8, // monaco.MarkerSeverity.Error,
+ severity: 'error',
});
}
+
+ getErrors(): EditorError[] {
+ return this.errors;
+ }
}
diff --git a/packages/kbn-monaco/src/esql/lib/antlr_facade.ts b/packages/kbn-esql-ast/src/antlr_facade.ts
similarity index 86%
rename from packages/kbn-monaco/src/esql/lib/antlr_facade.ts
rename to packages/kbn-esql-ast/src/antlr_facade.ts
index a7a9fb2104938..ba35dc342552b 100644
--- a/packages/kbn-monaco/src/esql/lib/antlr_facade.ts
+++ b/packages/kbn-esql-ast/src/antlr_facade.ts
@@ -8,9 +8,9 @@
import { CommonTokenStream, type CharStream, type ErrorListener } from 'antlr4';
-import { default as ESQLLexer } from '../antlr/esql_lexer';
-import { default as ESQLParser } from '../antlr/esql_parser';
-import { default as ESQLParserListener } from '../antlr/esql_parser_listener';
+import { default as ESQLLexer } from './antlr/esql_lexer';
+import { default as ESQLParser } from './antlr/esql_parser';
+import { default as ESQLParserListener } from './antlr/esql_parser_listener';
export const ROOT_STATEMENT = 'singleStatement';
diff --git a/packages/kbn-monaco/src/esql/lib/ast/ast_errors.ts b/packages/kbn-esql-ast/src/ast_errors.ts
similarity index 100%
rename from packages/kbn-monaco/src/esql/lib/ast/ast_errors.ts
rename to packages/kbn-esql-ast/src/ast_errors.ts
diff --git a/packages/kbn-monaco/src/esql/lib/ast/ast_factory.ts b/packages/kbn-esql-ast/src/ast_factory.ts
similarity index 89%
rename from packages/kbn-monaco/src/esql/lib/ast/ast_factory.ts
rename to packages/kbn-esql-ast/src/ast_factory.ts
index c543cc9c52caa..48b9a055aec94 100644
--- a/packages/kbn-monaco/src/esql/lib/ast/ast_factory.ts
+++ b/packages/kbn-esql-ast/src/ast_factory.ts
@@ -9,7 +9,7 @@
import type { ErrorNode, ParserRuleContext, TerminalNode } from 'antlr4';
import {
type ShowInfoContext,
- type ShowFunctionsContext,
+ type MetaFunctionsContext,
type SingleStatementContext,
type RowCommandContext,
type FromCommandContext,
@@ -27,9 +27,16 @@ import {
type EnrichCommandContext,
type WhereCommandContext,
default as esql_parser,
-} from '../../antlr/esql_parser';
-import { default as ESQLParserListener } from '../../antlr/esql_parser_listener';
-import { createCommand, createFunction, createOption, createLiteral } from './ast_helpers';
+ type MetaCommandContext,
+} from './antlr/esql_parser';
+import { default as ESQLParserListener } from './antlr/esql_parser_listener';
+import {
+ createCommand,
+ createFunction,
+ createOption,
+ createLiteral,
+ textExistsAndIsValid,
+} from './ast_helpers';
import { getPosition } from './ast_position_utils';
import {
collectAllSourceIdentifiers,
@@ -64,7 +71,9 @@ export class AstListener implements ESQLParserListener {
this.ast.push(commandAst);
commandAst.text = ctx.getText();
- commandAst?.args.push(createFunction('info', ctx, getPosition(ctx.INFO().symbol)));
+ if (textExistsAndIsValid(ctx.INFO().getText())) {
+ commandAst?.args.push(createFunction('info', ctx, getPosition(ctx.INFO().symbol)));
+ }
}
/**
@@ -72,12 +81,14 @@ export class AstListener implements ESQLParserListener {
* labeled alternative in `esql_parser.showCommand`.
* @param ctx the parse tree
*/
- exitShowFunctions(ctx: ShowFunctionsContext) {
- const commandAst = createCommand('show', ctx);
+ exitMetaFunctions(ctx: MetaFunctionsContext) {
+ const commandAst = createCommand('meta', ctx);
this.ast.push(commandAst);
// update the text
commandAst.text = ctx.getText();
- commandAst?.args.push(createFunction('functions', ctx, getPosition(ctx.FUNCTIONS().symbol)));
+ if (textExistsAndIsValid(ctx.FUNCTIONS().getText())) {
+ commandAst?.args.push(createFunction('functions', ctx, getPosition(ctx.FUNCTIONS().symbol)));
+ }
}
/**
@@ -249,6 +260,15 @@ export class AstListener implements ESQLParserListener {
const command = createCommand('show', ctx);
this.ast.push(command);
}
+
+ /**
+ * Enter a parse tree produced by `esql_parser.metaCommand`.
+ * @param ctx the parse tree
+ */
+ enterMetaCommand(ctx: MetaCommandContext) {
+ const command = createCommand('meta', ctx);
+ this.ast.push(command);
+ }
/**
* Exit a parse tree produced by `esql_parser.enrichCommand`.
* @param ctx the parse tree
diff --git a/packages/kbn-monaco/src/esql/lib/ast/ast_helpers.ts b/packages/kbn-esql-ast/src/ast_helpers.ts
similarity index 97%
rename from packages/kbn-monaco/src/esql/lib/ast/ast_helpers.ts
rename to packages/kbn-esql-ast/src/ast_helpers.ts
index c339342a0718d..0f85e30b96c45 100644
--- a/packages/kbn-monaco/src/esql/lib/ast/ast_helpers.ts
+++ b/packages/kbn-esql-ast/src/ast_helpers.ts
@@ -16,9 +16,9 @@ import type {
DecimalValueContext,
IntegerValueContext,
QualifiedIntegerLiteralContext,
-} from '../../antlr/esql_parser';
+} from './antlr/esql_parser';
import { getPosition } from './ast_position_utils';
-import { DOUBLE_TICKS_REGEX, SINGLE_BACKTICK, TICKS_REGEX } from './shared/constants';
+import { DOUBLE_TICKS_REGEX, SINGLE_BACKTICK, TICKS_REGEX } from './constants';
import type {
ESQLCommand,
ESQLLiteral,
@@ -201,16 +201,13 @@ export function computeLocationExtends(fn: ESQLFunction) {
/* SCRIPT_MARKER_START */
function getQuotedText(ctx: ParserRuleContext) {
- return [66 /* esql_parser.QUOTED_IDENTIFIER */]
+ return [67 /* esql_parser.QUOTED_IDENTIFIER */]
.map((keyCode) => ctx.getToken(keyCode, 0))
.filter(nonNullable)[0];
}
function getUnquotedText(ctx: ParserRuleContext) {
- return [
- 65 /* esql_parser.UNQUOTED_IDENTIFIER */, 71 /* esql_parser.FROM_UNQUOTED_IDENTIFIER */,
- 105 /* esql_parser.UNQUOTED_ID_PATTERN */,
- ]
+ return [66 /* esql_parser.UNQUOTED_IDENTIFIER */, 72 /* esql_parser.FROM_UNQUOTED_IDENTIFIER */]
.map((keyCode) => ctx.getToken(keyCode, 0))
.filter(nonNullable)[0];
}
diff --git a/packages/kbn-esql-ast/src/ast_parser.ts b/packages/kbn-esql-ast/src/ast_parser.ts
new file mode 100644
index 0000000000000..4e7f8b3701729
--- /dev/null
+++ b/packages/kbn-esql-ast/src/ast_parser.ts
@@ -0,0 +1,29 @@
+/*
+ * 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 'antlr4';
+import { ESQLErrorListener } from './antlr_error_listener';
+import { getParser, ROOT_STATEMENT } from './antlr_facade';
+import { AstListener } from './ast_factory';
+import type { ESQLAst, EditorError } from './types';
+
+export async function getAstAndSyntaxErrors(text: string | undefined): Promise<{
+ errors: EditorError[];
+ ast: ESQLAst;
+}> {
+ if (text == null) {
+ return { ast: [], errors: [] };
+ }
+ const errorListener = new ESQLErrorListener();
+ const parseListener = new AstListener();
+ const parser = getParser(CharStreams.fromString(text), errorListener, parseListener);
+
+ parser[ROOT_STATEMENT]();
+
+ return { ...parseListener.getAst(), errors: errorListener.getErrors() };
+}
diff --git a/packages/kbn-monaco/src/esql/lib/ast/ast_position_utils.ts b/packages/kbn-esql-ast/src/ast_position_utils.ts
similarity index 100%
rename from packages/kbn-monaco/src/esql/lib/ast/ast_position_utils.ts
rename to packages/kbn-esql-ast/src/ast_position_utils.ts
diff --git a/packages/kbn-monaco/src/esql/lib/ast/ast_walker.ts b/packages/kbn-esql-ast/src/ast_walker.ts
similarity index 99%
rename from packages/kbn-monaco/src/esql/lib/ast/ast_walker.ts
rename to packages/kbn-esql-ast/src/ast_walker.ts
index f9976901cdd19..05393d7b07c16 100644
--- a/packages/kbn-monaco/src/esql/lib/ast/ast_walker.ts
+++ b/packages/kbn-esql-ast/src/ast_walker.ts
@@ -57,7 +57,7 @@ import {
type ValueExpressionContext,
ValueExpressionDefaultContext,
FromIdentifierContext,
-} from '../../antlr/esql_parser';
+} from './antlr/esql_parser';
import {
createSource,
createColumn,
@@ -499,7 +499,7 @@ export function visitByOption(ctx: StatsCommandContext, expr: FieldsContext | un
}
export function visitOrderExpression(ctx: OrderExpressionContext[]) {
- const ast = [];
+ const ast: ESQLAstItem[] = [];
for (const orderCtx of ctx) {
const expression = collectBooleanExpression(orderCtx.booleanExpression());
if (orderCtx._ordering) {
diff --git a/packages/kbn-monaco/src/esql/lib/ast/shared/constants.ts b/packages/kbn-esql-ast/src/constants.ts
similarity index 100%
rename from packages/kbn-monaco/src/esql/lib/ast/shared/constants.ts
rename to packages/kbn-esql-ast/src/constants.ts
diff --git a/packages/kbn-monaco/src/esql/lib/ast/types.ts b/packages/kbn-esql-ast/src/types.ts
similarity index 85%
rename from packages/kbn-monaco/src/esql/lib/ast/types.ts
rename to packages/kbn-esql-ast/src/types.ts
index 32057a9ee3b65..4bce46d776671 100644
--- a/packages/kbn-monaco/src/esql/lib/ast/types.ts
+++ b/packages/kbn-esql-ast/src/types.ts
@@ -6,8 +6,6 @@
* Side Public License, v 1.
*/
-import { EditorError } from '../../../types';
-
export type ESQLAst = ESQLCommand[];
export type ESQLSingleAstItem =
@@ -87,6 +85,17 @@ export interface ESQLMessage {
code: string;
}
-export type AstProviderFn = (
- text: string | undefined
-) => Promise<{ ast: ESQLAst; errors: EditorError[] }>;
+export type AstProviderFn = (text: string | undefined) => Promise<{
+ ast: ESQLAst;
+ errors: EditorError[];
+}>;
+
+export interface EditorError {
+ startLineNumber: number;
+ endLineNumber: number;
+ startColumn: number;
+ endColumn: number;
+ message: string;
+ code?: string;
+ severity: 'error' | 'warning' | number;
+}
diff --git a/packages/kbn-esql-ast/tsconfig.json b/packages/kbn-esql-ast/tsconfig.json
new file mode 100644
index 0000000000000..a53bf973e2373
--- /dev/null
+++ b/packages/kbn-esql-ast/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "target/types",
+ "types": [
+ "jest",
+ "node"
+ ]
+ },
+ "include": [
+ "src/**/*",
+ "**/*.ts",
+ ],
+ "kbn_references": [],
+ "exclude": [
+ "target/**/*",
+ ]
+}
diff --git a/packages/kbn-esql-utils/kibana.jsonc b/packages/kbn-esql-utils/kibana.jsonc
index 4dd00764681a5..959a5d947b2b8 100644
--- a/packages/kbn-esql-utils/kibana.jsonc
+++ b/packages/kbn-esql-utils/kibana.jsonc
@@ -1,5 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/esql-utils",
- "owner": "@elastic/kibana-visualizations"
+ "owner": "@elastic/kibana-esql"
}
diff --git a/packages/kbn-esql-validation-autocomplete/BUILD.bazel b/packages/kbn-esql-validation-autocomplete/BUILD.bazel
new file mode 100644
index 0000000000000..366eaa3d1a66f
--- /dev/null
+++ b/packages/kbn-esql-validation-autocomplete/BUILD.bazel
@@ -0,0 +1,33 @@
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+
+SRCS = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.mock.*",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/mocks/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SHARED_DEPS = [
+ "//packages/kbn-i18n",
+ "@npm//js-levenshtein",
+]
+
+js_library(
+ name = "kbn-esql-validation-autocomplete",
+ package_name = "@kbn/esql-validation-autocomplete",
+ srcs = ["package.json"] + SRCS,
+ deps = SHARED_DEPS,
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/kbn-esql-validation-autocomplete/README.md b/packages/kbn-esql-validation-autocomplete/README.md
new file mode 100644
index 0000000000000..e521bbe7839d7
--- /dev/null
+++ b/packages/kbn-esql-validation-autocomplete/README.md
@@ -0,0 +1,191 @@
+# ES|QL utility library
+
+## Folder structure
+
+This library enables all the advanced features for ES|QL, as validation, autocomplete, hover, etc...
+The package is structure as follow:
+
+```
+src
+ | autocomplete // => the autocomplete/suggest service logic
+ | code_actions // => the quick fixes service logic
+ | definitions // => static assets to define all components behaviour of a ES|QL query: commands, functions, etc...
+ | validation // => the validation logic
+```
+
+### Basic usage
+
+#### Validation
+
+This module contains the validation logic useful to perform a full check of an ES|QL query string.
+The validation service can be gracefully degraded leveraging the `ignoreOnMissingCallbacks` option when it is not possible to pass all callbacks: this is useful in environments where it is not possible to connect to a ES instance to retrieve more metadata, while preserving most of the validation value.
+For instance, not passing the `getSources` callback will report all index mentioned in the ES|QL with the `Unknown index [...]` error, but with the `ignoreOnMissingCallbacks` option enabled this type of errors will be muted.
+
+##### Usage
+
+```js
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+import { validateQuery } from '@kbn/esql-validation-autocomplete';
+
+// define all callbacks
+const myCallbacks = {
+ getSources: async () => [{name: 'index', hidden: false}],
+ ...
+};
+
+// Full validation performed
+const { errors, warnings } = await validateQuery("from index | stats 1 + avg(myColumn)", getAstAndSyntaxErrors, undefined, myCallbacks);
+```
+
+If not all callbacks are available it is possible to gracefully degradate the validation experience with the `ignoreOnMissingCallbacks` option:
+
+```js
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+import { validateQuery } from '@kbn/esql-validation-autocomplete';
+
+// define only the getSources callback
+const myCallbacks = {
+ getSources: async () => [{name: 'index', hidden: false}],
+};
+
+// ignore errors that might be triggered by the lack of some callbacks (i.e. "Unknown columns", etc...)
+const { errors, warnings } = await validateQuery(
+ "from index | stats 1 + avg(myColumn)",
+ getAstAndSyntaxErrors,
+ { ignoreOnMissingCallbacks: true },
+ myCallbacks
+);
+```
+
+#### Autocomplete
+
+This is the complete logic for the ES|QL autocomplete language, it is completely indepedent from the actual editor (i.e. Monaco) and the suggestions reported need to be wrapped against the specific editor shape.
+
+```js
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+import { suggest } from '@kbn/esql-validation-autocomplete';
+
+const queryString = "from index | stats 1 + avg(myColumn) ";
+const myCallbacks = {
+ getSources: async () => [{name: 'index', hidden: false}],
+ ...
+};
+
+const suggestions = await suggest(
+ queryString,
+ queryString.length - 1, // the cursor position in a single line context
+ { triggerCharacter: " "; triggerKind: 1 }, // kind = 0 is a programmatic trigger, while other values are ignored
+ getAstAndSyntaxErrors,
+ myCallbacks
+);
+
+// Log the actual text to be injected as suggestion
+console.log(suggestions.map(({text}) => text));
+
+// for Monaco editor it is required to map each suggestion with the editor specific type
+suggestions.map( s => ({
+ label: s.label,
+ insertText: s.text,
+ insertTextRules: asSnippet
+ ? monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
+ : undefined,
+ ...
+ }))
+```
+
+Note that the autocomplete service will work as best effort with invalid queries, trying to correct them on the fly before generating the suggestions. In case an invalid query cannot be handled an empty suggestion result set will be returned.
+
+#### Quick fixes
+
+This feature provides a list of suggestions to propose as fixes for a subset of validation errors.
+The feature works in combination with the validation service.
+
+```js
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+import { validateQuery, getActions } from '@kbn/esql-validation-autocomplete';
+
+const queryString = "from index2 | stats 1 + avg(myColumn)"
+
+const myCallbacks = {
+ getSources: async () => [{name: 'index', hidden: false}],
+ ...
+};
+const { errors, warnings } = await validateQuery(queryString, getAstAndSyntaxErrors, undefined, myCallbacks);
+
+const {title, edits} = await getActions(
+ queryString,
+ errors,
+ getAstAndSyntaxErrors,
+ myCallbacks
+);
+
+// log the title of the fix suggestion and the proposed change
+// in this example it should suggest to change from "index2" to "index"
+console.log({ title, edits });
+```
+
+### getAstContext
+
+This is an important function in order to build more features on top of the existing one.
+For instance to show contextual information on Hover the `getAstContext` function can be leveraged to get the correct context for the cursor position:
+
+```js
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
+import { getAstContext } from '@kbn/esql-validation-autocomplete';
+
+const queryString = "from index2 | stats 1 + avg(myColumn)";
+const offset = queryString.indexOf("avg");
+
+const astContext = getAstContext(queryString, getAstAndSyntaxErrors(queryString), offset);
+
+if(astContext.type === "function"){
+ const fnNode = astContext.node;
+ const fnDefinition = getFunctionDefinition(fnNode.name);
+
+ // show something like "avg( field: number ): number"
+ console.log(getFunctionSignature(fnDefinition));
+}
+```
+
+
+### How does it work
+
+The general idea of this package is to provide all ES|QL features on top of a custom compact AST definition (all data structure types defined in `@kbn/esql-ast`) which is designed to be resilient to many grammar changes.
+The pipeline is the following:
+
+```
+Antlr grammar files
+=> Compiled grammar files (.ts assets in the antlr folder)
+=> AST Factory (Antlr Parser tree => custom AST)
+=> featureFn( AST, Definitions, ESQLCallbacks )
+```
+
+Each feature function works with the combination of the AST and the definition files: the former describe the current statement in a easy to traverse way, while the definitions describe what's the expected behaviour of each node in the AST node (i.e. what arguments should it accept? How many arguments? etc...).
+ESQLCallbacks are a set of utilities to retrieve context metadata like fields/index/policies list and policies metadata.
+
+While AST requires the grammar to be compiled to be updated, definitions are static files which can be dynamically updated without running the ANTLR compile task.
+
+#### Validation
+
+Validation takes an AST as input and generates a list of messages to show to the user.
+The validation function leverages the definition files to check if the current AST is respecting the defined behaviour.
+Most of the logic rely purely on the definitions, but in some specific cases some ad-hoc conditions are defined within the code for specific commands/options.
+The validation test suite generates a set of fixtures at the end of its execution, which are then re-used for other test suites (i.e. some FTR integration tests) as `esql_validation_meta_tests.json`.
+
+#### Autocomplete
+
+The autocomplete/suggest task takes a query as input together with the current cursor position, then produces internally an AST to work with, to generate a list of suggestions for the given query.
+Note that autocomplete works most of the time with incomplete/invalid queries, so some logic to manipulate the query into something valid (see the `EDITOR_MARKER` or the `countBracketsUnclosed` functions for more).
+
+Once the AST is produced there's a `getAstContext` function that finds the cursor position node (and its parent command), together with some hint like the type of current context: `expression`, `function`, `newCommand`, `option`.
+The most complex case is the `expression` as it can cover a moltitude of cases. The function is highly commented in order to identify the specific cases, but there's probably some obscure area still to comment/clarify.
+
+### Adding new commands/options/functions/erc...
+
+To update the definitions:
+1. open either approriate definition file within the `definitions` folder and add a new entry to the relative array
+2. write new tests for validation and autocomplete
+ * if a new function is added tests are automatically generated fro both validation and autocomplete with some standard checks
+ * if a new function requires a new field types, make sure to add the new type to the initial part of the test file
+ * this will be automatically picked up by the test generator to produce new test cases
+ * if a new function requires a new type of test, make sure to write it manually
\ No newline at end of file
diff --git a/packages/kbn-esql-validation-autocomplete/index.ts b/packages/kbn-esql-validation-autocomplete/index.ts
new file mode 100644
index 0000000000000..ade1b1fd9f73b
--- /dev/null
+++ b/packages/kbn-esql-validation-autocomplete/index.ts
@@ -0,0 +1,76 @@
+/*
+ * 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 type { SuggestionRawDefinition, ItemKind } from './src/autocomplete/types';
+export type { CodeAction } from './src/code_actions/types';
+export type {
+ FunctionDefinition,
+ CommandDefinition,
+ CommandOptionsDefinition,
+ CommandModeDefinition,
+ Literals,
+} from './src/definitions/types';
+export type { ESQLCallbacks } from './src/shared/types';
+
+/**
+ * High level functions
+ */
+
+// Given an the query string, its AST and the cursor position, it returns the node and some context information
+export { getAstContext } from './src/shared/context';
+// Validation function
+export { validateQuery } from './src/validation/validation';
+// Autocomplete function
+export { suggest } from './src/autocomplete/autocomplete';
+// Quick fixes function
+export { getActions } from './src/code_actions/actions';
+
+/**
+ * Some utility functions that can be useful to build more feature
+ * for the ES|QL language
+ */
+export type {
+ ValidationErrors,
+ ESQLVariable,
+ ESQLRealField,
+ ESQLPolicy,
+ ErrorTypes as ESQLValidationErrorTypes,
+} from './src/validation/types';
+export { collectVariables } from './src/shared/variables';
+export {
+ getAllFunctions,
+ isSupportedFunction,
+ getFunctionDefinition,
+ getCommandDefinition,
+ getAllCommands,
+ getCommandOption,
+ getColumnHit,
+ columnExists,
+ shouldBeQuotedText,
+ printFunctionSignature,
+ isEqualType,
+ isSourceItem,
+ isSettingItem,
+ isFunctionItem,
+ isOptionItem,
+ isColumnItem,
+ isLiteralItem,
+ isTimeIntervalItem,
+ isAssignment,
+ isExpression,
+ isAssignmentComplete,
+ isSingleItem,
+} from './src/shared/helpers';
+export { ENRICH_MODES } from './src/definitions/settings';
+export { getFunctionSignatures } from './src/definitions/helpers';
+
+export {
+ getFieldsByTypeHelper,
+ getPolicyHelper,
+ getSourcesHelper,
+} from './src/shared/resources_helpers';
diff --git a/packages/kbn-esql-validation-autocomplete/jest.config.js b/packages/kbn-esql-validation-autocomplete/jest.config.js
new file mode 100644
index 0000000000000..a9f9d1421b634
--- /dev/null
+++ b/packages/kbn-esql-validation-autocomplete/jest.config.js
@@ -0,0 +1,13 @@
+/*
+ * 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.
+ */
+
+module.exports = {
+ preset: '@kbn/test',
+ rootDir: '../..',
+ roots: ['/packages/kbn-esql-validation-autocomplete'],
+};
diff --git a/packages/kbn-esql-validation-autocomplete/kibana.jsonc b/packages/kbn-esql-validation-autocomplete/kibana.jsonc
new file mode 100644
index 0000000000000..b7c1d12d48cd1
--- /dev/null
+++ b/packages/kbn-esql-validation-autocomplete/kibana.jsonc
@@ -0,0 +1,5 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/esql-validation-autocomplete",
+ "owner": "@elastic/kibana-esql"
+ }
\ No newline at end of file
diff --git a/packages/kbn-esql-validation-autocomplete/package.json b/packages/kbn-esql-validation-autocomplete/package.json
new file mode 100644
index 0000000000000..1589e4aaba238
--- /dev/null
+++ b/packages/kbn-esql-validation-autocomplete/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "@kbn/esql-validation-autocomplete",
+ "version": "1.0.0",
+ "private": true,
+ "license": "SSPL-1.0 OR Elastic License 2.0",
+ "sideEffects": false
+ }
\ No newline at end of file
diff --git a/packages/kbn-monaco/src/esql/lib/ast/autocomplete/autocomplete.test.ts b/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts
similarity index 94%
rename from packages/kbn-monaco/src/esql/lib/ast/autocomplete/autocomplete.test.ts
rename to packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts
index 38f26de275577..b31ca967c55fb 100644
--- a/packages/kbn-monaco/src/esql/lib/ast/autocomplete/autocomplete.test.ts
+++ b/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts
@@ -6,12 +6,7 @@
* Side Public License, v 1.
*/
-import { monaco } from '../../../../monaco_imports';
-import { CharStreams } from 'antlr4';
import { suggest } from './autocomplete';
-import { getParser, ROOT_STATEMENT } from '../../antlr_facade';
-import { ESQLErrorListener } from '../../monaco/esql_error_listener';
-import { AstListener } from '../ast_factory';
import { evalFunctionsDefinitions } from '../definitions/functions';
import { builtinFunctions } from '../definitions/builtin';
import { statsAggregationFunctionDefinitions } from '../definitions/aggs';
@@ -19,6 +14,7 @@ import { chronoLiterals, timeLiterals } from '../definitions/literals';
import { commandDefinitions } from '../definitions/commands';
import { TRIGGER_SUGGESTION_COMMAND } from './factories';
import { camelCase } from 'lodash';
+import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
const triggerCharacters = [',', '(', '=', ' '];
@@ -180,13 +176,6 @@ function createCustomCallbackMocks(
};
}
-function createModelAndPosition(text: string, offset: number) {
- return {
- model: { getValue: () => text } as monaco.editor.ITextModel,
- position: { lineNumber: 1, column: offset } as monaco.Position,
- };
-}
-
function createSuggestContext(text: string, triggerCharacter?: string) {
if (triggerCharacter) {
return { triggerCharacter, triggerKind: 1 }; // any number is fine here
@@ -209,16 +198,6 @@ function getPolicyFields(policyName: string) {
}
describe('autocomplete', () => {
- const getAstAndErrors = async (text: string) => {
- const errorListener = new ESQLErrorListener();
- const parseListener = new AstListener();
- const parser = getParser(CharStreams.fromString(text), errorListener, parseListener);
-
- parser[ROOT_STATEMENT]();
-
- return { ...parseListener.getAst(), errors: [] };
- };
-
type TestArgs = [
string,
string[],
@@ -244,7 +223,7 @@ describe('autocomplete', () => {
const context = createSuggestContext(statement, triggerCharacterString);
const offset =
typeof triggerCharacter === 'string'
- ? statement.lastIndexOf(context.triggerCharacter) + 2
+ ? statement.lastIndexOf(context.triggerCharacter) + 1
: triggerCharacter;
const testFn = only ? test.only : skip ? test.skip : test;
@@ -254,20 +233,20 @@ describe('autocomplete', () => {
)}"]`,
async () => {
const callbackMocks = createCustomCallbackMocks(...customCallbacksArgs);
- const { model, position } = createModelAndPosition(statement, offset);
const suggestions = await suggest(
- model,
- position,
+ statement,
+ offset,
context,
- async (text) => (text ? await getAstAndErrors(text) : { ast: [], errors: [] }),
+ async (text) => (text ? await getAstAndSyntaxErrors(text) : { ast: [], errors: [] }),
callbackMocks
);
- expect(
- suggestions
- // simulate the editor behaviour for sorting suggestions
- .sort((a, b) => (a.sortText || '').localeCompare(b.sortText || ''))
- .map((i) => i.insertText)
- ).toEqual(expected);
+ const suggestionInertTextSorted = suggestions
+ // simulate the editor behaviour for sorting suggestions
+ .sort((a, b) => (a.sortText || '').localeCompare(b.sortText || ''))
+ .map((i) => i.text);
+ for (const [index, receivedSuggestion] of suggestionInertTextSorted.entries()) {
+ expect(receivedSuggestion).toEqual(expected[index]);
+ }
}
);
};
@@ -340,20 +319,27 @@ describe('autocomplete', () => {
testSuggestions('from a,', suggestedIndexes);
testSuggestions('from a, b ', ['metadata $0', ',', '|']);
testSuggestions('from *,', suggestedIndexes);
- testSuggestions('from index', suggestedIndexes, 6 /* index index in from */);
- testSuggestions('from a, b [metadata ]', ['_index', '_score'], 20);
- testSuggestions('from a, b metadata ', ['_index', '_score'], 19);
- testSuggestions('from a, b [metadata _index, ]', ['_score'], 27);
- testSuggestions('from a, b metadata _index, ', ['_score'], 26);
+ testSuggestions('from index', suggestedIndexes, 5 /* space before index */);
+ testSuggestions('from a, b [metadata ]', ['_index', '_score'], ' ]');
+ testSuggestions('from a, b metadata ', ['_index', '_score'], ' ');
+ testSuggestions('from a, b [metadata _index, ]', ['_score'], ' ]');
+ testSuggestions('from a, b metadata _index, ', ['_score'], ' ');
});
describe('show', () => {
- testSuggestions('show ', ['functions', 'info']);
- for (const fn of ['functions', 'info']) {
+ testSuggestions('show ', ['info']);
+ for (const fn of ['info']) {
testSuggestions(`show ${fn} `, ['|']);
}
});
+ describe('meta', () => {
+ testSuggestions('meta ', ['functions']);
+ for (const fn of ['functions']) {
+ testSuggestions(`meta ${fn} `, ['|']);
+ }
+ });
+
describe('where', () => {
const allEvalFns = getFunctionSignaturesByReturnType('where', 'any', {
evalMath: true,
@@ -638,7 +624,7 @@ describe('autocomplete', () => {
evalMath: true,
}),
],
- 32
+ '('
);
testSuggestions('from a | eval var0=round(b), var1=round(c) | stats ', [
@@ -650,18 +636,14 @@ describe('autocomplete', () => {
]);
// smoke testing with suggestions not at the end of the string
- testSuggestions(
- 'from a | stats a = min(b) | sort b',
- ['by $0', ',', '|'],
- 27 /* " " after min(b) */
- );
+ testSuggestions('from a | stats a = min(b) | sort b', ['by $0', ',', '|'], ') ');
testSuggestions(
'from a | stats avg(b) by stringField',
[
...getFieldNamesByType('number'),
...getFunctionSignaturesByReturnType('eval', 'number', { evalMath: true }),
],
- 21 /* b column in avg */
+ '(b'
);
// while nested functions are not suggested, complete them should be possible via suggestions
@@ -705,7 +687,7 @@ describe('autocomplete', () => {
'round',
]),
],
- 27
+ '('
);
testSuggestions(
'from a | stats avg(round(',
@@ -715,7 +697,7 @@ describe('autocomplete', () => {
'round',
]),
],
- 26
+ '('
);
testSuggestions(
'from a | stats avg(',
@@ -733,7 +715,7 @@ describe('autocomplete', () => {
'round',
]),
],
- 26
+ '('
);
});
@@ -1152,12 +1134,11 @@ describe('autocomplete', () => {
const statement = 'from a | drop stringField | eval var0 = abs(numberField) ';
const triggerOffset = statement.lastIndexOf(' ');
const context = createSuggestContext(statement, statement[triggerOffset]);
- const { model, position } = createModelAndPosition(statement, triggerOffset + 2);
await suggest(
- model,
- position,
+ statement,
+ triggerOffset + 1,
context,
- async (text) => (text ? await getAstAndErrors(text) : { ast: [], errors: [] }),
+ async (text) => (text ? await getAstAndSyntaxErrors(text) : { ast: [], errors: [] }),
callbackMocks
);
expect(callbackMocks.getFieldsFor).toHaveBeenCalledWith({
@@ -1169,12 +1150,11 @@ describe('autocomplete', () => {
const statement = 'from a | drop | eval var0 = abs(numberField) ';
const triggerOffset = statement.lastIndexOf('p') + 1; // drop
const context = createSuggestContext(statement, statement[triggerOffset]);
- const { model, position } = createModelAndPosition(statement, triggerOffset + 2);
await suggest(
- model,
- position,
+ statement,
+ triggerOffset + 1,
context,
- async (text) => (text ? await getAstAndErrors(text) : { ast: [], errors: [] }),
+ async (text) => (text ? await getAstAndSyntaxErrors(text) : { ast: [], errors: [] }),
callbackMocks
);
expect(callbackMocks.getFieldsFor).toHaveBeenCalledWith({ query: 'from a' });
@@ -1186,12 +1166,11 @@ describe('autocomplete', () => {
const callbackMocks = createCustomCallbackMocks(undefined, undefined, undefined);
const triggerOffset = statement.lastIndexOf(' ') + 1; // drop
const context = createSuggestContext(statement, statement[triggerOffset]);
- const { model, position } = createModelAndPosition(statement, triggerOffset + 2);
return suggest(
- model,
- position,
+ statement,
+ triggerOffset + 1,
context,
- async (text) => (text ? await getAstAndErrors(text) : { ast: [], errors: [] }),
+ async (text) => (text ? await getAstAndSyntaxErrors(text) : { ast: [], errors: [] }),
callbackMocks
);
}
@@ -1200,12 +1179,14 @@ describe('autocomplete', () => {
// test that all functions will retrigger suggestions
expect(
suggestions
- .filter(({ kind }) => kind === 1)
+ .filter(({ kind }) => kind === 'Function')
.every(({ command }) => command === TRIGGER_SUGGESTION_COMMAND)
).toBeTruthy();
// now test that non-function won't retrigger
expect(
- suggestions.filter(({ kind }) => kind !== 1).every(({ command }) => command == null)
+ suggestions
+ .filter(({ kind }) => kind !== 'Function')
+ .every(({ command }) => command == null)
).toBeTruthy();
});
it('should trigger further suggestions for commands', async () => {
diff --git a/packages/kbn-monaco/src/esql/lib/ast/autocomplete/autocomplete.ts b/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.ts
similarity index 97%
rename from packages/kbn-monaco/src/esql/lib/ast/autocomplete/autocomplete.ts
rename to packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.ts
index e43169c6adb78..84c5f59f49c31 100644
--- a/packages/kbn-monaco/src/esql/lib/ast/autocomplete/autocomplete.ts
+++ b/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.ts
@@ -7,9 +7,15 @@
*/
import uniqBy from 'lodash/uniqBy';
-import type { monaco } from '../../../../monaco_imports';
-import type { AutocompleteCommandDefinition } from './types';
-import { nonNullable } from '../ast_helpers';
+import type {
+ AstProviderFn,
+ ESQLAstItem,
+ ESQLCommand,
+ ESQLCommandOption,
+ ESQLFunction,
+ ESQLSingleAstItem,
+} from '@kbn/esql-ast';
+import type { EditorContext, SuggestionRawDefinition } from './types';
import {
columnExists,
getColumnHit,
@@ -32,19 +38,11 @@ import {
isSettingItem,
isSourceItem,
isTimeIntervalItem,
- monacoPositionToOffset,
getAllFunctions,
isSingleItem,
+ nonNullable,
} from '../shared/helpers';
import { collectVariables, excludeVariablesFromCurrentCommand } from '../shared/variables';
-import type {
- AstProviderFn,
- ESQLAstItem,
- ESQLCommand,
- ESQLCommandOption,
- ESQLFunction,
- ESQLSingleAstItem,
-} from '../types';
import type { ESQLPolicy, ESQLRealField, ESQLVariable, ReferenceMaps } from '../validation/types';
import {
colonCompleteItem,
@@ -82,13 +80,13 @@ import {
import { ESQLCallbacks } from '../shared/types';
import { getFunctionsToIgnoreForStats, isAggFunctionUsedAlready } from './helper';
-type GetSourceFn = () => Promise;
+type GetSourceFn = () => Promise;
type GetFieldsByTypeFn = (
type: string | string[],
ignored?: string[]
-) => Promise;
+) => Promise;
type GetFieldsMapFn = () => Promise