diff --git a/.ci/teamcity/tests/xpack_list_cyclic_dependency.sh b/.ci/teamcity/tests/xpack_list_cyclic_dependency.sh deleted file mode 100755 index 39f79f94744c7..0000000000000 --- a/.ci/teamcity/tests/xpack_list_cyclic_dependency.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -source "$(dirname "${0}")/../util.sh" - -cd x-pack -checks-reporter-with-killswitch "X-Pack List cyclic dependency test" node plugins/lists/scripts/check_circular_deps diff --git a/.ci/teamcity/tests/xpack_siem_cyclic_dependency.sh b/.ci/teamcity/tests/xpack_siem_cyclic_dependency.sh deleted file mode 100755 index e3829c961fac8..0000000000000 --- a/.ci/teamcity/tests/xpack_siem_cyclic_dependency.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -source "$(dirname "${0}")/../util.sh" - -cd x-pack -checks-reporter-with-killswitch "X-Pack SIEM cyclic dependency test" node plugins/security_solution/scripts/check_circular_deps diff --git a/.eslintignore b/.eslintignore index 1d58aff7c6a82..c7f0b9640f869 100644 --- a/.eslintignore +++ b/.eslintignore @@ -44,3 +44,4 @@ snapshots.js /packages/kbn-ui-framework/doc_site/build /packages/kbn-ui-framework/generator-kui/*/templates/ /packages/kbn-ui-shared-deps/flot_charts +/packages/kbn-monaco/src/painless/antlr diff --git a/.teamcity/src/builds/test/QuickTests.kt b/.teamcity/src/builds/test/QuickTests.kt index 1fdb1e366e83f..cca10cc3f2aa2 100644 --- a/.teamcity/src/builds/test/QuickTests.kt +++ b/.teamcity/src/builds/test/QuickTests.kt @@ -13,8 +13,6 @@ object QuickTests : BuildType({ val testScripts = mapOf( "Test Hardening" to ".ci/teamcity/tests/test_hardening.sh", - "X-Pack List cyclic dependency" to ".ci/teamcity/tests/xpack_list_cyclic_dependency.sh", - "X-Pack SIEM cyclic dependency" to ".ci/teamcity/tests/xpack_siem_cyclic_dependency.sh", "Test Projects" to ".ci/teamcity/tests/test_projects.sh", "Mocha Tests" to ".ci/teamcity/tests/mocha.sh" ) diff --git a/docs/developer/getting-started/debugging.asciidoc b/docs/developer/getting-started/debugging.asciidoc index a3fb12ec1f6a3..5ddc5dbb861b7 100644 --- a/docs/developer/getting-started/debugging.asciidoc +++ b/docs/developer/getting-started/debugging.asciidoc @@ -15,7 +15,17 @@ For information about how to debug unit tests, refer to <> https://github.com/elastic/apm-agent-nodejs[Elastic APM Node.js Agent] built-in for debugging purposes. -Its default configuration is meant to be used by core {kib} developers +With an application as varied and complex as Kibana has become, it's not practical or scalable to craft all possible performance measurements by hand ahead of time. As such, we need to rely on tooling to help us catch things we may otherwise have missed. + +For example, say you implement a brand new feature, plugin or service but don't quite know how it will impact Kibana's performance as a whole. APM allows us to not only spot that something is slow, but also hints at why it might be performing slowly. For example, if a function is slow on specific types of inputs, we can see where the time is spent by viewing the trace for that function call in the APM UI. + +image::images/apm_example_trace.png[] + +The net of metrics captured by APM are both a wide and deep because the entire application is instrumented at runtime and we simply take a sample of these metrics. This means that we don't have to know what we need to measure ahead of time, we'll instead just get (most) of the data we're likely going to need by default. + +This type of data can help us identify unknown bottlenecks, spot when a performance regression may have been introduced, and inform how the performance of Kibana is changing between releases. Using APM allows us to be proactive in getting ahead of potential performance regressions before they are released. + +The default APM configuration is meant to be used by core {kib} developers only, but it can easily be re-configured to your needs. In its default configuration it’s disabled and will, once enabled, send APM data to a centrally managed {es} cluster accessible only to Elastic @@ -27,11 +37,8 @@ APM config option. To activate the APM agent, use the https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#active[`active`] APM config option. -All config options can be set either via environment variables, or by -creating an appropriate config file under `config/apm.dev.js`. For -more information about configuring the APM agent, please refer to -https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuring-the-agent.html[the -documentation]. +All config options can be set by +creating an appropriate config file under `config/apm.dev.js`. Example `config/apm.dev.js` file: @@ -56,4 +63,70 @@ ELASTIC_APM_ACTIVE=true yarn start Once the agent is active, it will trace all incoming HTTP requests to {kib}, monitor for errors, and collect process-level metrics. The collected data will be sent to the APM Server and is viewable in the APM -UI in {kib}. \ No newline at end of file +UI in {kib}. + +[discrete] +=== Running Kibana with the APM Agent Locally + +The easiest and recommended way of running Kibana with the APM agent locally is to use the solution provided by the https://github.com/elastic/apm-integration-testing[apm-integration-testing] repo. You’ll need https://www.docker.com/community-edition[Docker] and https://docs.docker.com/compose/install/[Docker Compose] to use the tool. + +[discrete] +==== Quick start guide + +. Clone the https://github.com/elastic/apm-integration-testing[elastic/apm-integration-testing] repo. +. Change into the apm-integration-testing repo: ++ +[source,bash] +---- +cd apm-integration-testing +---- + +. Run {es} and the APM servers without running Kibana: ++ +[source,bash] +---- +./scripts/compose.py start master --no-kibana +---- + +. Change into the {kib} repo: ++ +[source,bash] +---- +cd ../kibana +---- + +. Change the elasticsearch credentials in your `kibana.yml` configuration file to match those needed by elasticsearch and the APM server (see the apm-integration-testing repo's https://github.com/elastic/apm-integration-testing#logging-in[README] for users provided to test different scenarios). +. Make sure that the APM agent is active and points to the local APM server by adding the following configuration settings to to a config file under `config/apm.dev.js`: ++ +Example `config/apm.dev.js` file: ++ +[source,js] +---- +module.exports = { + active: true, + serverUrl: 'http://127.0.0.1:8200', // supports `http://localhost:8200` + centralConfig: false, + breakdownMetrics: false, + transactionSampleRate: 0.1, + metricsInterval: '120s' +}; +---- + +. Start Kibana with APM active using: ++ +[source,bash] +---- +yarn start +---- + +. After Kibana starts up, navigate to the APM app, where you should see some transactions. + +image::images/apm_ui_transactions.png[] + +You can now continue doing what you want to in Kibana (e.g. install sample data sets, issue queries in dashboards, build new visualizations etc). +Once you're finished, you can stop Kibana normally, then stop the {es} and APM servers in the apm-integration-testing clone with the following script: + +[source,bash] +---- +./scripts/compose.py stop +---- diff --git a/docs/developer/images/apm_example_trace.png b/docs/developer/images/apm_example_trace.png new file mode 100644 index 0000000000000..ec29f72e0b70a Binary files /dev/null and b/docs/developer/images/apm_example_trace.png differ diff --git a/docs/developer/images/apm_ui_transactions.png b/docs/developer/images/apm_ui_transactions.png new file mode 100644 index 0000000000000..b2ee4d4b5ef66 Binary files /dev/null and b/docs/developer/images/apm_ui_transactions.png differ diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md index 9da31bb16b56b..fde40cca38fa2 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md @@ -101,6 +101,12 @@ readonly links: { readonly dateMath: string; }; readonly management: Record; + readonly ml: { + readonly guide: string; + readonly anomalyDetection: string; + readonly anomalyDetectionJobs: string; + readonly dataFrameAnalytics: string; + }; readonly visualize: Record; }; ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md index 01504aafe3bae..46437f7ccdc21 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md @@ -17,5 +17,5 @@ export interface DocLinksStart | --- | --- | --- | | [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string | | | [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string | | -| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly addData: string;
readonly kibana: string;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
readonly visualize: Record<string, string>;
} | | +| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly addData: string;
readonly kibana: string;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
readonly ml: {
readonly guide: string;
readonly anomalyDetection: string;
readonly anomalyDetectionJobs: string;
readonly dataFrameAnalytics: string;
};
readonly visualize: Record<string, string>;
} | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.deletefieldformat.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.deletefieldformat.md index 26276a809a613..3ef42968d85cd 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.deletefieldformat.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.deletefieldformat.md @@ -7,5 +7,5 @@ Signature: ```typescript -deleteFieldFormat: (fieldName: string) => void; +readonly deleteFieldFormat: (fieldName: string) => void; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md index 6bd2cbc24283f..179148265e68d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md @@ -59,5 +59,8 @@ export declare class IndexPattern implements IIndexPattern | [isTimeBased()](./kibana-plugin-plugins-data-public.indexpattern.istimebased.md) | | | | [isTimeNanosBased()](./kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md) | | | | [removeScriptedField(fieldName)](./kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md) | | Remove scripted field from field list | +| [setFieldAttrs(fieldName, attrName, value)](./kibana-plugin-plugins-data-public.indexpattern.setfieldattrs.md) | | | +| [setFieldCount(fieldName, count)](./kibana-plugin-plugins-data-public.indexpattern.setfieldcount.md) | | | +| [setFieldCustomLabel(fieldName, customLabel)](./kibana-plugin-plugins-data-public.indexpattern.setfieldcustomlabel.md) | | | | [toSpec()](./kibana-plugin-plugins-data-public.indexpattern.tospec.md) | | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldattrs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldattrs.md new file mode 100644 index 0000000000000..034081be71cb7 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldattrs.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [setFieldAttrs](./kibana-plugin-plugins-data-public.indexpattern.setfieldattrs.md) + +## IndexPattern.setFieldAttrs() method + +Signature: + +```typescript +protected setFieldAttrs(fieldName: string, attrName: K, value: FieldAttrSet[K]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | | +| attrName | K | | +| value | FieldAttrSet[K] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldcount.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldcount.md new file mode 100644 index 0000000000000..c0783a6b13270 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldcount.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [setFieldCount](./kibana-plugin-plugins-data-public.indexpattern.setfieldcount.md) + +## IndexPattern.setFieldCount() method + +Signature: + +```typescript +setFieldCount(fieldName: string, count: number | undefined | null): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | | +| count | number | undefined | null | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldcustomlabel.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldcustomlabel.md new file mode 100644 index 0000000000000..174041ba9736a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldcustomlabel.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [setFieldCustomLabel](./kibana-plugin-plugins-data-public.indexpattern.setfieldcustomlabel.md) + +## IndexPattern.setFieldCustomLabel() method + +Signature: + +```typescript +setFieldCustomLabel(fieldName: string, customLabel: string | undefined | null): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | | +| customLabel | string | undefined | null | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldformat.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldformat.md index 9774fc8c7308c..1a705659e8c43 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldformat.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.setfieldformat.md @@ -7,5 +7,5 @@ Signature: ```typescript -setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; +readonly setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.deletecount.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.deletecount.md new file mode 100644 index 0000000000000..015894d4cdd25 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.deletecount.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [deleteCount](./kibana-plugin-plugins-data-public.indexpatternfield.deletecount.md) + +## IndexPatternField.deleteCount() method + +Signature: + +```typescript +deleteCount(): void; +``` +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md index caf7d374161dd..c8118770ed394 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -43,6 +43,7 @@ export declare class IndexPatternField implements IFieldType | Method | Modifiers | Description | | --- | --- | --- | +| [deleteCount()](./kibana-plugin-plugins-data-public.indexpatternfield.deletecount.md) | | | | [toJSON()](./kibana-plugin-plugins-data-public.indexpatternfield.tojson.md) | | | | [toSpec({ getFormatterForField, })](./kibana-plugin-plugins-data-public.indexpatternfield.tospec.md) | | | diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.deletefieldformat.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.deletefieldformat.md index 4bfda56527474..9f580b2e3b48b 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.deletefieldformat.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.deletefieldformat.md @@ -7,5 +7,5 @@ Signature: ```typescript -deleteFieldFormat: (fieldName: string) => void; +readonly deleteFieldFormat: (fieldName: string) => void; ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.md index e5e2dfd0999db..b2cb217fecaa2 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.md @@ -59,5 +59,8 @@ export declare class IndexPattern implements IIndexPattern | [isTimeBased()](./kibana-plugin-plugins-data-server.indexpattern.istimebased.md) | | | | [isTimeNanosBased()](./kibana-plugin-plugins-data-server.indexpattern.istimenanosbased.md) | | | | [removeScriptedField(fieldName)](./kibana-plugin-plugins-data-server.indexpattern.removescriptedfield.md) | | Remove scripted field from field list | +| [setFieldAttrs(fieldName, attrName, value)](./kibana-plugin-plugins-data-server.indexpattern.setfieldattrs.md) | | | +| [setFieldCount(fieldName, count)](./kibana-plugin-plugins-data-server.indexpattern.setfieldcount.md) | | | +| [setFieldCustomLabel(fieldName, customLabel)](./kibana-plugin-plugins-data-server.indexpattern.setfieldcustomlabel.md) | | | | [toSpec()](./kibana-plugin-plugins-data-server.indexpattern.tospec.md) | | | diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldattrs.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldattrs.md new file mode 100644 index 0000000000000..91da8ee14c230 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldattrs.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPattern](./kibana-plugin-plugins-data-server.indexpattern.md) > [setFieldAttrs](./kibana-plugin-plugins-data-server.indexpattern.setfieldattrs.md) + +## IndexPattern.setFieldAttrs() method + +Signature: + +```typescript +protected setFieldAttrs(fieldName: string, attrName: K, value: FieldAttrSet[K]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | | +| attrName | K | | +| value | FieldAttrSet[K] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldcount.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldcount.md new file mode 100644 index 0000000000000..f7d6d21c00ef0 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldcount.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPattern](./kibana-plugin-plugins-data-server.indexpattern.md) > [setFieldCount](./kibana-plugin-plugins-data-server.indexpattern.setfieldcount.md) + +## IndexPattern.setFieldCount() method + +Signature: + +```typescript +setFieldCount(fieldName: string, count: number | undefined | null): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | | +| count | number | undefined | null | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldcustomlabel.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldcustomlabel.md new file mode 100644 index 0000000000000..2c15c3ca4f552 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldcustomlabel.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPattern](./kibana-plugin-plugins-data-server.indexpattern.md) > [setFieldCustomLabel](./kibana-plugin-plugins-data-server.indexpattern.setfieldcustomlabel.md) + +## IndexPattern.setFieldCustomLabel() method + +Signature: + +```typescript +setFieldCustomLabel(fieldName: string, customLabel: string | undefined | null): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | | +| customLabel | string | undefined | null | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldformat.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldformat.md index a8f2e726dd9b3..e6a6b9ea2c0f5 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldformat.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.setfieldformat.md @@ -7,5 +7,5 @@ Signature: ```typescript -setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; +readonly setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md index 439f4ff9fa78d..83e912d80dbd1 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md @@ -7,7 +7,7 @@ Signature: ```typescript -export declare class IndexPatternsService implements Plugin +export declare class IndexPatternsServiceProvider implements Plugin ``` ## Methods diff --git a/docs/fleet/fleet.asciidoc b/docs/fleet/fleet.asciidoc index 06b2b96c0035c..aac733ad8468c 100644 --- a/docs/fleet/fleet.asciidoc +++ b/docs/fleet/fleet.asciidoc @@ -17,8 +17,6 @@ Standalone mode requires you to manually configure and manage the agent locally. * An overview of the data ingest in your {es} cluster. * Multiple integrations to collect and transform data. -//TODO: Redo screen capture. - [role="screenshot"] image::fleet/images/fleet-start.png[{fleet} app in {kib}] @@ -26,4 +24,4 @@ image::fleet/images/fleet-start.png[{fleet} app in {kib}] == Get started To get started with {fleet}, refer to the -{ingest-guide}/index.html[Ingest Management Guide]. +{ingest-guide}/index.html[{fleet}] docs. diff --git a/docs/redirects.asciidoc b/docs/redirects.asciidoc index 7c81b8f9bbd0d..931a783654a91 100644 --- a/docs/redirects.asciidoc +++ b/docs/redirects.asciidoc @@ -168,6 +168,11 @@ This content has moved. See <>. This content has moved. See <>. +[role="exclude",id="lens"] +== Lens + +This content has moved. See <>. + [role="exclude",id="known-plugins"] == Known plugins diff --git a/docs/settings/fleet-settings.asciidoc b/docs/settings/fleet-settings.asciidoc index 9c28d28003175..abfd2d3a95bed 100644 --- a/docs/settings/fleet-settings.asciidoc +++ b/docs/settings/fleet-settings.asciidoc @@ -10,7 +10,7 @@ experimental[] You can configure `xpack.fleet` settings in your `kibana.yml`. By default, {fleet} is enabled. To use {fleet}, you also need to configure {kib} and {es} hosts. -See the {ingest-guide}/index.html[Ingest Management] docs for more information. +See the {ingest-guide}/index.html[{fleet}] docs for more information. [[general-fleet-settings-kb]] ==== General {fleet} settings diff --git a/docs/user/dashboard/dashboard.asciidoc b/docs/user/dashboard/dashboard.asciidoc index 5fda1af55c7fe..23d80f100b4b4 100644 --- a/docs/user/dashboard/dashboard.asciidoc +++ b/docs/user/dashboard/dashboard.asciidoc @@ -185,7 +185,7 @@ image:images/Dashboard_add_new_visualization.png[Example add new visualization t {kib} provides you with several editors that help you create panels. [float] -[[lens]] +[[create-panels-with-lens]] === Create panels with Lens *Lens* is the simplest and fastest way to create powerful visualizations of your data. To use *Lens*, you drag and drop as many data fields diff --git a/docs/user/security/reporting.asciidoc b/docs/user/security/reporting.asciidoc index 6e7fc0c212f07..e69643ef9712a 100644 --- a/docs/user/security/reporting.asciidoc +++ b/docs/user/security/reporting.asciidoc @@ -101,7 +101,7 @@ If you are using an external identity provider, such as LDAP or Active Directory, you can either assign roles on a per user basis, or assign roles to groups of users. By default, role mappings are configured in -{ref}/mapping-roles.html[`config/shield/role_mapping.yml`]. +{ref}/mapping-roles.html[`config/role_mapping.yml`]. For example, the following snippet assigns the user named Bill Murray the `kibana_admin` and `reporting_user` roles: diff --git a/package.json b/package.json index 93a72553b4551..0f55c9b2d259a 100644 --- a/package.json +++ b/package.json @@ -157,6 +157,7 @@ "angular-resource": "1.8.0", "angular-sanitize": "^1.8.0", "angular-ui-ace": "0.2.3", + "antlr4ts": "^0.5.0-alpha.3", "apollo-cache-inmemory": "1.6.2", "apollo-client": "^2.3.8", "apollo-link-http": "^1.5.16", @@ -348,7 +349,7 @@ "@babel/traverse": "^7.11.5", "@babel/types": "^7.11.0", "@cypress/snapshot": "^2.1.7", - "@cypress/webpack-preprocessor": "^5.4.10", + "@cypress/webpack-preprocessor": "^5.4.11", "@elastic/apm-rum": "^5.6.1", "@elastic/apm-rum-react": "^1.2.5", "@elastic/charts": "24.3.0", @@ -358,7 +359,6 @@ "@elastic/makelogs": "^6.0.0", "@elastic/maki": "6.3.0", "@elastic/ui-ace": "0.2.3", - "@hapi/hapi": "^18.4.1", "@istanbuljs/schema": "^0.1.2", "@jest/reporters": "^26.5.2", "@kbn/babel-code-parser": "link:packages/kbn-babel-code-parser", @@ -452,8 +452,6 @@ "@types/graphql": "^0.13.2", "@types/gulp": "^4.0.6", "@types/gulp-zip": "^4.0.1", - "@types/hapi": "^17.0.18", - "@types/hapi-auth-cookie": "^9.1.0", "@types/hapi__boom": "^7.4.1", "@types/hapi__cookie": "^10.1.1", "@types/hapi__h2o2": "8.3.0", @@ -579,6 +577,7 @@ "angular-recursion": "^1.0.5", "angular-route": "^1.8.0", "angular-sortable-view": "^0.0.17", + "antlr4ts-cli": "^0.5.0-alpha.3", "apidoc": "^0.25.0", "apidoc-markdown": "^5.1.8", "apollo-link": "^1.2.3", @@ -611,7 +610,7 @@ "cpy": "^8.1.1", "cronstrue": "^1.51.0", "css-loader": "^3.4.2", - "cypress": "^5.5.0", + "cypress": "^6.0.1", "cypress-cucumber-preprocessor": "^2.5.2", "cypress-multi-reporters": "^1.4.0", "d3": "3.5.17", @@ -731,7 +730,6 @@ "loader-utils": "^1.2.3", "log-symbols": "^2.2.0", "lz-string": "^1.4.4", - "madge": "3.4.4", "mapbox-gl": "^1.12.0", "mapbox-gl-draw-rectangle-mode": "^1.0.4", "marge": "^1.0.1", diff --git a/packages/kbn-es-archiver/src/cli.ts b/packages/kbn-es-archiver/src/cli.ts index d65f5a5b23cd0..1acb21748f773 100644 --- a/packages/kbn-es-archiver/src/cli.ts +++ b/packages/kbn-es-archiver/src/cli.ts @@ -26,8 +26,9 @@ import Path from 'path'; import Url from 'url'; import readline from 'readline'; +import Fs from 'fs'; -import { RunWithCommands, createFlagError } from '@kbn/dev-utils'; +import { RunWithCommands, createFlagError, KbnClient, CA_CERT_PATH } from '@kbn/dev-utils'; import { readConfigFile } from '@kbn/test'; import legacyElasticsearch from 'elasticsearch'; @@ -40,13 +41,15 @@ export function runCli() { new RunWithCommands({ description: 'CLI to manage archiving/restoring data in elasticsearch', globalFlags: { - string: ['es-url', 'kibana-url', 'dir', 'config'], + string: ['es-url', 'kibana-url', 'dir', 'config', 'es-ca', 'kibana-ca'], help: ` --config path to an FTR config file that sets --es-url, --kibana-url, and --dir default: ${defaultConfigPath} --es-url url for Elasticsearch, prefer the --config flag --kibana-url url for Kibana, prefer the --config flag --dir where arechives are stored, prefer the --config flag + --kibana-ca if Kibana url points to https://localhost we default to the CA from @kbn/dev-utils, customize the CA with this flag + --es-ca if Elasticsearch url points to https://localhost we default to the CA from @kbn/dev-utils, customize the CA with this flag `, }, async extendContext({ log, flags, addCleanupTask }) { @@ -78,6 +81,40 @@ export function runCli() { throw createFlagError('--kibana-url or --config must be defined'); } + const kibanaCaPath = flags['kibana-ca']; + if (kibanaCaPath && typeof kibanaCaPath !== 'string') { + throw createFlagError('--kibana-ca must be a string'); + } + + let kibanaCa; + if (config.get('servers.kibana.certificateAuthorities') && !kibanaCaPath) { + kibanaCa = config.get('servers.kibana.certificateAuthorities'); + } else if (kibanaCaPath) { + kibanaCa = Fs.readFileSync(kibanaCaPath); + } else { + const { protocol, hostname } = Url.parse(kibanaUrl); + if (protocol === 'https:' && hostname === 'localhost') { + kibanaCa = Fs.readFileSync(CA_CERT_PATH); + } + } + + const esCaPath = flags['es-ca']; + if (esCaPath && typeof esCaPath !== 'string') { + throw createFlagError('--es-ca must be a string'); + } + + let esCa; + if (config.get('servers.elasticsearch.certificateAuthorities') && !esCaPath) { + esCa = config.get('servers.elasticsearch.certificateAuthorities'); + } else if (esCaPath) { + esCa = Fs.readFileSync(esCaPath); + } else { + const { protocol, hostname } = Url.parse(kibanaUrl); + if (protocol === 'https:' && hostname === 'localhost') { + esCa = Fs.readFileSync(CA_CERT_PATH); + } + } + let dir = flags.dir; if (dir && typeof dir !== 'string') { throw createFlagError('--dir must be a string'); @@ -91,15 +128,22 @@ export function runCli() { const client = new legacyElasticsearch.Client({ host: esUrl, + ssl: esCa ? { ca: esCa } : undefined, log: flags.verbose ? 'trace' : [], }); addCleanupTask(() => client.close()); + const kbnClient = new KbnClient({ + log, + url: kibanaUrl, + certificateAuthorities: kibanaCa ? [kibanaCa] : undefined, + }); + const esArchiver = new EsArchiver({ log, client, dataDir: dir, - kibanaUrl, + kbnClient, }); return { diff --git a/packages/kbn-es-archiver/src/es_archiver.ts b/packages/kbn-es-archiver/src/es_archiver.ts index c6f890b963e3d..6733a48f4b370 100644 --- a/packages/kbn-es-archiver/src/es_archiver.ts +++ b/packages/kbn-es-archiver/src/es_archiver.ts @@ -29,27 +29,24 @@ import { editAction, } from './actions'; +interface Options { + client: Client; + dataDir: string; + log: ToolingLog; + kbnClient: KbnClient; +} + export class EsArchiver { private readonly client: Client; private readonly dataDir: string; private readonly log: ToolingLog; private readonly kbnClient: KbnClient; - constructor({ - client, - dataDir, - log, - kibanaUrl, - }: { - client: Client; - dataDir: string; - log: ToolingLog; - kibanaUrl: string; - }) { - this.client = client; - this.dataDir = dataDir; - this.log = log; - this.kbnClient = new KbnClient({ log, url: kibanaUrl }); + constructor(options: Options) { + this.client = options.client; + this.dataDir = options.dataDir; + this.log = options.log; + this.kbnClient = options.kbnClient; } /** diff --git a/packages/kbn-monaco/package.json b/packages/kbn-monaco/package.json index eef68d3a35e0c..6c2e531a2f1ee 100644 --- a/packages/kbn-monaco/package.json +++ b/packages/kbn-monaco/package.json @@ -6,7 +6,8 @@ "license": "Apache-2.0", "scripts": { "build": "node ./scripts/build.js", - "kbn:bootstrap": "yarn build --dev" + "kbn:bootstrap": "yarn build --dev", + "build:antlr4ts": "../../node_modules/antlr4ts-cli/antlr4ts ./src/painless/antlr/painless_lexer.g4 ./src/painless/antlr/painless_parser.g4 && node ./scripts/fix_generated_antlr.js" }, "devDependencies": { "@kbn/babel-preset": "link:../kbn-babel-preset", @@ -15,4 +16,4 @@ "dependencies": { "@kbn/i18n": "link:../kbn-i18n" } -} \ No newline at end of file +} diff --git a/packages/kbn-monaco/scripts/fix_generated_antlr.js b/packages/kbn-monaco/scripts/fix_generated_antlr.js new file mode 100644 index 0000000000000..faa853b93aa02 --- /dev/null +++ b/packages/kbn-monaco/scripts/fix_generated_antlr.js @@ -0,0 +1,66 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +const { join } = require('path'); +const { readdirSync, readFileSync, writeFileSync, renameSync } = require('fs'); +const ora = require('ora'); + +const generatedAntlrFolder = join(__dirname, '..', 'src', 'painless', 'antlr'); + +const generatedAntlrFolderContents = readdirSync(generatedAntlrFolder); + +const log = ora('Updating generated antlr grammar').start(); + +// 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'); + + 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 antlr4ts-cli +try { + renameSync( + join(generatedAntlrFolder, 'painless_parserListener.ts'), + join(generatedAntlrFolder, 'painless_parser_listener.ts') + ); +} catch (err) { + log.warn(`Unable to rename parserListener file to snakecase: ${err.message}`); +} + +log.succeed('Updated generated antlr grammar successfully'); diff --git a/packages/kbn-monaco/scripts/utils/clone_es.js b/packages/kbn-monaco/scripts/utils/clone_es.js index 511cfd89fbf54..51063b8901731 100644 --- a/packages/kbn-monaco/scripts/utils/clone_es.js +++ b/packages/kbn-monaco/scripts/utils/clone_es.js @@ -21,7 +21,7 @@ const { accessSync, mkdirSync } = require('fs'); const { join } = require('path'); const simpleGit = require('simple-git'); -// Note: The generated whitelists have not yet been merged to master +// Note: The generated allowlists have not yet been merged to ES // so this script may fail until code in this branch has been merged: // https://github.com/stu-elastic/elasticsearch/tree/scripting/whitelists const esRepo = 'https://github.com/elastic/elasticsearch.git'; diff --git a/packages/kbn-monaco/src/index.ts b/packages/kbn-monaco/src/index.ts index dcfcb5fbfc63f..41600d96ff7c9 100644 --- a/packages/kbn-monaco/src/index.ts +++ b/packages/kbn-monaco/src/index.ts @@ -22,7 +22,7 @@ import './register_globals'; export { monaco } from './monaco_imports'; export { XJsonLang } from './xjson'; -export { PainlessLang, PainlessContext } from './painless'; +export { PainlessLang, PainlessContext, PainlessAutocompleteField } from './painless'; /* eslint-disable-next-line @kbn/eslint/module_migration */ import * as BarePluginApi from 'monaco-editor/esm/vs/editor/editor.api'; diff --git a/packages/kbn-monaco/src/painless/README.md b/packages/kbn-monaco/src/painless/README.md index 89980a43770ee..6969e4045cba6 100644 --- a/packages/kbn-monaco/src/painless/README.md +++ b/packages/kbn-monaco/src/painless/README.md @@ -8,7 +8,7 @@ This folder contains the language definitions for Painless used by the Monaco ed Initializes the worker proxy service when the Painless language is first needed. It also exports the [suggestion provider](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.completionitemprovider.html) needed for autocompletion. -### ./services +### ./lib This directory exports two services: 1. Worker proxy: Responsible for holding a reference to the Monaco-provided proxy getter. @@ -32,12 +32,15 @@ Contains the Monarch-specific language tokenization rules for Painless. ### ./worker -The worker proxy and worker instantiation code used in both the main thread and the worker thread. The logic for providing autocomplete suggestions resides here. +The worker proxy and worker instantiation code used in both the main thread and the worker thread. The logic for providing autocomplete suggestions and error reporting resides here. ### ./autocomplete_definitions This directory is generated by a script and should not be changed manually. Read [Updating autocomplete definitions](#updating-autocomplete-definitions) for more information. +### ./antlr +This directory contains the Painless lexer and grammar rules, as well as the generated Typescript code. Read [Compiling ANTLR](#compiling-ANTLR) for more information. + ## Example usage ``` @@ -102,4 +105,20 @@ node scripts/generate_autocomplete --branch - `score` - `string_script_field_script_field` -To add additional contexts, edit the `supportedContexts` constant in `kbn-monaco/scripts/constants.js`. \ No newline at end of file +To add additional contexts, edit the `supportedContexts` constant in `kbn-monaco/scripts/constants.js`. + +## Compiling ANTLR + +[ANTLR](https://www.antlr.org/) generates lexical and syntax errors out of the box, which we can use to set error markers in monaco. + +Elasticsearch has defined [lexer and parser grammar](https://github.com/elastic/elasticsearch/tree/master/modules/lang-painless/src/main/antlr) for the Painless language. For now, these rules have been largely copied from ES to Kibana and reside in the `antlr` directory with the `.g4` file extension. We then use [antlr4ts](https://github.com/tunnelvisionlabs/antlr4ts) to generate a lexer and a parser in Typescript. + +To regenerate the lexer and parser, run the following script: + +``` +npm run build:antlr4ts +``` + +*Note:* This script should only need to be run if a change has been made to `painless_lexer.g4` or `painless_parser.g4`. + +*Note:* There is a manual change made to the `sempred()` method in the generated `painless_lexer.ts`. This needs further investigation, but it appears there is an offset between the rule index and the token value. Without this manual change, ANTLR incorrectly reports an error when using a `/` or regex in a script. There is a comment in the generated code to this effect. diff --git a/packages/kbn-monaco/src/painless/antlr/painless_lexer.g4 b/packages/kbn-monaco/src/painless/antlr/painless_lexer.g4 new file mode 100644 index 0000000000000..d7cdf31e6d587 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_lexer.g4 @@ -0,0 +1,122 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +lexer grammar painless_lexer; + +WS: [ \t\n\r]+ -> skip; +COMMENT: ( '//' .*? [\n\r] | '/*' .*? '*/' ) -> skip; + +LBRACK: '{'; +RBRACK: '}'; +LBRACE: '['; +RBRACE: ']'; +LP: '('; +RP: ')'; +// We switch modes after a dot to ensure there are not conflicts +// between shortcuts and decimal values. Without the mode switch +// shortcuts such as id.0.0 will fail because 0.0 will be interpreted +// as a decimal value instead of two individual list-style shortcuts. +DOT: '.' -> mode(AFTER_DOT); +NSDOT: '?.' -> mode(AFTER_DOT); +COMMA: ','; +SEMICOLON: ';'; +IF: 'if'; +IN: 'in'; +ELSE: 'else'; +WHILE: 'while'; +DO: 'do'; +FOR: 'for'; +CONTINUE: 'continue'; +BREAK: 'break'; +RETURN: 'return'; +NEW: 'new'; +TRY: 'try'; +CATCH: 'catch'; +THROW: 'throw'; +THIS: 'this'; +INSTANCEOF: 'instanceof'; + +BOOLNOT: '!'; +BWNOT: '~'; +MUL: '*'; +DIV: '/' { this.isSlashRegex() == false }?; +REM: '%'; +ADD: '+'; +SUB: '-'; +LSH: '<<'; +RSH: '>>'; +USH: '>>>'; +LT: '<'; +LTE: '<='; +GT: '>'; +GTE: '>='; +EQ: '=='; +EQR: '==='; +NE: '!='; +NER: '!=='; +BWAND: '&'; +XOR: '^'; +BWOR: '|'; +BOOLAND: '&&'; +BOOLOR: '||'; +COND: '?'; +COLON: ':'; +ELVIS: '?:'; +REF: '::'; +ARROW: '->'; +FIND: '=~'; +MATCH: '==~'; +INCR: '++'; +DECR: '--'; + +ASSIGN: '='; +AADD: '+='; +ASUB: '-='; +AMUL: '*='; +ADIV: '/='; +AREM: '%='; +AAND: '&='; +AXOR: '^='; +AOR: '|='; +ALSH: '<<='; +ARSH: '>>='; +AUSH: '>>>='; + +OCTAL: '0' [0-7]+ [lL]?; +HEX: '0' [xX] [0-9a-fA-F]+ [lL]?; +INTEGER: ( '0' | [1-9] [0-9]* ) [lLfFdD]?; +DECIMAL: ( '0' | [1-9] [0-9]* ) (DOT [0-9]+)? ( [eE] [+\-]? [0-9]+ )? [fFdD]?; + +STRING: ( '"' ( '\\"' | '\\\\' | ~[\\"] )*? '"' ) | ( '\'' ( '\\\'' | '\\\\' | ~[\\'] )*? '\'' ); +REGEX: '/' ( '\\' ~'\n' | ~('/' | '\n') )+? '/' [cilmsUux]* { this.isSlashRegex() }?; + +TRUE: 'true'; +FALSE: 'false'; + +NULL: 'null'; + +PRIMITIVE: 'boolean' | 'byte' | 'short' | 'char' | 'int' | 'long' | 'float' | 'double'; +DEF: 'def'; + +ID: [_a-zA-Z] [_a-zA-Z0-9]*; + +mode AFTER_DOT; + +DOTINTEGER: ( '0' | [1-9] [0-9]* ) -> mode(DEFAULT_MODE); +DOTID: [_a-zA-Z] [_a-zA-Z0-9]* -> mode(DEFAULT_MODE); diff --git a/packages/kbn-monaco/src/painless/antlr/painless_lexer.interp b/packages/kbn-monaco/src/painless/antlr/painless_lexer.interp new file mode 100644 index 0000000000000..df5a0d5244124 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_lexer.interp @@ -0,0 +1,273 @@ +token literal names: +null +null +null +'{' +'}' +'[' +']' +'(' +')' +'.' +'?.' +',' +';' +'if' +'in' +'else' +'while' +'do' +'for' +'continue' +'break' +'return' +'new' +'try' +'catch' +'throw' +'this' +'instanceof' +'!' +'~' +'*' +'/' +'%' +'+' +'-' +'<<' +'>>' +'>>>' +'<' +'<=' +'>' +'>=' +'==' +'===' +'!=' +'!==' +'&' +'^' +'|' +'&&' +'||' +'?' +':' +'?:' +'::' +'->' +'=~' +'==~' +'++' +'--' +'=' +'+=' +'-=' +'*=' +'/=' +'%=' +'&=' +'^=' +'|=' +'<<=' +'>>=' +'>>>=' +null +null +null +null +null +null +'true' +'false' +'null' +null +'def' +null +null +null + +token symbolic names: +null +WS +COMMENT +LBRACK +RBRACK +LBRACE +RBRACE +LP +RP +DOT +NSDOT +COMMA +SEMICOLON +IF +IN +ELSE +WHILE +DO +FOR +CONTINUE +BREAK +RETURN +NEW +TRY +CATCH +THROW +THIS +INSTANCEOF +BOOLNOT +BWNOT +MUL +DIV +REM +ADD +SUB +LSH +RSH +USH +LT +LTE +GT +GTE +EQ +EQR +NE +NER +BWAND +XOR +BWOR +BOOLAND +BOOLOR +COND +COLON +ELVIS +REF +ARROW +FIND +MATCH +INCR +DECR +ASSIGN +AADD +ASUB +AMUL +ADIV +AREM +AAND +AXOR +AOR +ALSH +ARSH +AUSH +OCTAL +HEX +INTEGER +DECIMAL +STRING +REGEX +TRUE +FALSE +NULL +PRIMITIVE +DEF +ID +DOTINTEGER +DOTID + +rule names: +WS +COMMENT +LBRACK +RBRACK +LBRACE +RBRACE +LP +RP +DOT +NSDOT +COMMA +SEMICOLON +IF +IN +ELSE +WHILE +DO +FOR +CONTINUE +BREAK +RETURN +NEW +TRY +CATCH +THROW +THIS +INSTANCEOF +BOOLNOT +BWNOT +MUL +DIV +REM +ADD +SUB +LSH +RSH +USH +LT +LTE +GT +GTE +EQ +EQR +NE +NER +BWAND +XOR +BWOR +BOOLAND +BOOLOR +COND +COLON +ELVIS +REF +ARROW +FIND +MATCH +INCR +DECR +ASSIGN +AADD +ASUB +AMUL +ADIV +AREM +AAND +AXOR +AOR +ALSH +ARSH +AUSH +OCTAL +HEX +INTEGER +DECIMAL +STRING +REGEX +TRUE +FALSE +NULL +PRIMITIVE +DEF +ID +DOTINTEGER +DOTID + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE +AFTER_DOT + +atn: +[3, 51485, 51898, 1421, 44986, 20307, 1543, 60043, 49729, 2, 87, 634, 8, 1, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, 9, 86, 3, 2, 6, 2, 176, 10, 2, 13, 2, 14, 2, 177, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 186, 10, 3, 12, 3, 14, 3, 189, 11, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 196, 10, 3, 12, 3, 14, 3, 199, 11, 3, 3, 3, 3, 3, 5, 3, 203, 10, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 34, 3, 34, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, 54, 3, 54, 3, 54, 3, 55, 3, 55, 3, 55, 3, 56, 3, 56, 3, 56, 3, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 63, 3, 64, 3, 64, 3, 64, 3, 65, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 3, 67, 3, 67, 3, 67, 3, 68, 3, 68, 3, 68, 3, 69, 3, 69, 3, 69, 3, 70, 3, 70, 3, 70, 3, 70, 3, 71, 3, 71, 3, 71, 3, 71, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 73, 3, 73, 6, 73, 442, 10, 73, 13, 73, 14, 73, 443, 3, 73, 5, 73, 447, 10, 73, 3, 74, 3, 74, 3, 74, 6, 74, 452, 10, 74, 13, 74, 14, 74, 453, 3, 74, 5, 74, 457, 10, 74, 3, 75, 3, 75, 3, 75, 7, 75, 462, 10, 75, 12, 75, 14, 75, 465, 11, 75, 5, 75, 467, 10, 75, 3, 75, 5, 75, 470, 10, 75, 3, 76, 3, 76, 3, 76, 7, 76, 475, 10, 76, 12, 76, 14, 76, 478, 11, 76, 5, 76, 480, 10, 76, 3, 76, 3, 76, 6, 76, 484, 10, 76, 13, 76, 14, 76, 485, 5, 76, 488, 10, 76, 3, 76, 3, 76, 5, 76, 492, 10, 76, 3, 76, 6, 76, 495, 10, 76, 13, 76, 14, 76, 496, 5, 76, 499, 10, 76, 3, 76, 5, 76, 502, 10, 76, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 7, 77, 510, 10, 77, 12, 77, 14, 77, 513, 11, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 7, 77, 522, 10, 77, 12, 77, 14, 77, 525, 11, 77, 3, 77, 5, 77, 528, 10, 77, 3, 78, 3, 78, 3, 78, 3, 78, 6, 78, 534, 10, 78, 13, 78, 14, 78, 535, 3, 78, 3, 78, 7, 78, 540, 10, 78, 12, 78, 14, 78, 543, 11, 78, 3, 78, 3, 78, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 5, 82, 601, 10, 82, 3, 83, 3, 83, 3, 83, 3, 83, 3, 84, 3, 84, 7, 84, 609, 10, 84, 12, 84, 14, 84, 612, 11, 84, 3, 85, 3, 85, 3, 85, 7, 85, 617, 10, 85, 12, 85, 14, 85, 620, 11, 85, 5, 85, 622, 10, 85, 3, 85, 3, 85, 3, 86, 3, 86, 7, 86, 628, 10, 86, 12, 86, 14, 86, 631, 11, 86, 3, 86, 3, 86, 7, 187, 197, 511, 523, 535, 2, 2, 87, 4, 2, 3, 6, 2, 4, 8, 2, 5, 10, 2, 6, 12, 2, 7, 14, 2, 8, 16, 2, 9, 18, 2, 10, 20, 2, 11, 22, 2, 12, 24, 2, 13, 26, 2, 14, 28, 2, 15, 30, 2, 16, 32, 2, 17, 34, 2, 18, 36, 2, 19, 38, 2, 20, 40, 2, 21, 42, 2, 22, 44, 2, 23, 46, 2, 24, 48, 2, 25, 50, 2, 26, 52, 2, 27, 54, 2, 28, 56, 2, 29, 58, 2, 30, 60, 2, 31, 62, 2, 32, 64, 2, 33, 66, 2, 34, 68, 2, 35, 70, 2, 36, 72, 2, 37, 74, 2, 38, 76, 2, 39, 78, 2, 40, 80, 2, 41, 82, 2, 42, 84, 2, 43, 86, 2, 44, 88, 2, 45, 90, 2, 46, 92, 2, 47, 94, 2, 48, 96, 2, 49, 98, 2, 50, 100, 2, 51, 102, 2, 52, 104, 2, 53, 106, 2, 54, 108, 2, 55, 110, 2, 56, 112, 2, 57, 114, 2, 58, 116, 2, 59, 118, 2, 60, 120, 2, 61, 122, 2, 62, 124, 2, 63, 126, 2, 64, 128, 2, 65, 130, 2, 66, 132, 2, 67, 134, 2, 68, 136, 2, 69, 138, 2, 70, 140, 2, 71, 142, 2, 72, 144, 2, 73, 146, 2, 74, 148, 2, 75, 150, 2, 76, 152, 2, 77, 154, 2, 78, 156, 2, 79, 158, 2, 80, 160, 2, 81, 162, 2, 82, 164, 2, 83, 166, 2, 84, 168, 2, 85, 170, 2, 86, 172, 2, 87, 4, 2, 3, 21, 5, 2, 11, 12, 15, 15, 34, 34, 4, 2, 12, 12, 15, 15, 3, 2, 50, 57, 4, 2, 78, 78, 110, 110, 4, 2, 90, 90, 122, 122, 5, 2, 50, 59, 67, 72, 99, 104, 3, 2, 51, 59, 3, 2, 50, 59, 8, 2, 70, 70, 72, 72, 78, 78, 102, 102, 104, 104, 110, 110, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45, 47, 47, 6, 2, 70, 70, 72, 72, 102, 102, 104, 104, 4, 2, 36, 36, 94, 94, 4, 2, 41, 41, 94, 94, 3, 2, 12, 12, 4, 2, 12, 12, 49, 49, 9, 2, 87, 87, 101, 101, 107, 107, 110, 111, 117, 117, 119, 119, 122, 122, 5, 2, 67, 92, 97, 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 2, 672, 2, 4, 3, 2, 2, 2, 2, 6, 3, 2, 2, 2, 2, 8, 3, 2, 2, 2, 2, 10, 3, 2, 2, 2, 2, 12, 3, 2, 2, 2, 2, 14, 3, 2, 2, 2, 2, 16, 3, 2, 2, 2, 2, 18, 3, 2, 2, 2, 2, 20, 3, 2, 2, 2, 2, 22, 3, 2, 2, 2, 2, 24, 3, 2, 2, 2, 2, 26, 3, 2, 2, 2, 2, 28, 3, 2, 2, 2, 2, 30, 3, 2, 2, 2, 2, 32, 3, 2, 2, 2, 2, 34, 3, 2, 2, 2, 2, 36, 3, 2, 2, 2, 2, 38, 3, 2, 2, 2, 2, 40, 3, 2, 2, 2, 2, 42, 3, 2, 2, 2, 2, 44, 3, 2, 2, 2, 2, 46, 3, 2, 2, 2, 2, 48, 3, 2, 2, 2, 2, 50, 3, 2, 2, 2, 2, 52, 3, 2, 2, 2, 2, 54, 3, 2, 2, 2, 2, 56, 3, 2, 2, 2, 2, 58, 3, 2, 2, 2, 2, 60, 3, 2, 2, 2, 2, 62, 3, 2, 2, 2, 2, 64, 3, 2, 2, 2, 2, 66, 3, 2, 2, 2, 2, 68, 3, 2, 2, 2, 2, 70, 3, 2, 2, 2, 2, 72, 3, 2, 2, 2, 2, 74, 3, 2, 2, 2, 2, 76, 3, 2, 2, 2, 2, 78, 3, 2, 2, 2, 2, 80, 3, 2, 2, 2, 2, 82, 3, 2, 2, 2, 2, 84, 3, 2, 2, 2, 2, 86, 3, 2, 2, 2, 2, 88, 3, 2, 2, 2, 2, 90, 3, 2, 2, 2, 2, 92, 3, 2, 2, 2, 2, 94, 3, 2, 2, 2, 2, 96, 3, 2, 2, 2, 2, 98, 3, 2, 2, 2, 2, 100, 3, 2, 2, 2, 2, 102, 3, 2, 2, 2, 2, 104, 3, 2, 2, 2, 2, 106, 3, 2, 2, 2, 2, 108, 3, 2, 2, 2, 2, 110, 3, 2, 2, 2, 2, 112, 3, 2, 2, 2, 2, 114, 3, 2, 2, 2, 2, 116, 3, 2, 2, 2, 2, 118, 3, 2, 2, 2, 2, 120, 3, 2, 2, 2, 2, 122, 3, 2, 2, 2, 2, 124, 3, 2, 2, 2, 2, 126, 3, 2, 2, 2, 2, 128, 3, 2, 2, 2, 2, 130, 3, 2, 2, 2, 2, 132, 3, 2, 2, 2, 2, 134, 3, 2, 2, 2, 2, 136, 3, 2, 2, 2, 2, 138, 3, 2, 2, 2, 2, 140, 3, 2, 2, 2, 2, 142, 3, 2, 2, 2, 2, 144, 3, 2, 2, 2, 2, 146, 3, 2, 2, 2, 2, 148, 3, 2, 2, 2, 2, 150, 3, 2, 2, 2, 2, 152, 3, 2, 2, 2, 2, 154, 3, 2, 2, 2, 2, 156, 3, 2, 2, 2, 2, 158, 3, 2, 2, 2, 2, 160, 3, 2, 2, 2, 2, 162, 3, 2, 2, 2, 2, 164, 3, 2, 2, 2, 2, 166, 3, 2, 2, 2, 2, 168, 3, 2, 2, 2, 3, 170, 3, 2, 2, 2, 3, 172, 3, 2, 2, 2, 4, 175, 3, 2, 2, 2, 6, 202, 3, 2, 2, 2, 8, 206, 3, 2, 2, 2, 10, 208, 3, 2, 2, 2, 12, 210, 3, 2, 2, 2, 14, 212, 3, 2, 2, 2, 16, 214, 3, 2, 2, 2, 18, 216, 3, 2, 2, 2, 20, 218, 3, 2, 2, 2, 22, 222, 3, 2, 2, 2, 24, 227, 3, 2, 2, 2, 26, 229, 3, 2, 2, 2, 28, 231, 3, 2, 2, 2, 30, 234, 3, 2, 2, 2, 32, 237, 3, 2, 2, 2, 34, 242, 3, 2, 2, 2, 36, 248, 3, 2, 2, 2, 38, 251, 3, 2, 2, 2, 40, 255, 3, 2, 2, 2, 42, 264, 3, 2, 2, 2, 44, 270, 3, 2, 2, 2, 46, 277, 3, 2, 2, 2, 48, 281, 3, 2, 2, 2, 50, 285, 3, 2, 2, 2, 52, 291, 3, 2, 2, 2, 54, 297, 3, 2, 2, 2, 56, 302, 3, 2, 2, 2, 58, 313, 3, 2, 2, 2, 60, 315, 3, 2, 2, 2, 62, 317, 3, 2, 2, 2, 64, 319, 3, 2, 2, 2, 66, 322, 3, 2, 2, 2, 68, 324, 3, 2, 2, 2, 70, 326, 3, 2, 2, 2, 72, 328, 3, 2, 2, 2, 74, 331, 3, 2, 2, 2, 76, 334, 3, 2, 2, 2, 78, 338, 3, 2, 2, 2, 80, 340, 3, 2, 2, 2, 82, 343, 3, 2, 2, 2, 84, 345, 3, 2, 2, 2, 86, 348, 3, 2, 2, 2, 88, 351, 3, 2, 2, 2, 90, 355, 3, 2, 2, 2, 92, 358, 3, 2, 2, 2, 94, 362, 3, 2, 2, 2, 96, 364, 3, 2, 2, 2, 98, 366, 3, 2, 2, 2, 100, 368, 3, 2, 2, 2, 102, 371, 3, 2, 2, 2, 104, 374, 3, 2, 2, 2, 106, 376, 3, 2, 2, 2, 108, 378, 3, 2, 2, 2, 110, 381, 3, 2, 2, 2, 112, 384, 3, 2, 2, 2, 114, 387, 3, 2, 2, 2, 116, 390, 3, 2, 2, 2, 118, 394, 3, 2, 2, 2, 120, 397, 3, 2, 2, 2, 122, 400, 3, 2, 2, 2, 124, 402, 3, 2, 2, 2, 126, 405, 3, 2, 2, 2, 128, 408, 3, 2, 2, 2, 130, 411, 3, 2, 2, 2, 132, 414, 3, 2, 2, 2, 134, 417, 3, 2, 2, 2, 136, 420, 3, 2, 2, 2, 138, 423, 3, 2, 2, 2, 140, 426, 3, 2, 2, 2, 142, 430, 3, 2, 2, 2, 144, 434, 3, 2, 2, 2, 146, 439, 3, 2, 2, 2, 148, 448, 3, 2, 2, 2, 150, 466, 3, 2, 2, 2, 152, 479, 3, 2, 2, 2, 154, 527, 3, 2, 2, 2, 156, 529, 3, 2, 2, 2, 158, 546, 3, 2, 2, 2, 160, 551, 3, 2, 2, 2, 162, 557, 3, 2, 2, 2, 164, 600, 3, 2, 2, 2, 166, 602, 3, 2, 2, 2, 168, 606, 3, 2, 2, 2, 170, 621, 3, 2, 2, 2, 172, 625, 3, 2, 2, 2, 174, 176, 9, 2, 2, 2, 175, 174, 3, 2, 2, 2, 176, 177, 3, 2, 2, 2, 177, 175, 3, 2, 2, 2, 177, 178, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 180, 8, 2, 2, 2, 180, 5, 3, 2, 2, 2, 181, 182, 7, 49, 2, 2, 182, 183, 7, 49, 2, 2, 183, 187, 3, 2, 2, 2, 184, 186, 11, 2, 2, 2, 185, 184, 3, 2, 2, 2, 186, 189, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 188, 190, 3, 2, 2, 2, 189, 187, 3, 2, 2, 2, 190, 203, 9, 3, 2, 2, 191, 192, 7, 49, 2, 2, 192, 193, 7, 44, 2, 2, 193, 197, 3, 2, 2, 2, 194, 196, 11, 2, 2, 2, 195, 194, 3, 2, 2, 2, 196, 199, 3, 2, 2, 2, 197, 198, 3, 2, 2, 2, 197, 195, 3, 2, 2, 2, 198, 200, 3, 2, 2, 2, 199, 197, 3, 2, 2, 2, 200, 201, 7, 44, 2, 2, 201, 203, 7, 49, 2, 2, 202, 181, 3, 2, 2, 2, 202, 191, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 205, 8, 3, 2, 2, 205, 7, 3, 2, 2, 2, 206, 207, 7, 125, 2, 2, 207, 9, 3, 2, 2, 2, 208, 209, 7, 127, 2, 2, 209, 11, 3, 2, 2, 2, 210, 211, 7, 93, 2, 2, 211, 13, 3, 2, 2, 2, 212, 213, 7, 95, 2, 2, 213, 15, 3, 2, 2, 2, 214, 215, 7, 42, 2, 2, 215, 17, 3, 2, 2, 2, 216, 217, 7, 43, 2, 2, 217, 19, 3, 2, 2, 2, 218, 219, 7, 48, 2, 2, 219, 220, 3, 2, 2, 2, 220, 221, 8, 10, 3, 2, 221, 21, 3, 2, 2, 2, 222, 223, 7, 65, 2, 2, 223, 224, 7, 48, 2, 2, 224, 225, 3, 2, 2, 2, 225, 226, 8, 11, 3, 2, 226, 23, 3, 2, 2, 2, 227, 228, 7, 46, 2, 2, 228, 25, 3, 2, 2, 2, 229, 230, 7, 61, 2, 2, 230, 27, 3, 2, 2, 2, 231, 232, 7, 107, 2, 2, 232, 233, 7, 104, 2, 2, 233, 29, 3, 2, 2, 2, 234, 235, 7, 107, 2, 2, 235, 236, 7, 112, 2, 2, 236, 31, 3, 2, 2, 2, 237, 238, 7, 103, 2, 2, 238, 239, 7, 110, 2, 2, 239, 240, 7, 117, 2, 2, 240, 241, 7, 103, 2, 2, 241, 33, 3, 2, 2, 2, 242, 243, 7, 121, 2, 2, 243, 244, 7, 106, 2, 2, 244, 245, 7, 107, 2, 2, 245, 246, 7, 110, 2, 2, 246, 247, 7, 103, 2, 2, 247, 35, 3, 2, 2, 2, 248, 249, 7, 102, 2, 2, 249, 250, 7, 113, 2, 2, 250, 37, 3, 2, 2, 2, 251, 252, 7, 104, 2, 2, 252, 253, 7, 113, 2, 2, 253, 254, 7, 116, 2, 2, 254, 39, 3, 2, 2, 2, 255, 256, 7, 101, 2, 2, 256, 257, 7, 113, 2, 2, 257, 258, 7, 112, 2, 2, 258, 259, 7, 118, 2, 2, 259, 260, 7, 107, 2, 2, 260, 261, 7, 112, 2, 2, 261, 262, 7, 119, 2, 2, 262, 263, 7, 103, 2, 2, 263, 41, 3, 2, 2, 2, 264, 265, 7, 100, 2, 2, 265, 266, 7, 116, 2, 2, 266, 267, 7, 103, 2, 2, 267, 268, 7, 99, 2, 2, 268, 269, 7, 109, 2, 2, 269, 43, 3, 2, 2, 2, 270, 271, 7, 116, 2, 2, 271, 272, 7, 103, 2, 2, 272, 273, 7, 118, 2, 2, 273, 274, 7, 119, 2, 2, 274, 275, 7, 116, 2, 2, 275, 276, 7, 112, 2, 2, 276, 45, 3, 2, 2, 2, 277, 278, 7, 112, 2, 2, 278, 279, 7, 103, 2, 2, 279, 280, 7, 121, 2, 2, 280, 47, 3, 2, 2, 2, 281, 282, 7, 118, 2, 2, 282, 283, 7, 116, 2, 2, 283, 284, 7, 123, 2, 2, 284, 49, 3, 2, 2, 2, 285, 286, 7, 101, 2, 2, 286, 287, 7, 99, 2, 2, 287, 288, 7, 118, 2, 2, 288, 289, 7, 101, 2, 2, 289, 290, 7, 106, 2, 2, 290, 51, 3, 2, 2, 2, 291, 292, 7, 118, 2, 2, 292, 293, 7, 106, 2, 2, 293, 294, 7, 116, 2, 2, 294, 295, 7, 113, 2, 2, 295, 296, 7, 121, 2, 2, 296, 53, 3, 2, 2, 2, 297, 298, 7, 118, 2, 2, 298, 299, 7, 106, 2, 2, 299, 300, 7, 107, 2, 2, 300, 301, 7, 117, 2, 2, 301, 55, 3, 2, 2, 2, 302, 303, 7, 107, 2, 2, 303, 304, 7, 112, 2, 2, 304, 305, 7, 117, 2, 2, 305, 306, 7, 118, 2, 2, 306, 307, 7, 99, 2, 2, 307, 308, 7, 112, 2, 2, 308, 309, 7, 101, 2, 2, 309, 310, 7, 103, 2, 2, 310, 311, 7, 113, 2, 2, 311, 312, 7, 104, 2, 2, 312, 57, 3, 2, 2, 2, 313, 314, 7, 35, 2, 2, 314, 59, 3, 2, 2, 2, 315, 316, 7, 128, 2, 2, 316, 61, 3, 2, 2, 2, 317, 318, 7, 44, 2, 2, 318, 63, 3, 2, 2, 2, 319, 320, 7, 49, 2, 2, 320, 321, 6, 32, 2, 2, 321, 65, 3, 2, 2, 2, 322, 323, 7, 39, 2, 2, 323, 67, 3, 2, 2, 2, 324, 325, 7, 45, 2, 2, 325, 69, 3, 2, 2, 2, 326, 327, 7, 47, 2, 2, 327, 71, 3, 2, 2, 2, 328, 329, 7, 62, 2, 2, 329, 330, 7, 62, 2, 2, 330, 73, 3, 2, 2, 2, 331, 332, 7, 64, 2, 2, 332, 333, 7, 64, 2, 2, 333, 75, 3, 2, 2, 2, 334, 335, 7, 64, 2, 2, 335, 336, 7, 64, 2, 2, 336, 337, 7, 64, 2, 2, 337, 77, 3, 2, 2, 2, 338, 339, 7, 62, 2, 2, 339, 79, 3, 2, 2, 2, 340, 341, 7, 62, 2, 2, 341, 342, 7, 63, 2, 2, 342, 81, 3, 2, 2, 2, 343, 344, 7, 64, 2, 2, 344, 83, 3, 2, 2, 2, 345, 346, 7, 64, 2, 2, 346, 347, 7, 63, 2, 2, 347, 85, 3, 2, 2, 2, 348, 349, 7, 63, 2, 2, 349, 350, 7, 63, 2, 2, 350, 87, 3, 2, 2, 2, 351, 352, 7, 63, 2, 2, 352, 353, 7, 63, 2, 2, 353, 354, 7, 63, 2, 2, 354, 89, 3, 2, 2, 2, 355, 356, 7, 35, 2, 2, 356, 357, 7, 63, 2, 2, 357, 91, 3, 2, 2, 2, 358, 359, 7, 35, 2, 2, 359, 360, 7, 63, 2, 2, 360, 361, 7, 63, 2, 2, 361, 93, 3, 2, 2, 2, 362, 363, 7, 40, 2, 2, 363, 95, 3, 2, 2, 2, 364, 365, 7, 96, 2, 2, 365, 97, 3, 2, 2, 2, 366, 367, 7, 126, 2, 2, 367, 99, 3, 2, 2, 2, 368, 369, 7, 40, 2, 2, 369, 370, 7, 40, 2, 2, 370, 101, 3, 2, 2, 2, 371, 372, 7, 126, 2, 2, 372, 373, 7, 126, 2, 2, 373, 103, 3, 2, 2, 2, 374, 375, 7, 65, 2, 2, 375, 105, 3, 2, 2, 2, 376, 377, 7, 60, 2, 2, 377, 107, 3, 2, 2, 2, 378, 379, 7, 65, 2, 2, 379, 380, 7, 60, 2, 2, 380, 109, 3, 2, 2, 2, 381, 382, 7, 60, 2, 2, 382, 383, 7, 60, 2, 2, 383, 111, 3, 2, 2, 2, 384, 385, 7, 47, 2, 2, 385, 386, 7, 64, 2, 2, 386, 113, 3, 2, 2, 2, 387, 388, 7, 63, 2, 2, 388, 389, 7, 128, 2, 2, 389, 115, 3, 2, 2, 2, 390, 391, 7, 63, 2, 2, 391, 392, 7, 63, 2, 2, 392, 393, 7, 128, 2, 2, 393, 117, 3, 2, 2, 2, 394, 395, 7, 45, 2, 2, 395, 396, 7, 45, 2, 2, 396, 119, 3, 2, 2, 2, 397, 398, 7, 47, 2, 2, 398, 399, 7, 47, 2, 2, 399, 121, 3, 2, 2, 2, 400, 401, 7, 63, 2, 2, 401, 123, 3, 2, 2, 2, 402, 403, 7, 45, 2, 2, 403, 404, 7, 63, 2, 2, 404, 125, 3, 2, 2, 2, 405, 406, 7, 47, 2, 2, 406, 407, 7, 63, 2, 2, 407, 127, 3, 2, 2, 2, 408, 409, 7, 44, 2, 2, 409, 410, 7, 63, 2, 2, 410, 129, 3, 2, 2, 2, 411, 412, 7, 49, 2, 2, 412, 413, 7, 63, 2, 2, 413, 131, 3, 2, 2, 2, 414, 415, 7, 39, 2, 2, 415, 416, 7, 63, 2, 2, 416, 133, 3, 2, 2, 2, 417, 418, 7, 40, 2, 2, 418, 419, 7, 63, 2, 2, 419, 135, 3, 2, 2, 2, 420, 421, 7, 96, 2, 2, 421, 422, 7, 63, 2, 2, 422, 137, 3, 2, 2, 2, 423, 424, 7, 126, 2, 2, 424, 425, 7, 63, 2, 2, 425, 139, 3, 2, 2, 2, 426, 427, 7, 62, 2, 2, 427, 428, 7, 62, 2, 2, 428, 429, 7, 63, 2, 2, 429, 141, 3, 2, 2, 2, 430, 431, 7, 64, 2, 2, 431, 432, 7, 64, 2, 2, 432, 433, 7, 63, 2, 2, 433, 143, 3, 2, 2, 2, 434, 435, 7, 64, 2, 2, 435, 436, 7, 64, 2, 2, 436, 437, 7, 64, 2, 2, 437, 438, 7, 63, 2, 2, 438, 145, 3, 2, 2, 2, 439, 441, 7, 50, 2, 2, 440, 442, 9, 4, 2, 2, 441, 440, 3, 2, 2, 2, 442, 443, 3, 2, 2, 2, 443, 441, 3, 2, 2, 2, 443, 444, 3, 2, 2, 2, 444, 446, 3, 2, 2, 2, 445, 447, 9, 5, 2, 2, 446, 445, 3, 2, 2, 2, 446, 447, 3, 2, 2, 2, 447, 147, 3, 2, 2, 2, 448, 449, 7, 50, 2, 2, 449, 451, 9, 6, 2, 2, 450, 452, 9, 7, 2, 2, 451, 450, 3, 2, 2, 2, 452, 453, 3, 2, 2, 2, 453, 451, 3, 2, 2, 2, 453, 454, 3, 2, 2, 2, 454, 456, 3, 2, 2, 2, 455, 457, 9, 5, 2, 2, 456, 455, 3, 2, 2, 2, 456, 457, 3, 2, 2, 2, 457, 149, 3, 2, 2, 2, 458, 467, 7, 50, 2, 2, 459, 463, 9, 8, 2, 2, 460, 462, 9, 9, 2, 2, 461, 460, 3, 2, 2, 2, 462, 465, 3, 2, 2, 2, 463, 461, 3, 2, 2, 2, 463, 464, 3, 2, 2, 2, 464, 467, 3, 2, 2, 2, 465, 463, 3, 2, 2, 2, 466, 458, 3, 2, 2, 2, 466, 459, 3, 2, 2, 2, 467, 469, 3, 2, 2, 2, 468, 470, 9, 10, 2, 2, 469, 468, 3, 2, 2, 2, 469, 470, 3, 2, 2, 2, 470, 151, 3, 2, 2, 2, 471, 480, 7, 50, 2, 2, 472, 476, 9, 8, 2, 2, 473, 475, 9, 9, 2, 2, 474, 473, 3, 2, 2, 2, 475, 478, 3, 2, 2, 2, 476, 474, 3, 2, 2, 2, 476, 477, 3, 2, 2, 2, 477, 480, 3, 2, 2, 2, 478, 476, 3, 2, 2, 2, 479, 471, 3, 2, 2, 2, 479, 472, 3, 2, 2, 2, 480, 487, 3, 2, 2, 2, 481, 483, 5, 20, 10, 2, 482, 484, 9, 9, 2, 2, 483, 482, 3, 2, 2, 2, 484, 485, 3, 2, 2, 2, 485, 483, 3, 2, 2, 2, 485, 486, 3, 2, 2, 2, 486, 488, 3, 2, 2, 2, 487, 481, 3, 2, 2, 2, 487, 488, 3, 2, 2, 2, 488, 498, 3, 2, 2, 2, 489, 491, 9, 11, 2, 2, 490, 492, 9, 12, 2, 2, 491, 490, 3, 2, 2, 2, 491, 492, 3, 2, 2, 2, 492, 494, 3, 2, 2, 2, 493, 495, 9, 9, 2, 2, 494, 493, 3, 2, 2, 2, 495, 496, 3, 2, 2, 2, 496, 494, 3, 2, 2, 2, 496, 497, 3, 2, 2, 2, 497, 499, 3, 2, 2, 2, 498, 489, 3, 2, 2, 2, 498, 499, 3, 2, 2, 2, 499, 501, 3, 2, 2, 2, 500, 502, 9, 13, 2, 2, 501, 500, 3, 2, 2, 2, 501, 502, 3, 2, 2, 2, 502, 153, 3, 2, 2, 2, 503, 511, 7, 36, 2, 2, 504, 505, 7, 94, 2, 2, 505, 510, 7, 36, 2, 2, 506, 507, 7, 94, 2, 2, 507, 510, 7, 94, 2, 2, 508, 510, 10, 14, 2, 2, 509, 504, 3, 2, 2, 2, 509, 506, 3, 2, 2, 2, 509, 508, 3, 2, 2, 2, 510, 513, 3, 2, 2, 2, 511, 512, 3, 2, 2, 2, 511, 509, 3, 2, 2, 2, 512, 514, 3, 2, 2, 2, 513, 511, 3, 2, 2, 2, 514, 528, 7, 36, 2, 2, 515, 523, 7, 41, 2, 2, 516, 517, 7, 94, 2, 2, 517, 522, 7, 41, 2, 2, 518, 519, 7, 94, 2, 2, 519, 522, 7, 94, 2, 2, 520, 522, 10, 15, 2, 2, 521, 516, 3, 2, 2, 2, 521, 518, 3, 2, 2, 2, 521, 520, 3, 2, 2, 2, 522, 525, 3, 2, 2, 2, 523, 524, 3, 2, 2, 2, 523, 521, 3, 2, 2, 2, 524, 526, 3, 2, 2, 2, 525, 523, 3, 2, 2, 2, 526, 528, 7, 41, 2, 2, 527, 503, 3, 2, 2, 2, 527, 515, 3, 2, 2, 2, 528, 155, 3, 2, 2, 2, 529, 533, 7, 49, 2, 2, 530, 531, 7, 94, 2, 2, 531, 534, 10, 16, 2, 2, 532, 534, 10, 17, 2, 2, 533, 530, 3, 2, 2, 2, 533, 532, 3, 2, 2, 2, 534, 535, 3, 2, 2, 2, 535, 536, 3, 2, 2, 2, 535, 533, 3, 2, 2, 2, 536, 537, 3, 2, 2, 2, 537, 541, 7, 49, 2, 2, 538, 540, 9, 18, 2, 2, 539, 538, 3, 2, 2, 2, 540, 543, 3, 2, 2, 2, 541, 539, 3, 2, 2, 2, 541, 542, 3, 2, 2, 2, 542, 544, 3, 2, 2, 2, 543, 541, 3, 2, 2, 2, 544, 545, 6, 78, 3, 2, 545, 157, 3, 2, 2, 2, 546, 547, 7, 118, 2, 2, 547, 548, 7, 116, 2, 2, 548, 549, 7, 119, 2, 2, 549, 550, 7, 103, 2, 2, 550, 159, 3, 2, 2, 2, 551, 552, 7, 104, 2, 2, 552, 553, 7, 99, 2, 2, 553, 554, 7, 110, 2, 2, 554, 555, 7, 117, 2, 2, 555, 556, 7, 103, 2, 2, 556, 161, 3, 2, 2, 2, 557, 558, 7, 112, 2, 2, 558, 559, 7, 119, 2, 2, 559, 560, 7, 110, 2, 2, 560, 561, 7, 110, 2, 2, 561, 163, 3, 2, 2, 2, 562, 563, 7, 100, 2, 2, 563, 564, 7, 113, 2, 2, 564, 565, 7, 113, 2, 2, 565, 566, 7, 110, 2, 2, 566, 567, 7, 103, 2, 2, 567, 568, 7, 99, 2, 2, 568, 601, 7, 112, 2, 2, 569, 570, 7, 100, 2, 2, 570, 571, 7, 123, 2, 2, 571, 572, 7, 118, 2, 2, 572, 601, 7, 103, 2, 2, 573, 574, 7, 117, 2, 2, 574, 575, 7, 106, 2, 2, 575, 576, 7, 113, 2, 2, 576, 577, 7, 116, 2, 2, 577, 601, 7, 118, 2, 2, 578, 579, 7, 101, 2, 2, 579, 580, 7, 106, 2, 2, 580, 581, 7, 99, 2, 2, 581, 601, 7, 116, 2, 2, 582, 583, 7, 107, 2, 2, 583, 584, 7, 112, 2, 2, 584, 601, 7, 118, 2, 2, 585, 586, 7, 110, 2, 2, 586, 587, 7, 113, 2, 2, 587, 588, 7, 112, 2, 2, 588, 601, 7, 105, 2, 2, 589, 590, 7, 104, 2, 2, 590, 591, 7, 110, 2, 2, 591, 592, 7, 113, 2, 2, 592, 593, 7, 99, 2, 2, 593, 601, 7, 118, 2, 2, 594, 595, 7, 102, 2, 2, 595, 596, 7, 113, 2, 2, 596, 597, 7, 119, 2, 2, 597, 598, 7, 100, 2, 2, 598, 599, 7, 110, 2, 2, 599, 601, 7, 103, 2, 2, 600, 562, 3, 2, 2, 2, 600, 569, 3, 2, 2, 2, 600, 573, 3, 2, 2, 2, 600, 578, 3, 2, 2, 2, 600, 582, 3, 2, 2, 2, 600, 585, 3, 2, 2, 2, 600, 589, 3, 2, 2, 2, 600, 594, 3, 2, 2, 2, 601, 165, 3, 2, 2, 2, 602, 603, 7, 102, 2, 2, 603, 604, 7, 103, 2, 2, 604, 605, 7, 104, 2, 2, 605, 167, 3, 2, 2, 2, 606, 610, 9, 19, 2, 2, 607, 609, 9, 20, 2, 2, 608, 607, 3, 2, 2, 2, 609, 612, 3, 2, 2, 2, 610, 608, 3, 2, 2, 2, 610, 611, 3, 2, 2, 2, 611, 169, 3, 2, 2, 2, 612, 610, 3, 2, 2, 2, 613, 622, 7, 50, 2, 2, 614, 618, 9, 8, 2, 2, 615, 617, 9, 9, 2, 2, 616, 615, 3, 2, 2, 2, 617, 620, 3, 2, 2, 2, 618, 616, 3, 2, 2, 2, 618, 619, 3, 2, 2, 2, 619, 622, 3, 2, 2, 2, 620, 618, 3, 2, 2, 2, 621, 613, 3, 2, 2, 2, 621, 614, 3, 2, 2, 2, 622, 623, 3, 2, 2, 2, 623, 624, 8, 85, 4, 2, 624, 171, 3, 2, 2, 2, 625, 629, 9, 19, 2, 2, 626, 628, 9, 20, 2, 2, 627, 626, 3, 2, 2, 2, 628, 631, 3, 2, 2, 2, 629, 627, 3, 2, 2, 2, 629, 630, 3, 2, 2, 2, 630, 632, 3, 2, 2, 2, 631, 629, 3, 2, 2, 2, 632, 633, 8, 86, 4, 2, 633, 173, 3, 2, 2, 2, 36, 2, 3, 177, 187, 197, 202, 443, 446, 453, 456, 463, 466, 469, 476, 479, 485, 487, 491, 496, 498, 501, 509, 511, 521, 523, 527, 533, 535, 541, 600, 610, 618, 621, 629, 5, 8, 2, 2, 4, 3, 2, 4, 2, 2] \ No newline at end of file diff --git a/packages/kbn-monaco/src/painless/antlr/painless_lexer.tokens b/packages/kbn-monaco/src/painless/antlr/painless_lexer.tokens new file mode 100644 index 0000000000000..ff62343c92ba5 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_lexer.tokens @@ -0,0 +1,158 @@ +WS=1 +COMMENT=2 +LBRACK=3 +RBRACK=4 +LBRACE=5 +RBRACE=6 +LP=7 +RP=8 +DOT=9 +NSDOT=10 +COMMA=11 +SEMICOLON=12 +IF=13 +IN=14 +ELSE=15 +WHILE=16 +DO=17 +FOR=18 +CONTINUE=19 +BREAK=20 +RETURN=21 +NEW=22 +TRY=23 +CATCH=24 +THROW=25 +THIS=26 +INSTANCEOF=27 +BOOLNOT=28 +BWNOT=29 +MUL=30 +DIV=31 +REM=32 +ADD=33 +SUB=34 +LSH=35 +RSH=36 +USH=37 +LT=38 +LTE=39 +GT=40 +GTE=41 +EQ=42 +EQR=43 +NE=44 +NER=45 +BWAND=46 +XOR=47 +BWOR=48 +BOOLAND=49 +BOOLOR=50 +COND=51 +COLON=52 +ELVIS=53 +REF=54 +ARROW=55 +FIND=56 +MATCH=57 +INCR=58 +DECR=59 +ASSIGN=60 +AADD=61 +ASUB=62 +AMUL=63 +ADIV=64 +AREM=65 +AAND=66 +AXOR=67 +AOR=68 +ALSH=69 +ARSH=70 +AUSH=71 +OCTAL=72 +HEX=73 +INTEGER=74 +DECIMAL=75 +STRING=76 +REGEX=77 +TRUE=78 +FALSE=79 +NULL=80 +PRIMITIVE=81 +DEF=82 +ID=83 +DOTINTEGER=84 +DOTID=85 +'{'=3 +'}'=4 +'['=5 +']'=6 +'('=7 +')'=8 +'.'=9 +'?.'=10 +','=11 +';'=12 +'if'=13 +'in'=14 +'else'=15 +'while'=16 +'do'=17 +'for'=18 +'continue'=19 +'break'=20 +'return'=21 +'new'=22 +'try'=23 +'catch'=24 +'throw'=25 +'this'=26 +'instanceof'=27 +'!'=28 +'~'=29 +'*'=30 +'/'=31 +'%'=32 +'+'=33 +'-'=34 +'<<'=35 +'>>'=36 +'>>>'=37 +'<'=38 +'<='=39 +'>'=40 +'>='=41 +'=='=42 +'==='=43 +'!='=44 +'!=='=45 +'&'=46 +'^'=47 +'|'=48 +'&&'=49 +'||'=50 +'?'=51 +':'=52 +'?:'=53 +'::'=54 +'->'=55 +'=~'=56 +'==~'=57 +'++'=58 +'--'=59 +'='=60 +'+='=61 +'-='=62 +'*='=63 +'/='=64 +'%='=65 +'&='=66 +'^='=67 +'|='=68 +'<<='=69 +'>>='=70 +'>>>='=71 +'true'=78 +'false'=79 +'null'=80 +'def'=82 diff --git a/packages/kbn-monaco/src/painless/antlr/painless_lexer.ts b/packages/kbn-monaco/src/painless/antlr/painless_lexer.ts new file mode 100644 index 0000000000000..eb335c73d94b2 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_lexer.ts @@ -0,0 +1,538 @@ +// @ts-nocheck +// Generated from ./src/painless/antlr/painless_lexer.g4 by ANTLR 4.7.3-SNAPSHOT + + +import { ATN } from "antlr4ts/atn/ATN"; +import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer"; +import { CharStream } from "antlr4ts/CharStream"; +import { Lexer } from "antlr4ts/Lexer"; +import { LexerATNSimulator } from "antlr4ts/atn/LexerATNSimulator"; +import { NotNull } from "antlr4ts/Decorators"; +import { Override } from "antlr4ts/Decorators"; +import { RuleContext } from "antlr4ts/RuleContext"; +import { Vocabulary } from "antlr4ts/Vocabulary"; +import { VocabularyImpl } from "antlr4ts/VocabularyImpl"; + +import * as Utils from "antlr4ts/misc/Utils"; + + +export class painless_lexer extends Lexer { + public static readonly WS = 1; + public static readonly COMMENT = 2; + public static readonly LBRACK = 3; + public static readonly RBRACK = 4; + public static readonly LBRACE = 5; + public static readonly RBRACE = 6; + public static readonly LP = 7; + public static readonly RP = 8; + public static readonly DOT = 9; + public static readonly NSDOT = 10; + public static readonly COMMA = 11; + public static readonly SEMICOLON = 12; + public static readonly IF = 13; + public static readonly IN = 14; + public static readonly ELSE = 15; + public static readonly WHILE = 16; + public static readonly DO = 17; + public static readonly FOR = 18; + public static readonly CONTINUE = 19; + public static readonly BREAK = 20; + public static readonly RETURN = 21; + public static readonly NEW = 22; + public static readonly TRY = 23; + public static readonly CATCH = 24; + public static readonly THROW = 25; + public static readonly THIS = 26; + public static readonly INSTANCEOF = 27; + public static readonly BOOLNOT = 28; + public static readonly BWNOT = 29; + public static readonly MUL = 30; + public static readonly DIV = 31; + public static readonly REM = 32; + public static readonly ADD = 33; + public static readonly SUB = 34; + public static readonly LSH = 35; + public static readonly RSH = 36; + public static readonly USH = 37; + public static readonly LT = 38; + public static readonly LTE = 39; + public static readonly GT = 40; + public static readonly GTE = 41; + public static readonly EQ = 42; + public static readonly EQR = 43; + public static readonly NE = 44; + public static readonly NER = 45; + public static readonly BWAND = 46; + public static readonly XOR = 47; + public static readonly BWOR = 48; + public static readonly BOOLAND = 49; + public static readonly BOOLOR = 50; + public static readonly COND = 51; + public static readonly COLON = 52; + public static readonly ELVIS = 53; + public static readonly REF = 54; + public static readonly ARROW = 55; + public static readonly FIND = 56; + public static readonly MATCH = 57; + public static readonly INCR = 58; + public static readonly DECR = 59; + public static readonly ASSIGN = 60; + public static readonly AADD = 61; + public static readonly ASUB = 62; + public static readonly AMUL = 63; + public static readonly ADIV = 64; + public static readonly AREM = 65; + public static readonly AAND = 66; + public static readonly AXOR = 67; + public static readonly AOR = 68; + public static readonly ALSH = 69; + public static readonly ARSH = 70; + public static readonly AUSH = 71; + public static readonly OCTAL = 72; + public static readonly HEX = 73; + public static readonly INTEGER = 74; + public static readonly DECIMAL = 75; + public static readonly STRING = 76; + public static readonly REGEX = 77; + public static readonly TRUE = 78; + public static readonly FALSE = 79; + public static readonly NULL = 80; + public static readonly PRIMITIVE = 81; + public static readonly DEF = 82; + public static readonly ID = 83; + public static readonly DOTINTEGER = 84; + public static readonly DOTID = 85; + public static readonly AFTER_DOT = 1; + + // tslint:disable:no-trailing-whitespace + public static readonly channelNames: string[] = [ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN", + ]; + + // tslint:disable:no-trailing-whitespace + public static readonly modeNames: string[] = [ + "DEFAULT_MODE", "AFTER_DOT", + ]; + + public static readonly ruleNames: string[] = [ + "WS", "COMMENT", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "LP", "RP", "DOT", + "NSDOT", "COMMA", "SEMICOLON", "IF", "IN", "ELSE", "WHILE", "DO", "FOR", + "CONTINUE", "BREAK", "RETURN", "NEW", "TRY", "CATCH", "THROW", "THIS", + "INSTANCEOF", "BOOLNOT", "BWNOT", "MUL", "DIV", "REM", "ADD", "SUB", "LSH", + "RSH", "USH", "LT", "LTE", "GT", "GTE", "EQ", "EQR", "NE", "NER", "BWAND", + "XOR", "BWOR", "BOOLAND", "BOOLOR", "COND", "COLON", "ELVIS", "REF", "ARROW", + "FIND", "MATCH", "INCR", "DECR", "ASSIGN", "AADD", "ASUB", "AMUL", "ADIV", + "AREM", "AAND", "AXOR", "AOR", "ALSH", "ARSH", "AUSH", "OCTAL", "HEX", + "INTEGER", "DECIMAL", "STRING", "REGEX", "TRUE", "FALSE", "NULL", "PRIMITIVE", + "DEF", "ID", "DOTINTEGER", "DOTID", + ]; + + private static readonly _LITERAL_NAMES: Array = [ + undefined, undefined, undefined, "'{'", "'}'", "'['", "']'", "'('", "')'", + "'.'", "'?.'", "','", "';'", "'if'", "'in'", "'else'", "'while'", "'do'", + "'for'", "'continue'", "'break'", "'return'", "'new'", "'try'", "'catch'", + "'throw'", "'this'", "'instanceof'", "'!'", "'~'", "'*'", "'/'", "'%'", + "'+'", "'-'", "'<<'", "'>>'", "'>>>'", "'<'", "'<='", "'>'", "'>='", "'=='", + "'==='", "'!='", "'!=='", "'&'", "'^'", "'|'", "'&&'", "'||'", "'?'", + "':'", "'?:'", "'::'", "'->'", "'=~'", "'==~'", "'++'", "'--'", "'='", + "'+='", "'-='", "'*='", "'/='", "'%='", "'&='", "'^='", "'|='", "'<<='", + "'>>='", "'>>>='", undefined, undefined, undefined, undefined, undefined, + undefined, "'true'", "'false'", "'null'", undefined, "'def'", + ]; + private static readonly _SYMBOLIC_NAMES: Array = [ + undefined, "WS", "COMMENT", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "LP", + "RP", "DOT", "NSDOT", "COMMA", "SEMICOLON", "IF", "IN", "ELSE", "WHILE", + "DO", "FOR", "CONTINUE", "BREAK", "RETURN", "NEW", "TRY", "CATCH", "THROW", + "THIS", "INSTANCEOF", "BOOLNOT", "BWNOT", "MUL", "DIV", "REM", "ADD", + "SUB", "LSH", "RSH", "USH", "LT", "LTE", "GT", "GTE", "EQ", "EQR", "NE", + "NER", "BWAND", "XOR", "BWOR", "BOOLAND", "BOOLOR", "COND", "COLON", "ELVIS", + "REF", "ARROW", "FIND", "MATCH", "INCR", "DECR", "ASSIGN", "AADD", "ASUB", + "AMUL", "ADIV", "AREM", "AAND", "AXOR", "AOR", "ALSH", "ARSH", "AUSH", + "OCTAL", "HEX", "INTEGER", "DECIMAL", "STRING", "REGEX", "TRUE", "FALSE", + "NULL", "PRIMITIVE", "DEF", "ID", "DOTINTEGER", "DOTID", + ]; + public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(painless_lexer._LITERAL_NAMES, painless_lexer._SYMBOLIC_NAMES, []); + + // @Override + // @NotNull + public get vocabulary(): Vocabulary { + return painless_lexer.VOCABULARY; + } + // tslint:enable:no-trailing-whitespace + + + constructor(input: CharStream) { + super(input); + this._interp = new LexerATNSimulator(painless_lexer._ATN, this); + } + + // @Override + public get grammarFileName(): string { return "painless_lexer.g4"; } + + // @Override + public get ruleNames(): string[] { return painless_lexer.ruleNames; } + + // @Override + public get serializedATN(): string { return painless_lexer._serializedATN; } + + // @Override + public get channelNames(): string[] { return painless_lexer.channelNames; } + + // @Override + public get modeNames(): string[] { return painless_lexer.modeNames; } + + // @Override + public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean { + switch (ruleIndex) { + // DO NOT CHANGE + // This is a manual fix to handle slashes appropriately + case 31: + return this.DIV_sempred(_localctx, predIndex); + + // DO NOT CHANGE + // This is a manual fix to handle regexes appropriately + case 77: + return this.REGEX_sempred(_localctx, predIndex); + } + return true; + } + private DIV_sempred(_localctx: RuleContext, predIndex: number): boolean { + switch (predIndex) { + case 0: + return this.isSlashRegex() == false ; + } + return true; + } + private REGEX_sempred(_localctx: RuleContext, predIndex: number): boolean { + switch (predIndex) { + case 1: + return this.isSlashRegex() ; + } + return true; + } + + private static readonly _serializedATNSegments: number = 2; + private static readonly _serializedATNSegment0: string = + "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02W\u027A\b\x01" + + "\b\x01\x04\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06" + + "\t\x06\x04\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f" + + "\x04\r\t\r\x04\x0E\t\x0E\x04\x0F\t\x0F\x04\x10\t\x10\x04\x11\t\x11\x04" + + "\x12\t\x12\x04\x13\t\x13\x04\x14\t\x14\x04\x15\t\x15\x04\x16\t\x16\x04" + + "\x17\t\x17\x04\x18\t\x18\x04\x19\t\x19\x04\x1A\t\x1A\x04\x1B\t\x1B\x04" + + "\x1C\t\x1C\x04\x1D\t\x1D\x04\x1E\t\x1E\x04\x1F\t\x1F\x04 \t \x04!\t!\x04" + + "\"\t\"\x04#\t#\x04$\t$\x04%\t%\x04&\t&\x04\'\t\'\x04(\t(\x04)\t)\x04*" + + "\t*\x04+\t+\x04,\t,\x04-\t-\x04.\t.\x04/\t/\x040\t0\x041\t1\x042\t2\x04" + + "3\t3\x044\t4\x045\t5\x046\t6\x047\t7\x048\t8\x049\t9\x04:\t:\x04;\t;\x04" + + "<\t<\x04=\t=\x04>\t>\x04?\t?\x04@\t@\x04A\tA\x04B\tB\x04C\tC\x04D\tD\x04" + + "E\tE\x04F\tF\x04G\tG\x04H\tH\x04I\tI\x04J\tJ\x04K\tK\x04L\tL\x04M\tM\x04" + + "N\tN\x04O\tO\x04P\tP\x04Q\tQ\x04R\tR\x04S\tS\x04T\tT\x04U\tU\x04V\tV\x03" + + "\x02\x06\x02\xB0\n\x02\r\x02\x0E\x02\xB1\x03\x02\x03\x02\x03\x03\x03\x03" + + "\x03\x03\x03\x03\x07\x03\xBA\n\x03\f\x03\x0E\x03\xBD\v\x03\x03\x03\x03" + + "\x03\x03\x03\x03\x03\x03\x03\x07\x03\xC4\n\x03\f\x03\x0E\x03\xC7\v\x03" + + "\x03\x03\x03\x03\x05\x03\xCB\n\x03\x03\x03\x03\x03\x03\x04\x03\x04\x03" + + "\x05\x03\x05\x03\x06\x03\x06\x03\x07\x03\x07\x03\b\x03\b\x03\t\x03\t\x03" + + "\n\x03\n\x03\n\x03\n\x03\v\x03\v\x03\v\x03\v\x03\v\x03\f\x03\f\x03\r\x03" + + "\r\x03\x0E\x03\x0E\x03\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x10\x03\x10\x03" + + "\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03" + + "\x12\x03\x12\x03\x12\x03\x13\x03\x13\x03\x13\x03\x13\x03\x14\x03\x14\x03" + + "\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03\x15\x03\x15\x03" + + "\x15\x03\x15\x03\x15\x03\x15\x03\x16\x03\x16\x03\x16\x03\x16\x03\x16\x03" + + "\x16\x03\x16\x03\x17\x03\x17\x03\x17\x03\x17\x03\x18\x03\x18\x03\x18\x03" + + "\x18\x03\x19\x03\x19\x03\x19\x03\x19\x03\x19\x03\x19\x03\x1A\x03\x1A\x03" + + "\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1B\x03\x1B\x03\x1B\x03\x1B\x03\x1B\x03" + + "\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03" + + "\x1C\x03\x1C\x03\x1D\x03\x1D\x03\x1E\x03\x1E\x03\x1F\x03\x1F\x03 \x03" + + " \x03 \x03!\x03!\x03\"\x03\"\x03#\x03#\x03$\x03$\x03$\x03%\x03%\x03%\x03" + + "&\x03&\x03&\x03&\x03\'\x03\'\x03(\x03(\x03(\x03)\x03)\x03*\x03*\x03*\x03" + + "+\x03+\x03+\x03,\x03,\x03,\x03,\x03-\x03-\x03-\x03.\x03.\x03.\x03.\x03" + + "/\x03/\x030\x030\x031\x031\x032\x032\x032\x033\x033\x033\x034\x034\x03" + + "5\x035\x036\x036\x036\x037\x037\x037\x038\x038\x038\x039\x039\x039\x03" + + ":\x03:\x03:\x03:\x03;\x03;\x03;\x03<\x03<\x03<\x03=\x03=\x03>\x03>\x03" + + ">\x03?\x03?\x03?\x03@\x03@\x03@\x03A\x03A\x03A\x03B\x03B\x03B\x03C\x03" + + "C\x03C\x03D\x03D\x03D\x03E\x03E\x03E\x03F\x03F\x03F\x03F\x03G\x03G\x03" + + "G\x03G\x03H\x03H\x03H\x03H\x03H\x03I\x03I\x06I\u01BA\nI\rI\x0EI\u01BB" + + "\x03I\x05I\u01BF\nI\x03J\x03J\x03J\x06J\u01C4\nJ\rJ\x0EJ\u01C5\x03J\x05" + + "J\u01C9\nJ\x03K\x03K\x03K\x07K\u01CE\nK\fK\x0EK\u01D1\vK\x05K\u01D3\n" + + "K\x03K\x05K\u01D6\nK\x03L\x03L\x03L\x07L\u01DB\nL\fL\x0EL\u01DE\vL\x05" + + "L\u01E0\nL\x03L\x03L\x06L\u01E4\nL\rL\x0EL\u01E5\x05L\u01E8\nL\x03L\x03" + + "L\x05L\u01EC\nL\x03L\x06L\u01EF\nL\rL\x0EL\u01F0\x05L\u01F3\nL\x03L\x05" + + "L\u01F6\nL\x03M\x03M\x03M\x03M\x03M\x03M\x07M\u01FE\nM\fM\x0EM\u0201\v" + + "M\x03M\x03M\x03M\x03M\x03M\x03M\x03M\x07M\u020A\nM\fM\x0EM\u020D\vM\x03" + + "M\x05M\u0210\nM\x03N\x03N\x03N\x03N\x06N\u0216\nN\rN\x0EN\u0217\x03N\x03" + + "N\x07N\u021C\nN\fN\x0EN\u021F\vN\x03N\x03N\x03O\x03O\x03O\x03O\x03O\x03" + + "P\x03P\x03P\x03P\x03P\x03P\x03Q\x03Q\x03Q\x03Q\x03Q\x03R\x03R\x03R\x03" + + "R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03" + + "R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03R\x03" + + "R\x03R\x03R\x03R\x03R\x03R\x03R\x05R\u0259\nR\x03S\x03S\x03S\x03S\x03" + + "T\x03T\x07T\u0261\nT\fT\x0ET\u0264\vT\x03U\x03U\x03U\x07U\u0269\nU\fU" + + "\x0EU\u026C\vU\x05U\u026E\nU\x03U\x03U\x03V\x03V\x07V\u0274\nV\fV\x0E" + + "V\u0277\vV\x03V\x03V\x07\xBB\xC5\u01FF\u020B\u0217\x02\x02W\x04\x02\x03" + + "\x06\x02\x04\b\x02\x05\n\x02\x06\f\x02\x07\x0E\x02\b\x10\x02\t\x12\x02" + + "\n\x14\x02\v\x16\x02\f\x18\x02\r\x1A\x02\x0E\x1C\x02\x0F\x1E\x02\x10 " + + "\x02\x11\"\x02\x12$\x02\x13&\x02\x14(\x02\x15*\x02\x16,\x02\x17.\x02\x18" + + "0\x02\x192\x02\x1A4\x02\x1B6\x02\x1C8\x02\x1D:\x02\x1E<\x02\x1F>\x02 " + + "@\x02!B\x02\"D\x02#F\x02$H\x02%J\x02&L\x02\'N\x02(P\x02)R\x02*T\x02+V" + + "\x02,X\x02-Z\x02.\\\x02/^\x020`\x021b\x022d\x023f\x024h\x025j\x026l\x02" + + "7n\x028p\x029r\x02:t\x02;v\x02|\x02?~\x02@\x80\x02A\x82\x02" + + "B\x84\x02C\x86\x02D\x88\x02E\x8A\x02F\x8C\x02G\x8E\x02H\x90\x02I\x92\x02" + + "J\x94\x02K\x96\x02L\x98\x02M\x9A\x02N\x9C\x02O\x9E\x02P\xA0\x02Q\xA2\x02" + + "R\xA4\x02S\xA6\x02T\xA8\x02U\xAA\x02V\xAC\x02W\x04\x02\x03\x15\x05\x02" + + "\v\f\x0F\x0F\"\"\x04\x02\f\f\x0F\x0F\x03\x0229\x04\x02NNnn\x04\x02ZZz" + + "z\x05\x022;CHch\x03\x023;\x03\x022;\b\x02FFHHNNffhhnn\x04\x02GGgg\x04" + + "\x02--//\x06\x02FFHHffhh\x04\x02$$^^\x04\x02))^^\x03\x02\f\f\x04\x02\f" + + "\f11\t\x02WWeekknouuwwzz\x05\x02C\\aac|\x06\x022;C\\aac|\x02\u02A0\x02" + + "\x04\x03\x02\x02\x02\x02\x06\x03\x02\x02\x02\x02\b\x03\x02\x02\x02\x02" + + "\n\x03\x02\x02\x02\x02\f\x03\x02\x02\x02\x02\x0E\x03\x02\x02\x02\x02\x10" + + "\x03\x02\x02\x02\x02\x12\x03\x02\x02\x02\x02\x14\x03\x02\x02\x02\x02\x16" + + "\x03\x02\x02\x02\x02\x18\x03\x02\x02\x02\x02\x1A\x03\x02\x02\x02\x02\x1C" + + "\x03\x02\x02\x02\x02\x1E\x03\x02\x02\x02\x02 \x03\x02\x02\x02\x02\"\x03" + + "\x02\x02\x02\x02$\x03\x02\x02\x02\x02&\x03\x02\x02\x02\x02(\x03\x02\x02" + + "\x02\x02*\x03\x02\x02\x02\x02,\x03\x02\x02\x02\x02.\x03\x02\x02\x02\x02" + + "0\x03\x02\x02\x02\x022\x03\x02\x02\x02\x024\x03\x02\x02\x02\x026\x03\x02" + + "\x02\x02\x028\x03\x02\x02\x02\x02:\x03\x02\x02\x02\x02<\x03\x02\x02\x02" + + "\x02>\x03\x02\x02\x02\x02@\x03\x02\x02\x02\x02B\x03\x02\x02\x02\x02D\x03" + + "\x02\x02\x02\x02F\x03\x02\x02\x02\x02H\x03\x02\x02\x02\x02J\x03\x02\x02" + + "\x02\x02L\x03\x02\x02\x02\x02N\x03\x02\x02\x02\x02P\x03\x02\x02\x02\x02" + + "R\x03\x02\x02\x02\x02T\x03\x02\x02\x02\x02V\x03\x02\x02\x02\x02X\x03\x02" + + "\x02\x02\x02Z\x03\x02\x02\x02\x02\\\x03\x02\x02\x02\x02^\x03\x02\x02\x02" + + "\x02`\x03\x02\x02\x02\x02b\x03\x02\x02\x02\x02d\x03\x02\x02\x02\x02f\x03" + + "\x02\x02\x02\x02h\x03\x02\x02\x02\x02j\x03\x02\x02\x02\x02l\x03\x02\x02" + + "\x02\x02n\x03\x02\x02\x02\x02p\x03\x02\x02\x02\x02r\x03\x02\x02\x02\x02" + + "t\x03\x02\x02\x02\x02v\x03\x02\x02\x02\x02x\x03\x02\x02\x02\x02z\x03\x02" + + "\x02\x02\x02|\x03\x02\x02\x02\x02~\x03\x02\x02\x02\x02\x80\x03\x02\x02" + + "\x02\x02\x82\x03\x02\x02\x02\x02\x84\x03\x02\x02\x02\x02\x86\x03\x02\x02" + + "\x02\x02\x88\x03\x02\x02\x02\x02\x8A\x03\x02\x02\x02\x02\x8C\x03\x02\x02" + + "\x02\x02\x8E\x03\x02\x02\x02\x02\x90\x03\x02\x02\x02\x02\x92\x03\x02\x02" + + "\x02\x02\x94\x03\x02\x02\x02\x02\x96\x03\x02\x02\x02\x02\x98\x03\x02\x02" + + "\x02\x02\x9A\x03\x02\x02\x02\x02\x9C\x03\x02\x02\x02\x02\x9E\x03\x02\x02" + + "\x02\x02\xA0\x03\x02\x02\x02\x02\xA2\x03\x02\x02\x02\x02\xA4\x03\x02\x02" + + "\x02\x02\xA6\x03\x02\x02\x02\x02\xA8\x03\x02\x02\x02\x03\xAA\x03\x02\x02" + + "\x02\x03\xAC\x03\x02\x02\x02\x04\xAF\x03\x02\x02\x02\x06\xCA\x03\x02\x02" + + "\x02\b\xCE\x03\x02\x02\x02\n\xD0\x03\x02\x02\x02\f\xD2\x03\x02\x02\x02" + + "\x0E\xD4\x03\x02\x02\x02\x10\xD6\x03\x02\x02\x02\x12\xD8\x03\x02\x02\x02" + + "\x14\xDA\x03\x02\x02\x02\x16\xDE\x03\x02\x02\x02\x18\xE3\x03\x02\x02\x02" + + "\x1A\xE5\x03\x02\x02\x02\x1C\xE7\x03\x02\x02\x02\x1E\xEA\x03\x02\x02\x02" + + " \xED\x03\x02\x02\x02\"\xF2\x03\x02\x02\x02$\xF8\x03\x02\x02\x02&\xFB" + + "\x03\x02\x02\x02(\xFF\x03\x02\x02\x02*\u0108\x03\x02\x02\x02,\u010E\x03" + + "\x02\x02\x02.\u0115\x03\x02\x02\x020\u0119\x03\x02\x02\x022\u011D\x03" + + "\x02\x02\x024\u0123\x03\x02\x02\x026\u0129\x03\x02\x02\x028\u012E\x03" + + "\x02\x02\x02:\u0139\x03\x02\x02\x02<\u013B\x03\x02\x02\x02>\u013D\x03" + + "\x02\x02\x02@\u013F\x03\x02\x02\x02B\u0142\x03\x02\x02\x02D\u0144\x03" + + "\x02\x02\x02F\u0146\x03\x02\x02\x02H\u0148\x03\x02\x02\x02J\u014B\x03" + + "\x02\x02\x02L\u014E\x03\x02\x02\x02N\u0152\x03\x02\x02\x02P\u0154\x03" + + "\x02\x02\x02R\u0157\x03\x02\x02\x02T\u0159\x03\x02\x02\x02V\u015C\x03" + + "\x02\x02\x02X\u015F\x03\x02\x02\x02Z\u0163\x03\x02\x02\x02\\\u0166\x03" + + "\x02\x02\x02^\u016A\x03\x02\x02\x02`\u016C\x03\x02\x02\x02b\u016E\x03" + + "\x02\x02\x02d\u0170\x03\x02\x02\x02f\u0173\x03\x02\x02\x02h\u0176\x03" + + "\x02\x02\x02j\u0178\x03\x02\x02\x02l\u017A\x03\x02\x02\x02n\u017D\x03" + + "\x02\x02\x02p\u0180\x03\x02\x02\x02r\u0183\x03\x02\x02\x02t\u0186\x03" + + "\x02\x02\x02v\u018A\x03\x02\x02\x02x\u018D\x03\x02\x02\x02z\u0190\x03" + + "\x02\x02\x02|\u0192\x03\x02\x02\x02~\u0195\x03\x02\x02\x02\x80\u0198\x03" + + "\x02\x02\x02\x82\u019B\x03\x02\x02\x02\x84\u019E\x03\x02\x02\x02\x86\u01A1" + + "\x03\x02\x02\x02\x88\u01A4\x03\x02\x02\x02\x8A\u01A7\x03\x02\x02\x02\x8C" + + "\u01AA\x03\x02\x02\x02\x8E\u01AE\x03\x02\x02\x02\x90\u01B2\x03\x02\x02" + + "\x02\x92\u01B7\x03\x02\x02\x02\x94\u01C0\x03\x02\x02\x02\x96\u01D2\x03" + + "\x02\x02\x02\x98\u01DF\x03\x02\x02\x02\x9A\u020F\x03\x02\x02\x02\x9C\u0211" + + "\x03\x02\x02\x02\x9E\u0222\x03\x02\x02\x02\xA0\u0227\x03\x02\x02\x02\xA2" + + "\u022D\x03\x02\x02\x02\xA4\u0258\x03\x02\x02\x02\xA6\u025A\x03\x02\x02" + + "\x02\xA8\u025E\x03\x02\x02\x02\xAA\u026D\x03\x02\x02\x02\xAC\u0271\x03" + + "\x02\x02\x02\xAE\xB0\t\x02\x02\x02\xAF\xAE\x03\x02\x02\x02\xB0\xB1\x03" + + "\x02\x02\x02\xB1\xAF\x03\x02\x02\x02\xB1\xB2\x03\x02\x02\x02\xB2\xB3\x03" + + "\x02\x02\x02\xB3\xB4\b\x02\x02\x02\xB4\x05\x03\x02\x02\x02\xB5\xB6\x07" + + "1\x02\x02\xB6\xB7\x071\x02\x02\xB7\xBB\x03\x02\x02\x02\xB8\xBA\v\x02\x02" + + "\x02\xB9\xB8\x03\x02\x02\x02\xBA\xBD\x03\x02\x02\x02\xBB\xBC\x03\x02\x02" + + "\x02\xBB\xB9\x03\x02\x02\x02\xBC\xBE\x03\x02\x02\x02\xBD\xBB\x03\x02\x02" + + "\x02\xBE\xCB\t\x03\x02\x02\xBF\xC0\x071\x02\x02\xC0\xC1\x07,\x02\x02\xC1" + + "\xC5\x03\x02\x02\x02\xC2\xC4\v\x02\x02\x02\xC3\xC2\x03\x02\x02\x02\xC4" + + "\xC7\x03\x02\x02\x02\xC5\xC6\x03\x02\x02\x02\xC5\xC3\x03\x02\x02\x02\xC6" + + "\xC8\x03\x02\x02\x02\xC7\xC5\x03\x02\x02\x02\xC8\xC9\x07,\x02\x02\xC9" + + "\xCB\x071\x02\x02\xCA\xB5\x03\x02\x02\x02\xCA\xBF\x03\x02\x02\x02\xCB" + + "\xCC\x03\x02\x02\x02\xCC\xCD\b\x03\x02\x02\xCD\x07\x03\x02\x02\x02\xCE" + + "\xCF\x07}\x02\x02\xCF\t\x03\x02\x02\x02\xD0\xD1\x07\x7F\x02\x02\xD1\v" + + "\x03\x02\x02\x02\xD2\xD3\x07]\x02\x02\xD3\r\x03\x02\x02\x02\xD4\xD5\x07" + + "_\x02\x02\xD5\x0F\x03\x02\x02\x02\xD6\xD7\x07*\x02\x02\xD7\x11\x03\x02" + + "\x02\x02\xD8\xD9\x07+\x02\x02\xD9\x13\x03\x02\x02\x02\xDA\xDB\x070\x02" + + "\x02\xDB\xDC\x03\x02\x02\x02\xDC\xDD\b\n\x03\x02\xDD\x15\x03\x02\x02\x02" + + "\xDE\xDF\x07A\x02\x02\xDF\xE0\x070\x02\x02\xE0\xE1\x03\x02\x02\x02\xE1" + + "\xE2\b\v\x03\x02\xE2\x17\x03\x02\x02\x02\xE3\xE4\x07.\x02\x02\xE4\x19" + + "\x03\x02\x02\x02\xE5\xE6\x07=\x02\x02\xE6\x1B\x03\x02\x02\x02\xE7\xE8" + + "\x07k\x02\x02\xE8\xE9\x07h\x02\x02\xE9\x1D\x03\x02\x02\x02\xEA\xEB\x07" + + "k\x02\x02\xEB\xEC\x07p\x02\x02\xEC\x1F\x03\x02\x02\x02\xED\xEE\x07g\x02" + + "\x02\xEE\xEF\x07n\x02\x02\xEF\xF0\x07u\x02\x02\xF0\xF1\x07g\x02\x02\xF1" + + "!\x03\x02\x02\x02\xF2\xF3\x07y\x02\x02\xF3\xF4\x07j\x02\x02\xF4\xF5\x07" + + "k\x02\x02\xF5\xF6\x07n\x02\x02\xF6\xF7\x07g\x02\x02\xF7#\x03\x02\x02\x02" + + "\xF8\xF9\x07f\x02\x02\xF9\xFA\x07q\x02\x02\xFA%\x03\x02\x02\x02\xFB\xFC" + + "\x07h\x02\x02\xFC\xFD\x07q\x02\x02\xFD\xFE\x07t\x02\x02\xFE\'\x03\x02" + + "\x02\x02\xFF\u0100\x07e\x02\x02\u0100\u0101\x07q\x02\x02\u0101\u0102\x07" + + "p\x02\x02\u0102\u0103\x07v\x02\x02\u0103\u0104\x07k\x02\x02\u0104\u0105" + + "\x07p\x02\x02\u0105\u0106\x07w\x02\x02\u0106\u0107\x07g\x02\x02\u0107" + + ")\x03\x02\x02\x02\u0108\u0109\x07d\x02\x02\u0109\u010A\x07t\x02\x02\u010A" + + "\u010B\x07g\x02\x02\u010B\u010C\x07c\x02\x02\u010C\u010D\x07m\x02\x02" + + "\u010D+\x03\x02\x02\x02\u010E\u010F\x07t\x02\x02\u010F\u0110\x07g\x02" + + "\x02\u0110\u0111\x07v\x02\x02\u0111\u0112\x07w\x02\x02\u0112\u0113\x07" + + "t\x02\x02\u0113\u0114\x07p\x02\x02\u0114-\x03\x02\x02\x02\u0115\u0116" + + "\x07p\x02\x02\u0116\u0117\x07g\x02\x02\u0117\u0118\x07y\x02\x02\u0118" + + "/\x03\x02\x02\x02\u0119\u011A\x07v\x02\x02\u011A\u011B\x07t\x02\x02\u011B" + + "\u011C\x07{\x02\x02\u011C1\x03\x02\x02\x02\u011D\u011E\x07e\x02\x02\u011E" + + "\u011F\x07c\x02\x02\u011F\u0120\x07v\x02\x02\u0120\u0121\x07e\x02\x02" + + "\u0121\u0122\x07j\x02\x02\u01223\x03\x02\x02\x02\u0123\u0124\x07v\x02" + + "\x02\u0124\u0125\x07j\x02\x02\u0125\u0126\x07t\x02\x02\u0126\u0127\x07" + + "q\x02\x02\u0127\u0128\x07y\x02\x02\u01285\x03\x02\x02\x02\u0129\u012A" + + "\x07v\x02\x02\u012A\u012B\x07j\x02\x02\u012B\u012C\x07k\x02\x02\u012C" + + "\u012D\x07u\x02\x02\u012D7\x03\x02\x02\x02\u012E\u012F\x07k\x02\x02\u012F" + + "\u0130\x07p\x02\x02\u0130\u0131\x07u\x02\x02\u0131\u0132\x07v\x02\x02" + + "\u0132\u0133\x07c\x02\x02\u0133\u0134\x07p\x02\x02\u0134\u0135\x07e\x02" + + "\x02\u0135\u0136\x07g\x02\x02\u0136\u0137\x07q\x02\x02\u0137\u0138\x07" + + "h\x02\x02\u01389\x03\x02\x02\x02\u0139\u013A\x07#\x02\x02\u013A;\x03\x02" + + "\x02\x02\u013B\u013C\x07\x80\x02\x02\u013C=\x03\x02\x02\x02\u013D\u013E" + + "\x07,\x02\x02\u013E?\x03\x02\x02\x02\u013F\u0140\x071\x02\x02\u0140\u0141" + + "\x06 \x02\x02\u0141A\x03\x02\x02\x02\u0142\u0143\x07\'\x02\x02\u0143C" + + "\x03\x02\x02\x02\u0144\u0145\x07-\x02\x02\u0145E\x03\x02\x02\x02\u0146" + + "\u0147\x07/\x02\x02\u0147G\x03\x02\x02\x02\u0148\u0149\x07>\x02\x02\u0149" + + "\u014A\x07>\x02\x02\u014AI\x03\x02\x02\x02\u014B\u014C\x07@\x02\x02\u014C" + + "\u014D\x07@\x02\x02\u014DK\x03\x02\x02\x02\u014E\u014F\x07@\x02\x02\u014F" + + "\u0150\x07@\x02\x02\u0150\u0151\x07@\x02\x02\u0151M\x03\x02\x02\x02\u0152" + + "\u0153\x07>\x02\x02\u0153O\x03\x02\x02\x02\u0154\u0155\x07>\x02\x02\u0155" + + "\u0156\x07?\x02\x02\u0156Q\x03\x02\x02\x02\u0157\u0158\x07@\x02\x02\u0158" + + "S\x03\x02\x02\x02\u0159\u015A\x07@\x02\x02\u015A\u015B\x07?\x02\x02\u015B" + + "U\x03\x02\x02\x02\u015C\u015D\x07?\x02\x02\u015D\u015E\x07?\x02\x02\u015E" + + "W\x03\x02\x02\x02\u015F\u0160\x07?\x02\x02\u0160\u0161\x07?\x02\x02\u0161" + + "\u0162\x07?\x02\x02\u0162Y\x03\x02\x02\x02\u0163\u0164\x07#\x02\x02\u0164" + + "\u0165\x07?\x02\x02\u0165[\x03\x02\x02\x02\u0166\u0167\x07#\x02\x02\u0167" + + "\u0168\x07?\x02\x02\u0168\u0169\x07?\x02\x02\u0169]\x03\x02\x02\x02\u016A" + + "\u016B\x07(\x02\x02\u016B_\x03\x02\x02\x02\u016C\u016D\x07`\x02\x02\u016D" + + "a\x03\x02\x02\x02\u016E\u016F\x07~\x02\x02\u016Fc\x03\x02\x02\x02\u0170" + + "\u0171\x07(\x02\x02\u0171\u0172\x07(\x02\x02\u0172e\x03\x02\x02\x02\u0173" + + "\u0174\x07~\x02\x02\u0174\u0175\x07~\x02\x02\u0175g\x03\x02\x02\x02\u0176" + + "\u0177\x07A\x02\x02\u0177i\x03\x02\x02\x02\u0178\u0179\x07<\x02\x02\u0179" + + "k\x03\x02\x02\x02\u017A\u017B\x07A\x02\x02\u017B\u017C\x07<\x02\x02\u017C" + + "m\x03\x02\x02\x02\u017D\u017E\x07<\x02\x02\u017E\u017F\x07<\x02\x02\u017F" + + "o\x03\x02\x02\x02\u0180\u0181\x07/\x02\x02\u0181\u0182\x07@\x02\x02\u0182" + + "q\x03\x02\x02\x02\u0183\u0184\x07?\x02\x02\u0184\u0185\x07\x80\x02\x02" + + "\u0185s\x03\x02\x02\x02\u0186\u0187\x07?\x02\x02\u0187\u0188\x07?\x02" + + "\x02\u0188\u0189\x07\x80\x02\x02\u0189u\x03\x02\x02\x02\u018A\u018B\x07" + + "-\x02\x02\u018B\u018C\x07-\x02\x02\u018Cw\x03\x02\x02\x02\u018D\u018E" + + "\x07/\x02\x02\u018E\u018F\x07/\x02\x02\u018Fy\x03\x02\x02\x02\u0190\u0191" + + "\x07?\x02\x02\u0191{\x03\x02\x02\x02\u0192\u0193\x07-\x02\x02\u0193\u0194" + + "\x07?\x02\x02\u0194}\x03\x02\x02\x02\u0195\u0196\x07/\x02\x02\u0196\u0197" + + "\x07?\x02\x02\u0197\x7F\x03\x02\x02\x02\u0198\u0199\x07,\x02\x02\u0199" + + "\u019A\x07?\x02\x02\u019A\x81\x03\x02\x02\x02\u019B\u019C\x071\x02\x02" + + "\u019C\u019D\x07?\x02\x02\u019D\x83\x03\x02\x02\x02\u019E\u019F\x07\'" + + "\x02\x02\u019F\u01A0\x07?\x02\x02\u01A0\x85\x03\x02\x02\x02\u01A1\u01A2" + + "\x07(\x02\x02\u01A2\u01A3\x07?\x02\x02\u01A3\x87\x03\x02\x02\x02\u01A4" + + "\u01A5\x07`\x02\x02\u01A5\u01A6\x07?\x02\x02\u01A6\x89\x03\x02\x02\x02" + + "\u01A7\u01A8\x07~\x02\x02\u01A8\u01A9\x07?\x02\x02\u01A9\x8B\x03\x02\x02" + + "\x02\u01AA\u01AB\x07>\x02\x02\u01AB\u01AC\x07>\x02\x02\u01AC\u01AD\x07" + + "?\x02\x02\u01AD\x8D\x03\x02\x02\x02\u01AE\u01AF\x07@\x02\x02\u01AF\u01B0" + + "\x07@\x02\x02\u01B0\u01B1\x07?\x02\x02\u01B1\x8F\x03\x02\x02\x02\u01B2" + + "\u01B3\x07@\x02\x02\u01B3\u01B4\x07@\x02\x02\u01B4\u01B5\x07@\x02\x02" + + "\u01B5\u01B6\x07?\x02\x02\u01B6\x91\x03\x02\x02\x02\u01B7\u01B9\x072\x02" + + "\x02\u01B8\u01BA\t\x04\x02\x02\u01B9\u01B8\x03\x02\x02\x02\u01BA\u01BB" + + "\x03\x02\x02\x02\u01BB\u01B9\x03\x02\x02\x02\u01BB\u01BC\x03\x02\x02\x02" + + "\u01BC\u01BE\x03\x02\x02\x02\u01BD\u01BF\t\x05\x02\x02\u01BE\u01BD\x03" + + "\x02\x02\x02\u01BE\u01BF\x03\x02\x02\x02\u01BF\x93\x03\x02\x02\x02\u01C0" + + "\u01C1\x072\x02\x02\u01C1\u01C3\t\x06\x02\x02\u01C2\u01C4\t\x07\x02\x02" + + "\u01C3\u01C2\x03\x02\x02\x02\u01C4\u01C5\x03\x02\x02\x02\u01C5\u01C3\x03" + + "\x02\x02\x02\u01C5\u01C6\x03\x02\x02\x02\u01C6\u01C8\x03\x02\x02\x02\u01C7" + + "\u01C9\t\x05\x02\x02\u01C8\u01C7\x03\x02\x02\x02\u01C8\u01C9\x03\x02\x02" + + "\x02\u01C9\x95\x03\x02\x02\x02\u01CA\u01D3\x072\x02\x02\u01CB\u01CF\t" + + "\b\x02\x02\u01CC\u01CE\t\t\x02\x02\u01CD\u01CC\x03\x02\x02\x02\u01CE\u01D1" + + "\x03\x02\x02\x02\u01CF\u01CD\x03\x02\x02\x02\u01CF\u01D0\x03\x02\x02\x02" + + "\u01D0\u01D3\x03\x02\x02\x02\u01D1\u01CF\x03\x02\x02\x02\u01D2\u01CA\x03" + + "\x02\x02\x02\u01D2\u01CB\x03\x02\x02\x02\u01D3\u01D5\x03\x02\x02\x02\u01D4" + + "\u01D6\t\n\x02\x02\u01D5\u01D4\x03\x02\x02\x02\u01D5\u01D6\x03\x02\x02" + + "\x02\u01D6\x97\x03\x02\x02\x02\u01D7\u01E0\x072\x02\x02\u01D8\u01DC\t" + + "\b\x02\x02\u01D9\u01DB\t\t\x02\x02\u01DA\u01D9\x03\x02\x02\x02\u01DB\u01DE" + + "\x03\x02\x02\x02\u01DC\u01DA\x03\x02\x02\x02\u01DC\u01DD\x03\x02\x02\x02" + + "\u01DD\u01E0\x03\x02\x02\x02\u01DE\u01DC\x03\x02\x02\x02\u01DF\u01D7\x03" + + "\x02\x02\x02\u01DF\u01D8\x03\x02\x02\x02\u01E0\u01E7\x03\x02\x02\x02\u01E1" + + "\u01E3\x05\x14\n\x02\u01E2\u01E4\t\t\x02\x02\u01E3\u01E2\x03\x02\x02\x02" + + "\u01E4\u01E5\x03\x02\x02\x02\u01E5\u01E3\x03\x02\x02\x02\u01E5\u01E6\x03" + + "\x02\x02\x02\u01E6\u01E8\x03\x02\x02\x02\u01E7\u01E1\x03\x02\x02\x02\u01E7" + + "\u01E8\x03\x02\x02\x02\u01E8\u01F2\x03\x02\x02\x02\u01E9\u01EB\t\v\x02" + + "\x02\u01EA\u01EC\t\f\x02\x02\u01EB\u01EA\x03\x02\x02\x02\u01EB\u01EC\x03" + + "\x02\x02\x02\u01EC\u01EE\x03\x02\x02\x02\u01ED\u01EF\t\t\x02\x02\u01EE" + + "\u01ED\x03\x02\x02\x02\u01EF\u01F0\x03\x02\x02\x02\u01F0\u01EE\x03\x02" + + "\x02\x02\u01F0\u01F1\x03\x02\x02\x02\u01F1\u01F3\x03\x02\x02\x02\u01F2" + + "\u01E9\x03\x02\x02\x02\u01F2\u01F3\x03\x02\x02\x02\u01F3\u01F5\x03\x02" + + "\x02\x02\u01F4\u01F6\t\r\x02\x02\u01F5\u01F4\x03\x02\x02\x02\u01F5\u01F6" + + "\x03\x02\x02\x02\u01F6\x99\x03\x02\x02\x02\u01F7\u01FF\x07$\x02\x02\u01F8" + + "\u01F9\x07^\x02\x02\u01F9\u01FE\x07$\x02\x02\u01FA\u01FB\x07^\x02\x02" + + "\u01FB\u01FE\x07^\x02\x02\u01FC\u01FE\n\x0E\x02\x02\u01FD\u01F8\x03\x02" + + "\x02\x02\u01FD\u01FA\x03\x02\x02\x02\u01FD\u01FC\x03\x02\x02\x02\u01FE" + + "\u0201\x03\x02\x02\x02\u01FF\u0200\x03\x02\x02\x02\u01FF\u01FD\x03\x02" + + "\x02\x02\u0200\u0202\x03\x02\x02\x02\u0201\u01FF\x03\x02\x02\x02\u0202" + + "\u0210\x07$\x02\x02\u0203\u020B\x07)\x02\x02\u0204\u0205\x07^\x02\x02" + + "\u0205\u020A\x07)\x02\x02\u0206\u0207\x07^\x02\x02\u0207\u020A\x07^\x02" + + "\x02\u0208\u020A\n\x0F\x02\x02\u0209\u0204\x03\x02\x02\x02\u0209\u0206" + + "\x03\x02\x02\x02\u0209\u0208\x03\x02\x02\x02\u020A\u020D\x03\x02\x02\x02" + + "\u020B\u020C\x03\x02\x02\x02\u020B\u0209\x03\x02\x02\x02\u020C"; + private static readonly _serializedATNSegment1: string = + "\u020E\x03\x02\x02\x02\u020D\u020B\x03\x02\x02\x02\u020E\u0210\x07)\x02" + + "\x02\u020F\u01F7\x03\x02\x02\x02\u020F\u0203\x03\x02\x02\x02\u0210\x9B" + + "\x03\x02\x02\x02\u0211\u0215\x071\x02\x02\u0212\u0213\x07^\x02\x02\u0213" + + "\u0216\n\x10\x02\x02\u0214\u0216\n\x11\x02\x02\u0215\u0212\x03\x02\x02" + + "\x02\u0215\u0214\x03\x02\x02\x02\u0216\u0217\x03\x02\x02\x02\u0217\u0218" + + "\x03\x02\x02\x02\u0217\u0215\x03\x02\x02\x02\u0218\u0219\x03\x02\x02\x02" + + "\u0219\u021D\x071\x02\x02\u021A\u021C\t\x12\x02\x02\u021B\u021A\x03\x02" + + "\x02\x02\u021C\u021F\x03\x02\x02\x02\u021D\u021B\x03\x02\x02\x02\u021D" + + "\u021E\x03\x02\x02\x02\u021E\u0220\x03\x02\x02\x02\u021F\u021D\x03\x02" + + "\x02\x02\u0220\u0221\x06N\x03\x02\u0221\x9D\x03\x02\x02\x02\u0222\u0223" + + "\x07v\x02\x02\u0223\u0224\x07t\x02\x02\u0224\u0225\x07w\x02\x02\u0225" + + "\u0226\x07g\x02\x02\u0226\x9F\x03\x02\x02\x02\u0227\u0228\x07h\x02\x02" + + "\u0228\u0229\x07c\x02\x02\u0229\u022A\x07n\x02\x02\u022A\u022B\x07u\x02" + + "\x02\u022B\u022C\x07g\x02\x02\u022C\xA1\x03\x02\x02\x02\u022D\u022E\x07" + + "p\x02\x02\u022E\u022F\x07w\x02\x02\u022F\u0230\x07n\x02\x02\u0230\u0231" + + "\x07n\x02\x02\u0231\xA3\x03\x02\x02\x02\u0232\u0233\x07d\x02\x02\u0233" + + "\u0234\x07q\x02\x02\u0234\u0235\x07q\x02\x02\u0235\u0236\x07n\x02\x02" + + "\u0236\u0237\x07g\x02\x02\u0237\u0238\x07c\x02\x02\u0238\u0259\x07p\x02" + + "\x02\u0239\u023A\x07d\x02\x02\u023A\u023B\x07{\x02\x02\u023B\u023C\x07" + + "v\x02\x02\u023C\u0259\x07g\x02\x02\u023D\u023E\x07u\x02\x02\u023E\u023F" + + "\x07j\x02\x02\u023F\u0240\x07q\x02\x02\u0240\u0241\x07t\x02\x02\u0241" + + "\u0259\x07v\x02\x02\u0242\u0243\x07e\x02\x02\u0243\u0244\x07j\x02\x02" + + "\u0244\u0245\x07c\x02\x02\u0245\u0259\x07t\x02\x02\u0246\u0247\x07k\x02" + + "\x02\u0247\u0248\x07p\x02\x02\u0248\u0259\x07v\x02\x02\u0249\u024A\x07" + + "n\x02\x02\u024A\u024B\x07q\x02\x02\u024B\u024C\x07p\x02\x02\u024C\u0259" + + "\x07i\x02\x02\u024D\u024E\x07h\x02\x02\u024E\u024F\x07n\x02\x02\u024F" + + "\u0250\x07q\x02\x02\u0250\u0251\x07c\x02\x02\u0251\u0259\x07v\x02\x02" + + "\u0252\u0253\x07f\x02\x02\u0253\u0254\x07q\x02\x02\u0254\u0255\x07w\x02" + + "\x02\u0255\u0256\x07d\x02\x02\u0256\u0257\x07n\x02\x02\u0257\u0259\x07" + + "g\x02\x02\u0258\u0232\x03\x02\x02\x02\u0258\u0239\x03\x02\x02\x02\u0258" + + "\u023D\x03\x02\x02\x02\u0258\u0242\x03\x02\x02\x02\u0258\u0246\x03\x02" + + "\x02\x02\u0258\u0249\x03\x02\x02\x02\u0258\u024D\x03\x02\x02\x02\u0258" + + "\u0252\x03\x02\x02\x02\u0259\xA5\x03\x02\x02\x02\u025A\u025B\x07f\x02" + + "\x02\u025B\u025C\x07g\x02\x02\u025C\u025D\x07h\x02\x02\u025D\xA7\x03\x02" + + "\x02\x02\u025E\u0262\t\x13\x02\x02\u025F\u0261\t\x14\x02\x02\u0260\u025F" + + "\x03\x02\x02\x02\u0261\u0264\x03\x02\x02\x02\u0262\u0260\x03\x02\x02\x02" + + "\u0262\u0263\x03\x02\x02\x02\u0263\xA9\x03\x02\x02\x02\u0264\u0262\x03" + + "\x02\x02\x02\u0265\u026E\x072\x02\x02\u0266\u026A\t\b\x02\x02\u0267\u0269" + + "\t\t\x02\x02\u0268\u0267\x03\x02\x02\x02\u0269\u026C\x03\x02\x02\x02\u026A" + + "\u0268\x03\x02\x02\x02\u026A\u026B\x03\x02\x02\x02\u026B\u026E\x03\x02" + + "\x02\x02\u026C\u026A\x03\x02\x02\x02\u026D\u0265\x03\x02\x02\x02\u026D" + + "\u0266\x03\x02\x02\x02\u026E\u026F\x03\x02\x02\x02\u026F\u0270\bU\x04" + + "\x02\u0270\xAB\x03\x02\x02\x02\u0271\u0275\t\x13\x02\x02\u0272\u0274\t" + + "\x14\x02\x02\u0273\u0272\x03\x02\x02\x02\u0274\u0277\x03\x02\x02\x02\u0275" + + "\u0273\x03\x02\x02\x02\u0275\u0276\x03\x02\x02\x02\u0276\u0278\x03\x02" + + "\x02\x02\u0277\u0275\x03\x02\x02\x02\u0278\u0279\bV\x04\x02\u0279\xAD" + + "\x03\x02\x02\x02$\x02\x03\xB1\xBB\xC5\xCA\u01BB\u01BE\u01C5\u01C8\u01CF" + + "\u01D2\u01D5\u01DC\u01DF\u01E5\u01E7\u01EB\u01F0\u01F2\u01F5\u01FD\u01FF" + + "\u0209\u020B\u020F\u0215\u0217\u021D\u0258\u0262\u026A\u026D\u0275\x05" + + "\b\x02\x02\x04\x03\x02\x04\x02\x02"; + public static readonly _serializedATN: string = Utils.join( + [ + painless_lexer._serializedATNSegment0, + painless_lexer._serializedATNSegment1, + ], + "", + ); + public static __ATN: ATN; + public static get _ATN(): ATN { + if (!painless_lexer.__ATN) { + painless_lexer.__ATN = new ATNDeserializer().deserialize(Utils.toCharArray(painless_lexer._serializedATN)); + } + + return painless_lexer.__ATN; + } + +} + diff --git a/packages/kbn-monaco/src/painless/antlr/painless_parser.g4 b/packages/kbn-monaco/src/painless/antlr/painless_parser.g4 new file mode 100644 index 0000000000000..58a9285c57a00 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_parser.g4 @@ -0,0 +1,226 @@ +parser grammar painless_parser; + +options { tokenVocab=painless_lexer; } + +source + : function* statement* EOF + ; + +function + : decltype ID parameters block + ; + +parameters + : LP ( decltype ID ( COMMA decltype ID )* )? RP + ; + +statement + : rstatement + | dstatement ( SEMICOLON | EOF ) + ; + +// Note we use a predicate on the if/else case here to prevent the +// "dangling-else" ambiguity by forcing the 'else' token to be consumed +// as soon as one is found. See (https://en.wikipedia.org/wiki/Dangling_else). +rstatement + : IF LP expression RP trailer ( ELSE trailer | { this._input.LA(1) != painless_parser.ELSE }? ) # if + | WHILE LP expression RP ( trailer | empty ) # while + | FOR LP initializer? SEMICOLON expression? SEMICOLON afterthought? RP ( trailer | empty ) # for + | FOR LP decltype ID COLON expression RP trailer # each + | FOR LP ID IN expression RP trailer # ineach + | TRY block trap+ # try + ; + +dstatement + : DO block WHILE LP expression RP # do + | declaration # decl + | CONTINUE # continue + | BREAK # break + | RETURN expression? # return + | THROW expression # throw + | expression # expr + ; + +trailer + : block + | statement + ; + +block + : LBRACK statement* dstatement? RBRACK + ; + +empty + : SEMICOLON + ; + +initializer + : declaration + | expression + ; + +afterthought + : expression + ; + +declaration + : decltype declvar (COMMA declvar)* + ; + +decltype + : type (LBRACE RBRACE)* + ; + +type + : DEF + | PRIMITIVE + | ID (DOT DOTID)* + ; + +declvar + : ID ( ASSIGN expression )? + ; + +trap + : CATCH LP type ID RP block + ; + +noncondexpression + : unary # single + | noncondexpression ( MUL | DIV | REM ) noncondexpression # binary + | noncondexpression ( ADD | SUB ) noncondexpression # binary + | noncondexpression ( FIND | MATCH ) noncondexpression # binary + | noncondexpression ( LSH | RSH | USH ) noncondexpression # binary + | noncondexpression ( LT | LTE | GT | GTE ) noncondexpression # comp + | noncondexpression INSTANCEOF decltype # instanceof + | noncondexpression ( EQ | EQR | NE | NER ) noncondexpression # comp + | noncondexpression BWAND noncondexpression # binary + | noncondexpression XOR noncondexpression # binary + | noncondexpression BWOR noncondexpression # binary + | noncondexpression BOOLAND noncondexpression # bool + | noncondexpression BOOLOR noncondexpression # bool + | noncondexpression ELVIS noncondexpression # elvis + ; + +expression + : noncondexpression # nonconditional + | noncondexpression COND expression COLON expression # conditional + | noncondexpression ( ASSIGN | AADD | ASUB | AMUL | + ADIV | AREM | AAND | AXOR | + AOR | ALSH | ARSH | AUSH ) expression # assignment + ; + +unary + : ( INCR | DECR ) chain # pre + | ( ADD | SUB ) unary # addsub + | unarynotaddsub # notaddsub + ; + +unarynotaddsub + : chain # read + | chain (INCR | DECR ) # post + | ( BOOLNOT | BWNOT ) unary # not + | castexpression # cast + ; + +castexpression + : LP primordefcasttype RP unary # primordefcast + | LP refcasttype RP unarynotaddsub # refcast + ; + +primordefcasttype + : DEF + | PRIMITIVE + ; + +refcasttype + : DEF (LBRACE RBRACE)+ + | PRIMITIVE (LBRACE RBRACE)+ + | ID (DOT DOTID)* (LBRACE RBRACE)* + ; + +chain + : primary postfix* # dynamic + | arrayinitializer # newarray + ; + +primary + : LP expression RP # precedence + | ( OCTAL | HEX | INTEGER | DECIMAL ) # numeric + | TRUE # true + | FALSE # false + | NULL # null + | STRING # string + | REGEX # regex + | listinitializer # listinit + | mapinitializer # mapinit + | ID # variable + | ID arguments # calllocal + | NEW type arguments # newobject + ; + +postfix + : callinvoke + | fieldaccess + | braceaccess + ; + +postdot + : callinvoke + | fieldaccess + ; + +callinvoke + : ( DOT | NSDOT ) DOTID arguments + ; + +fieldaccess + : ( DOT | NSDOT ) ( DOTID | DOTINTEGER ) + ; + +braceaccess + : LBRACE expression RBRACE + ; + +arrayinitializer + : NEW type ( LBRACE expression RBRACE )+ ( postdot postfix* )? # newstandardarray + | NEW type LBRACE RBRACE LBRACK ( expression ( COMMA expression )* )? RBRACK postfix* # newinitializedarray + ; + +listinitializer + : LBRACE expression ( COMMA expression)* RBRACE + | LBRACE RBRACE + ; + +mapinitializer + : LBRACE maptoken ( COMMA maptoken )* RBRACE + | LBRACE COLON RBRACE + ; + +maptoken + : expression COLON expression + ; + +arguments + : ( LP ( argument ( COMMA argument )* )? RP ) + ; + +argument + : expression + | lambda + | funcref + ; + +lambda + : ( lamtype | LP ( lamtype ( COMMA lamtype )* )? RP ) ARROW ( block | expression ) + ; + +lamtype + : decltype? ID + ; + +funcref + : decltype REF ID # classfuncref + | decltype REF NEW # constructorfuncref + | THIS REF ID # localfuncref + ; diff --git a/packages/kbn-monaco/src/painless/antlr/painless_parser.interp b/packages/kbn-monaco/src/painless/antlr/painless_parser.interp new file mode 100644 index 0000000000000..4c0a7a4399e4e --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_parser.interp @@ -0,0 +1,220 @@ +token literal names: +null +null +null +'{' +'}' +'[' +']' +'(' +')' +'.' +'?.' +',' +';' +'if' +'in' +'else' +'while' +'do' +'for' +'continue' +'break' +'return' +'new' +'try' +'catch' +'throw' +'this' +'instanceof' +'!' +'~' +'*' +'/' +'%' +'+' +'-' +'<<' +'>>' +'>>>' +'<' +'<=' +'>' +'>=' +'==' +'===' +'!=' +'!==' +'&' +'^' +'|' +'&&' +'||' +'?' +':' +'?:' +'::' +'->' +'=~' +'==~' +'++' +'--' +'=' +'+=' +'-=' +'*=' +'/=' +'%=' +'&=' +'^=' +'|=' +'<<=' +'>>=' +'>>>=' +null +null +null +null +null +null +'true' +'false' +'null' +null +'def' +null +null +null + +token symbolic names: +null +WS +COMMENT +LBRACK +RBRACK +LBRACE +RBRACE +LP +RP +DOT +NSDOT +COMMA +SEMICOLON +IF +IN +ELSE +WHILE +DO +FOR +CONTINUE +BREAK +RETURN +NEW +TRY +CATCH +THROW +THIS +INSTANCEOF +BOOLNOT +BWNOT +MUL +DIV +REM +ADD +SUB +LSH +RSH +USH +LT +LTE +GT +GTE +EQ +EQR +NE +NER +BWAND +XOR +BWOR +BOOLAND +BOOLOR +COND +COLON +ELVIS +REF +ARROW +FIND +MATCH +INCR +DECR +ASSIGN +AADD +ASUB +AMUL +ADIV +AREM +AAND +AXOR +AOR +ALSH +ARSH +AUSH +OCTAL +HEX +INTEGER +DECIMAL +STRING +REGEX +TRUE +FALSE +NULL +PRIMITIVE +DEF +ID +DOTINTEGER +DOTID + +rule names: +source +function +parameters +statement +rstatement +dstatement +trailer +block +empty +initializer +afterthought +declaration +decltype +type +declvar +trap +noncondexpression +expression +unary +unarynotaddsub +castexpression +primordefcasttype +refcasttype +chain +primary +postfix +postdot +callinvoke +fieldaccess +braceaccess +arrayinitializer +listinitializer +mapinitializer +maptoken +arguments +argument +lambda +lamtype +funcref + + +atn: +[3, 51485, 51898, 1421, 44986, 20307, 1543, 60043, 49729, 3, 87, 574, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 3, 2, 7, 2, 82, 10, 2, 12, 2, 14, 2, 85, 11, 2, 3, 2, 7, 2, 88, 10, 2, 12, 2, 14, 2, 91, 11, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 7, 4, 107, 10, 4, 12, 4, 14, 4, 110, 11, 4, 5, 4, 112, 10, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 120, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 130, 10, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 138, 10, 6, 3, 6, 3, 6, 3, 6, 5, 6, 143, 10, 6, 3, 6, 3, 6, 5, 6, 147, 10, 6, 3, 6, 3, 6, 5, 6, 151, 10, 6, 3, 6, 3, 6, 3, 6, 5, 6, 156, 10, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 6, 6, 178, 10, 6, 13, 6, 14, 6, 179, 5, 6, 182, 10, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 196, 10, 7, 3, 7, 3, 7, 3, 7, 5, 7, 201, 10, 7, 3, 8, 3, 8, 5, 8, 205, 10, 8, 3, 9, 3, 9, 7, 9, 209, 10, 9, 12, 9, 14, 9, 212, 11, 9, 3, 9, 5, 9, 215, 10, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 5, 11, 223, 10, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 231, 10, 13, 12, 13, 14, 13, 234, 11, 13, 3, 14, 3, 14, 3, 14, 7, 14, 239, 10, 14, 12, 14, 14, 14, 242, 11, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 249, 10, 15, 12, 15, 14, 15, 252, 11, 15, 5, 15, 254, 10, 15, 3, 16, 3, 16, 3, 16, 5, 16, 259, 10, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 7, 18, 310, 10, 18, 12, 18, 14, 18, 313, 11, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 5, 19, 326, 10, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 5, 20, 333, 10, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 342, 10, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 5, 22, 354, 10, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 6, 24, 361, 10, 24, 13, 24, 14, 24, 362, 3, 24, 3, 24, 3, 24, 6, 24, 368, 10, 24, 13, 24, 14, 24, 369, 3, 24, 3, 24, 3, 24, 7, 24, 375, 10, 24, 12, 24, 14, 24, 378, 11, 24, 3, 24, 3, 24, 7, 24, 382, 10, 24, 12, 24, 14, 24, 385, 11, 24, 5, 24, 387, 10, 24, 3, 25, 3, 25, 7, 25, 391, 10, 25, 12, 25, 14, 25, 394, 11, 25, 3, 25, 5, 25, 397, 10, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 418, 10, 26, 3, 27, 3, 27, 3, 27, 5, 27, 423, 10, 27, 3, 28, 3, 28, 5, 28, 427, 10, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 6, 32, 446, 10, 32, 13, 32, 14, 32, 447, 3, 32, 3, 32, 7, 32, 452, 10, 32, 12, 32, 14, 32, 455, 11, 32, 5, 32, 457, 10, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 7, 32, 467, 10, 32, 12, 32, 14, 32, 470, 11, 32, 5, 32, 472, 10, 32, 3, 32, 3, 32, 7, 32, 476, 10, 32, 12, 32, 14, 32, 479, 11, 32, 5, 32, 481, 10, 32, 3, 33, 3, 33, 3, 33, 3, 33, 7, 33, 487, 10, 33, 12, 33, 14, 33, 490, 11, 33, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 496, 10, 33, 3, 34, 3, 34, 3, 34, 3, 34, 7, 34, 502, 10, 34, 12, 34, 14, 34, 505, 11, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 512, 10, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 7, 36, 522, 10, 36, 12, 36, 14, 36, 525, 11, 36, 5, 36, 527, 10, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 5, 37, 534, 10, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 7, 38, 541, 10, 38, 12, 38, 14, 38, 544, 11, 38, 5, 38, 546, 10, 38, 3, 38, 5, 38, 549, 10, 38, 3, 38, 3, 38, 3, 38, 5, 38, 554, 10, 38, 3, 39, 5, 39, 557, 10, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 572, 10, 40, 3, 40, 2, 2, 3, 34, 41, 2, 2, 4, 2, 6, 2, 8, 2, 10, 2, 12, 2, 14, 2, 16, 2, 18, 2, 20, 2, 22, 2, 24, 2, 26, 2, 28, 2, 30, 2, 32, 2, 34, 2, 36, 2, 38, 2, 40, 2, 42, 2, 44, 2, 46, 2, 48, 2, 50, 2, 52, 2, 54, 2, 56, 2, 58, 2, 60, 2, 62, 2, 64, 2, 66, 2, 68, 2, 70, 2, 72, 2, 74, 2, 76, 2, 78, 2, 2, 16, 3, 3, 14, 14, 3, 2, 32, 34, 3, 2, 35, 36, 3, 2, 58, 59, 3, 2, 37, 39, 3, 2, 40, 43, 3, 2, 44, 47, 3, 2, 62, 73, 3, 2, 60, 61, 3, 2, 30, 31, 3, 2, 83, 84, 3, 2, 74, 77, 3, 2, 11, 12, 3, 2, 86, 87, 2, 633, 2, 83, 3, 2, 2, 2, 4, 94, 3, 2, 2, 2, 6, 99, 3, 2, 2, 2, 8, 119, 3, 2, 2, 2, 10, 181, 3, 2, 2, 2, 12, 200, 3, 2, 2, 2, 14, 204, 3, 2, 2, 2, 16, 206, 3, 2, 2, 2, 18, 218, 3, 2, 2, 2, 20, 222, 3, 2, 2, 2, 22, 224, 3, 2, 2, 2, 24, 226, 3, 2, 2, 2, 26, 235, 3, 2, 2, 2, 28, 253, 3, 2, 2, 2, 30, 255, 3, 2, 2, 2, 32, 260, 3, 2, 2, 2, 34, 267, 3, 2, 2, 2, 36, 325, 3, 2, 2, 2, 38, 332, 3, 2, 2, 2, 40, 341, 3, 2, 2, 2, 42, 353, 3, 2, 2, 2, 44, 355, 3, 2, 2, 2, 46, 386, 3, 2, 2, 2, 48, 396, 3, 2, 2, 2, 50, 417, 3, 2, 2, 2, 52, 422, 3, 2, 2, 2, 54, 426, 3, 2, 2, 2, 56, 428, 3, 2, 2, 2, 58, 432, 3, 2, 2, 2, 60, 435, 3, 2, 2, 2, 62, 480, 3, 2, 2, 2, 64, 495, 3, 2, 2, 2, 66, 511, 3, 2, 2, 2, 68, 513, 3, 2, 2, 2, 70, 517, 3, 2, 2, 2, 72, 533, 3, 2, 2, 2, 74, 548, 3, 2, 2, 2, 76, 556, 3, 2, 2, 2, 78, 571, 3, 2, 2, 2, 80, 82, 5, 4, 3, 2, 81, 80, 3, 2, 2, 2, 82, 85, 3, 2, 2, 2, 83, 81, 3, 2, 2, 2, 83, 84, 3, 2, 2, 2, 84, 89, 3, 2, 2, 2, 85, 83, 3, 2, 2, 2, 86, 88, 5, 8, 5, 2, 87, 86, 3, 2, 2, 2, 88, 91, 3, 2, 2, 2, 89, 87, 3, 2, 2, 2, 89, 90, 3, 2, 2, 2, 90, 92, 3, 2, 2, 2, 91, 89, 3, 2, 2, 2, 92, 93, 7, 2, 2, 3, 93, 3, 3, 2, 2, 2, 94, 95, 5, 26, 14, 2, 95, 96, 7, 85, 2, 2, 96, 97, 5, 6, 4, 2, 97, 98, 5, 16, 9, 2, 98, 5, 3, 2, 2, 2, 99, 111, 7, 9, 2, 2, 100, 101, 5, 26, 14, 2, 101, 108, 7, 85, 2, 2, 102, 103, 7, 13, 2, 2, 103, 104, 5, 26, 14, 2, 104, 105, 7, 85, 2, 2, 105, 107, 3, 2, 2, 2, 106, 102, 3, 2, 2, 2, 107, 110, 3, 2, 2, 2, 108, 106, 3, 2, 2, 2, 108, 109, 3, 2, 2, 2, 109, 112, 3, 2, 2, 2, 110, 108, 3, 2, 2, 2, 111, 100, 3, 2, 2, 2, 111, 112, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 114, 7, 10, 2, 2, 114, 7, 3, 2, 2, 2, 115, 120, 5, 10, 6, 2, 116, 117, 5, 12, 7, 2, 117, 118, 9, 2, 2, 2, 118, 120, 3, 2, 2, 2, 119, 115, 3, 2, 2, 2, 119, 116, 3, 2, 2, 2, 120, 9, 3, 2, 2, 2, 121, 122, 7, 15, 2, 2, 122, 123, 7, 9, 2, 2, 123, 124, 5, 36, 19, 2, 124, 125, 7, 10, 2, 2, 125, 129, 5, 14, 8, 2, 126, 127, 7, 17, 2, 2, 127, 130, 5, 14, 8, 2, 128, 130, 6, 6, 2, 2, 129, 126, 3, 2, 2, 2, 129, 128, 3, 2, 2, 2, 130, 182, 3, 2, 2, 2, 131, 132, 7, 18, 2, 2, 132, 133, 7, 9, 2, 2, 133, 134, 5, 36, 19, 2, 134, 137, 7, 10, 2, 2, 135, 138, 5, 14, 8, 2, 136, 138, 5, 18, 10, 2, 137, 135, 3, 2, 2, 2, 137, 136, 3, 2, 2, 2, 138, 182, 3, 2, 2, 2, 139, 140, 7, 20, 2, 2, 140, 142, 7, 9, 2, 2, 141, 143, 5, 20, 11, 2, 142, 141, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 146, 7, 14, 2, 2, 145, 147, 5, 36, 19, 2, 146, 145, 3, 2, 2, 2, 146, 147, 3, 2, 2, 2, 147, 148, 3, 2, 2, 2, 148, 150, 7, 14, 2, 2, 149, 151, 5, 22, 12, 2, 150, 149, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 152, 3, 2, 2, 2, 152, 155, 7, 10, 2, 2, 153, 156, 5, 14, 8, 2, 154, 156, 5, 18, 10, 2, 155, 153, 3, 2, 2, 2, 155, 154, 3, 2, 2, 2, 156, 182, 3, 2, 2, 2, 157, 158, 7, 20, 2, 2, 158, 159, 7, 9, 2, 2, 159, 160, 5, 26, 14, 2, 160, 161, 7, 85, 2, 2, 161, 162, 7, 54, 2, 2, 162, 163, 5, 36, 19, 2, 163, 164, 7, 10, 2, 2, 164, 165, 5, 14, 8, 2, 165, 182, 3, 2, 2, 2, 166, 167, 7, 20, 2, 2, 167, 168, 7, 9, 2, 2, 168, 169, 7, 85, 2, 2, 169, 170, 7, 16, 2, 2, 170, 171, 5, 36, 19, 2, 171, 172, 7, 10, 2, 2, 172, 173, 5, 14, 8, 2, 173, 182, 3, 2, 2, 2, 174, 175, 7, 25, 2, 2, 175, 177, 5, 16, 9, 2, 176, 178, 5, 32, 17, 2, 177, 176, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180, 182, 3, 2, 2, 2, 181, 121, 3, 2, 2, 2, 181, 131, 3, 2, 2, 2, 181, 139, 3, 2, 2, 2, 181, 157, 3, 2, 2, 2, 181, 166, 3, 2, 2, 2, 181, 174, 3, 2, 2, 2, 182, 11, 3, 2, 2, 2, 183, 184, 7, 19, 2, 2, 184, 185, 5, 16, 9, 2, 185, 186, 7, 18, 2, 2, 186, 187, 7, 9, 2, 2, 187, 188, 5, 36, 19, 2, 188, 189, 7, 10, 2, 2, 189, 201, 3, 2, 2, 2, 190, 201, 5, 24, 13, 2, 191, 201, 7, 21, 2, 2, 192, 201, 7, 22, 2, 2, 193, 195, 7, 23, 2, 2, 194, 196, 5, 36, 19, 2, 195, 194, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 201, 3, 2, 2, 2, 197, 198, 7, 27, 2, 2, 198, 201, 5, 36, 19, 2, 199, 201, 5, 36, 19, 2, 200, 183, 3, 2, 2, 2, 200, 190, 3, 2, 2, 2, 200, 191, 3, 2, 2, 2, 200, 192, 3, 2, 2, 2, 200, 193, 3, 2, 2, 2, 200, 197, 3, 2, 2, 2, 200, 199, 3, 2, 2, 2, 201, 13, 3, 2, 2, 2, 202, 205, 5, 16, 9, 2, 203, 205, 5, 8, 5, 2, 204, 202, 3, 2, 2, 2, 204, 203, 3, 2, 2, 2, 205, 15, 3, 2, 2, 2, 206, 210, 7, 5, 2, 2, 207, 209, 5, 8, 5, 2, 208, 207, 3, 2, 2, 2, 209, 212, 3, 2, 2, 2, 210, 208, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2, 211, 214, 3, 2, 2, 2, 212, 210, 3, 2, 2, 2, 213, 215, 5, 12, 7, 2, 214, 213, 3, 2, 2, 2, 214, 215, 3, 2, 2, 2, 215, 216, 3, 2, 2, 2, 216, 217, 7, 6, 2, 2, 217, 17, 3, 2, 2, 2, 218, 219, 7, 14, 2, 2, 219, 19, 3, 2, 2, 2, 220, 223, 5, 24, 13, 2, 221, 223, 5, 36, 19, 2, 222, 220, 3, 2, 2, 2, 222, 221, 3, 2, 2, 2, 223, 21, 3, 2, 2, 2, 224, 225, 5, 36, 19, 2, 225, 23, 3, 2, 2, 2, 226, 227, 5, 26, 14, 2, 227, 232, 5, 30, 16, 2, 228, 229, 7, 13, 2, 2, 229, 231, 5, 30, 16, 2, 230, 228, 3, 2, 2, 2, 231, 234, 3, 2, 2, 2, 232, 230, 3, 2, 2, 2, 232, 233, 3, 2, 2, 2, 233, 25, 3, 2, 2, 2, 234, 232, 3, 2, 2, 2, 235, 240, 5, 28, 15, 2, 236, 237, 7, 7, 2, 2, 237, 239, 7, 8, 2, 2, 238, 236, 3, 2, 2, 2, 239, 242, 3, 2, 2, 2, 240, 238, 3, 2, 2, 2, 240, 241, 3, 2, 2, 2, 241, 27, 3, 2, 2, 2, 242, 240, 3, 2, 2, 2, 243, 254, 7, 84, 2, 2, 244, 254, 7, 83, 2, 2, 245, 250, 7, 85, 2, 2, 246, 247, 7, 11, 2, 2, 247, 249, 7, 87, 2, 2, 248, 246, 3, 2, 2, 2, 249, 252, 3, 2, 2, 2, 250, 248, 3, 2, 2, 2, 250, 251, 3, 2, 2, 2, 251, 254, 3, 2, 2, 2, 252, 250, 3, 2, 2, 2, 253, 243, 3, 2, 2, 2, 253, 244, 3, 2, 2, 2, 253, 245, 3, 2, 2, 2, 254, 29, 3, 2, 2, 2, 255, 258, 7, 85, 2, 2, 256, 257, 7, 62, 2, 2, 257, 259, 5, 36, 19, 2, 258, 256, 3, 2, 2, 2, 258, 259, 3, 2, 2, 2, 259, 31, 3, 2, 2, 2, 260, 261, 7, 26, 2, 2, 261, 262, 7, 9, 2, 2, 262, 263, 5, 28, 15, 2, 263, 264, 7, 85, 2, 2, 264, 265, 7, 10, 2, 2, 265, 266, 5, 16, 9, 2, 266, 33, 3, 2, 2, 2, 267, 268, 8, 18, 1, 2, 268, 269, 5, 38, 20, 2, 269, 311, 3, 2, 2, 2, 270, 271, 12, 15, 2, 2, 271, 272, 9, 3, 2, 2, 272, 310, 5, 34, 18, 16, 273, 274, 12, 14, 2, 2, 274, 275, 9, 4, 2, 2, 275, 310, 5, 34, 18, 15, 276, 277, 12, 13, 2, 2, 277, 278, 9, 5, 2, 2, 278, 310, 5, 34, 18, 14, 279, 280, 12, 12, 2, 2, 280, 281, 9, 6, 2, 2, 281, 310, 5, 34, 18, 13, 282, 283, 12, 11, 2, 2, 283, 284, 9, 7, 2, 2, 284, 310, 5, 34, 18, 12, 285, 286, 12, 9, 2, 2, 286, 287, 9, 8, 2, 2, 287, 310, 5, 34, 18, 10, 288, 289, 12, 8, 2, 2, 289, 290, 7, 48, 2, 2, 290, 310, 5, 34, 18, 9, 291, 292, 12, 7, 2, 2, 292, 293, 7, 49, 2, 2, 293, 310, 5, 34, 18, 8, 294, 295, 12, 6, 2, 2, 295, 296, 7, 50, 2, 2, 296, 310, 5, 34, 18, 7, 297, 298, 12, 5, 2, 2, 298, 299, 7, 51, 2, 2, 299, 310, 5, 34, 18, 6, 300, 301, 12, 4, 2, 2, 301, 302, 7, 52, 2, 2, 302, 310, 5, 34, 18, 5, 303, 304, 12, 3, 2, 2, 304, 305, 7, 55, 2, 2, 305, 310, 5, 34, 18, 3, 306, 307, 12, 10, 2, 2, 307, 308, 7, 29, 2, 2, 308, 310, 5, 26, 14, 2, 309, 270, 3, 2, 2, 2, 309, 273, 3, 2, 2, 2, 309, 276, 3, 2, 2, 2, 309, 279, 3, 2, 2, 2, 309, 282, 3, 2, 2, 2, 309, 285, 3, 2, 2, 2, 309, 288, 3, 2, 2, 2, 309, 291, 3, 2, 2, 2, 309, 294, 3, 2, 2, 2, 309, 297, 3, 2, 2, 2, 309, 300, 3, 2, 2, 2, 309, 303, 3, 2, 2, 2, 309, 306, 3, 2, 2, 2, 310, 313, 3, 2, 2, 2, 311, 309, 3, 2, 2, 2, 311, 312, 3, 2, 2, 2, 312, 35, 3, 2, 2, 2, 313, 311, 3, 2, 2, 2, 314, 326, 5, 34, 18, 2, 315, 316, 5, 34, 18, 2, 316, 317, 7, 53, 2, 2, 317, 318, 5, 36, 19, 2, 318, 319, 7, 54, 2, 2, 319, 320, 5, 36, 19, 2, 320, 326, 3, 2, 2, 2, 321, 322, 5, 34, 18, 2, 322, 323, 9, 9, 2, 2, 323, 324, 5, 36, 19, 2, 324, 326, 3, 2, 2, 2, 325, 314, 3, 2, 2, 2, 325, 315, 3, 2, 2, 2, 325, 321, 3, 2, 2, 2, 326, 37, 3, 2, 2, 2, 327, 328, 9, 10, 2, 2, 328, 333, 5, 48, 25, 2, 329, 330, 9, 4, 2, 2, 330, 333, 5, 38, 20, 2, 331, 333, 5, 40, 21, 2, 332, 327, 3, 2, 2, 2, 332, 329, 3, 2, 2, 2, 332, 331, 3, 2, 2, 2, 333, 39, 3, 2, 2, 2, 334, 342, 5, 48, 25, 2, 335, 336, 5, 48, 25, 2, 336, 337, 9, 10, 2, 2, 337, 342, 3, 2, 2, 2, 338, 339, 9, 11, 2, 2, 339, 342, 5, 38, 20, 2, 340, 342, 5, 42, 22, 2, 341, 334, 3, 2, 2, 2, 341, 335, 3, 2, 2, 2, 341, 338, 3, 2, 2, 2, 341, 340, 3, 2, 2, 2, 342, 41, 3, 2, 2, 2, 343, 344, 7, 9, 2, 2, 344, 345, 5, 44, 23, 2, 345, 346, 7, 10, 2, 2, 346, 347, 5, 38, 20, 2, 347, 354, 3, 2, 2, 2, 348, 349, 7, 9, 2, 2, 349, 350, 5, 46, 24, 2, 350, 351, 7, 10, 2, 2, 351, 352, 5, 40, 21, 2, 352, 354, 3, 2, 2, 2, 353, 343, 3, 2, 2, 2, 353, 348, 3, 2, 2, 2, 354, 43, 3, 2, 2, 2, 355, 356, 9, 12, 2, 2, 356, 45, 3, 2, 2, 2, 357, 360, 7, 84, 2, 2, 358, 359, 7, 7, 2, 2, 359, 361, 7, 8, 2, 2, 360, 358, 3, 2, 2, 2, 361, 362, 3, 2, 2, 2, 362, 360, 3, 2, 2, 2, 362, 363, 3, 2, 2, 2, 363, 387, 3, 2, 2, 2, 364, 367, 7, 83, 2, 2, 365, 366, 7, 7, 2, 2, 366, 368, 7, 8, 2, 2, 367, 365, 3, 2, 2, 2, 368, 369, 3, 2, 2, 2, 369, 367, 3, 2, 2, 2, 369, 370, 3, 2, 2, 2, 370, 387, 3, 2, 2, 2, 371, 376, 7, 85, 2, 2, 372, 373, 7, 11, 2, 2, 373, 375, 7, 87, 2, 2, 374, 372, 3, 2, 2, 2, 375, 378, 3, 2, 2, 2, 376, 374, 3, 2, 2, 2, 376, 377, 3, 2, 2, 2, 377, 383, 3, 2, 2, 2, 378, 376, 3, 2, 2, 2, 379, 380, 7, 7, 2, 2, 380, 382, 7, 8, 2, 2, 381, 379, 3, 2, 2, 2, 382, 385, 3, 2, 2, 2, 383, 381, 3, 2, 2, 2, 383, 384, 3, 2, 2, 2, 384, 387, 3, 2, 2, 2, 385, 383, 3, 2, 2, 2, 386, 357, 3, 2, 2, 2, 386, 364, 3, 2, 2, 2, 386, 371, 3, 2, 2, 2, 387, 47, 3, 2, 2, 2, 388, 392, 5, 50, 26, 2, 389, 391, 5, 52, 27, 2, 390, 389, 3, 2, 2, 2, 391, 394, 3, 2, 2, 2, 392, 390, 3, 2, 2, 2, 392, 393, 3, 2, 2, 2, 393, 397, 3, 2, 2, 2, 394, 392, 3, 2, 2, 2, 395, 397, 5, 62, 32, 2, 396, 388, 3, 2, 2, 2, 396, 395, 3, 2, 2, 2, 397, 49, 3, 2, 2, 2, 398, 399, 7, 9, 2, 2, 399, 400, 5, 36, 19, 2, 400, 401, 7, 10, 2, 2, 401, 418, 3, 2, 2, 2, 402, 418, 9, 13, 2, 2, 403, 418, 7, 80, 2, 2, 404, 418, 7, 81, 2, 2, 405, 418, 7, 82, 2, 2, 406, 418, 7, 78, 2, 2, 407, 418, 7, 79, 2, 2, 408, 418, 5, 64, 33, 2, 409, 418, 5, 66, 34, 2, 410, 418, 7, 85, 2, 2, 411, 412, 7, 85, 2, 2, 412, 418, 5, 70, 36, 2, 413, 414, 7, 24, 2, 2, 414, 415, 5, 28, 15, 2, 415, 416, 5, 70, 36, 2, 416, 418, 3, 2, 2, 2, 417, 398, 3, 2, 2, 2, 417, 402, 3, 2, 2, 2, 417, 403, 3, 2, 2, 2, 417, 404, 3, 2, 2, 2, 417, 405, 3, 2, 2, 2, 417, 406, 3, 2, 2, 2, 417, 407, 3, 2, 2, 2, 417, 408, 3, 2, 2, 2, 417, 409, 3, 2, 2, 2, 417, 410, 3, 2, 2, 2, 417, 411, 3, 2, 2, 2, 417, 413, 3, 2, 2, 2, 418, 51, 3, 2, 2, 2, 419, 423, 5, 56, 29, 2, 420, 423, 5, 58, 30, 2, 421, 423, 5, 60, 31, 2, 422, 419, 3, 2, 2, 2, 422, 420, 3, 2, 2, 2, 422, 421, 3, 2, 2, 2, 423, 53, 3, 2, 2, 2, 424, 427, 5, 56, 29, 2, 425, 427, 5, 58, 30, 2, 426, 424, 3, 2, 2, 2, 426, 425, 3, 2, 2, 2, 427, 55, 3, 2, 2, 2, 428, 429, 9, 14, 2, 2, 429, 430, 7, 87, 2, 2, 430, 431, 5, 70, 36, 2, 431, 57, 3, 2, 2, 2, 432, 433, 9, 14, 2, 2, 433, 434, 9, 15, 2, 2, 434, 59, 3, 2, 2, 2, 435, 436, 7, 7, 2, 2, 436, 437, 5, 36, 19, 2, 437, 438, 7, 8, 2, 2, 438, 61, 3, 2, 2, 2, 439, 440, 7, 24, 2, 2, 440, 445, 5, 28, 15, 2, 441, 442, 7, 7, 2, 2, 442, 443, 5, 36, 19, 2, 443, 444, 7, 8, 2, 2, 444, 446, 3, 2, 2, 2, 445, 441, 3, 2, 2, 2, 446, 447, 3, 2, 2, 2, 447, 445, 3, 2, 2, 2, 447, 448, 3, 2, 2, 2, 448, 456, 3, 2, 2, 2, 449, 453, 5, 54, 28, 2, 450, 452, 5, 52, 27, 2, 451, 450, 3, 2, 2, 2, 452, 455, 3, 2, 2, 2, 453, 451, 3, 2, 2, 2, 453, 454, 3, 2, 2, 2, 454, 457, 3, 2, 2, 2, 455, 453, 3, 2, 2, 2, 456, 449, 3, 2, 2, 2, 456, 457, 3, 2, 2, 2, 457, 481, 3, 2, 2, 2, 458, 459, 7, 24, 2, 2, 459, 460, 5, 28, 15, 2, 460, 461, 7, 7, 2, 2, 461, 462, 7, 8, 2, 2, 462, 471, 7, 5, 2, 2, 463, 468, 5, 36, 19, 2, 464, 465, 7, 13, 2, 2, 465, 467, 5, 36, 19, 2, 466, 464, 3, 2, 2, 2, 467, 470, 3, 2, 2, 2, 468, 466, 3, 2, 2, 2, 468, 469, 3, 2, 2, 2, 469, 472, 3, 2, 2, 2, 470, 468, 3, 2, 2, 2, 471, 463, 3, 2, 2, 2, 471, 472, 3, 2, 2, 2, 472, 473, 3, 2, 2, 2, 473, 477, 7, 6, 2, 2, 474, 476, 5, 52, 27, 2, 475, 474, 3, 2, 2, 2, 476, 479, 3, 2, 2, 2, 477, 475, 3, 2, 2, 2, 477, 478, 3, 2, 2, 2, 478, 481, 3, 2, 2, 2, 479, 477, 3, 2, 2, 2, 480, 439, 3, 2, 2, 2, 480, 458, 3, 2, 2, 2, 481, 63, 3, 2, 2, 2, 482, 483, 7, 7, 2, 2, 483, 488, 5, 36, 19, 2, 484, 485, 7, 13, 2, 2, 485, 487, 5, 36, 19, 2, 486, 484, 3, 2, 2, 2, 487, 490, 3, 2, 2, 2, 488, 486, 3, 2, 2, 2, 488, 489, 3, 2, 2, 2, 489, 491, 3, 2, 2, 2, 490, 488, 3, 2, 2, 2, 491, 492, 7, 8, 2, 2, 492, 496, 3, 2, 2, 2, 493, 494, 7, 7, 2, 2, 494, 496, 7, 8, 2, 2, 495, 482, 3, 2, 2, 2, 495, 493, 3, 2, 2, 2, 496, 65, 3, 2, 2, 2, 497, 498, 7, 7, 2, 2, 498, 503, 5, 68, 35, 2, 499, 500, 7, 13, 2, 2, 500, 502, 5, 68, 35, 2, 501, 499, 3, 2, 2, 2, 502, 505, 3, 2, 2, 2, 503, 501, 3, 2, 2, 2, 503, 504, 3, 2, 2, 2, 504, 506, 3, 2, 2, 2, 505, 503, 3, 2, 2, 2, 506, 507, 7, 8, 2, 2, 507, 512, 3, 2, 2, 2, 508, 509, 7, 7, 2, 2, 509, 510, 7, 54, 2, 2, 510, 512, 7, 8, 2, 2, 511, 497, 3, 2, 2, 2, 511, 508, 3, 2, 2, 2, 512, 67, 3, 2, 2, 2, 513, 514, 5, 36, 19, 2, 514, 515, 7, 54, 2, 2, 515, 516, 5, 36, 19, 2, 516, 69, 3, 2, 2, 2, 517, 526, 7, 9, 2, 2, 518, 523, 5, 72, 37, 2, 519, 520, 7, 13, 2, 2, 520, 522, 5, 72, 37, 2, 521, 519, 3, 2, 2, 2, 522, 525, 3, 2, 2, 2, 523, 521, 3, 2, 2, 2, 523, 524, 3, 2, 2, 2, 524, 527, 3, 2, 2, 2, 525, 523, 3, 2, 2, 2, 526, 518, 3, 2, 2, 2, 526, 527, 3, 2, 2, 2, 527, 528, 3, 2, 2, 2, 528, 529, 7, 10, 2, 2, 529, 71, 3, 2, 2, 2, 530, 534, 5, 36, 19, 2, 531, 534, 5, 74, 38, 2, 532, 534, 5, 78, 40, 2, 533, 530, 3, 2, 2, 2, 533, 531, 3, 2, 2, 2, 533, 532, 3, 2, 2, 2, 534, 73, 3, 2, 2, 2, 535, 549, 5, 76, 39, 2, 536, 545, 7, 9, 2, 2, 537, 542, 5, 76, 39, 2, 538, 539, 7, 13, 2, 2, 539, 541, 5, 76, 39, 2, 540, 538, 3, 2, 2, 2, 541, 544, 3, 2, 2, 2, 542, 540, 3, 2, 2, 2, 542, 543, 3, 2, 2, 2, 543, 546, 3, 2, 2, 2, 544, 542, 3, 2, 2, 2, 545, 537, 3, 2, 2, 2, 545, 546, 3, 2, 2, 2, 546, 547, 3, 2, 2, 2, 547, 549, 7, 10, 2, 2, 548, 535, 3, 2, 2, 2, 548, 536, 3, 2, 2, 2, 549, 550, 3, 2, 2, 2, 550, 553, 7, 57, 2, 2, 551, 554, 5, 16, 9, 2, 552, 554, 5, 36, 19, 2, 553, 551, 3, 2, 2, 2, 553, 552, 3, 2, 2, 2, 554, 75, 3, 2, 2, 2, 555, 557, 5, 26, 14, 2, 556, 555, 3, 2, 2, 2, 556, 557, 3, 2, 2, 2, 557, 558, 3, 2, 2, 2, 558, 559, 7, 85, 2, 2, 559, 77, 3, 2, 2, 2, 560, 561, 5, 26, 14, 2, 561, 562, 7, 56, 2, 2, 562, 563, 7, 85, 2, 2, 563, 572, 3, 2, 2, 2, 564, 565, 5, 26, 14, 2, 565, 566, 7, 56, 2, 2, 566, 567, 7, 24, 2, 2, 567, 572, 3, 2, 2, 2, 568, 569, 7, 28, 2, 2, 569, 570, 7, 56, 2, 2, 570, 572, 7, 85, 2, 2, 571, 560, 3, 2, 2, 2, 571, 564, 3, 2, 2, 2, 571, 568, 3, 2, 2, 2, 572, 79, 3, 2, 2, 2, 62, 83, 89, 108, 111, 119, 129, 137, 142, 146, 150, 155, 179, 181, 195, 200, 204, 210, 214, 222, 232, 240, 250, 253, 258, 309, 311, 325, 332, 341, 353, 362, 369, 376, 383, 386, 392, 396, 417, 422, 426, 447, 453, 456, 468, 471, 477, 480, 488, 495, 503, 511, 523, 526, 533, 542, 545, 548, 553, 556, 571] \ No newline at end of file diff --git a/packages/kbn-monaco/src/painless/antlr/painless_parser.tokens b/packages/kbn-monaco/src/painless/antlr/painless_parser.tokens new file mode 100644 index 0000000000000..ff62343c92ba5 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_parser.tokens @@ -0,0 +1,158 @@ +WS=1 +COMMENT=2 +LBRACK=3 +RBRACK=4 +LBRACE=5 +RBRACE=6 +LP=7 +RP=8 +DOT=9 +NSDOT=10 +COMMA=11 +SEMICOLON=12 +IF=13 +IN=14 +ELSE=15 +WHILE=16 +DO=17 +FOR=18 +CONTINUE=19 +BREAK=20 +RETURN=21 +NEW=22 +TRY=23 +CATCH=24 +THROW=25 +THIS=26 +INSTANCEOF=27 +BOOLNOT=28 +BWNOT=29 +MUL=30 +DIV=31 +REM=32 +ADD=33 +SUB=34 +LSH=35 +RSH=36 +USH=37 +LT=38 +LTE=39 +GT=40 +GTE=41 +EQ=42 +EQR=43 +NE=44 +NER=45 +BWAND=46 +XOR=47 +BWOR=48 +BOOLAND=49 +BOOLOR=50 +COND=51 +COLON=52 +ELVIS=53 +REF=54 +ARROW=55 +FIND=56 +MATCH=57 +INCR=58 +DECR=59 +ASSIGN=60 +AADD=61 +ASUB=62 +AMUL=63 +ADIV=64 +AREM=65 +AAND=66 +AXOR=67 +AOR=68 +ALSH=69 +ARSH=70 +AUSH=71 +OCTAL=72 +HEX=73 +INTEGER=74 +DECIMAL=75 +STRING=76 +REGEX=77 +TRUE=78 +FALSE=79 +NULL=80 +PRIMITIVE=81 +DEF=82 +ID=83 +DOTINTEGER=84 +DOTID=85 +'{'=3 +'}'=4 +'['=5 +']'=6 +'('=7 +')'=8 +'.'=9 +'?.'=10 +','=11 +';'=12 +'if'=13 +'in'=14 +'else'=15 +'while'=16 +'do'=17 +'for'=18 +'continue'=19 +'break'=20 +'return'=21 +'new'=22 +'try'=23 +'catch'=24 +'throw'=25 +'this'=26 +'instanceof'=27 +'!'=28 +'~'=29 +'*'=30 +'/'=31 +'%'=32 +'+'=33 +'-'=34 +'<<'=35 +'>>'=36 +'>>>'=37 +'<'=38 +'<='=39 +'>'=40 +'>='=41 +'=='=42 +'==='=43 +'!='=44 +'!=='=45 +'&'=46 +'^'=47 +'|'=48 +'&&'=49 +'||'=50 +'?'=51 +':'=52 +'?:'=53 +'::'=54 +'->'=55 +'=~'=56 +'==~'=57 +'++'=58 +'--'=59 +'='=60 +'+='=61 +'-='=62 +'*='=63 +'/='=64 +'%='=65 +'&='=66 +'^='=67 +'|='=68 +'<<='=69 +'>>='=70 +'>>>='=71 +'true'=78 +'false'=79 +'null'=80 +'def'=82 diff --git a/packages/kbn-monaco/src/painless/antlr/painless_parser.ts b/packages/kbn-monaco/src/painless/antlr/painless_parser.ts new file mode 100644 index 0000000000000..320e310a0a9a2 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_parser.ts @@ -0,0 +1,5832 @@ +// @ts-nocheck +// Generated from ./src/painless/antlr/painless_parser.g4 by ANTLR 4.7.3-SNAPSHOT + + +import { ATN } from "antlr4ts/atn/ATN"; +import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer"; +import { FailedPredicateException } from "antlr4ts/FailedPredicateException"; +import { NotNull } from "antlr4ts/Decorators"; +import { NoViableAltException } from "antlr4ts/NoViableAltException"; +import { Override } from "antlr4ts/Decorators"; +import { Parser } from "antlr4ts/Parser"; +import { ParserRuleContext } from "antlr4ts/ParserRuleContext"; +import { ParserATNSimulator } from "antlr4ts/atn/ParserATNSimulator"; +import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener"; +import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor"; +import { RecognitionException } from "antlr4ts/RecognitionException"; +import { RuleContext } from "antlr4ts/RuleContext"; +//import { RuleVersion } from "antlr4ts/RuleVersion"; +import { TerminalNode } from "antlr4ts/tree/TerminalNode"; +import { Token } from "antlr4ts/Token"; +import { TokenStream } from "antlr4ts/TokenStream"; +import { Vocabulary } from "antlr4ts/Vocabulary"; +import { VocabularyImpl } from "antlr4ts/VocabularyImpl"; + +import * as Utils from "antlr4ts/misc/Utils"; + +import { painless_parserListener } from "./painless_parserListener"; + +export class painless_parser extends Parser { + public static readonly WS = 1; + public static readonly COMMENT = 2; + public static readonly LBRACK = 3; + public static readonly RBRACK = 4; + public static readonly LBRACE = 5; + public static readonly RBRACE = 6; + public static readonly LP = 7; + public static readonly RP = 8; + public static readonly DOT = 9; + public static readonly NSDOT = 10; + public static readonly COMMA = 11; + public static readonly SEMICOLON = 12; + public static readonly IF = 13; + public static readonly IN = 14; + public static readonly ELSE = 15; + public static readonly WHILE = 16; + public static readonly DO = 17; + public static readonly FOR = 18; + public static readonly CONTINUE = 19; + public static readonly BREAK = 20; + public static readonly RETURN = 21; + public static readonly NEW = 22; + public static readonly TRY = 23; + public static readonly CATCH = 24; + public static readonly THROW = 25; + public static readonly THIS = 26; + public static readonly INSTANCEOF = 27; + public static readonly BOOLNOT = 28; + public static readonly BWNOT = 29; + public static readonly MUL = 30; + public static readonly DIV = 31; + public static readonly REM = 32; + public static readonly ADD = 33; + public static readonly SUB = 34; + public static readonly LSH = 35; + public static readonly RSH = 36; + public static readonly USH = 37; + public static readonly LT = 38; + public static readonly LTE = 39; + public static readonly GT = 40; + public static readonly GTE = 41; + public static readonly EQ = 42; + public static readonly EQR = 43; + public static readonly NE = 44; + public static readonly NER = 45; + public static readonly BWAND = 46; + public static readonly XOR = 47; + public static readonly BWOR = 48; + public static readonly BOOLAND = 49; + public static readonly BOOLOR = 50; + public static readonly COND = 51; + public static readonly COLON = 52; + public static readonly ELVIS = 53; + public static readonly REF = 54; + public static readonly ARROW = 55; + public static readonly FIND = 56; + public static readonly MATCH = 57; + public static readonly INCR = 58; + public static readonly DECR = 59; + public static readonly ASSIGN = 60; + public static readonly AADD = 61; + public static readonly ASUB = 62; + public static readonly AMUL = 63; + public static readonly ADIV = 64; + public static readonly AREM = 65; + public static readonly AAND = 66; + public static readonly AXOR = 67; + public static readonly AOR = 68; + public static readonly ALSH = 69; + public static readonly ARSH = 70; + public static readonly AUSH = 71; + public static readonly OCTAL = 72; + public static readonly HEX = 73; + public static readonly INTEGER = 74; + public static readonly DECIMAL = 75; + public static readonly STRING = 76; + public static readonly REGEX = 77; + public static readonly TRUE = 78; + public static readonly FALSE = 79; + public static readonly NULL = 80; + public static readonly PRIMITIVE = 81; + public static readonly DEF = 82; + public static readonly ID = 83; + public static readonly DOTINTEGER = 84; + public static readonly DOTID = 85; + public static readonly RULE_source = 0; + public static readonly RULE_function = 1; + public static readonly RULE_parameters = 2; + public static readonly RULE_statement = 3; + public static readonly RULE_rstatement = 4; + public static readonly RULE_dstatement = 5; + public static readonly RULE_trailer = 6; + public static readonly RULE_block = 7; + public static readonly RULE_empty = 8; + public static readonly RULE_initializer = 9; + public static readonly RULE_afterthought = 10; + public static readonly RULE_declaration = 11; + public static readonly RULE_decltype = 12; + public static readonly RULE_type = 13; + public static readonly RULE_declvar = 14; + public static readonly RULE_trap = 15; + public static readonly RULE_noncondexpression = 16; + public static readonly RULE_expression = 17; + public static readonly RULE_unary = 18; + public static readonly RULE_unarynotaddsub = 19; + public static readonly RULE_castexpression = 20; + public static readonly RULE_primordefcasttype = 21; + public static readonly RULE_refcasttype = 22; + public static readonly RULE_chain = 23; + public static readonly RULE_primary = 24; + public static readonly RULE_postfix = 25; + public static readonly RULE_postdot = 26; + public static readonly RULE_callinvoke = 27; + public static readonly RULE_fieldaccess = 28; + public static readonly RULE_braceaccess = 29; + public static readonly RULE_arrayinitializer = 30; + public static readonly RULE_listinitializer = 31; + public static readonly RULE_mapinitializer = 32; + public static readonly RULE_maptoken = 33; + public static readonly RULE_arguments = 34; + public static readonly RULE_argument = 35; + public static readonly RULE_lambda = 36; + public static readonly RULE_lamtype = 37; + public static readonly RULE_funcref = 38; + // tslint:disable:no-trailing-whitespace + public static readonly ruleNames: string[] = [ + "source", "function", "parameters", "statement", "rstatement", "dstatement", + "trailer", "block", "empty", "initializer", "afterthought", "declaration", + "decltype", "type", "declvar", "trap", "noncondexpression", "expression", + "unary", "unarynotaddsub", "castexpression", "primordefcasttype", "refcasttype", + "chain", "primary", "postfix", "postdot", "callinvoke", "fieldaccess", + "braceaccess", "arrayinitializer", "listinitializer", "mapinitializer", + "maptoken", "arguments", "argument", "lambda", "lamtype", "funcref", + ]; + + private static readonly _LITERAL_NAMES: Array = [ + undefined, undefined, undefined, "'{'", "'}'", "'['", "']'", "'('", "')'", + "'.'", "'?.'", "','", "';'", "'if'", "'in'", "'else'", "'while'", "'do'", + "'for'", "'continue'", "'break'", "'return'", "'new'", "'try'", "'catch'", + "'throw'", "'this'", "'instanceof'", "'!'", "'~'", "'*'", "'/'", "'%'", + "'+'", "'-'", "'<<'", "'>>'", "'>>>'", "'<'", "'<='", "'>'", "'>='", "'=='", + "'==='", "'!='", "'!=='", "'&'", "'^'", "'|'", "'&&'", "'||'", "'?'", + "':'", "'?:'", "'::'", "'->'", "'=~'", "'==~'", "'++'", "'--'", "'='", + "'+='", "'-='", "'*='", "'/='", "'%='", "'&='", "'^='", "'|='", "'<<='", + "'>>='", "'>>>='", undefined, undefined, undefined, undefined, undefined, + undefined, "'true'", "'false'", "'null'", undefined, "'def'", + ]; + private static readonly _SYMBOLIC_NAMES: Array = [ + undefined, "WS", "COMMENT", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "LP", + "RP", "DOT", "NSDOT", "COMMA", "SEMICOLON", "IF", "IN", "ELSE", "WHILE", + "DO", "FOR", "CONTINUE", "BREAK", "RETURN", "NEW", "TRY", "CATCH", "THROW", + "THIS", "INSTANCEOF", "BOOLNOT", "BWNOT", "MUL", "DIV", "REM", "ADD", + "SUB", "LSH", "RSH", "USH", "LT", "LTE", "GT", "GTE", "EQ", "EQR", "NE", + "NER", "BWAND", "XOR", "BWOR", "BOOLAND", "BOOLOR", "COND", "COLON", "ELVIS", + "REF", "ARROW", "FIND", "MATCH", "INCR", "DECR", "ASSIGN", "AADD", "ASUB", + "AMUL", "ADIV", "AREM", "AAND", "AXOR", "AOR", "ALSH", "ARSH", "AUSH", + "OCTAL", "HEX", "INTEGER", "DECIMAL", "STRING", "REGEX", "TRUE", "FALSE", + "NULL", "PRIMITIVE", "DEF", "ID", "DOTINTEGER", "DOTID", + ]; + public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(painless_parser._LITERAL_NAMES, painless_parser._SYMBOLIC_NAMES, []); + + // @Override + // @NotNull + public get vocabulary(): Vocabulary { + return painless_parser.VOCABULARY; + } + // tslint:enable:no-trailing-whitespace + + // @Override + public get grammarFileName(): string { return "painless_parser.g4"; } + + // @Override + public get ruleNames(): string[] { return painless_parser.ruleNames; } + + // @Override + public get serializedATN(): string { return painless_parser._serializedATN; } + + constructor(input: TokenStream) { + super(input); + this._interp = new ParserATNSimulator(painless_parser._ATN, this); + } + // @RuleVersion(0) + public source(): SourceContext { + let _localctx: SourceContext = new SourceContext(this._ctx, this.state); + this.enterRule(_localctx, 0, painless_parser.RULE_source); + let _la: number; + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 81; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 0, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 78; + this.function(); + } + } + } + this.state = 83; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 0, this._ctx); + } + this.state = 87; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.IF - 5)) | (1 << (painless_parser.WHILE - 5)) | (1 << (painless_parser.DO - 5)) | (1 << (painless_parser.FOR - 5)) | (1 << (painless_parser.CONTINUE - 5)) | (1 << (painless_parser.BREAK - 5)) | (1 << (painless_parser.RETURN - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.TRY - 5)) | (1 << (painless_parser.THROW - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.PRIMITIVE - 58)) | (1 << (painless_parser.DEF - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + { + this.state = 84; + this.statement(); + } + } + this.state = 89; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 90; + this.match(painless_parser.EOF); + } + } + 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 function(): FunctionContext { + let _localctx: FunctionContext = new FunctionContext(this._ctx, this.state); + this.enterRule(_localctx, 2, painless_parser.RULE_function); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 92; + this.decltype(); + this.state = 93; + this.match(painless_parser.ID); + this.state = 94; + this.parameters(); + this.state = 95; + this.block(); + } + } + 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 parameters(): ParametersContext { + let _localctx: ParametersContext = new ParametersContext(this._ctx, this.state); + this.enterRule(_localctx, 4, painless_parser.RULE_parameters); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 97; + this.match(painless_parser.LP); + this.state = 109; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 81)) & ~0x1F) === 0 && ((1 << (_la - 81)) & ((1 << (painless_parser.PRIMITIVE - 81)) | (1 << (painless_parser.DEF - 81)) | (1 << (painless_parser.ID - 81)))) !== 0)) { + { + this.state = 98; + this.decltype(); + this.state = 99; + this.match(painless_parser.ID); + this.state = 106; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.COMMA) { + { + { + this.state = 100; + this.match(painless_parser.COMMA); + this.state = 101; + this.decltype(); + this.state = 102; + this.match(painless_parser.ID); + } + } + this.state = 108; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + } + } + + this.state = 111; + this.match(painless_parser.RP); + } + } + 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 statement(): StatementContext { + let _localctx: StatementContext = new StatementContext(this._ctx, this.state); + this.enterRule(_localctx, 6, painless_parser.RULE_statement); + let _la: number; + try { + this.state = 117; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.IF: + case painless_parser.WHILE: + case painless_parser.FOR: + case painless_parser.TRY: + this.enterOuterAlt(_localctx, 1); + { + this.state = 113; + this.rstatement(); + } + break; + case painless_parser.LBRACE: + case painless_parser.LP: + case painless_parser.DO: + case painless_parser.CONTINUE: + case painless_parser.BREAK: + case painless_parser.RETURN: + case painless_parser.NEW: + case painless_parser.THROW: + case painless_parser.BOOLNOT: + case painless_parser.BWNOT: + case painless_parser.ADD: + case painless_parser.SUB: + case painless_parser.INCR: + case painless_parser.DECR: + case painless_parser.OCTAL: + case painless_parser.HEX: + case painless_parser.INTEGER: + case painless_parser.DECIMAL: + case painless_parser.STRING: + case painless_parser.REGEX: + case painless_parser.TRUE: + case painless_parser.FALSE: + case painless_parser.NULL: + case painless_parser.PRIMITIVE: + case painless_parser.DEF: + case painless_parser.ID: + this.enterOuterAlt(_localctx, 2); + { + this.state = 114; + this.dstatement(); + this.state = 115; + _la = this._input.LA(1); + if (!(_la === painless_parser.EOF || _la === painless_parser.SEMICOLON)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new NoViableAltException(this); + } + } + 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 rstatement(): RstatementContext { + let _localctx: RstatementContext = new RstatementContext(this._ctx, this.state); + this.enterRule(_localctx, 8, painless_parser.RULE_rstatement); + let _la: number; + try { + let _alt: number; + this.state = 179; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 12, this._ctx) ) { + case 1: + _localctx = new IfContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 119; + this.match(painless_parser.IF); + this.state = 120; + this.match(painless_parser.LP); + this.state = 121; + this.expression(); + this.state = 122; + this.match(painless_parser.RP); + this.state = 123; + this.trailer(); + this.state = 127; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 5, this._ctx) ) { + case 1: + { + this.state = 124; + this.match(painless_parser.ELSE); + this.state = 125; + this.trailer(); + } + break; + + case 2: + { + this.state = 126; + if (!( this._input.LA(1) != painless_parser.ELSE )) { + throw new FailedPredicateException(this, " this._input.LA(1) != painless_parser.ELSE "); + } + } + break; + } + } + break; + + case 2: + _localctx = new WhileContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 129; + this.match(painless_parser.WHILE); + this.state = 130; + this.match(painless_parser.LP); + this.state = 131; + this.expression(); + this.state = 132; + this.match(painless_parser.RP); + this.state = 135; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.LBRACK: + case painless_parser.LBRACE: + case painless_parser.LP: + case painless_parser.IF: + case painless_parser.WHILE: + case painless_parser.DO: + case painless_parser.FOR: + case painless_parser.CONTINUE: + case painless_parser.BREAK: + case painless_parser.RETURN: + case painless_parser.NEW: + case painless_parser.TRY: + case painless_parser.THROW: + case painless_parser.BOOLNOT: + case painless_parser.BWNOT: + case painless_parser.ADD: + case painless_parser.SUB: + case painless_parser.INCR: + case painless_parser.DECR: + case painless_parser.OCTAL: + case painless_parser.HEX: + case painless_parser.INTEGER: + case painless_parser.DECIMAL: + case painless_parser.STRING: + case painless_parser.REGEX: + case painless_parser.TRUE: + case painless_parser.FALSE: + case painless_parser.NULL: + case painless_parser.PRIMITIVE: + case painless_parser.DEF: + case painless_parser.ID: + { + this.state = 133; + this.trailer(); + } + break; + case painless_parser.SEMICOLON: + { + this.state = 134; + this.empty(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + + case 3: + _localctx = new ForContext(_localctx); + this.enterOuterAlt(_localctx, 3); + { + this.state = 137; + this.match(painless_parser.FOR); + this.state = 138; + this.match(painless_parser.LP); + this.state = 140; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.PRIMITIVE - 58)) | (1 << (painless_parser.DEF - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + this.state = 139; + this.initializer(); + } + } + + this.state = 142; + this.match(painless_parser.SEMICOLON); + this.state = 144; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + this.state = 143; + this.expression(); + } + } + + this.state = 146; + this.match(painless_parser.SEMICOLON); + this.state = 148; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + this.state = 147; + this.afterthought(); + } + } + + this.state = 150; + this.match(painless_parser.RP); + this.state = 153; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.LBRACK: + case painless_parser.LBRACE: + case painless_parser.LP: + case painless_parser.IF: + case painless_parser.WHILE: + case painless_parser.DO: + case painless_parser.FOR: + case painless_parser.CONTINUE: + case painless_parser.BREAK: + case painless_parser.RETURN: + case painless_parser.NEW: + case painless_parser.TRY: + case painless_parser.THROW: + case painless_parser.BOOLNOT: + case painless_parser.BWNOT: + case painless_parser.ADD: + case painless_parser.SUB: + case painless_parser.INCR: + case painless_parser.DECR: + case painless_parser.OCTAL: + case painless_parser.HEX: + case painless_parser.INTEGER: + case painless_parser.DECIMAL: + case painless_parser.STRING: + case painless_parser.REGEX: + case painless_parser.TRUE: + case painless_parser.FALSE: + case painless_parser.NULL: + case painless_parser.PRIMITIVE: + case painless_parser.DEF: + case painless_parser.ID: + { + this.state = 151; + this.trailer(); + } + break; + case painless_parser.SEMICOLON: + { + this.state = 152; + this.empty(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + + case 4: + _localctx = new EachContext(_localctx); + this.enterOuterAlt(_localctx, 4); + { + this.state = 155; + this.match(painless_parser.FOR); + this.state = 156; + this.match(painless_parser.LP); + this.state = 157; + this.decltype(); + this.state = 158; + this.match(painless_parser.ID); + this.state = 159; + this.match(painless_parser.COLON); + this.state = 160; + this.expression(); + this.state = 161; + this.match(painless_parser.RP); + this.state = 162; + this.trailer(); + } + break; + + case 5: + _localctx = new IneachContext(_localctx); + this.enterOuterAlt(_localctx, 5); + { + this.state = 164; + this.match(painless_parser.FOR); + this.state = 165; + this.match(painless_parser.LP); + this.state = 166; + this.match(painless_parser.ID); + this.state = 167; + this.match(painless_parser.IN); + this.state = 168; + this.expression(); + this.state = 169; + this.match(painless_parser.RP); + this.state = 170; + this.trailer(); + } + break; + + case 6: + _localctx = new TryContext(_localctx); + this.enterOuterAlt(_localctx, 6); + { + this.state = 172; + this.match(painless_parser.TRY); + this.state = 173; + this.block(); + this.state = 175; + this._errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + this.state = 174; + this.trap(); + } + } + break; + default: + throw new NoViableAltException(this); + } + this.state = 177; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 11, this._ctx); + } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); + } + break; + } + } + 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 dstatement(): DstatementContext { + let _localctx: DstatementContext = new DstatementContext(this._ctx, this.state); + this.enterRule(_localctx, 10, painless_parser.RULE_dstatement); + let _la: number; + try { + this.state = 198; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 14, this._ctx) ) { + case 1: + _localctx = new DoContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 181; + this.match(painless_parser.DO); + this.state = 182; + this.block(); + this.state = 183; + this.match(painless_parser.WHILE); + this.state = 184; + this.match(painless_parser.LP); + this.state = 185; + this.expression(); + this.state = 186; + this.match(painless_parser.RP); + } + break; + + case 2: + _localctx = new DeclContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 188; + this.declaration(); + } + break; + + case 3: + _localctx = new ContinueContext(_localctx); + this.enterOuterAlt(_localctx, 3); + { + this.state = 189; + this.match(painless_parser.CONTINUE); + } + break; + + case 4: + _localctx = new BreakContext(_localctx); + this.enterOuterAlt(_localctx, 4); + { + this.state = 190; + this.match(painless_parser.BREAK); + } + break; + + case 5: + _localctx = new ReturnContext(_localctx); + this.enterOuterAlt(_localctx, 5); + { + this.state = 191; + this.match(painless_parser.RETURN); + this.state = 193; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + this.state = 192; + this.expression(); + } + } + + } + break; + + case 6: + _localctx = new ThrowContext(_localctx); + this.enterOuterAlt(_localctx, 6); + { + this.state = 195; + this.match(painless_parser.THROW); + this.state = 196; + this.expression(); + } + break; + + case 7: + _localctx = new ExprContext(_localctx); + this.enterOuterAlt(_localctx, 7); + { + this.state = 197; + this.expression(); + } + break; + } + } + 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 trailer(): TrailerContext { + let _localctx: TrailerContext = new TrailerContext(this._ctx, this.state); + this.enterRule(_localctx, 12, painless_parser.RULE_trailer); + try { + this.state = 202; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.LBRACK: + this.enterOuterAlt(_localctx, 1); + { + this.state = 200; + this.block(); + } + break; + case painless_parser.LBRACE: + case painless_parser.LP: + case painless_parser.IF: + case painless_parser.WHILE: + case painless_parser.DO: + case painless_parser.FOR: + case painless_parser.CONTINUE: + case painless_parser.BREAK: + case painless_parser.RETURN: + case painless_parser.NEW: + case painless_parser.TRY: + case painless_parser.THROW: + case painless_parser.BOOLNOT: + case painless_parser.BWNOT: + case painless_parser.ADD: + case painless_parser.SUB: + case painless_parser.INCR: + case painless_parser.DECR: + case painless_parser.OCTAL: + case painless_parser.HEX: + case painless_parser.INTEGER: + case painless_parser.DECIMAL: + case painless_parser.STRING: + case painless_parser.REGEX: + case painless_parser.TRUE: + case painless_parser.FALSE: + case painless_parser.NULL: + case painless_parser.PRIMITIVE: + case painless_parser.DEF: + case painless_parser.ID: + this.enterOuterAlt(_localctx, 2); + { + this.state = 201; + this.statement(); + } + break; + default: + throw new NoViableAltException(this); + } + } + 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 block(): BlockContext { + let _localctx: BlockContext = new BlockContext(this._ctx, this.state); + this.enterRule(_localctx, 14, painless_parser.RULE_block); + let _la: number; + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 204; + this.match(painless_parser.LBRACK); + this.state = 208; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 16, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 205; + this.statement(); + } + } + } + this.state = 210; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 16, this._ctx); + } + this.state = 212; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.DO - 5)) | (1 << (painless_parser.CONTINUE - 5)) | (1 << (painless_parser.BREAK - 5)) | (1 << (painless_parser.RETURN - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.THROW - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.PRIMITIVE - 58)) | (1 << (painless_parser.DEF - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + this.state = 211; + this.dstatement(); + } + } + + this.state = 214; + this.match(painless_parser.RBRACK); + } + } + 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 empty(): EmptyContext { + let _localctx: EmptyContext = new EmptyContext(this._ctx, this.state); + this.enterRule(_localctx, 16, painless_parser.RULE_empty); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 216; + this.match(painless_parser.SEMICOLON); + } + } + 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 initializer(): InitializerContext { + let _localctx: InitializerContext = new InitializerContext(this._ctx, this.state); + this.enterRule(_localctx, 18, painless_parser.RULE_initializer); + try { + this.state = 220; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 18, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 218; + this.declaration(); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 219; + this.expression(); + } + break; + } + } + 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 afterthought(): AfterthoughtContext { + let _localctx: AfterthoughtContext = new AfterthoughtContext(this._ctx, this.state); + this.enterRule(_localctx, 20, painless_parser.RULE_afterthought); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 222; + this.expression(); + } + } + 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 declaration(): DeclarationContext { + let _localctx: DeclarationContext = new DeclarationContext(this._ctx, this.state); + this.enterRule(_localctx, 22, painless_parser.RULE_declaration); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 224; + this.decltype(); + this.state = 225; + this.declvar(); + this.state = 230; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.COMMA) { + { + { + this.state = 226; + this.match(painless_parser.COMMA); + this.state = 227; + this.declvar(); + } + } + this.state = 232; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + } + } + 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 decltype(): DecltypeContext { + let _localctx: DecltypeContext = new DecltypeContext(this._ctx, this.state); + this.enterRule(_localctx, 24, painless_parser.RULE_decltype); + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 233; + this.type(); + this.state = 238; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 20, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 234; + this.match(painless_parser.LBRACE); + this.state = 235; + this.match(painless_parser.RBRACE); + } + } + } + this.state = 240; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 20, this._ctx); + } + } + } + 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 type(): TypeContext { + let _localctx: TypeContext = new TypeContext(this._ctx, this.state); + this.enterRule(_localctx, 26, painless_parser.RULE_type); + try { + let _alt: number; + this.state = 251; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.DEF: + this.enterOuterAlt(_localctx, 1); + { + this.state = 241; + this.match(painless_parser.DEF); + } + break; + case painless_parser.PRIMITIVE: + this.enterOuterAlt(_localctx, 2); + { + this.state = 242; + this.match(painless_parser.PRIMITIVE); + } + break; + case painless_parser.ID: + this.enterOuterAlt(_localctx, 3); + { + this.state = 243; + this.match(painless_parser.ID); + this.state = 248; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 21, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 244; + this.match(painless_parser.DOT); + this.state = 245; + this.match(painless_parser.DOTID); + } + } + } + this.state = 250; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 21, this._ctx); + } + } + break; + default: + throw new NoViableAltException(this); + } + } + 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 declvar(): DeclvarContext { + let _localctx: DeclvarContext = new DeclvarContext(this._ctx, this.state); + this.enterRule(_localctx, 28, painless_parser.RULE_declvar); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 253; + this.match(painless_parser.ID); + this.state = 256; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === painless_parser.ASSIGN) { + { + this.state = 254; + this.match(painless_parser.ASSIGN); + this.state = 255; + this.expression(); + } + } + + } + } + 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 trap(): TrapContext { + let _localctx: TrapContext = new TrapContext(this._ctx, this.state); + this.enterRule(_localctx, 30, painless_parser.RULE_trap); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 258; + this.match(painless_parser.CATCH); + this.state = 259; + this.match(painless_parser.LP); + this.state = 260; + this.type(); + this.state = 261; + this.match(painless_parser.ID); + this.state = 262; + this.match(painless_parser.RP); + this.state = 263; + this.block(); + } + } + 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; + } + + public noncondexpression(): NoncondexpressionContext; + public noncondexpression(_p: number): NoncondexpressionContext; + // @RuleVersion(0) + public noncondexpression(_p?: number): NoncondexpressionContext { + if (_p === undefined) { + _p = 0; + } + + let _parentctx: ParserRuleContext = this._ctx; + let _parentState: number = this.state; + let _localctx: NoncondexpressionContext = new NoncondexpressionContext(this._ctx, _parentState); + let _prevctx: NoncondexpressionContext = _localctx; + let _startState: number = 32; + this.enterRecursionRule(_localctx, 32, painless_parser.RULE_noncondexpression, _p); + let _la: number; + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + { + _localctx = new SingleContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + + this.state = 266; + this.unary(); + } + this._ctx._stop = this._input.tryLT(-1); + this.state = 309; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 25, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + _prevctx = _localctx; + { + this.state = 307; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 24, this._ctx) ) { + case 1: + { + _localctx = new BinaryContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 268; + if (!(this.precpred(this._ctx, 13))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 13)"); + } + this.state = 269; + _la = this._input.LA(1); + if (!(((((_la - 30)) & ~0x1F) === 0 && ((1 << (_la - 30)) & ((1 << (painless_parser.MUL - 30)) | (1 << (painless_parser.DIV - 30)) | (1 << (painless_parser.REM - 30)))) !== 0))) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 270; + this.noncondexpression(14); + } + break; + + case 2: + { + _localctx = new BinaryContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 271; + if (!(this.precpred(this._ctx, 12))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 12)"); + } + this.state = 272; + _la = this._input.LA(1); + if (!(_la === painless_parser.ADD || _la === painless_parser.SUB)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 273; + this.noncondexpression(13); + } + break; + + case 3: + { + _localctx = new BinaryContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 274; + if (!(this.precpred(this._ctx, 11))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 11)"); + } + this.state = 275; + _la = this._input.LA(1); + if (!(_la === painless_parser.FIND || _la === painless_parser.MATCH)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 276; + this.noncondexpression(12); + } + break; + + case 4: + { + _localctx = new BinaryContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 277; + if (!(this.precpred(this._ctx, 10))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 10)"); + } + this.state = 278; + _la = this._input.LA(1); + if (!(((((_la - 35)) & ~0x1F) === 0 && ((1 << (_la - 35)) & ((1 << (painless_parser.LSH - 35)) | (1 << (painless_parser.RSH - 35)) | (1 << (painless_parser.USH - 35)))) !== 0))) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 279; + this.noncondexpression(11); + } + break; + + case 5: + { + _localctx = new CompContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 280; + if (!(this.precpred(this._ctx, 9))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 9)"); + } + this.state = 281; + _la = this._input.LA(1); + if (!(((((_la - 38)) & ~0x1F) === 0 && ((1 << (_la - 38)) & ((1 << (painless_parser.LT - 38)) | (1 << (painless_parser.LTE - 38)) | (1 << (painless_parser.GT - 38)) | (1 << (painless_parser.GTE - 38)))) !== 0))) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 282; + this.noncondexpression(10); + } + break; + + case 6: + { + _localctx = new CompContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 283; + if (!(this.precpred(this._ctx, 7))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 7)"); + } + this.state = 284; + _la = this._input.LA(1); + if (!(((((_la - 42)) & ~0x1F) === 0 && ((1 << (_la - 42)) & ((1 << (painless_parser.EQ - 42)) | (1 << (painless_parser.EQR - 42)) | (1 << (painless_parser.NE - 42)) | (1 << (painless_parser.NER - 42)))) !== 0))) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 285; + this.noncondexpression(8); + } + break; + + case 7: + { + _localctx = new BinaryContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 286; + if (!(this.precpred(this._ctx, 6))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 6)"); + } + this.state = 287; + this.match(painless_parser.BWAND); + this.state = 288; + this.noncondexpression(7); + } + break; + + case 8: + { + _localctx = new BinaryContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 289; + if (!(this.precpred(this._ctx, 5))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 5)"); + } + this.state = 290; + this.match(painless_parser.XOR); + this.state = 291; + this.noncondexpression(6); + } + break; + + case 9: + { + _localctx = new BinaryContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 292; + if (!(this.precpred(this._ctx, 4))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 4)"); + } + this.state = 293; + this.match(painless_parser.BWOR); + this.state = 294; + this.noncondexpression(5); + } + break; + + case 10: + { + _localctx = new BoolContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 295; + if (!(this.precpred(this._ctx, 3))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 3)"); + } + this.state = 296; + this.match(painless_parser.BOOLAND); + this.state = 297; + this.noncondexpression(4); + } + break; + + case 11: + { + _localctx = new BoolContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 298; + if (!(this.precpred(this._ctx, 2))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 2)"); + } + this.state = 299; + this.match(painless_parser.BOOLOR); + this.state = 300; + this.noncondexpression(3); + } + break; + + case 12: + { + _localctx = new ElvisContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 301; + if (!(this.precpred(this._ctx, 1))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 1)"); + } + this.state = 302; + this.match(painless_parser.ELVIS); + this.state = 303; + this.noncondexpression(1); + } + break; + + case 13: + { + _localctx = new InstanceofContext(new NoncondexpressionContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, painless_parser.RULE_noncondexpression); + this.state = 304; + if (!(this.precpred(this._ctx, 8))) { + throw new FailedPredicateException(this, "this.precpred(this._ctx, 8)"); + } + this.state = 305; + this.match(painless_parser.INSTANCEOF); + this.state = 306; + this.decltype(); + } + break; + } + } + } + this.state = 311; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 25, this._ctx); + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.unrollRecursionContexts(_parentctx); + } + return _localctx; + } + // @RuleVersion(0) + public expression(): ExpressionContext { + let _localctx: ExpressionContext = new ExpressionContext(this._ctx, this.state); + this.enterRule(_localctx, 34, painless_parser.RULE_expression); + let _la: number; + try { + this.state = 323; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 26, this._ctx) ) { + case 1: + _localctx = new NonconditionalContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 312; + this.noncondexpression(0); + } + break; + + case 2: + _localctx = new ConditionalContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 313; + this.noncondexpression(0); + this.state = 314; + this.match(painless_parser.COND); + this.state = 315; + this.expression(); + this.state = 316; + this.match(painless_parser.COLON); + this.state = 317; + this.expression(); + } + break; + + case 3: + _localctx = new AssignmentContext(_localctx); + this.enterOuterAlt(_localctx, 3); + { + this.state = 319; + this.noncondexpression(0); + this.state = 320; + _la = this._input.LA(1); + if (!(((((_la - 60)) & ~0x1F) === 0 && ((1 << (_la - 60)) & ((1 << (painless_parser.ASSIGN - 60)) | (1 << (painless_parser.AADD - 60)) | (1 << (painless_parser.ASUB - 60)) | (1 << (painless_parser.AMUL - 60)) | (1 << (painless_parser.ADIV - 60)) | (1 << (painless_parser.AREM - 60)) | (1 << (painless_parser.AAND - 60)) | (1 << (painless_parser.AXOR - 60)) | (1 << (painless_parser.AOR - 60)) | (1 << (painless_parser.ALSH - 60)) | (1 << (painless_parser.ARSH - 60)) | (1 << (painless_parser.AUSH - 60)))) !== 0))) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 321; + this.expression(); + } + break; + } + } + 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 unary(): UnaryContext { + let _localctx: UnaryContext = new UnaryContext(this._ctx, this.state); + this.enterRule(_localctx, 36, painless_parser.RULE_unary); + let _la: number; + try { + this.state = 330; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.INCR: + case painless_parser.DECR: + _localctx = new PreContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 325; + _la = this._input.LA(1); + if (!(_la === painless_parser.INCR || _la === painless_parser.DECR)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 326; + this.chain(); + } + break; + case painless_parser.ADD: + case painless_parser.SUB: + _localctx = new AddsubContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 327; + _la = this._input.LA(1); + if (!(_la === painless_parser.ADD || _la === painless_parser.SUB)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 328; + this.unary(); + } + break; + case painless_parser.LBRACE: + case painless_parser.LP: + case painless_parser.NEW: + case painless_parser.BOOLNOT: + case painless_parser.BWNOT: + case painless_parser.OCTAL: + case painless_parser.HEX: + case painless_parser.INTEGER: + case painless_parser.DECIMAL: + case painless_parser.STRING: + case painless_parser.REGEX: + case painless_parser.TRUE: + case painless_parser.FALSE: + case painless_parser.NULL: + case painless_parser.ID: + _localctx = new NotaddsubContext(_localctx); + this.enterOuterAlt(_localctx, 3); + { + this.state = 329; + this.unarynotaddsub(); + } + break; + default: + throw new NoViableAltException(this); + } + } + 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 unarynotaddsub(): UnarynotaddsubContext { + let _localctx: UnarynotaddsubContext = new UnarynotaddsubContext(this._ctx, this.state); + this.enterRule(_localctx, 38, painless_parser.RULE_unarynotaddsub); + let _la: number; + try { + this.state = 339; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 28, this._ctx) ) { + case 1: + _localctx = new ReadContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 332; + this.chain(); + } + break; + + case 2: + _localctx = new PostContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 333; + this.chain(); + this.state = 334; + _la = this._input.LA(1); + if (!(_la === painless_parser.INCR || _la === painless_parser.DECR)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + break; + + case 3: + _localctx = new NotContext(_localctx); + this.enterOuterAlt(_localctx, 3); + { + this.state = 336; + _la = this._input.LA(1); + if (!(_la === painless_parser.BOOLNOT || _la === painless_parser.BWNOT)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 337; + this.unary(); + } + break; + + case 4: + _localctx = new CastContext(_localctx); + this.enterOuterAlt(_localctx, 4); + { + this.state = 338; + this.castexpression(); + } + break; + } + } + 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 castexpression(): CastexpressionContext { + let _localctx: CastexpressionContext = new CastexpressionContext(this._ctx, this.state); + this.enterRule(_localctx, 40, painless_parser.RULE_castexpression); + try { + this.state = 351; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 29, this._ctx) ) { + case 1: + _localctx = new PrimordefcastContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 341; + this.match(painless_parser.LP); + this.state = 342; + this.primordefcasttype(); + this.state = 343; + this.match(painless_parser.RP); + this.state = 344; + this.unary(); + } + break; + + case 2: + _localctx = new RefcastContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 346; + this.match(painless_parser.LP); + this.state = 347; + this.refcasttype(); + this.state = 348; + this.match(painless_parser.RP); + this.state = 349; + this.unarynotaddsub(); + } + break; + } + } + 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 primordefcasttype(): PrimordefcasttypeContext { + let _localctx: PrimordefcasttypeContext = new PrimordefcasttypeContext(this._ctx, this.state); + this.enterRule(_localctx, 42, painless_parser.RULE_primordefcasttype); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 353; + _la = this._input.LA(1); + if (!(_la === painless_parser.PRIMITIVE || _la === painless_parser.DEF)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + 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 refcasttype(): RefcasttypeContext { + let _localctx: RefcasttypeContext = new RefcasttypeContext(this._ctx, this.state); + this.enterRule(_localctx, 44, painless_parser.RULE_refcasttype); + let _la: number; + try { + this.state = 384; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.DEF: + this.enterOuterAlt(_localctx, 1); + { + this.state = 355; + this.match(painless_parser.DEF); + this.state = 358; + this._errHandler.sync(this); + _la = this._input.LA(1); + do { + { + { + this.state = 356; + this.match(painless_parser.LBRACE); + this.state = 357; + this.match(painless_parser.RBRACE); + } + } + this.state = 360; + this._errHandler.sync(this); + _la = this._input.LA(1); + } while (_la === painless_parser.LBRACE); + } + break; + case painless_parser.PRIMITIVE: + this.enterOuterAlt(_localctx, 2); + { + this.state = 362; + this.match(painless_parser.PRIMITIVE); + this.state = 365; + this._errHandler.sync(this); + _la = this._input.LA(1); + do { + { + { + this.state = 363; + this.match(painless_parser.LBRACE); + this.state = 364; + this.match(painless_parser.RBRACE); + } + } + this.state = 367; + this._errHandler.sync(this); + _la = this._input.LA(1); + } while (_la === painless_parser.LBRACE); + } + break; + case painless_parser.ID: + this.enterOuterAlt(_localctx, 3); + { + this.state = 369; + this.match(painless_parser.ID); + this.state = 374; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.DOT) { + { + { + this.state = 370; + this.match(painless_parser.DOT); + this.state = 371; + this.match(painless_parser.DOTID); + } + } + this.state = 376; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 381; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.LBRACE) { + { + { + this.state = 377; + this.match(painless_parser.LBRACE); + this.state = 378; + this.match(painless_parser.RBRACE); + } + } + this.state = 383; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + } + break; + default: + throw new NoViableAltException(this); + } + } + 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 chain(): ChainContext { + let _localctx: ChainContext = new ChainContext(this._ctx, this.state); + this.enterRule(_localctx, 46, painless_parser.RULE_chain); + try { + let _alt: number; + this.state = 394; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 36, this._ctx) ) { + case 1: + _localctx = new DynamicContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 386; + this.primary(); + this.state = 390; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 35, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 387; + this.postfix(); + } + } + } + this.state = 392; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 35, this._ctx); + } + } + break; + + case 2: + _localctx = new NewarrayContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 393; + this.arrayinitializer(); + } + break; + } + } + 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 primary(): PrimaryContext { + let _localctx: PrimaryContext = new PrimaryContext(this._ctx, this.state); + this.enterRule(_localctx, 48, painless_parser.RULE_primary); + let _la: number; + try { + this.state = 415; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 37, this._ctx) ) { + case 1: + _localctx = new PrecedenceContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 396; + this.match(painless_parser.LP); + this.state = 397; + this.expression(); + this.state = 398; + this.match(painless_parser.RP); + } + break; + + case 2: + _localctx = new NumericContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 400; + _la = this._input.LA(1); + if (!(((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & ((1 << (painless_parser.OCTAL - 72)) | (1 << (painless_parser.HEX - 72)) | (1 << (painless_parser.INTEGER - 72)) | (1 << (painless_parser.DECIMAL - 72)))) !== 0))) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + break; + + case 3: + _localctx = new TrueContext(_localctx); + this.enterOuterAlt(_localctx, 3); + { + this.state = 401; + this.match(painless_parser.TRUE); + } + break; + + case 4: + _localctx = new FalseContext(_localctx); + this.enterOuterAlt(_localctx, 4); + { + this.state = 402; + this.match(painless_parser.FALSE); + } + break; + + case 5: + _localctx = new NullContext(_localctx); + this.enterOuterAlt(_localctx, 5); + { + this.state = 403; + this.match(painless_parser.NULL); + } + break; + + case 6: + _localctx = new StringContext(_localctx); + this.enterOuterAlt(_localctx, 6); + { + this.state = 404; + this.match(painless_parser.STRING); + } + break; + + case 7: + _localctx = new RegexContext(_localctx); + this.enterOuterAlt(_localctx, 7); + { + this.state = 405; + this.match(painless_parser.REGEX); + } + break; + + case 8: + _localctx = new ListinitContext(_localctx); + this.enterOuterAlt(_localctx, 8); + { + this.state = 406; + this.listinitializer(); + } + break; + + case 9: + _localctx = new MapinitContext(_localctx); + this.enterOuterAlt(_localctx, 9); + { + this.state = 407; + this.mapinitializer(); + } + break; + + case 10: + _localctx = new VariableContext(_localctx); + this.enterOuterAlt(_localctx, 10); + { + this.state = 408; + this.match(painless_parser.ID); + } + break; + + case 11: + _localctx = new CalllocalContext(_localctx); + this.enterOuterAlt(_localctx, 11); + { + this.state = 409; + this.match(painless_parser.ID); + this.state = 410; + this.arguments(); + } + break; + + case 12: + _localctx = new NewobjectContext(_localctx); + this.enterOuterAlt(_localctx, 12); + { + this.state = 411; + this.match(painless_parser.NEW); + this.state = 412; + this.type(); + this.state = 413; + this.arguments(); + } + break; + } + } + 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 postfix(): PostfixContext { + let _localctx: PostfixContext = new PostfixContext(this._ctx, this.state); + this.enterRule(_localctx, 50, painless_parser.RULE_postfix); + try { + this.state = 420; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 38, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 417; + this.callinvoke(); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 418; + this.fieldaccess(); + } + break; + + case 3: + this.enterOuterAlt(_localctx, 3); + { + this.state = 419; + this.braceaccess(); + } + break; + } + } + 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 postdot(): PostdotContext { + let _localctx: PostdotContext = new PostdotContext(this._ctx, this.state); + this.enterRule(_localctx, 52, painless_parser.RULE_postdot); + try { + this.state = 424; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 39, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 422; + this.callinvoke(); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 423; + this.fieldaccess(); + } + break; + } + } + 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 callinvoke(): CallinvokeContext { + let _localctx: CallinvokeContext = new CallinvokeContext(this._ctx, this.state); + this.enterRule(_localctx, 54, painless_parser.RULE_callinvoke); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 426; + _la = this._input.LA(1); + if (!(_la === painless_parser.DOT || _la === painless_parser.NSDOT)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 427; + this.match(painless_parser.DOTID); + this.state = 428; + this.arguments(); + } + } + 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 fieldaccess(): FieldaccessContext { + let _localctx: FieldaccessContext = new FieldaccessContext(this._ctx, this.state); + this.enterRule(_localctx, 56, painless_parser.RULE_fieldaccess); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 430; + _la = this._input.LA(1); + if (!(_la === painless_parser.DOT || _la === painless_parser.NSDOT)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 431; + _la = this._input.LA(1); + if (!(_la === painless_parser.DOTINTEGER || _la === painless_parser.DOTID)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + 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 braceaccess(): BraceaccessContext { + let _localctx: BraceaccessContext = new BraceaccessContext(this._ctx, this.state); + this.enterRule(_localctx, 58, painless_parser.RULE_braceaccess); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 433; + this.match(painless_parser.LBRACE); + this.state = 434; + this.expression(); + this.state = 435; + this.match(painless_parser.RBRACE); + } + } + 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 arrayinitializer(): ArrayinitializerContext { + let _localctx: ArrayinitializerContext = new ArrayinitializerContext(this._ctx, this.state); + this.enterRule(_localctx, 60, painless_parser.RULE_arrayinitializer); + let _la: number; + try { + let _alt: number; + this.state = 478; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 46, this._ctx) ) { + case 1: + _localctx = new NewstandardarrayContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 437; + this.match(painless_parser.NEW); + this.state = 438; + this.type(); + this.state = 443; + this._errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + this.state = 439; + this.match(painless_parser.LBRACE); + this.state = 440; + this.expression(); + this.state = 441; + this.match(painless_parser.RBRACE); + } + } + break; + default: + throw new NoViableAltException(this); + } + this.state = 445; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 40, this._ctx); + } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); + this.state = 454; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 42, this._ctx) ) { + case 1: + { + this.state = 447; + this.postdot(); + this.state = 451; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 41, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 448; + this.postfix(); + } + } + } + this.state = 453; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 41, this._ctx); + } + } + break; + } + } + break; + + case 2: + _localctx = new NewinitializedarrayContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 456; + this.match(painless_parser.NEW); + this.state = 457; + this.type(); + this.state = 458; + this.match(painless_parser.LBRACE); + this.state = 459; + this.match(painless_parser.RBRACE); + this.state = 460; + this.match(painless_parser.LBRACK); + this.state = 469; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + this.state = 461; + this.expression(); + this.state = 466; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.COMMA) { + { + { + this.state = 462; + this.match(painless_parser.COMMA); + this.state = 463; + this.expression(); + } + } + this.state = 468; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + } + } + + this.state = 471; + this.match(painless_parser.RBRACK); + this.state = 475; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 45, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 472; + this.postfix(); + } + } + } + this.state = 477; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 45, this._ctx); + } + } + break; + } + } + 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 listinitializer(): ListinitializerContext { + let _localctx: ListinitializerContext = new ListinitializerContext(this._ctx, this.state); + this.enterRule(_localctx, 62, painless_parser.RULE_listinitializer); + let _la: number; + try { + this.state = 493; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 48, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 480; + this.match(painless_parser.LBRACE); + this.state = 481; + this.expression(); + this.state = 486; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.COMMA) { + { + { + this.state = 482; + this.match(painless_parser.COMMA); + this.state = 483; + this.expression(); + } + } + this.state = 488; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 489; + this.match(painless_parser.RBRACE); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 491; + this.match(painless_parser.LBRACE); + this.state = 492; + this.match(painless_parser.RBRACE); + } + break; + } + } + 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 mapinitializer(): MapinitializerContext { + let _localctx: MapinitializerContext = new MapinitializerContext(this._ctx, this.state); + this.enterRule(_localctx, 64, painless_parser.RULE_mapinitializer); + let _la: number; + try { + this.state = 509; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 50, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 495; + this.match(painless_parser.LBRACE); + this.state = 496; + this.maptoken(); + this.state = 501; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.COMMA) { + { + { + this.state = 497; + this.match(painless_parser.COMMA); + this.state = 498; + this.maptoken(); + } + } + this.state = 503; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 504; + this.match(painless_parser.RBRACE); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 506; + this.match(painless_parser.LBRACE); + this.state = 507; + this.match(painless_parser.COLON); + this.state = 508; + this.match(painless_parser.RBRACE); + } + break; + } + } + 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 maptoken(): MaptokenContext { + let _localctx: MaptokenContext = new MaptokenContext(this._ctx, this.state); + this.enterRule(_localctx, 66, painless_parser.RULE_maptoken); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 511; + this.expression(); + this.state = 512; + this.match(painless_parser.COLON); + this.state = 513; + this.expression(); + } + } + 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 arguments(): ArgumentsContext { + let _localctx: ArgumentsContext = new ArgumentsContext(this._ctx, this.state); + this.enterRule(_localctx, 68, painless_parser.RULE_arguments); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + { + this.state = 515; + this.match(painless_parser.LP); + this.state = 524; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 5)) & ~0x1F) === 0 && ((1 << (_la - 5)) & ((1 << (painless_parser.LBRACE - 5)) | (1 << (painless_parser.LP - 5)) | (1 << (painless_parser.NEW - 5)) | (1 << (painless_parser.THIS - 5)) | (1 << (painless_parser.BOOLNOT - 5)) | (1 << (painless_parser.BWNOT - 5)) | (1 << (painless_parser.ADD - 5)) | (1 << (painless_parser.SUB - 5)))) !== 0) || ((((_la - 58)) & ~0x1F) === 0 && ((1 << (_la - 58)) & ((1 << (painless_parser.INCR - 58)) | (1 << (painless_parser.DECR - 58)) | (1 << (painless_parser.OCTAL - 58)) | (1 << (painless_parser.HEX - 58)) | (1 << (painless_parser.INTEGER - 58)) | (1 << (painless_parser.DECIMAL - 58)) | (1 << (painless_parser.STRING - 58)) | (1 << (painless_parser.REGEX - 58)) | (1 << (painless_parser.TRUE - 58)) | (1 << (painless_parser.FALSE - 58)) | (1 << (painless_parser.NULL - 58)) | (1 << (painless_parser.PRIMITIVE - 58)) | (1 << (painless_parser.DEF - 58)) | (1 << (painless_parser.ID - 58)))) !== 0)) { + { + this.state = 516; + this.argument(); + this.state = 521; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.COMMA) { + { + { + this.state = 517; + this.match(painless_parser.COMMA); + this.state = 518; + this.argument(); + } + } + this.state = 523; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + } + } + + this.state = 526; + this.match(painless_parser.RP); + } + } + } + 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 argument(): ArgumentContext { + let _localctx: ArgumentContext = new ArgumentContext(this._ctx, this.state); + this.enterRule(_localctx, 70, painless_parser.RULE_argument); + try { + this.state = 531; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 53, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 528; + this.expression(); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 529; + this.lambda(); + } + break; + + case 3: + this.enterOuterAlt(_localctx, 3); + { + this.state = 530; + this.funcref(); + } + break; + } + } + 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 lambda(): LambdaContext { + let _localctx: LambdaContext = new LambdaContext(this._ctx, this.state); + this.enterRule(_localctx, 72, painless_parser.RULE_lambda); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 546; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.PRIMITIVE: + case painless_parser.DEF: + case painless_parser.ID: + { + this.state = 533; + this.lamtype(); + } + break; + case painless_parser.LP: + { + this.state = 534; + this.match(painless_parser.LP); + this.state = 543; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (((((_la - 81)) & ~0x1F) === 0 && ((1 << (_la - 81)) & ((1 << (painless_parser.PRIMITIVE - 81)) | (1 << (painless_parser.DEF - 81)) | (1 << (painless_parser.ID - 81)))) !== 0)) { + { + this.state = 535; + this.lamtype(); + this.state = 540; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === painless_parser.COMMA) { + { + { + this.state = 536; + this.match(painless_parser.COMMA); + this.state = 537; + this.lamtype(); + } + } + this.state = 542; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + } + } + + this.state = 545; + this.match(painless_parser.RP); + } + break; + default: + throw new NoViableAltException(this); + } + this.state = 548; + this.match(painless_parser.ARROW); + this.state = 551; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case painless_parser.LBRACK: + { + this.state = 549; + this.block(); + } + break; + case painless_parser.LBRACE: + case painless_parser.LP: + case painless_parser.NEW: + case painless_parser.BOOLNOT: + case painless_parser.BWNOT: + case painless_parser.ADD: + case painless_parser.SUB: + case painless_parser.INCR: + case painless_parser.DECR: + case painless_parser.OCTAL: + case painless_parser.HEX: + case painless_parser.INTEGER: + case painless_parser.DECIMAL: + case painless_parser.STRING: + case painless_parser.REGEX: + case painless_parser.TRUE: + case painless_parser.FALSE: + case painless_parser.NULL: + case painless_parser.ID: + { + this.state = 550; + this.expression(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + 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 lamtype(): LamtypeContext { + let _localctx: LamtypeContext = new LamtypeContext(this._ctx, this.state); + this.enterRule(_localctx, 74, painless_parser.RULE_lamtype); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 554; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 58, this._ctx) ) { + case 1: + { + this.state = 553; + this.decltype(); + } + break; + } + this.state = 556; + this.match(painless_parser.ID); + } + } + 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 funcref(): FuncrefContext { + let _localctx: FuncrefContext = new FuncrefContext(this._ctx, this.state); + this.enterRule(_localctx, 76, painless_parser.RULE_funcref); + try { + this.state = 569; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 59, this._ctx) ) { + case 1: + _localctx = new ClassfuncrefContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 558; + this.decltype(); + this.state = 559; + this.match(painless_parser.REF); + this.state = 560; + this.match(painless_parser.ID); + } + break; + + case 2: + _localctx = new ConstructorfuncrefContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 562; + this.decltype(); + this.state = 563; + this.match(painless_parser.REF); + this.state = 564; + this.match(painless_parser.NEW); + } + break; + + case 3: + _localctx = new LocalfuncrefContext(_localctx); + this.enterOuterAlt(_localctx, 3); + { + this.state = 566; + this.match(painless_parser.THIS); + this.state = 567; + this.match(painless_parser.REF); + this.state = 568; + this.match(painless_parser.ID); + } + break; + } + } + 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; + } + + public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean { + switch (ruleIndex) { + case 4: + return this.rstatement_sempred(_localctx as RstatementContext, predIndex); + + case 16: + return this.noncondexpression_sempred(_localctx as NoncondexpressionContext, predIndex); + } + return true; + } + private rstatement_sempred(_localctx: RstatementContext, predIndex: number): boolean { + switch (predIndex) { + case 0: + return this._input.LA(1) != painless_parser.ELSE ; + } + return true; + } + private noncondexpression_sempred(_localctx: NoncondexpressionContext, predIndex: number): boolean { + switch (predIndex) { + case 1: + return this.precpred(this._ctx, 13); + + case 2: + return this.precpred(this._ctx, 12); + + case 3: + return this.precpred(this._ctx, 11); + + case 4: + return this.precpred(this._ctx, 10); + + case 5: + return this.precpred(this._ctx, 9); + + case 6: + return this.precpred(this._ctx, 7); + + case 7: + return this.precpred(this._ctx, 6); + + case 8: + return this.precpred(this._ctx, 5); + + case 9: + return this.precpred(this._ctx, 4); + + case 10: + return this.precpred(this._ctx, 3); + + case 11: + return this.precpred(this._ctx, 2); + + case 12: + return this.precpred(this._ctx, 1); + + case 13: + return this.precpred(this._ctx, 8); + } + return true; + } + + private static readonly _serializedATNSegments: number = 2; + private static readonly _serializedATNSegment0: string = + "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03W\u023E\x04\x02" + + "\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" + + "\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r\x04" + + "\x0E\t\x0E\x04\x0F\t\x0F\x04\x10\t\x10\x04\x11\t\x11\x04\x12\t\x12\x04" + + "\x13\t\x13\x04\x14\t\x14\x04\x15\t\x15\x04\x16\t\x16\x04\x17\t\x17\x04" + + "\x18\t\x18\x04\x19\t\x19\x04\x1A\t\x1A\x04\x1B\t\x1B\x04\x1C\t\x1C\x04" + + "\x1D\t\x1D\x04\x1E\t\x1E\x04\x1F\t\x1F\x04 \t \x04!\t!\x04\"\t\"\x04#" + + "\t#\x04$\t$\x04%\t%\x04&\t&\x04\'\t\'\x04(\t(\x03\x02\x07\x02R\n\x02\f" + + "\x02\x0E\x02U\v\x02\x03\x02\x07\x02X\n\x02\f\x02\x0E\x02[\v\x02\x03\x02" + + "\x03\x02\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x04\x03\x04\x03\x04" + + "\x03\x04\x03\x04\x03\x04\x03\x04\x07\x04k\n\x04\f\x04\x0E\x04n\v\x04\x05" + + "\x04p\n\x04\x03\x04\x03\x04\x03\x05\x03\x05\x03\x05\x03\x05\x05\x05x\n" + + "\x05\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x05" + + "\x06\x82\n\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x05\x06" + + "\x8A\n\x06\x03\x06\x03\x06\x03\x06\x05\x06\x8F\n\x06\x03\x06\x03\x06\x05" + + "\x06\x93\n\x06\x03\x06\x03\x06\x05\x06\x97\n\x06\x03\x06\x03\x06\x03\x06" + + "\x05\x06\x9C\n\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03" + + "\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03" + + "\x06\x03\x06\x03\x06\x03\x06\x03\x06\x06\x06\xB2\n\x06\r\x06\x0E\x06\xB3" + + "\x05\x06\xB6\n\x06\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03" + + "\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x05\x07\xC4\n\x07\x03\x07" + + "\x03\x07\x03\x07\x05\x07\xC9\n\x07\x03\b\x03\b\x05\b\xCD\n\b\x03\t\x03" + + "\t\x07\t\xD1\n\t\f\t\x0E\t\xD4\v\t\x03\t\x05\t\xD7\n\t\x03\t\x03\t\x03" + + "\n\x03\n\x03\v\x03\v\x05\v\xDF\n\v\x03\f\x03\f\x03\r\x03\r\x03\r\x03\r" + + "\x07\r\xE7\n\r\f\r\x0E\r\xEA\v\r\x03\x0E\x03\x0E\x03\x0E\x07\x0E\xEF\n" + + "\x0E\f\x0E\x0E\x0E\xF2\v\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x07" + + "\x0F\xF9\n\x0F\f\x0F\x0E\x0F\xFC\v\x0F\x05\x0F\xFE\n\x0F\x03\x10\x03\x10" + + "\x03\x10\x05\x10\u0103\n\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03" + + "\x11\x03\x11\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03" + + "\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03" + + "\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03" + + "\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03" + + "\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x07\x12\u0136" + + "\n\x12\f\x12\x0E\x12\u0139\v\x12\x03\x13\x03\x13\x03\x13\x03\x13\x03\x13" + + "\x03\x13\x03\x13\x03\x13\x03\x13\x03\x13\x03\x13\x05\x13\u0146\n\x13\x03" + + "\x14\x03\x14\x03\x14\x03\x14\x03\x14\x05\x14\u014D\n\x14\x03\x15\x03\x15" + + "\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x05\x15\u0156\n\x15\x03\x16\x03" + + "\x16\x03\x16\x03\x16\x03\x16\x03\x16\x03\x16\x03\x16\x03\x16\x03\x16\x05" + + "\x16\u0162\n\x16\x03\x17\x03\x17\x03\x18\x03\x18\x03\x18\x06\x18\u0169" + + "\n\x18\r\x18\x0E\x18\u016A\x03\x18\x03\x18\x03\x18\x06\x18\u0170\n\x18" + + "\r\x18\x0E\x18\u0171\x03\x18\x03\x18\x03\x18\x07\x18\u0177\n\x18\f\x18" + + "\x0E\x18\u017A\v\x18\x03\x18\x03\x18\x07\x18\u017E\n\x18\f\x18\x0E\x18" + + "\u0181\v\x18\x05\x18\u0183\n\x18\x03\x19\x03\x19\x07\x19\u0187\n\x19\f" + + "\x19\x0E\x19\u018A\v\x19\x03\x19\x05\x19\u018D\n\x19\x03\x1A\x03\x1A\x03" + + "\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03" + + "\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x05\x1A\u01A2" + + "\n\x1A\x03\x1B\x03\x1B\x03\x1B\x05\x1B\u01A7\n\x1B\x03\x1C\x03\x1C\x05" + + "\x1C\u01AB\n\x1C\x03\x1D\x03\x1D\x03\x1D\x03\x1D\x03\x1E\x03\x1E\x03\x1E" + + "\x03\x1F\x03\x1F\x03\x1F\x03\x1F\x03 \x03 \x03 \x03 \x03 \x03 \x06 \u01BE" + + "\n \r \x0E \u01BF\x03 \x03 \x07 \u01C4\n \f \x0E \u01C7\v \x05 \u01C9" + + "\n \x03 \x03 \x03 \x03 \x03 \x03 \x03 \x03 \x07 \u01D3\n \f \x0E \u01D6" + + "\v \x05 \u01D8\n \x03 \x03 \x07 \u01DC\n \f \x0E \u01DF\v \x05 \u01E1" + + "\n \x03!\x03!\x03!\x03!\x07!\u01E7\n!\f!\x0E!\u01EA\v!\x03!\x03!\x03!" + + "\x03!\x05!\u01F0\n!\x03\"\x03\"\x03\"\x03\"\x07\"\u01F6\n\"\f\"\x0E\"" + + "\u01F9\v\"\x03\"\x03\"\x03\"\x03\"\x03\"\x05\"\u0200\n\"\x03#\x03#\x03" + + "#\x03#\x03$\x03$\x03$\x03$\x07$\u020A\n$\f$\x0E$\u020D\v$\x05$\u020F\n" + + "$\x03$\x03$\x03%\x03%\x03%\x05%\u0216\n%\x03&\x03&\x03&\x03&\x03&\x07" + + "&\u021D\n&\f&\x0E&\u0220\v&\x05&\u0222\n&\x03&\x05&\u0225\n&\x03&\x03" + + "&\x03&\x05&\u022A\n&\x03\'\x05\'\u022D\n\'\x03\'\x03\'\x03(\x03(\x03(" + + "\x03(\x03(\x03(\x03(\x03(\x03(\x03(\x03(\x05(\u023C\n(\x03(\x02\x02\x03" + + "\")\x02\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02" + + "\x14\x02\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02" + + "(\x02*\x02,\x02.\x020\x022\x024\x026\x028\x02:\x02<\x02>\x02@\x02B\x02" + + "D\x02F\x02H\x02J\x02L\x02N\x02\x02\x10\x03\x03\x0E\x0E\x03\x02 \"\x03" + + "\x02#$\x03\x02:;\x03\x02%\'\x03\x02(+\x03\x02,/\x03\x02>I\x03\x02<=\x03" + + "\x02\x1E\x1F\x03\x02ST\x03\x02JM\x03\x02\v\f\x03\x02VW\x02\u0279\x02S" + + "\x03\x02\x02\x02\x04^\x03\x02\x02\x02\x06c\x03\x02\x02\x02\bw\x03\x02" + + "\x02\x02\n\xB5\x03\x02\x02\x02\f\xC8\x03\x02\x02\x02\x0E\xCC\x03\x02\x02" + + "\x02\x10\xCE\x03\x02\x02\x02\x12\xDA\x03\x02\x02\x02\x14\xDE\x03\x02\x02" + + "\x02\x16\xE0\x03\x02\x02\x02\x18\xE2\x03\x02\x02\x02\x1A\xEB\x03\x02\x02" + + "\x02\x1C\xFD\x03\x02\x02\x02\x1E\xFF\x03\x02\x02\x02 \u0104\x03\x02\x02" + + "\x02\"\u010B\x03\x02\x02\x02$\u0145\x03\x02\x02\x02&\u014C\x03\x02\x02" + + "\x02(\u0155\x03\x02\x02\x02*\u0161\x03\x02\x02\x02,\u0163\x03\x02\x02" + + "\x02.\u0182\x03\x02\x02\x020\u018C\x03\x02\x02\x022\u01A1\x03\x02\x02" + + "\x024\u01A6\x03\x02\x02\x026\u01AA\x03\x02\x02\x028\u01AC\x03\x02\x02" + + "\x02:\u01B0\x03\x02\x02\x02<\u01B3\x03\x02\x02\x02>\u01E0\x03\x02\x02" + + "\x02@\u01EF\x03\x02\x02\x02B\u01FF\x03\x02\x02\x02D\u0201\x03\x02\x02" + + "\x02F\u0205\x03\x02\x02\x02H\u0215\x03\x02\x02\x02J\u0224\x03\x02\x02" + + "\x02L\u022C\x03\x02\x02\x02N\u023B\x03\x02\x02\x02PR\x05\x04\x03\x02Q" + + "P\x03\x02\x02\x02RU\x03\x02\x02\x02SQ\x03\x02\x02\x02ST\x03\x02\x02\x02" + + "TY\x03\x02\x02\x02US\x03\x02\x02\x02VX\x05\b\x05\x02WV\x03\x02\x02\x02" + + "X[\x03\x02\x02\x02YW\x03\x02\x02\x02YZ\x03\x02\x02\x02Z\\\x03\x02\x02" + + "\x02[Y\x03\x02\x02\x02\\]\x07\x02\x02\x03]\x03\x03\x02\x02\x02^_\x05\x1A" + + "\x0E\x02_`\x07U\x02\x02`a\x05\x06\x04\x02ab\x05\x10\t\x02b\x05\x03\x02" + + "\x02\x02co\x07\t\x02\x02de\x05\x1A\x0E\x02el\x07U\x02\x02fg\x07\r\x02" + + "\x02gh\x05\x1A\x0E\x02hi\x07U\x02\x02ik\x03\x02\x02\x02jf\x03\x02\x02" + + "\x02kn\x03\x02\x02\x02lj\x03\x02\x02\x02lm\x03\x02\x02\x02mp\x03\x02\x02" + + "\x02nl\x03\x02\x02\x02od\x03\x02\x02\x02op\x03\x02\x02\x02pq\x03\x02\x02" + + "\x02qr\x07\n\x02\x02r\x07\x03\x02\x02\x02sx\x05\n\x06\x02tu\x05\f\x07" + + "\x02uv\t\x02\x02\x02vx\x03\x02\x02\x02ws\x03\x02\x02\x02wt\x03\x02\x02" + + "\x02x\t\x03\x02\x02\x02yz\x07\x0F\x02\x02z{\x07\t\x02\x02{|\x05$\x13\x02" + + "|}\x07\n\x02\x02}\x81\x05\x0E\b\x02~\x7F\x07\x11\x02\x02\x7F\x82\x05\x0E" + + "\b\x02\x80\x82\x06\x06\x02\x02\x81~\x03\x02\x02\x02\x81\x80\x03\x02\x02" + + "\x02\x82\xB6\x03\x02\x02\x02\x83\x84\x07\x12\x02\x02\x84\x85\x07\t\x02" + + "\x02\x85\x86\x05$\x13\x02\x86\x89\x07\n\x02\x02\x87\x8A\x05\x0E\b\x02" + + "\x88\x8A\x05\x12\n\x02\x89\x87\x03\x02\x02\x02\x89\x88\x03\x02\x02\x02" + + "\x8A\xB6\x03\x02\x02\x02\x8B\x8C\x07\x14\x02\x02\x8C\x8E\x07\t\x02\x02" + + "\x8D\x8F\x05\x14\v\x02\x8E\x8D\x03\x02\x02\x02\x8E\x8F\x03\x02\x02\x02" + + "\x8F\x90\x03\x02\x02\x02\x90\x92\x07\x0E\x02\x02\x91\x93\x05$\x13\x02" + + "\x92\x91\x03\x02\x02\x02\x92\x93\x03\x02\x02\x02\x93\x94\x03\x02\x02\x02" + + "\x94\x96\x07\x0E\x02\x02\x95\x97\x05\x16\f\x02\x96\x95\x03\x02\x02\x02" + + "\x96\x97\x03\x02\x02\x02\x97\x98\x03\x02\x02\x02\x98\x9B\x07\n\x02\x02" + + "\x99\x9C\x05\x0E\b\x02\x9A\x9C\x05\x12\n\x02\x9B\x99\x03\x02\x02\x02\x9B" + + "\x9A\x03\x02\x02\x02\x9C\xB6\x03\x02\x02\x02\x9D\x9E\x07\x14\x02\x02\x9E" + + "\x9F\x07\t\x02\x02\x9F\xA0\x05\x1A\x0E\x02\xA0\xA1\x07U\x02\x02\xA1\xA2" + + "\x076\x02\x02\xA2\xA3\x05$\x13\x02\xA3\xA4\x07\n\x02\x02\xA4\xA5\x05\x0E" + + "\b\x02\xA5\xB6\x03\x02\x02\x02\xA6\xA7\x07\x14\x02\x02\xA7\xA8\x07\t\x02" + + "\x02\xA8\xA9\x07U\x02\x02\xA9\xAA\x07\x10\x02\x02\xAA\xAB\x05$\x13\x02" + + "\xAB\xAC\x07\n\x02\x02\xAC\xAD\x05\x0E\b\x02\xAD\xB6\x03\x02\x02\x02\xAE" + + "\xAF\x07\x19\x02\x02\xAF\xB1\x05\x10\t\x02\xB0\xB2\x05 \x11\x02\xB1\xB0" + + "\x03\x02\x02\x02\xB2\xB3\x03\x02\x02\x02\xB3\xB1\x03\x02\x02\x02\xB3\xB4" + + "\x03\x02\x02\x02\xB4\xB6\x03\x02\x02\x02\xB5y\x03\x02\x02\x02\xB5\x83" + + "\x03\x02\x02\x02\xB5\x8B\x03\x02\x02\x02\xB5\x9D\x03\x02\x02\x02\xB5\xA6" + + "\x03\x02\x02\x02\xB5\xAE\x03\x02\x02\x02\xB6\v\x03\x02\x02\x02\xB7\xB8" + + "\x07\x13\x02\x02\xB8\xB9\x05\x10\t\x02\xB9\xBA\x07\x12\x02\x02\xBA\xBB" + + "\x07\t\x02\x02\xBB\xBC\x05$\x13\x02\xBC\xBD\x07\n\x02\x02\xBD\xC9\x03" + + "\x02\x02\x02\xBE\xC9\x05\x18\r\x02\xBF\xC9\x07\x15\x02\x02\xC0\xC9\x07" + + "\x16\x02\x02\xC1\xC3\x07\x17\x02\x02\xC2\xC4\x05$\x13\x02\xC3\xC2\x03" + + "\x02\x02\x02\xC3\xC4\x03\x02\x02\x02\xC4\xC9\x03\x02\x02\x02\xC5\xC6\x07" + + "\x1B\x02\x02\xC6\xC9\x05$\x13\x02\xC7\xC9\x05$\x13\x02\xC8\xB7\x03\x02" + + "\x02\x02\xC8\xBE\x03\x02\x02\x02\xC8\xBF\x03\x02\x02\x02\xC8\xC0\x03\x02" + + "\x02\x02\xC8\xC1\x03\x02\x02\x02\xC8\xC5\x03\x02\x02\x02\xC8\xC7\x03\x02" + + "\x02\x02\xC9\r\x03\x02\x02\x02\xCA\xCD\x05\x10\t\x02\xCB\xCD\x05\b\x05" + + "\x02\xCC\xCA\x03\x02\x02\x02\xCC\xCB\x03\x02\x02\x02\xCD\x0F\x03\x02\x02" + + "\x02\xCE\xD2\x07\x05\x02\x02\xCF\xD1\x05\b\x05\x02\xD0\xCF\x03\x02\x02" + + "\x02\xD1\xD4\x03\x02\x02\x02\xD2\xD0\x03\x02\x02\x02\xD2\xD3\x03\x02\x02" + + "\x02\xD3\xD6\x03\x02\x02\x02\xD4\xD2\x03\x02\x02\x02\xD5\xD7\x05\f\x07" + + "\x02\xD6\xD5\x03\x02\x02\x02\xD6\xD7\x03\x02\x02\x02\xD7\xD8\x03\x02\x02" + + "\x02\xD8\xD9\x07\x06\x02\x02\xD9\x11\x03\x02\x02\x02\xDA\xDB\x07\x0E\x02" + + "\x02\xDB\x13\x03\x02\x02\x02\xDC\xDF\x05\x18\r\x02\xDD\xDF\x05$\x13\x02" + + "\xDE\xDC\x03\x02\x02\x02\xDE\xDD\x03\x02\x02\x02\xDF\x15\x03\x02\x02\x02" + + "\xE0\xE1\x05$\x13\x02\xE1\x17\x03\x02\x02\x02\xE2\xE3\x05\x1A\x0E\x02" + + "\xE3\xE8\x05\x1E\x10\x02\xE4\xE5\x07\r\x02\x02\xE5\xE7\x05\x1E\x10\x02" + + "\xE6\xE4\x03\x02\x02\x02\xE7\xEA\x03\x02\x02\x02\xE8\xE6\x03\x02\x02\x02" + + "\xE8\xE9\x03\x02\x02\x02\xE9\x19\x03\x02\x02\x02\xEA\xE8\x03\x02\x02\x02" + + "\xEB\xF0\x05\x1C\x0F\x02\xEC\xED\x07\x07\x02\x02\xED\xEF\x07\b\x02\x02" + + "\xEE\xEC\x03\x02\x02\x02\xEF\xF2\x03\x02\x02\x02\xF0\xEE\x03\x02\x02\x02" + + "\xF0\xF1\x03\x02\x02\x02\xF1\x1B\x03\x02\x02\x02\xF2\xF0\x03\x02\x02\x02" + + "\xF3\xFE\x07T\x02\x02\xF4\xFE\x07S\x02\x02\xF5\xFA\x07U\x02\x02\xF6\xF7" + + "\x07\v\x02\x02\xF7\xF9\x07W\x02\x02\xF8\xF6\x03\x02\x02\x02\xF9\xFC\x03" + + "\x02\x02\x02\xFA\xF8\x03\x02\x02\x02\xFA\xFB\x03\x02\x02\x02\xFB\xFE\x03" + + "\x02\x02\x02\xFC\xFA\x03\x02\x02\x02\xFD\xF3\x03\x02\x02\x02\xFD\xF4\x03" + + "\x02\x02\x02\xFD\xF5\x03\x02\x02\x02\xFE\x1D\x03\x02\x02\x02\xFF\u0102" + + "\x07U\x02\x02\u0100\u0101\x07>\x02\x02\u0101\u0103\x05$\x13\x02\u0102" + + "\u0100\x03\x02\x02\x02\u0102\u0103\x03\x02\x02\x02\u0103\x1F\x03\x02\x02" + + "\x02\u0104\u0105\x07\x1A\x02\x02\u0105\u0106\x07\t\x02\x02\u0106\u0107" + + "\x05\x1C\x0F\x02\u0107\u0108\x07U\x02\x02\u0108\u0109\x07\n\x02\x02\u0109" + + "\u010A\x05\x10\t\x02\u010A!\x03\x02\x02\x02\u010B\u010C\b\x12\x01\x02" + + "\u010C\u010D\x05&\x14\x02\u010D\u0137\x03\x02\x02\x02\u010E\u010F\f\x0F" + + "\x02\x02\u010F\u0110\t\x03\x02\x02\u0110\u0136\x05\"\x12\x10\u0111\u0112" + + "\f\x0E\x02\x02\u0112\u0113\t\x04\x02\x02\u0113\u0136\x05\"\x12\x0F\u0114" + + "\u0115\f\r\x02\x02\u0115\u0116\t\x05\x02\x02\u0116\u0136\x05\"\x12\x0E" + + "\u0117\u0118\f\f\x02\x02\u0118\u0119\t\x06\x02\x02\u0119\u0136\x05\"\x12" + + "\r\u011A\u011B\f\v\x02\x02\u011B\u011C\t\x07\x02\x02\u011C\u0136\x05\"" + + "\x12\f\u011D\u011E\f\t\x02\x02\u011E\u011F\t\b\x02\x02\u011F\u0136\x05" + + "\"\x12\n\u0120\u0121\f\b\x02\x02\u0121\u0122\x070\x02\x02\u0122\u0136" + + "\x05\"\x12\t\u0123\u0124\f\x07\x02\x02\u0124\u0125\x071\x02\x02\u0125" + + "\u0136\x05\"\x12\b\u0126\u0127\f\x06\x02\x02\u0127\u0128\x072\x02\x02" + + "\u0128\u0136\x05\"\x12\x07\u0129\u012A\f\x05\x02\x02\u012A\u012B\x073" + + "\x02\x02\u012B\u0136\x05\"\x12\x06\u012C\u012D\f\x04\x02\x02\u012D\u012E" + + "\x074\x02\x02\u012E\u0136\x05\"\x12\x05\u012F\u0130\f\x03\x02\x02\u0130" + + "\u0131\x077\x02\x02\u0131\u0136\x05\"\x12\x03\u0132\u0133\f\n\x02\x02" + + "\u0133\u0134\x07\x1D\x02\x02\u0134\u0136\x05\x1A\x0E\x02\u0135\u010E\x03" + + "\x02\x02\x02\u0135\u0111\x03\x02\x02\x02\u0135\u0114\x03\x02\x02\x02\u0135" + + "\u0117\x03\x02\x02\x02\u0135\u011A\x03\x02\x02\x02\u0135\u011D\x03\x02" + + "\x02\x02\u0135\u0120\x03\x02\x02\x02\u0135\u0123\x03\x02\x02\x02\u0135" + + "\u0126\x03\x02\x02\x02\u0135\u0129\x03\x02\x02\x02\u0135\u012C\x03\x02" + + "\x02\x02\u0135\u012F\x03\x02\x02\x02\u0135\u0132\x03\x02\x02\x02\u0136" + + "\u0139\x03\x02\x02\x02\u0137\u0135\x03\x02\x02\x02\u0137\u0138\x03\x02" + + "\x02\x02\u0138#\x03\x02\x02\x02\u0139\u0137\x03\x02\x02\x02\u013A\u0146" + + "\x05\"\x12\x02\u013B\u013C\x05\"\x12\x02\u013C\u013D\x075\x02\x02\u013D" + + "\u013E\x05$\x13\x02\u013E\u013F\x076\x02\x02\u013F\u0140\x05$\x13\x02" + + "\u0140\u0146\x03\x02\x02\x02\u0141\u0142\x05\"\x12\x02\u0142\u0143\t\t" + + "\x02\x02\u0143\u0144\x05$\x13\x02\u0144\u0146\x03\x02\x02\x02\u0145\u013A" + + "\x03\x02\x02\x02\u0145\u013B\x03\x02\x02\x02\u0145\u0141\x03\x02\x02\x02" + + "\u0146%\x03\x02\x02\x02\u0147\u0148\t\n\x02\x02\u0148\u014D\x050\x19\x02" + + "\u0149\u014A\t\x04\x02\x02\u014A\u014D\x05&\x14\x02\u014B\u014D\x05(\x15" + + "\x02\u014C\u0147\x03\x02\x02\x02\u014C\u0149\x03\x02\x02\x02\u014C\u014B" + + "\x03\x02\x02\x02\u014D\'\x03\x02\x02\x02\u014E\u0156\x050\x19\x02\u014F" + + "\u0150\x050\x19\x02\u0150\u0151\t\n\x02\x02\u0151\u0156\x03\x02\x02\x02" + + "\u0152\u0153\t\v\x02\x02\u0153\u0156\x05&\x14\x02\u0154\u0156\x05*\x16" + + "\x02\u0155\u014E\x03\x02\x02\x02\u0155\u014F\x03\x02\x02\x02\u0155\u0152" + + "\x03\x02\x02\x02\u0155\u0154\x03\x02\x02\x02\u0156)\x03\x02\x02\x02\u0157" + + "\u0158\x07\t\x02\x02\u0158\u0159\x05,\x17\x02\u0159\u015A\x07\n\x02\x02" + + "\u015A\u015B\x05&\x14\x02\u015B\u0162\x03\x02\x02\x02\u015C\u015D\x07" + + "\t\x02\x02\u015D\u015E\x05.\x18\x02\u015E\u015F\x07\n\x02\x02\u015F\u0160" + + "\x05(\x15\x02\u0160\u0162\x03\x02\x02\x02\u0161\u0157\x03\x02\x02\x02" + + "\u0161\u015C\x03\x02\x02\x02\u0162+\x03\x02\x02\x02\u0163\u0164\t\f\x02" + + "\x02\u0164-\x03\x02\x02\x02\u0165\u0168\x07T\x02\x02\u0166\u0167\x07\x07" + + "\x02\x02\u0167\u0169\x07\b\x02\x02\u0168\u0166\x03\x02\x02\x02\u0169\u016A" + + "\x03\x02\x02\x02\u016A\u0168\x03\x02\x02\x02\u016A\u016B\x03\x02\x02\x02" + + "\u016B\u0183\x03\x02\x02\x02\u016C\u016F\x07S\x02\x02\u016D\u016E\x07" + + "\x07\x02\x02\u016E\u0170\x07\b\x02\x02\u016F\u016D\x03\x02\x02\x02\u0170" + + "\u0171\x03\x02\x02\x02\u0171\u016F\x03\x02\x02\x02\u0171\u0172\x03\x02" + + "\x02\x02\u0172\u0183\x03\x02\x02\x02\u0173\u0178\x07U\x02\x02\u0174\u0175" + + "\x07\v\x02\x02\u0175\u0177\x07W\x02\x02\u0176\u0174\x03\x02\x02\x02\u0177" + + "\u017A\x03\x02\x02\x02\u0178\u0176\x03\x02\x02\x02\u0178\u0179\x03\x02" + + "\x02\x02\u0179\u017F\x03\x02\x02\x02\u017A\u0178\x03\x02\x02\x02\u017B" + + "\u017C\x07\x07\x02\x02\u017C\u017E\x07\b\x02\x02\u017D\u017B\x03\x02\x02" + + "\x02\u017E\u0181\x03\x02\x02\x02\u017F\u017D\x03\x02\x02\x02\u017F\u0180" + + "\x03\x02\x02\x02\u0180\u0183\x03\x02\x02\x02\u0181\u017F\x03\x02\x02\x02" + + "\u0182\u0165\x03\x02\x02\x02\u0182\u016C\x03\x02\x02\x02\u0182\u0173\x03" + + "\x02\x02\x02\u0183/\x03\x02\x02\x02\u0184\u0188\x052\x1A\x02\u0185\u0187" + + "\x054\x1B\x02\u0186\u0185\x03\x02\x02\x02\u0187\u018A\x03\x02\x02\x02" + + "\u0188\u0186\x03\x02\x02\x02\u0188\u0189\x03\x02\x02\x02\u0189\u018D\x03" + + "\x02\x02\x02\u018A\u0188\x03\x02\x02\x02\u018B\u018D\x05> \x02\u018C\u0184" + + "\x03\x02\x02\x02\u018C\u018B\x03\x02\x02\x02\u018D1\x03\x02\x02\x02\u018E" + + "\u018F\x07\t\x02\x02\u018F\u0190\x05$\x13\x02\u0190\u0191\x07\n\x02\x02" + + "\u0191\u01A2\x03\x02\x02\x02\u0192\u01A2\t\r\x02\x02\u0193\u01A2\x07P" + + "\x02\x02\u0194\u01A2\x07Q\x02\x02\u0195\u01A2\x07R\x02\x02\u0196\u01A2" + + "\x07N\x02\x02\u0197\u01A2\x07O\x02\x02\u0198\u01A2\x05@!\x02\u0199\u01A2" + + "\x05B\"\x02\u019A\u01A2\x07U\x02\x02\u019B\u019C\x07U\x02\x02\u019C\u01A2" + + "\x05F$\x02\u019D\u019E\x07\x18\x02\x02\u019E\u019F\x05\x1C\x0F\x02\u019F" + + "\u01A0\x05F$\x02\u01A0\u01A2\x03\x02\x02\x02\u01A1\u018E\x03\x02\x02\x02" + + "\u01A1\u0192\x03\x02\x02\x02\u01A1\u0193\x03\x02\x02\x02\u01A1\u0194\x03" + + "\x02\x02\x02\u01A1\u0195\x03\x02\x02\x02\u01A1\u0196\x03\x02\x02\x02\u01A1" + + "\u0197\x03\x02\x02\x02\u01A1\u0198\x03\x02\x02\x02\u01A1\u0199\x03\x02" + + "\x02\x02\u01A1\u019A\x03\x02\x02\x02\u01A1\u019B\x03\x02\x02\x02\u01A1" + + "\u019D\x03\x02\x02\x02\u01A23\x03\x02\x02\x02\u01A3\u01A7\x058\x1D\x02" + + "\u01A4\u01A7\x05:\x1E\x02\u01A5\u01A7\x05<\x1F\x02\u01A6\u01A3\x03\x02" + + "\x02\x02\u01A6\u01A4\x03\x02\x02\x02\u01A6\u01A5\x03\x02\x02\x02\u01A7" + + "5\x03\x02\x02\x02\u01A8\u01AB\x058\x1D\x02\u01A9\u01AB\x05:\x1E\x02\u01AA" + + "\u01A8\x03\x02\x02\x02\u01AA\u01A9\x03\x02\x02\x02\u01AB7\x03\x02\x02" + + "\x02\u01AC\u01AD\t\x0E\x02\x02\u01AD\u01AE\x07W\x02\x02\u01AE\u01AF\x05" + + "F$\x02\u01AF9\x03\x02\x02\x02\u01B0\u01B1\t\x0E\x02\x02\u01B1\u01B2\t" + + "\x0F\x02\x02\u01B2;\x03\x02\x02\x02\u01B3\u01B4\x07\x07\x02\x02\u01B4" + + "\u01B5\x05$\x13\x02\u01B5\u01B6\x07\b\x02\x02\u01B6=\x03\x02\x02\x02\u01B7" + + "\u01B8\x07\x18\x02\x02\u01B8\u01BD\x05\x1C\x0F\x02\u01B9\u01BA\x07\x07" + + "\x02\x02\u01BA\u01BB\x05$\x13\x02\u01BB\u01BC\x07\b\x02\x02\u01BC\u01BE" + + "\x03\x02\x02\x02\u01BD\u01B9\x03\x02\x02\x02\u01BE\u01BF\x03\x02\x02\x02" + + "\u01BF\u01BD\x03\x02\x02\x02\u01BF\u01C0\x03\x02\x02\x02\u01C0\u01C8\x03" + + "\x02\x02\x02\u01C1\u01C5\x056\x1C\x02\u01C2\u01C4\x054\x1B\x02\u01C3\u01C2" + + "\x03\x02\x02\x02\u01C4\u01C7\x03\x02\x02\x02\u01C5\u01C3\x03\x02\x02\x02" + + "\u01C5\u01C6\x03\x02\x02\x02\u01C6\u01C9\x03\x02\x02\x02\u01C7\u01C5\x03" + + "\x02\x02\x02\u01C8\u01C1\x03\x02\x02\x02\u01C8\u01C9\x03\x02\x02\x02\u01C9" + + "\u01E1\x03\x02\x02\x02\u01CA\u01CB\x07\x18\x02\x02\u01CB\u01CC\x05\x1C" + + "\x0F\x02\u01CC\u01CD\x07\x07\x02\x02\u01CD\u01CE\x07\b\x02\x02\u01CE\u01D7" + + "\x07\x05\x02\x02\u01CF\u01D4\x05$\x13\x02\u01D0\u01D1\x07\r\x02\x02\u01D1" + + "\u01D3\x05$\x13\x02\u01D2\u01D0\x03\x02\x02\x02\u01D3\u01D6\x03\x02\x02" + + "\x02\u01D4\u01D2\x03\x02\x02\x02\u01D4\u01D5\x03\x02\x02\x02\u01D5\u01D8" + + "\x03\x02\x02\x02\u01D6\u01D4\x03\x02\x02\x02\u01D7\u01CF\x03\x02\x02\x02" + + "\u01D7\u01D8\x03\x02\x02\x02\u01D8\u01D9\x03\x02\x02\x02\u01D9\u01DD\x07" + + "\x06\x02\x02\u01DA\u01DC\x054\x1B\x02\u01DB\u01DA\x03\x02\x02\x02\u01DC" + + "\u01DF\x03\x02\x02\x02\u01DD\u01DB\x03\x02\x02\x02\u01DD\u01DE\x03\x02" + + "\x02\x02\u01DE\u01E1\x03\x02\x02\x02\u01DF\u01DD\x03\x02\x02\x02\u01E0" + + "\u01B7\x03\x02\x02\x02\u01E0\u01CA\x03\x02\x02\x02\u01E1?\x03\x02\x02" + + "\x02\u01E2\u01E3\x07\x07\x02\x02\u01E3\u01E8\x05$\x13\x02\u01E4\u01E5" + + "\x07\r\x02\x02\u01E5\u01E7\x05$\x13\x02\u01E6\u01E4\x03\x02\x02\x02\u01E7" + + "\u01EA\x03\x02\x02\x02\u01E8\u01E6\x03\x02\x02\x02\u01E8\u01E9\x03\x02" + + "\x02\x02\u01E9\u01EB\x03\x02\x02\x02\u01EA\u01E8\x03\x02\x02\x02\u01EB" + + "\u01EC\x07\b\x02\x02\u01EC\u01F0\x03\x02\x02\x02\u01ED\u01EE\x07\x07\x02" + + "\x02\u01EE\u01F0\x07\b\x02\x02\u01EF\u01E2\x03\x02\x02\x02\u01EF\u01ED" + + "\x03\x02\x02\x02\u01F0A\x03\x02\x02\x02\u01F1\u01F2\x07\x07\x02\x02\u01F2" + + "\u01F7\x05D#\x02\u01F3\u01F4\x07\r\x02\x02\u01F4\u01F6\x05D#\x02\u01F5" + + "\u01F3\x03\x02\x02\x02\u01F6\u01F9\x03\x02\x02\x02\u01F7\u01F5\x03\x02" + + "\x02\x02\u01F7\u01F8\x03\x02\x02\x02\u01F8\u01FA\x03\x02\x02\x02\u01F9" + + "\u01F7\x03\x02\x02\x02\u01FA\u01FB\x07\b\x02\x02\u01FB\u0200\x03\x02\x02" + + "\x02\u01FC\u01FD\x07\x07\x02\x02\u01FD\u01FE\x076\x02\x02\u01FE\u0200" + + "\x07\b\x02\x02\u01FF\u01F1\x03\x02\x02\x02\u01FF\u01FC\x03\x02\x02\x02" + + "\u0200C\x03\x02\x02\x02\u0201\u0202\x05$\x13\x02\u0202\u0203\x076\x02" + + "\x02\u0203\u0204\x05$\x13\x02\u0204E\x03\x02\x02\x02\u0205\u020E\x07\t" + + "\x02\x02\u0206\u020B\x05H%\x02\u0207\u0208\x07\r\x02\x02\u0208\u020A\x05" + + "H%\x02\u0209\u0207\x03\x02\x02\x02\u020A\u020D\x03\x02\x02\x02\u020B\u0209" + + "\x03\x02\x02\x02\u020B\u020C\x03\x02\x02\x02\u020C\u020F\x03\x02\x02\x02" + + "\u020D\u020B\x03\x02\x02\x02\u020E\u0206\x03\x02\x02\x02\u020E\u020F\x03" + + "\x02\x02\x02\u020F\u0210\x03\x02\x02\x02\u0210\u0211\x07\n\x02\x02\u0211" + + "G\x03\x02\x02\x02\u0212\u0216\x05$\x13\x02\u0213\u0216\x05J&\x02\u0214" + + "\u0216\x05N(\x02\u0215\u0212\x03\x02\x02\x02\u0215\u0213\x03\x02\x02\x02" + + "\u0215\u0214\x03\x02\x02\x02\u0216I\x03\x02\x02\x02\u0217\u0225\x05L\'" + + "\x02\u0218\u0221\x07\t\x02\x02\u0219\u021E\x05L\'\x02\u021A\u021B\x07" + + "\r\x02\x02\u021B\u021D\x05L\'\x02\u021C\u021A\x03\x02\x02\x02\u021D\u0220" + + "\x03\x02\x02\x02\u021E\u021C\x03\x02\x02\x02\u021E\u021F\x03\x02\x02\x02" + + "\u021F\u0222\x03\x02\x02\x02\u0220\u021E\x03\x02\x02\x02\u0221\u0219\x03" + + "\x02\x02\x02\u0221\u0222\x03\x02\x02\x02\u0222\u0223\x03\x02\x02\x02\u0223" + + "\u0225\x07\n\x02\x02\u0224\u0217\x03\x02\x02\x02\u0224\u0218\x03\x02\x02" + + "\x02\u0225\u0226"; + private static readonly _serializedATNSegment1: string = + "\x03\x02\x02\x02\u0226\u0229\x079\x02\x02\u0227\u022A\x05\x10\t\x02\u0228" + + "\u022A\x05$\x13\x02\u0229\u0227\x03\x02\x02\x02\u0229\u0228\x03\x02\x02" + + "\x02\u022AK\x03\x02\x02\x02\u022B\u022D\x05\x1A\x0E\x02\u022C\u022B\x03" + + "\x02\x02\x02\u022C\u022D\x03\x02\x02\x02\u022D\u022E\x03\x02\x02\x02\u022E" + + "\u022F\x07U\x02\x02\u022FM\x03\x02\x02\x02\u0230\u0231\x05\x1A\x0E\x02" + + "\u0231\u0232\x078\x02\x02\u0232\u0233\x07U\x02\x02\u0233\u023C\x03\x02" + + "\x02\x02\u0234\u0235\x05\x1A\x0E\x02\u0235\u0236\x078\x02\x02\u0236\u0237" + + "\x07\x18\x02\x02\u0237\u023C\x03\x02\x02\x02\u0238\u0239\x07\x1C\x02\x02" + + "\u0239\u023A\x078\x02\x02\u023A\u023C\x07U\x02\x02\u023B\u0230\x03\x02" + + "\x02\x02\u023B\u0234\x03\x02\x02\x02\u023B\u0238\x03\x02\x02\x02\u023C" + + "O\x03\x02\x02\x02>SYlow\x81\x89\x8E\x92\x96\x9B\xB3\xB5\xC3\xC8\xCC\xD2" + + "\xD6\xDE\xE8\xF0\xFA\xFD\u0102\u0135\u0137\u0145\u014C\u0155\u0161\u016A" + + "\u0171\u0178\u017F\u0182\u0188\u018C\u01A1\u01A6\u01AA\u01BF\u01C5\u01C8" + + "\u01D4\u01D7\u01DD\u01E0\u01E8\u01EF\u01F7\u01FF\u020B\u020E\u0215\u021E" + + "\u0221\u0224\u0229\u022C\u023B"; + public static readonly _serializedATN: string = Utils.join( + [ + painless_parser._serializedATNSegment0, + painless_parser._serializedATNSegment1, + ], + "", + ); + public static __ATN: ATN; + public static get _ATN(): ATN { + if (!painless_parser.__ATN) { + painless_parser.__ATN = new ATNDeserializer().deserialize(Utils.toCharArray(painless_parser._serializedATN)); + } + + return painless_parser.__ATN; + } + +} + +export class SourceContext extends ParserRuleContext { + public EOF(): TerminalNode { return this.getToken(painless_parser.EOF, 0); } + public function(): FunctionContext[]; + public function(i: number): FunctionContext; + public function(i?: number): FunctionContext | FunctionContext[] { + if (i === undefined) { + return this.getRuleContexts(FunctionContext); + } else { + return this.getRuleContext(i, FunctionContext); + } + } + public statement(): StatementContext[]; + public statement(i: number): StatementContext; + public statement(i?: number): StatementContext | StatementContext[] { + if (i === undefined) { + return this.getRuleContexts(StatementContext); + } else { + return this.getRuleContext(i, StatementContext); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_source; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterSource) { + listener.enterSource(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitSource) { + listener.exitSource(this); + } + } +} + + +export class FunctionContext extends ParserRuleContext { + public decltype(): DecltypeContext { + return this.getRuleContext(0, DecltypeContext); + } + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + public parameters(): ParametersContext { + return this.getRuleContext(0, ParametersContext); + } + public block(): BlockContext { + return this.getRuleContext(0, BlockContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_function; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterFunction) { + listener.enterFunction(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitFunction) { + listener.exitFunction(this); + } + } +} + + +export class ParametersContext extends ParserRuleContext { + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public decltype(): DecltypeContext[]; + public decltype(i: number): DecltypeContext; + public decltype(i?: number): DecltypeContext | DecltypeContext[] { + if (i === undefined) { + return this.getRuleContexts(DecltypeContext); + } else { + return this.getRuleContext(i, DecltypeContext); + } + } + public ID(): TerminalNode[]; + public ID(i: number): TerminalNode; + public ID(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.ID); + } else { + return this.getToken(painless_parser.ID, i); + } + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.COMMA); + } else { + return this.getToken(painless_parser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_parameters; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterParameters) { + listener.enterParameters(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitParameters) { + listener.exitParameters(this); + } + } +} + + +export class StatementContext extends ParserRuleContext { + public rstatement(): RstatementContext | undefined { + return this.tryGetRuleContext(0, RstatementContext); + } + public dstatement(): DstatementContext | undefined { + return this.tryGetRuleContext(0, DstatementContext); + } + public SEMICOLON(): TerminalNode | undefined { return this.tryGetToken(painless_parser.SEMICOLON, 0); } + public EOF(): TerminalNode | undefined { return this.tryGetToken(painless_parser.EOF, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_statement; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterStatement) { + listener.enterStatement(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitStatement) { + listener.exitStatement(this); + } + } +} + + +export class RstatementContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_rstatement; } + public copyFrom(ctx: RstatementContext): void { + super.copyFrom(ctx); + } +} +export class IfContext extends RstatementContext { + public IF(): TerminalNode { return this.getToken(painless_parser.IF, 0); } + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public trailer(): TrailerContext[]; + public trailer(i: number): TrailerContext; + public trailer(i?: number): TrailerContext | TrailerContext[] { + if (i === undefined) { + return this.getRuleContexts(TrailerContext); + } else { + return this.getRuleContext(i, TrailerContext); + } + } + public ELSE(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ELSE, 0); } + constructor(ctx: RstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterIf) { + listener.enterIf(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitIf) { + listener.exitIf(this); + } + } +} +export class WhileContext extends RstatementContext { + public WHILE(): TerminalNode { return this.getToken(painless_parser.WHILE, 0); } + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public trailer(): TrailerContext | undefined { + return this.tryGetRuleContext(0, TrailerContext); + } + public empty(): EmptyContext | undefined { + return this.tryGetRuleContext(0, EmptyContext); + } + constructor(ctx: RstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterWhile) { + listener.enterWhile(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitWhile) { + listener.exitWhile(this); + } + } +} +export class ForContext extends RstatementContext { + public FOR(): TerminalNode { return this.getToken(painless_parser.FOR, 0); } + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public SEMICOLON(): TerminalNode[]; + public SEMICOLON(i: number): TerminalNode; + public SEMICOLON(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.SEMICOLON); + } else { + return this.getToken(painless_parser.SEMICOLON, i); + } + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public trailer(): TrailerContext | undefined { + return this.tryGetRuleContext(0, TrailerContext); + } + public empty(): EmptyContext | undefined { + return this.tryGetRuleContext(0, EmptyContext); + } + public initializer(): InitializerContext | undefined { + return this.tryGetRuleContext(0, InitializerContext); + } + public expression(): ExpressionContext | undefined { + return this.tryGetRuleContext(0, ExpressionContext); + } + public afterthought(): AfterthoughtContext | undefined { + return this.tryGetRuleContext(0, AfterthoughtContext); + } + constructor(ctx: RstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterFor) { + listener.enterFor(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitFor) { + listener.exitFor(this); + } + } +} +export class EachContext extends RstatementContext { + public FOR(): TerminalNode { return this.getToken(painless_parser.FOR, 0); } + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public decltype(): DecltypeContext { + return this.getRuleContext(0, DecltypeContext); + } + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + public COLON(): TerminalNode { return this.getToken(painless_parser.COLON, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public trailer(): TrailerContext { + return this.getRuleContext(0, TrailerContext); + } + constructor(ctx: RstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterEach) { + listener.enterEach(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitEach) { + listener.exitEach(this); + } + } +} +export class IneachContext extends RstatementContext { + public FOR(): TerminalNode { return this.getToken(painless_parser.FOR, 0); } + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + public IN(): TerminalNode { return this.getToken(painless_parser.IN, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public trailer(): TrailerContext { + return this.getRuleContext(0, TrailerContext); + } + constructor(ctx: RstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterIneach) { + listener.enterIneach(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitIneach) { + listener.exitIneach(this); + } + } +} +export class TryContext extends RstatementContext { + public TRY(): TerminalNode { return this.getToken(painless_parser.TRY, 0); } + public block(): BlockContext { + return this.getRuleContext(0, BlockContext); + } + public trap(): TrapContext[]; + public trap(i: number): TrapContext; + public trap(i?: number): TrapContext | TrapContext[] { + if (i === undefined) { + return this.getRuleContexts(TrapContext); + } else { + return this.getRuleContext(i, TrapContext); + } + } + constructor(ctx: RstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterTry) { + listener.enterTry(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitTry) { + listener.exitTry(this); + } + } +} + + +export class DstatementContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_dstatement; } + public copyFrom(ctx: DstatementContext): void { + super.copyFrom(ctx); + } +} +export class DoContext extends DstatementContext { + public DO(): TerminalNode { return this.getToken(painless_parser.DO, 0); } + public block(): BlockContext { + return this.getRuleContext(0, BlockContext); + } + public WHILE(): TerminalNode { return this.getToken(painless_parser.WHILE, 0); } + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + constructor(ctx: DstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterDo) { + listener.enterDo(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitDo) { + listener.exitDo(this); + } + } +} +export class DeclContext extends DstatementContext { + public declaration(): DeclarationContext { + return this.getRuleContext(0, DeclarationContext); + } + constructor(ctx: DstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterDecl) { + listener.enterDecl(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitDecl) { + listener.exitDecl(this); + } + } +} +export class ContinueContext extends DstatementContext { + public CONTINUE(): TerminalNode { return this.getToken(painless_parser.CONTINUE, 0); } + constructor(ctx: DstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterContinue) { + listener.enterContinue(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitContinue) { + listener.exitContinue(this); + } + } +} +export class BreakContext extends DstatementContext { + public BREAK(): TerminalNode { return this.getToken(painless_parser.BREAK, 0); } + constructor(ctx: DstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterBreak) { + listener.enterBreak(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitBreak) { + listener.exitBreak(this); + } + } +} +export class ReturnContext extends DstatementContext { + public RETURN(): TerminalNode { return this.getToken(painless_parser.RETURN, 0); } + public expression(): ExpressionContext | undefined { + return this.tryGetRuleContext(0, ExpressionContext); + } + constructor(ctx: DstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterReturn) { + listener.enterReturn(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitReturn) { + listener.exitReturn(this); + } + } +} +export class ThrowContext extends DstatementContext { + public THROW(): TerminalNode { return this.getToken(painless_parser.THROW, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + constructor(ctx: DstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterThrow) { + listener.enterThrow(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitThrow) { + listener.exitThrow(this); + } + } +} +export class ExprContext extends DstatementContext { + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + constructor(ctx: DstatementContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterExpr) { + listener.enterExpr(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitExpr) { + listener.exitExpr(this); + } + } +} + + +export class TrailerContext extends ParserRuleContext { + public block(): BlockContext | undefined { + return this.tryGetRuleContext(0, BlockContext); + } + public statement(): StatementContext | undefined { + return this.tryGetRuleContext(0, StatementContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_trailer; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterTrailer) { + listener.enterTrailer(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitTrailer) { + listener.exitTrailer(this); + } + } +} + + +export class BlockContext extends ParserRuleContext { + public LBRACK(): TerminalNode { return this.getToken(painless_parser.LBRACK, 0); } + public RBRACK(): TerminalNode { return this.getToken(painless_parser.RBRACK, 0); } + public statement(): StatementContext[]; + public statement(i: number): StatementContext; + public statement(i?: number): StatementContext | StatementContext[] { + if (i === undefined) { + return this.getRuleContexts(StatementContext); + } else { + return this.getRuleContext(i, StatementContext); + } + } + public dstatement(): DstatementContext | undefined { + return this.tryGetRuleContext(0, DstatementContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_block; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterBlock) { + listener.enterBlock(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitBlock) { + listener.exitBlock(this); + } + } +} + + +export class EmptyContext extends ParserRuleContext { + public SEMICOLON(): TerminalNode { return this.getToken(painless_parser.SEMICOLON, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_empty; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterEmpty) { + listener.enterEmpty(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitEmpty) { + listener.exitEmpty(this); + } + } +} + + +export class InitializerContext extends ParserRuleContext { + public declaration(): DeclarationContext | undefined { + return this.tryGetRuleContext(0, DeclarationContext); + } + public expression(): ExpressionContext | undefined { + return this.tryGetRuleContext(0, ExpressionContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_initializer; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterInitializer) { + listener.enterInitializer(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitInitializer) { + listener.exitInitializer(this); + } + } +} + + +export class AfterthoughtContext extends ParserRuleContext { + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_afterthought; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterAfterthought) { + listener.enterAfterthought(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitAfterthought) { + listener.exitAfterthought(this); + } + } +} + + +export class DeclarationContext extends ParserRuleContext { + public decltype(): DecltypeContext { + return this.getRuleContext(0, DecltypeContext); + } + public declvar(): DeclvarContext[]; + public declvar(i: number): DeclvarContext; + public declvar(i?: number): DeclvarContext | DeclvarContext[] { + if (i === undefined) { + return this.getRuleContexts(DeclvarContext); + } else { + return this.getRuleContext(i, DeclvarContext); + } + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.COMMA); + } else { + return this.getToken(painless_parser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_declaration; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterDeclaration) { + listener.enterDeclaration(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitDeclaration) { + listener.exitDeclaration(this); + } + } +} + + +export class DecltypeContext extends ParserRuleContext { + public type(): TypeContext { + return this.getRuleContext(0, TypeContext); + } + public LBRACE(): TerminalNode[]; + public LBRACE(i: number): TerminalNode; + public LBRACE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.LBRACE); + } else { + return this.getToken(painless_parser.LBRACE, i); + } + } + public RBRACE(): TerminalNode[]; + public RBRACE(i: number): TerminalNode; + public RBRACE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.RBRACE); + } else { + return this.getToken(painless_parser.RBRACE, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_decltype; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterDecltype) { + listener.enterDecltype(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitDecltype) { + listener.exitDecltype(this); + } + } +} + + +export class TypeContext extends ParserRuleContext { + public DEF(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DEF, 0); } + public PRIMITIVE(): TerminalNode | undefined { return this.tryGetToken(painless_parser.PRIMITIVE, 0); } + public ID(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ID, 0); } + public DOT(): TerminalNode[]; + public DOT(i: number): TerminalNode; + public DOT(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.DOT); + } else { + return this.getToken(painless_parser.DOT, i); + } + } + public DOTID(): TerminalNode[]; + public DOTID(i: number): TerminalNode; + public DOTID(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.DOTID); + } else { + return this.getToken(painless_parser.DOTID, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_type; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterType) { + listener.enterType(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitType) { + listener.exitType(this); + } + } +} + + +export class DeclvarContext extends ParserRuleContext { + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + public ASSIGN(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ASSIGN, 0); } + public expression(): ExpressionContext | undefined { + return this.tryGetRuleContext(0, ExpressionContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_declvar; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterDeclvar) { + listener.enterDeclvar(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitDeclvar) { + listener.exitDeclvar(this); + } + } +} + + +export class TrapContext extends ParserRuleContext { + public CATCH(): TerminalNode { return this.getToken(painless_parser.CATCH, 0); } + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public type(): TypeContext { + return this.getRuleContext(0, TypeContext); + } + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public block(): BlockContext { + return this.getRuleContext(0, BlockContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_trap; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterTrap) { + listener.enterTrap(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitTrap) { + listener.exitTrap(this); + } + } +} + + +export class NoncondexpressionContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_noncondexpression; } + public copyFrom(ctx: NoncondexpressionContext): void { + super.copyFrom(ctx); + } +} +export class SingleContext extends NoncondexpressionContext { + public unary(): UnaryContext { + return this.getRuleContext(0, UnaryContext); + } + constructor(ctx: NoncondexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterSingle) { + listener.enterSingle(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitSingle) { + listener.exitSingle(this); + } + } +} +export class BinaryContext extends NoncondexpressionContext { + public noncondexpression(): NoncondexpressionContext[]; + public noncondexpression(i: number): NoncondexpressionContext; + public noncondexpression(i?: number): NoncondexpressionContext | NoncondexpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(NoncondexpressionContext); + } else { + return this.getRuleContext(i, NoncondexpressionContext); + } + } + public MUL(): TerminalNode | undefined { return this.tryGetToken(painless_parser.MUL, 0); } + public DIV(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DIV, 0); } + public REM(): TerminalNode | undefined { return this.tryGetToken(painless_parser.REM, 0); } + public ADD(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ADD, 0); } + public SUB(): TerminalNode | undefined { return this.tryGetToken(painless_parser.SUB, 0); } + public FIND(): TerminalNode | undefined { return this.tryGetToken(painless_parser.FIND, 0); } + public MATCH(): TerminalNode | undefined { return this.tryGetToken(painless_parser.MATCH, 0); } + public LSH(): TerminalNode | undefined { return this.tryGetToken(painless_parser.LSH, 0); } + public RSH(): TerminalNode | undefined { return this.tryGetToken(painless_parser.RSH, 0); } + public USH(): TerminalNode | undefined { return this.tryGetToken(painless_parser.USH, 0); } + public BWAND(): TerminalNode | undefined { return this.tryGetToken(painless_parser.BWAND, 0); } + public XOR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.XOR, 0); } + public BWOR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.BWOR, 0); } + constructor(ctx: NoncondexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterBinary) { + listener.enterBinary(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitBinary) { + listener.exitBinary(this); + } + } +} +export class CompContext extends NoncondexpressionContext { + public noncondexpression(): NoncondexpressionContext[]; + public noncondexpression(i: number): NoncondexpressionContext; + public noncondexpression(i?: number): NoncondexpressionContext | NoncondexpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(NoncondexpressionContext); + } else { + return this.getRuleContext(i, NoncondexpressionContext); + } + } + public LT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.LT, 0); } + public LTE(): TerminalNode | undefined { return this.tryGetToken(painless_parser.LTE, 0); } + public GT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.GT, 0); } + public GTE(): TerminalNode | undefined { return this.tryGetToken(painless_parser.GTE, 0); } + public EQ(): TerminalNode | undefined { return this.tryGetToken(painless_parser.EQ, 0); } + public EQR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.EQR, 0); } + public NE(): TerminalNode | undefined { return this.tryGetToken(painless_parser.NE, 0); } + public NER(): TerminalNode | undefined { return this.tryGetToken(painless_parser.NER, 0); } + constructor(ctx: NoncondexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterComp) { + listener.enterComp(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitComp) { + listener.exitComp(this); + } + } +} +export class InstanceofContext extends NoncondexpressionContext { + public noncondexpression(): NoncondexpressionContext { + return this.getRuleContext(0, NoncondexpressionContext); + } + public INSTANCEOF(): TerminalNode { return this.getToken(painless_parser.INSTANCEOF, 0); } + public decltype(): DecltypeContext { + return this.getRuleContext(0, DecltypeContext); + } + constructor(ctx: NoncondexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterInstanceof) { + listener.enterInstanceof(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitInstanceof) { + listener.exitInstanceof(this); + } + } +} +export class BoolContext extends NoncondexpressionContext { + public noncondexpression(): NoncondexpressionContext[]; + public noncondexpression(i: number): NoncondexpressionContext; + public noncondexpression(i?: number): NoncondexpressionContext | NoncondexpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(NoncondexpressionContext); + } else { + return this.getRuleContext(i, NoncondexpressionContext); + } + } + public BOOLAND(): TerminalNode | undefined { return this.tryGetToken(painless_parser.BOOLAND, 0); } + public BOOLOR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.BOOLOR, 0); } + constructor(ctx: NoncondexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterBool) { + listener.enterBool(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitBool) { + listener.exitBool(this); + } + } +} +export class ElvisContext extends NoncondexpressionContext { + public noncondexpression(): NoncondexpressionContext[]; + public noncondexpression(i: number): NoncondexpressionContext; + public noncondexpression(i?: number): NoncondexpressionContext | NoncondexpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(NoncondexpressionContext); + } else { + return this.getRuleContext(i, NoncondexpressionContext); + } + } + public ELVIS(): TerminalNode { return this.getToken(painless_parser.ELVIS, 0); } + constructor(ctx: NoncondexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterElvis) { + listener.enterElvis(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitElvis) { + listener.exitElvis(this); + } + } +} + + +export class ExpressionContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_expression; } + public copyFrom(ctx: ExpressionContext): void { + super.copyFrom(ctx); + } +} +export class NonconditionalContext extends ExpressionContext { + public noncondexpression(): NoncondexpressionContext { + return this.getRuleContext(0, NoncondexpressionContext); + } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNonconditional) { + listener.enterNonconditional(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNonconditional) { + listener.exitNonconditional(this); + } + } +} +export class ConditionalContext extends ExpressionContext { + public noncondexpression(): NoncondexpressionContext { + return this.getRuleContext(0, NoncondexpressionContext); + } + public COND(): TerminalNode { return this.getToken(painless_parser.COND, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public COLON(): TerminalNode { return this.getToken(painless_parser.COLON, 0); } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterConditional) { + listener.enterConditional(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitConditional) { + listener.exitConditional(this); + } + } +} +export class AssignmentContext extends ExpressionContext { + public noncondexpression(): NoncondexpressionContext { + return this.getRuleContext(0, NoncondexpressionContext); + } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public ASSIGN(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ASSIGN, 0); } + public AADD(): TerminalNode | undefined { return this.tryGetToken(painless_parser.AADD, 0); } + public ASUB(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ASUB, 0); } + public AMUL(): TerminalNode | undefined { return this.tryGetToken(painless_parser.AMUL, 0); } + public ADIV(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ADIV, 0); } + public AREM(): TerminalNode | undefined { return this.tryGetToken(painless_parser.AREM, 0); } + public AAND(): TerminalNode | undefined { return this.tryGetToken(painless_parser.AAND, 0); } + public AXOR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.AXOR, 0); } + public AOR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.AOR, 0); } + public ALSH(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ALSH, 0); } + public ARSH(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ARSH, 0); } + public AUSH(): TerminalNode | undefined { return this.tryGetToken(painless_parser.AUSH, 0); } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterAssignment) { + listener.enterAssignment(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitAssignment) { + listener.exitAssignment(this); + } + } +} + + +export class UnaryContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_unary; } + public copyFrom(ctx: UnaryContext): void { + super.copyFrom(ctx); + } +} +export class PreContext extends UnaryContext { + public chain(): ChainContext { + return this.getRuleContext(0, ChainContext); + } + public INCR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.INCR, 0); } + public DECR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DECR, 0); } + constructor(ctx: UnaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterPre) { + listener.enterPre(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitPre) { + listener.exitPre(this); + } + } +} +export class AddsubContext extends UnaryContext { + public unary(): UnaryContext { + return this.getRuleContext(0, UnaryContext); + } + public ADD(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ADD, 0); } + public SUB(): TerminalNode | undefined { return this.tryGetToken(painless_parser.SUB, 0); } + constructor(ctx: UnaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterAddsub) { + listener.enterAddsub(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitAddsub) { + listener.exitAddsub(this); + } + } +} +export class NotaddsubContext extends UnaryContext { + public unarynotaddsub(): UnarynotaddsubContext { + return this.getRuleContext(0, UnarynotaddsubContext); + } + constructor(ctx: UnaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNotaddsub) { + listener.enterNotaddsub(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNotaddsub) { + listener.exitNotaddsub(this); + } + } +} + + +export class UnarynotaddsubContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_unarynotaddsub; } + public copyFrom(ctx: UnarynotaddsubContext): void { + super.copyFrom(ctx); + } +} +export class ReadContext extends UnarynotaddsubContext { + public chain(): ChainContext { + return this.getRuleContext(0, ChainContext); + } + constructor(ctx: UnarynotaddsubContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterRead) { + listener.enterRead(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitRead) { + listener.exitRead(this); + } + } +} +export class PostContext extends UnarynotaddsubContext { + public chain(): ChainContext { + return this.getRuleContext(0, ChainContext); + } + public INCR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.INCR, 0); } + public DECR(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DECR, 0); } + constructor(ctx: UnarynotaddsubContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterPost) { + listener.enterPost(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitPost) { + listener.exitPost(this); + } + } +} +export class NotContext extends UnarynotaddsubContext { + public unary(): UnaryContext { + return this.getRuleContext(0, UnaryContext); + } + public BOOLNOT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.BOOLNOT, 0); } + public BWNOT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.BWNOT, 0); } + constructor(ctx: UnarynotaddsubContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNot) { + listener.enterNot(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNot) { + listener.exitNot(this); + } + } +} +export class CastContext extends UnarynotaddsubContext { + public castexpression(): CastexpressionContext { + return this.getRuleContext(0, CastexpressionContext); + } + constructor(ctx: UnarynotaddsubContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterCast) { + listener.enterCast(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitCast) { + listener.exitCast(this); + } + } +} + + +export class CastexpressionContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_castexpression; } + public copyFrom(ctx: CastexpressionContext): void { + super.copyFrom(ctx); + } +} +export class PrimordefcastContext extends CastexpressionContext { + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public primordefcasttype(): PrimordefcasttypeContext { + return this.getRuleContext(0, PrimordefcasttypeContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public unary(): UnaryContext { + return this.getRuleContext(0, UnaryContext); + } + constructor(ctx: CastexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterPrimordefcast) { + listener.enterPrimordefcast(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitPrimordefcast) { + listener.exitPrimordefcast(this); + } + } +} +export class RefcastContext extends CastexpressionContext { + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public refcasttype(): RefcasttypeContext { + return this.getRuleContext(0, RefcasttypeContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + public unarynotaddsub(): UnarynotaddsubContext { + return this.getRuleContext(0, UnarynotaddsubContext); + } + constructor(ctx: CastexpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterRefcast) { + listener.enterRefcast(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitRefcast) { + listener.exitRefcast(this); + } + } +} + + +export class PrimordefcasttypeContext extends ParserRuleContext { + public DEF(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DEF, 0); } + public PRIMITIVE(): TerminalNode | undefined { return this.tryGetToken(painless_parser.PRIMITIVE, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_primordefcasttype; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterPrimordefcasttype) { + listener.enterPrimordefcasttype(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitPrimordefcasttype) { + listener.exitPrimordefcasttype(this); + } + } +} + + +export class RefcasttypeContext extends ParserRuleContext { + public DEF(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DEF, 0); } + public LBRACE(): TerminalNode[]; + public LBRACE(i: number): TerminalNode; + public LBRACE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.LBRACE); + } else { + return this.getToken(painless_parser.LBRACE, i); + } + } + public RBRACE(): TerminalNode[]; + public RBRACE(i: number): TerminalNode; + public RBRACE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.RBRACE); + } else { + return this.getToken(painless_parser.RBRACE, i); + } + } + public PRIMITIVE(): TerminalNode | undefined { return this.tryGetToken(painless_parser.PRIMITIVE, 0); } + public ID(): TerminalNode | undefined { return this.tryGetToken(painless_parser.ID, 0); } + public DOT(): TerminalNode[]; + public DOT(i: number): TerminalNode; + public DOT(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.DOT); + } else { + return this.getToken(painless_parser.DOT, i); + } + } + public DOTID(): TerminalNode[]; + public DOTID(i: number): TerminalNode; + public DOTID(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.DOTID); + } else { + return this.getToken(painless_parser.DOTID, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_refcasttype; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterRefcasttype) { + listener.enterRefcasttype(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitRefcasttype) { + listener.exitRefcasttype(this); + } + } +} + + +export class ChainContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_chain; } + public copyFrom(ctx: ChainContext): void { + super.copyFrom(ctx); + } +} +export class DynamicContext extends ChainContext { + public primary(): PrimaryContext { + return this.getRuleContext(0, PrimaryContext); + } + public postfix(): PostfixContext[]; + public postfix(i: number): PostfixContext; + public postfix(i?: number): PostfixContext | PostfixContext[] { + if (i === undefined) { + return this.getRuleContexts(PostfixContext); + } else { + return this.getRuleContext(i, PostfixContext); + } + } + constructor(ctx: ChainContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterDynamic) { + listener.enterDynamic(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitDynamic) { + listener.exitDynamic(this); + } + } +} +export class NewarrayContext extends ChainContext { + public arrayinitializer(): ArrayinitializerContext { + return this.getRuleContext(0, ArrayinitializerContext); + } + constructor(ctx: ChainContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNewarray) { + listener.enterNewarray(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNewarray) { + listener.exitNewarray(this); + } + } +} + + +export class PrimaryContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_primary; } + public copyFrom(ctx: PrimaryContext): void { + super.copyFrom(ctx); + } +} +export class PrecedenceContext extends PrimaryContext { + public LP(): TerminalNode { return this.getToken(painless_parser.LP, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RP(): TerminalNode { return this.getToken(painless_parser.RP, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterPrecedence) { + listener.enterPrecedence(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitPrecedence) { + listener.exitPrecedence(this); + } + } +} +export class NumericContext extends PrimaryContext { + public OCTAL(): TerminalNode | undefined { return this.tryGetToken(painless_parser.OCTAL, 0); } + public HEX(): TerminalNode | undefined { return this.tryGetToken(painless_parser.HEX, 0); } + public INTEGER(): TerminalNode | undefined { return this.tryGetToken(painless_parser.INTEGER, 0); } + public DECIMAL(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DECIMAL, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNumeric) { + listener.enterNumeric(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNumeric) { + listener.exitNumeric(this); + } + } +} +export class TrueContext extends PrimaryContext { + public TRUE(): TerminalNode { return this.getToken(painless_parser.TRUE, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterTrue) { + listener.enterTrue(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitTrue) { + listener.exitTrue(this); + } + } +} +export class FalseContext extends PrimaryContext { + public FALSE(): TerminalNode { return this.getToken(painless_parser.FALSE, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterFalse) { + listener.enterFalse(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitFalse) { + listener.exitFalse(this); + } + } +} +export class NullContext extends PrimaryContext { + public NULL(): TerminalNode { return this.getToken(painless_parser.NULL, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNull) { + listener.enterNull(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNull) { + listener.exitNull(this); + } + } +} +export class StringContext extends PrimaryContext { + public STRING(): TerminalNode { return this.getToken(painless_parser.STRING, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterString) { + listener.enterString(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitString) { + listener.exitString(this); + } + } +} +export class RegexContext extends PrimaryContext { + public REGEX(): TerminalNode { return this.getToken(painless_parser.REGEX, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterRegex) { + listener.enterRegex(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitRegex) { + listener.exitRegex(this); + } + } +} +export class ListinitContext extends PrimaryContext { + public listinitializer(): ListinitializerContext { + return this.getRuleContext(0, ListinitializerContext); + } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterListinit) { + listener.enterListinit(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitListinit) { + listener.exitListinit(this); + } + } +} +export class MapinitContext extends PrimaryContext { + public mapinitializer(): MapinitializerContext { + return this.getRuleContext(0, MapinitializerContext); + } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterMapinit) { + listener.enterMapinit(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitMapinit) { + listener.exitMapinit(this); + } + } +} +export class VariableContext extends PrimaryContext { + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterVariable) { + listener.enterVariable(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitVariable) { + listener.exitVariable(this); + } + } +} +export class CalllocalContext extends PrimaryContext { + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + public arguments(): ArgumentsContext { + return this.getRuleContext(0, ArgumentsContext); + } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterCalllocal) { + listener.enterCalllocal(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitCalllocal) { + listener.exitCalllocal(this); + } + } +} +export class NewobjectContext extends PrimaryContext { + public NEW(): TerminalNode { return this.getToken(painless_parser.NEW, 0); } + public type(): TypeContext { + return this.getRuleContext(0, TypeContext); + } + public arguments(): ArgumentsContext { + return this.getRuleContext(0, ArgumentsContext); + } + constructor(ctx: PrimaryContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNewobject) { + listener.enterNewobject(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNewobject) { + listener.exitNewobject(this); + } + } +} + + +export class PostfixContext extends ParserRuleContext { + public callinvoke(): CallinvokeContext | undefined { + return this.tryGetRuleContext(0, CallinvokeContext); + } + public fieldaccess(): FieldaccessContext | undefined { + return this.tryGetRuleContext(0, FieldaccessContext); + } + public braceaccess(): BraceaccessContext | undefined { + return this.tryGetRuleContext(0, BraceaccessContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_postfix; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterPostfix) { + listener.enterPostfix(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitPostfix) { + listener.exitPostfix(this); + } + } +} + + +export class PostdotContext extends ParserRuleContext { + public callinvoke(): CallinvokeContext | undefined { + return this.tryGetRuleContext(0, CallinvokeContext); + } + public fieldaccess(): FieldaccessContext | undefined { + return this.tryGetRuleContext(0, FieldaccessContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_postdot; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterPostdot) { + listener.enterPostdot(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitPostdot) { + listener.exitPostdot(this); + } + } +} + + +export class CallinvokeContext extends ParserRuleContext { + public DOTID(): TerminalNode { return this.getToken(painless_parser.DOTID, 0); } + public arguments(): ArgumentsContext { + return this.getRuleContext(0, ArgumentsContext); + } + public DOT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DOT, 0); } + public NSDOT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.NSDOT, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_callinvoke; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterCallinvoke) { + listener.enterCallinvoke(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitCallinvoke) { + listener.exitCallinvoke(this); + } + } +} + + +export class FieldaccessContext extends ParserRuleContext { + public DOT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DOT, 0); } + public NSDOT(): TerminalNode | undefined { return this.tryGetToken(painless_parser.NSDOT, 0); } + public DOTID(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DOTID, 0); } + public DOTINTEGER(): TerminalNode | undefined { return this.tryGetToken(painless_parser.DOTINTEGER, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_fieldaccess; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterFieldaccess) { + listener.enterFieldaccess(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitFieldaccess) { + listener.exitFieldaccess(this); + } + } +} + + +export class BraceaccessContext extends ParserRuleContext { + public LBRACE(): TerminalNode { return this.getToken(painless_parser.LBRACE, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RBRACE(): TerminalNode { return this.getToken(painless_parser.RBRACE, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_braceaccess; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterBraceaccess) { + listener.enterBraceaccess(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitBraceaccess) { + listener.exitBraceaccess(this); + } + } +} + + +export class ArrayinitializerContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_arrayinitializer; } + public copyFrom(ctx: ArrayinitializerContext): void { + super.copyFrom(ctx); + } +} +export class NewstandardarrayContext extends ArrayinitializerContext { + public NEW(): TerminalNode { return this.getToken(painless_parser.NEW, 0); } + public type(): TypeContext { + return this.getRuleContext(0, TypeContext); + } + public LBRACE(): TerminalNode[]; + public LBRACE(i: number): TerminalNode; + public LBRACE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.LBRACE); + } else { + return this.getToken(painless_parser.LBRACE, i); + } + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public RBRACE(): TerminalNode[]; + public RBRACE(i: number): TerminalNode; + public RBRACE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.RBRACE); + } else { + return this.getToken(painless_parser.RBRACE, i); + } + } + public postdot(): PostdotContext | undefined { + return this.tryGetRuleContext(0, PostdotContext); + } + public postfix(): PostfixContext[]; + public postfix(i: number): PostfixContext; + public postfix(i?: number): PostfixContext | PostfixContext[] { + if (i === undefined) { + return this.getRuleContexts(PostfixContext); + } else { + return this.getRuleContext(i, PostfixContext); + } + } + constructor(ctx: ArrayinitializerContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNewstandardarray) { + listener.enterNewstandardarray(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNewstandardarray) { + listener.exitNewstandardarray(this); + } + } +} +export class NewinitializedarrayContext extends ArrayinitializerContext { + public NEW(): TerminalNode { return this.getToken(painless_parser.NEW, 0); } + public type(): TypeContext { + return this.getRuleContext(0, TypeContext); + } + public LBRACE(): TerminalNode { return this.getToken(painless_parser.LBRACE, 0); } + public RBRACE(): TerminalNode { return this.getToken(painless_parser.RBRACE, 0); } + public LBRACK(): TerminalNode { return this.getToken(painless_parser.LBRACK, 0); } + public RBRACK(): TerminalNode { return this.getToken(painless_parser.RBRACK, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public postfix(): PostfixContext[]; + public postfix(i: number): PostfixContext; + public postfix(i?: number): PostfixContext | PostfixContext[] { + if (i === undefined) { + return this.getRuleContexts(PostfixContext); + } else { + return this.getRuleContext(i, PostfixContext); + } + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.COMMA); + } else { + return this.getToken(painless_parser.COMMA, i); + } + } + constructor(ctx: ArrayinitializerContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterNewinitializedarray) { + listener.enterNewinitializedarray(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitNewinitializedarray) { + listener.exitNewinitializedarray(this); + } + } +} + + +export class ListinitializerContext extends ParserRuleContext { + public LBRACE(): TerminalNode { return this.getToken(painless_parser.LBRACE, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public RBRACE(): TerminalNode { return this.getToken(painless_parser.RBRACE, 0); } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.COMMA); + } else { + return this.getToken(painless_parser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_listinitializer; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterListinitializer) { + listener.enterListinitializer(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitListinitializer) { + listener.exitListinitializer(this); + } + } +} + + +export class MapinitializerContext extends ParserRuleContext { + public LBRACE(): TerminalNode { return this.getToken(painless_parser.LBRACE, 0); } + public maptoken(): MaptokenContext[]; + public maptoken(i: number): MaptokenContext; + public maptoken(i?: number): MaptokenContext | MaptokenContext[] { + if (i === undefined) { + return this.getRuleContexts(MaptokenContext); + } else { + return this.getRuleContext(i, MaptokenContext); + } + } + public RBRACE(): TerminalNode { return this.getToken(painless_parser.RBRACE, 0); } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.COMMA); + } else { + return this.getToken(painless_parser.COMMA, i); + } + } + public COLON(): TerminalNode | undefined { return this.tryGetToken(painless_parser.COLON, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_mapinitializer; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterMapinitializer) { + listener.enterMapinitializer(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitMapinitializer) { + listener.exitMapinitializer(this); + } + } +} + + +export class MaptokenContext extends ParserRuleContext { + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public COLON(): TerminalNode { return this.getToken(painless_parser.COLON, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_maptoken; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterMaptoken) { + listener.enterMaptoken(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitMaptoken) { + listener.exitMaptoken(this); + } + } +} + + +export class ArgumentsContext extends ParserRuleContext { + public LP(): TerminalNode | undefined { return this.tryGetToken(painless_parser.LP, 0); } + public RP(): TerminalNode | undefined { return this.tryGetToken(painless_parser.RP, 0); } + public argument(): ArgumentContext[]; + public argument(i: number): ArgumentContext; + public argument(i?: number): ArgumentContext | ArgumentContext[] { + if (i === undefined) { + return this.getRuleContexts(ArgumentContext); + } else { + return this.getRuleContext(i, ArgumentContext); + } + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.COMMA); + } else { + return this.getToken(painless_parser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_arguments; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterArguments) { + listener.enterArguments(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitArguments) { + listener.exitArguments(this); + } + } +} + + +export class ArgumentContext extends ParserRuleContext { + public expression(): ExpressionContext | undefined { + return this.tryGetRuleContext(0, ExpressionContext); + } + public lambda(): LambdaContext | undefined { + return this.tryGetRuleContext(0, LambdaContext); + } + public funcref(): FuncrefContext | undefined { + return this.tryGetRuleContext(0, FuncrefContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_argument; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterArgument) { + listener.enterArgument(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitArgument) { + listener.exitArgument(this); + } + } +} + + +export class LambdaContext extends ParserRuleContext { + public ARROW(): TerminalNode { return this.getToken(painless_parser.ARROW, 0); } + public lamtype(): LamtypeContext[]; + public lamtype(i: number): LamtypeContext; + public lamtype(i?: number): LamtypeContext | LamtypeContext[] { + if (i === undefined) { + return this.getRuleContexts(LamtypeContext); + } else { + return this.getRuleContext(i, LamtypeContext); + } + } + public LP(): TerminalNode | undefined { return this.tryGetToken(painless_parser.LP, 0); } + public RP(): TerminalNode | undefined { return this.tryGetToken(painless_parser.RP, 0); } + public block(): BlockContext | undefined { + return this.tryGetRuleContext(0, BlockContext); + } + public expression(): ExpressionContext | undefined { + return this.tryGetRuleContext(0, ExpressionContext); + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(painless_parser.COMMA); + } else { + return this.getToken(painless_parser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_lambda; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterLambda) { + listener.enterLambda(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitLambda) { + listener.exitLambda(this); + } + } +} + + +export class LamtypeContext extends ParserRuleContext { + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + public decltype(): DecltypeContext | undefined { + return this.tryGetRuleContext(0, DecltypeContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_lamtype; } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterLamtype) { + listener.enterLamtype(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitLamtype) { + listener.exitLamtype(this); + } + } +} + + +export class FuncrefContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return painless_parser.RULE_funcref; } + public copyFrom(ctx: FuncrefContext): void { + super.copyFrom(ctx); + } +} +export class ClassfuncrefContext extends FuncrefContext { + public decltype(): DecltypeContext { + return this.getRuleContext(0, DecltypeContext); + } + public REF(): TerminalNode { return this.getToken(painless_parser.REF, 0); } + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + constructor(ctx: FuncrefContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterClassfuncref) { + listener.enterClassfuncref(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitClassfuncref) { + listener.exitClassfuncref(this); + } + } +} +export class ConstructorfuncrefContext extends FuncrefContext { + public decltype(): DecltypeContext { + return this.getRuleContext(0, DecltypeContext); + } + public REF(): TerminalNode { return this.getToken(painless_parser.REF, 0); } + public NEW(): TerminalNode { return this.getToken(painless_parser.NEW, 0); } + constructor(ctx: FuncrefContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterConstructorfuncref) { + listener.enterConstructorfuncref(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitConstructorfuncref) { + listener.exitConstructorfuncref(this); + } + } +} +export class LocalfuncrefContext extends FuncrefContext { + public THIS(): TerminalNode { return this.getToken(painless_parser.THIS, 0); } + public REF(): TerminalNode { return this.getToken(painless_parser.REF, 0); } + public ID(): TerminalNode { return this.getToken(painless_parser.ID, 0); } + constructor(ctx: FuncrefContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: painless_parserListener): void { + if (listener.enterLocalfuncref) { + listener.enterLocalfuncref(this); + } + } + // @Override + public exitRule(listener: painless_parserListener): void { + if (listener.exitLocalfuncref) { + listener.exitLocalfuncref(this); + } + } +} + + diff --git a/packages/kbn-monaco/src/painless/antlr/painless_parser_listener.ts b/packages/kbn-monaco/src/painless/antlr/painless_parser_listener.ts new file mode 100644 index 0000000000000..bc2637d1f75d0 --- /dev/null +++ b/packages/kbn-monaco/src/painless/antlr/painless_parser_listener.ts @@ -0,0 +1,1182 @@ +// @ts-nocheck +// Generated from ./src/painless/antlr/painless_parser.g4 by ANTLR 4.7.3-SNAPSHOT + + +import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener"; + +import { NewstandardarrayContext } from "./painless_parser"; +import { NewinitializedarrayContext } from "./painless_parser"; +import { PrimordefcastContext } from "./painless_parser"; +import { RefcastContext } from "./painless_parser"; +import { PreContext } from "./painless_parser"; +import { AddsubContext } from "./painless_parser"; +import { NotaddsubContext } from "./painless_parser"; +import { ClassfuncrefContext } from "./painless_parser"; +import { ConstructorfuncrefContext } from "./painless_parser"; +import { LocalfuncrefContext } from "./painless_parser"; +import { IfContext } from "./painless_parser"; +import { WhileContext } from "./painless_parser"; +import { ForContext } from "./painless_parser"; +import { EachContext } from "./painless_parser"; +import { IneachContext } from "./painless_parser"; +import { TryContext } from "./painless_parser"; +import { ReadContext } from "./painless_parser"; +import { PostContext } from "./painless_parser"; +import { NotContext } from "./painless_parser"; +import { CastContext } from "./painless_parser"; +import { DynamicContext } from "./painless_parser"; +import { NewarrayContext } from "./painless_parser"; +import { NonconditionalContext } from "./painless_parser"; +import { ConditionalContext } from "./painless_parser"; +import { AssignmentContext } from "./painless_parser"; +import { DoContext } from "./painless_parser"; +import { DeclContext } from "./painless_parser"; +import { ContinueContext } from "./painless_parser"; +import { BreakContext } from "./painless_parser"; +import { ReturnContext } from "./painless_parser"; +import { ThrowContext } from "./painless_parser"; +import { ExprContext } from "./painless_parser"; +import { SingleContext } from "./painless_parser"; +import { BinaryContext } from "./painless_parser"; +import { CompContext } from "./painless_parser"; +import { InstanceofContext } from "./painless_parser"; +import { BoolContext } from "./painless_parser"; +import { ElvisContext } from "./painless_parser"; +import { PrecedenceContext } from "./painless_parser"; +import { NumericContext } from "./painless_parser"; +import { TrueContext } from "./painless_parser"; +import { FalseContext } from "./painless_parser"; +import { NullContext } from "./painless_parser"; +import { StringContext } from "./painless_parser"; +import { RegexContext } from "./painless_parser"; +import { ListinitContext } from "./painless_parser"; +import { MapinitContext } from "./painless_parser"; +import { VariableContext } from "./painless_parser"; +import { CalllocalContext } from "./painless_parser"; +import { NewobjectContext } from "./painless_parser"; +import { SourceContext } from "./painless_parser"; +import { FunctionContext } from "./painless_parser"; +import { ParametersContext } from "./painless_parser"; +import { StatementContext } from "./painless_parser"; +import { RstatementContext } from "./painless_parser"; +import { DstatementContext } from "./painless_parser"; +import { TrailerContext } from "./painless_parser"; +import { BlockContext } from "./painless_parser"; +import { EmptyContext } from "./painless_parser"; +import { InitializerContext } from "./painless_parser"; +import { AfterthoughtContext } from "./painless_parser"; +import { DeclarationContext } from "./painless_parser"; +import { DecltypeContext } from "./painless_parser"; +import { TypeContext } from "./painless_parser"; +import { DeclvarContext } from "./painless_parser"; +import { TrapContext } from "./painless_parser"; +import { NoncondexpressionContext } from "./painless_parser"; +import { ExpressionContext } from "./painless_parser"; +import { UnaryContext } from "./painless_parser"; +import { UnarynotaddsubContext } from "./painless_parser"; +import { CastexpressionContext } from "./painless_parser"; +import { PrimordefcasttypeContext } from "./painless_parser"; +import { RefcasttypeContext } from "./painless_parser"; +import { ChainContext } from "./painless_parser"; +import { PrimaryContext } from "./painless_parser"; +import { PostfixContext } from "./painless_parser"; +import { PostdotContext } from "./painless_parser"; +import { CallinvokeContext } from "./painless_parser"; +import { FieldaccessContext } from "./painless_parser"; +import { BraceaccessContext } from "./painless_parser"; +import { ArrayinitializerContext } from "./painless_parser"; +import { ListinitializerContext } from "./painless_parser"; +import { MapinitializerContext } from "./painless_parser"; +import { MaptokenContext } from "./painless_parser"; +import { ArgumentsContext } from "./painless_parser"; +import { ArgumentContext } from "./painless_parser"; +import { LambdaContext } from "./painless_parser"; +import { LamtypeContext } from "./painless_parser"; +import { FuncrefContext } from "./painless_parser"; + + +/** + * This interface defines a complete listener for a parse tree produced by + * `painless_parser`. + */ +export interface painless_parserListener extends ParseTreeListener { + /** + * Enter a parse tree produced by the `newstandardarray` + * labeled alternative in `painless_parser.arrayinitializer`. + * @param ctx the parse tree + */ + enterNewstandardarray?: (ctx: NewstandardarrayContext) => void; + /** + * Exit a parse tree produced by the `newstandardarray` + * labeled alternative in `painless_parser.arrayinitializer`. + * @param ctx the parse tree + */ + exitNewstandardarray?: (ctx: NewstandardarrayContext) => void; + + /** + * Enter a parse tree produced by the `newinitializedarray` + * labeled alternative in `painless_parser.arrayinitializer`. + * @param ctx the parse tree + */ + enterNewinitializedarray?: (ctx: NewinitializedarrayContext) => void; + /** + * Exit a parse tree produced by the `newinitializedarray` + * labeled alternative in `painless_parser.arrayinitializer`. + * @param ctx the parse tree + */ + exitNewinitializedarray?: (ctx: NewinitializedarrayContext) => void; + + /** + * Enter a parse tree produced by the `primordefcast` + * labeled alternative in `painless_parser.castexpression`. + * @param ctx the parse tree + */ + enterPrimordefcast?: (ctx: PrimordefcastContext) => void; + /** + * Exit a parse tree produced by the `primordefcast` + * labeled alternative in `painless_parser.castexpression`. + * @param ctx the parse tree + */ + exitPrimordefcast?: (ctx: PrimordefcastContext) => void; + + /** + * Enter a parse tree produced by the `refcast` + * labeled alternative in `painless_parser.castexpression`. + * @param ctx the parse tree + */ + enterRefcast?: (ctx: RefcastContext) => void; + /** + * Exit a parse tree produced by the `refcast` + * labeled alternative in `painless_parser.castexpression`. + * @param ctx the parse tree + */ + exitRefcast?: (ctx: RefcastContext) => void; + + /** + * Enter a parse tree produced by the `pre` + * labeled alternative in `painless_parser.unary`. + * @param ctx the parse tree + */ + enterPre?: (ctx: PreContext) => void; + /** + * Exit a parse tree produced by the `pre` + * labeled alternative in `painless_parser.unary`. + * @param ctx the parse tree + */ + exitPre?: (ctx: PreContext) => void; + + /** + * Enter a parse tree produced by the `addsub` + * labeled alternative in `painless_parser.unary`. + * @param ctx the parse tree + */ + enterAddsub?: (ctx: AddsubContext) => void; + /** + * Exit a parse tree produced by the `addsub` + * labeled alternative in `painless_parser.unary`. + * @param ctx the parse tree + */ + exitAddsub?: (ctx: AddsubContext) => void; + + /** + * Enter a parse tree produced by the `notaddsub` + * labeled alternative in `painless_parser.unary`. + * @param ctx the parse tree + */ + enterNotaddsub?: (ctx: NotaddsubContext) => void; + /** + * Exit a parse tree produced by the `notaddsub` + * labeled alternative in `painless_parser.unary`. + * @param ctx the parse tree + */ + exitNotaddsub?: (ctx: NotaddsubContext) => void; + + /** + * Enter a parse tree produced by the `classfuncref` + * labeled alternative in `painless_parser.funcref`. + * @param ctx the parse tree + */ + enterClassfuncref?: (ctx: ClassfuncrefContext) => void; + /** + * Exit a parse tree produced by the `classfuncref` + * labeled alternative in `painless_parser.funcref`. + * @param ctx the parse tree + */ + exitClassfuncref?: (ctx: ClassfuncrefContext) => void; + + /** + * Enter a parse tree produced by the `constructorfuncref` + * labeled alternative in `painless_parser.funcref`. + * @param ctx the parse tree + */ + enterConstructorfuncref?: (ctx: ConstructorfuncrefContext) => void; + /** + * Exit a parse tree produced by the `constructorfuncref` + * labeled alternative in `painless_parser.funcref`. + * @param ctx the parse tree + */ + exitConstructorfuncref?: (ctx: ConstructorfuncrefContext) => void; + + /** + * Enter a parse tree produced by the `localfuncref` + * labeled alternative in `painless_parser.funcref`. + * @param ctx the parse tree + */ + enterLocalfuncref?: (ctx: LocalfuncrefContext) => void; + /** + * Exit a parse tree produced by the `localfuncref` + * labeled alternative in `painless_parser.funcref`. + * @param ctx the parse tree + */ + exitLocalfuncref?: (ctx: LocalfuncrefContext) => void; + + /** + * Enter a parse tree produced by the `if` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + enterIf?: (ctx: IfContext) => void; + /** + * Exit a parse tree produced by the `if` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + exitIf?: (ctx: IfContext) => void; + + /** + * Enter a parse tree produced by the `while` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + enterWhile?: (ctx: WhileContext) => void; + /** + * Exit a parse tree produced by the `while` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + exitWhile?: (ctx: WhileContext) => void; + + /** + * Enter a parse tree produced by the `for` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + enterFor?: (ctx: ForContext) => void; + /** + * Exit a parse tree produced by the `for` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + exitFor?: (ctx: ForContext) => void; + + /** + * Enter a parse tree produced by the `each` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + enterEach?: (ctx: EachContext) => void; + /** + * Exit a parse tree produced by the `each` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + exitEach?: (ctx: EachContext) => void; + + /** + * Enter a parse tree produced by the `ineach` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + enterIneach?: (ctx: IneachContext) => void; + /** + * Exit a parse tree produced by the `ineach` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + exitIneach?: (ctx: IneachContext) => void; + + /** + * Enter a parse tree produced by the `try` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + enterTry?: (ctx: TryContext) => void; + /** + * Exit a parse tree produced by the `try` + * labeled alternative in `painless_parser.rstatement`. + * @param ctx the parse tree + */ + exitTry?: (ctx: TryContext) => void; + + /** + * Enter a parse tree produced by the `read` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + enterRead?: (ctx: ReadContext) => void; + /** + * Exit a parse tree produced by the `read` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + exitRead?: (ctx: ReadContext) => void; + + /** + * Enter a parse tree produced by the `post` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + enterPost?: (ctx: PostContext) => void; + /** + * Exit a parse tree produced by the `post` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + exitPost?: (ctx: PostContext) => void; + + /** + * Enter a parse tree produced by the `not` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + enterNot?: (ctx: NotContext) => void; + /** + * Exit a parse tree produced by the `not` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + exitNot?: (ctx: NotContext) => void; + + /** + * Enter a parse tree produced by the `cast` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + enterCast?: (ctx: CastContext) => void; + /** + * Exit a parse tree produced by the `cast` + * labeled alternative in `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + exitCast?: (ctx: CastContext) => void; + + /** + * Enter a parse tree produced by the `dynamic` + * labeled alternative in `painless_parser.chain`. + * @param ctx the parse tree + */ + enterDynamic?: (ctx: DynamicContext) => void; + /** + * Exit a parse tree produced by the `dynamic` + * labeled alternative in `painless_parser.chain`. + * @param ctx the parse tree + */ + exitDynamic?: (ctx: DynamicContext) => void; + + /** + * Enter a parse tree produced by the `newarray` + * labeled alternative in `painless_parser.chain`. + * @param ctx the parse tree + */ + enterNewarray?: (ctx: NewarrayContext) => void; + /** + * Exit a parse tree produced by the `newarray` + * labeled alternative in `painless_parser.chain`. + * @param ctx the parse tree + */ + exitNewarray?: (ctx: NewarrayContext) => void; + + /** + * Enter a parse tree produced by the `nonconditional` + * labeled alternative in `painless_parser.expression`. + * @param ctx the parse tree + */ + enterNonconditional?: (ctx: NonconditionalContext) => void; + /** + * Exit a parse tree produced by the `nonconditional` + * labeled alternative in `painless_parser.expression`. + * @param ctx the parse tree + */ + exitNonconditional?: (ctx: NonconditionalContext) => void; + + /** + * Enter a parse tree produced by the `conditional` + * labeled alternative in `painless_parser.expression`. + * @param ctx the parse tree + */ + enterConditional?: (ctx: ConditionalContext) => void; + /** + * Exit a parse tree produced by the `conditional` + * labeled alternative in `painless_parser.expression`. + * @param ctx the parse tree + */ + exitConditional?: (ctx: ConditionalContext) => void; + + /** + * Enter a parse tree produced by the `assignment` + * labeled alternative in `painless_parser.expression`. + * @param ctx the parse tree + */ + enterAssignment?: (ctx: AssignmentContext) => void; + /** + * Exit a parse tree produced by the `assignment` + * labeled alternative in `painless_parser.expression`. + * @param ctx the parse tree + */ + exitAssignment?: (ctx: AssignmentContext) => void; + + /** + * Enter a parse tree produced by the `do` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterDo?: (ctx: DoContext) => void; + /** + * Exit a parse tree produced by the `do` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitDo?: (ctx: DoContext) => void; + + /** + * Enter a parse tree produced by the `decl` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterDecl?: (ctx: DeclContext) => void; + /** + * Exit a parse tree produced by the `decl` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitDecl?: (ctx: DeclContext) => void; + + /** + * Enter a parse tree produced by the `continue` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterContinue?: (ctx: ContinueContext) => void; + /** + * Exit a parse tree produced by the `continue` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitContinue?: (ctx: ContinueContext) => void; + + /** + * Enter a parse tree produced by the `break` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterBreak?: (ctx: BreakContext) => void; + /** + * Exit a parse tree produced by the `break` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitBreak?: (ctx: BreakContext) => void; + + /** + * Enter a parse tree produced by the `return` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterReturn?: (ctx: ReturnContext) => void; + /** + * Exit a parse tree produced by the `return` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitReturn?: (ctx: ReturnContext) => void; + + /** + * Enter a parse tree produced by the `throw` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterThrow?: (ctx: ThrowContext) => void; + /** + * Exit a parse tree produced by the `throw` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitThrow?: (ctx: ThrowContext) => void; + + /** + * Enter a parse tree produced by the `expr` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterExpr?: (ctx: ExprContext) => void; + /** + * Exit a parse tree produced by the `expr` + * labeled alternative in `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitExpr?: (ctx: ExprContext) => void; + + /** + * Enter a parse tree produced by the `single` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + enterSingle?: (ctx: SingleContext) => void; + /** + * Exit a parse tree produced by the `single` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + exitSingle?: (ctx: SingleContext) => void; + + /** + * Enter a parse tree produced by the `binary` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + enterBinary?: (ctx: BinaryContext) => void; + /** + * Exit a parse tree produced by the `binary` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + exitBinary?: (ctx: BinaryContext) => void; + + /** + * Enter a parse tree produced by the `comp` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + enterComp?: (ctx: CompContext) => void; + /** + * Exit a parse tree produced by the `comp` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + exitComp?: (ctx: CompContext) => void; + + /** + * Enter a parse tree produced by the `instanceof` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + enterInstanceof?: (ctx: InstanceofContext) => void; + /** + * Exit a parse tree produced by the `instanceof` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + exitInstanceof?: (ctx: InstanceofContext) => void; + + /** + * Enter a parse tree produced by the `bool` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + enterBool?: (ctx: BoolContext) => void; + /** + * Exit a parse tree produced by the `bool` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + exitBool?: (ctx: BoolContext) => void; + + /** + * Enter a parse tree produced by the `elvis` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + enterElvis?: (ctx: ElvisContext) => void; + /** + * Exit a parse tree produced by the `elvis` + * labeled alternative in `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + exitElvis?: (ctx: ElvisContext) => void; + + /** + * Enter a parse tree produced by the `precedence` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterPrecedence?: (ctx: PrecedenceContext) => void; + /** + * Exit a parse tree produced by the `precedence` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitPrecedence?: (ctx: PrecedenceContext) => void; + + /** + * Enter a parse tree produced by the `numeric` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterNumeric?: (ctx: NumericContext) => void; + /** + * Exit a parse tree produced by the `numeric` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitNumeric?: (ctx: NumericContext) => void; + + /** + * Enter a parse tree produced by the `true` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterTrue?: (ctx: TrueContext) => void; + /** + * Exit a parse tree produced by the `true` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitTrue?: (ctx: TrueContext) => void; + + /** + * Enter a parse tree produced by the `false` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterFalse?: (ctx: FalseContext) => void; + /** + * Exit a parse tree produced by the `false` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitFalse?: (ctx: FalseContext) => void; + + /** + * Enter a parse tree produced by the `null` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterNull?: (ctx: NullContext) => void; + /** + * Exit a parse tree produced by the `null` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitNull?: (ctx: NullContext) => void; + + /** + * Enter a parse tree produced by the `string` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterString?: (ctx: StringContext) => void; + /** + * Exit a parse tree produced by the `string` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitString?: (ctx: StringContext) => void; + + /** + * Enter a parse tree produced by the `regex` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterRegex?: (ctx: RegexContext) => void; + /** + * Exit a parse tree produced by the `regex` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitRegex?: (ctx: RegexContext) => void; + + /** + * Enter a parse tree produced by the `listinit` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterListinit?: (ctx: ListinitContext) => void; + /** + * Exit a parse tree produced by the `listinit` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitListinit?: (ctx: ListinitContext) => void; + + /** + * Enter a parse tree produced by the `mapinit` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterMapinit?: (ctx: MapinitContext) => void; + /** + * Exit a parse tree produced by the `mapinit` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitMapinit?: (ctx: MapinitContext) => void; + + /** + * Enter a parse tree produced by the `variable` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterVariable?: (ctx: VariableContext) => void; + /** + * Exit a parse tree produced by the `variable` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitVariable?: (ctx: VariableContext) => void; + + /** + * Enter a parse tree produced by the `calllocal` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterCalllocal?: (ctx: CalllocalContext) => void; + /** + * Exit a parse tree produced by the `calllocal` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitCalllocal?: (ctx: CalllocalContext) => void; + + /** + * Enter a parse tree produced by the `newobject` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + enterNewobject?: (ctx: NewobjectContext) => void; + /** + * Exit a parse tree produced by the `newobject` + * labeled alternative in `painless_parser.primary`. + * @param ctx the parse tree + */ + exitNewobject?: (ctx: NewobjectContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.source`. + * @param ctx the parse tree + */ + enterSource?: (ctx: SourceContext) => void; + /** + * Exit a parse tree produced by `painless_parser.source`. + * @param ctx the parse tree + */ + exitSource?: (ctx: SourceContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.function`. + * @param ctx the parse tree + */ + enterFunction?: (ctx: FunctionContext) => void; + /** + * Exit a parse tree produced by `painless_parser.function`. + * @param ctx the parse tree + */ + exitFunction?: (ctx: FunctionContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.parameters`. + * @param ctx the parse tree + */ + enterParameters?: (ctx: ParametersContext) => void; + /** + * Exit a parse tree produced by `painless_parser.parameters`. + * @param ctx the parse tree + */ + exitParameters?: (ctx: ParametersContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.statement`. + * @param ctx the parse tree + */ + enterStatement?: (ctx: StatementContext) => void; + /** + * Exit a parse tree produced by `painless_parser.statement`. + * @param ctx the parse tree + */ + exitStatement?: (ctx: StatementContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.rstatement`. + * @param ctx the parse tree + */ + enterRstatement?: (ctx: RstatementContext) => void; + /** + * Exit a parse tree produced by `painless_parser.rstatement`. + * @param ctx the parse tree + */ + exitRstatement?: (ctx: RstatementContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.dstatement`. + * @param ctx the parse tree + */ + enterDstatement?: (ctx: DstatementContext) => void; + /** + * Exit a parse tree produced by `painless_parser.dstatement`. + * @param ctx the parse tree + */ + exitDstatement?: (ctx: DstatementContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.trailer`. + * @param ctx the parse tree + */ + enterTrailer?: (ctx: TrailerContext) => void; + /** + * Exit a parse tree produced by `painless_parser.trailer`. + * @param ctx the parse tree + */ + exitTrailer?: (ctx: TrailerContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.block`. + * @param ctx the parse tree + */ + enterBlock?: (ctx: BlockContext) => void; + /** + * Exit a parse tree produced by `painless_parser.block`. + * @param ctx the parse tree + */ + exitBlock?: (ctx: BlockContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.empty`. + * @param ctx the parse tree + */ + enterEmpty?: (ctx: EmptyContext) => void; + /** + * Exit a parse tree produced by `painless_parser.empty`. + * @param ctx the parse tree + */ + exitEmpty?: (ctx: EmptyContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.initializer`. + * @param ctx the parse tree + */ + enterInitializer?: (ctx: InitializerContext) => void; + /** + * Exit a parse tree produced by `painless_parser.initializer`. + * @param ctx the parse tree + */ + exitInitializer?: (ctx: InitializerContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.afterthought`. + * @param ctx the parse tree + */ + enterAfterthought?: (ctx: AfterthoughtContext) => void; + /** + * Exit a parse tree produced by `painless_parser.afterthought`. + * @param ctx the parse tree + */ + exitAfterthought?: (ctx: AfterthoughtContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.declaration`. + * @param ctx the parse tree + */ + enterDeclaration?: (ctx: DeclarationContext) => void; + /** + * Exit a parse tree produced by `painless_parser.declaration`. + * @param ctx the parse tree + */ + exitDeclaration?: (ctx: DeclarationContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.decltype`. + * @param ctx the parse tree + */ + enterDecltype?: (ctx: DecltypeContext) => void; + /** + * Exit a parse tree produced by `painless_parser.decltype`. + * @param ctx the parse tree + */ + exitDecltype?: (ctx: DecltypeContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.type`. + * @param ctx the parse tree + */ + enterType?: (ctx: TypeContext) => void; + /** + * Exit a parse tree produced by `painless_parser.type`. + * @param ctx the parse tree + */ + exitType?: (ctx: TypeContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.declvar`. + * @param ctx the parse tree + */ + enterDeclvar?: (ctx: DeclvarContext) => void; + /** + * Exit a parse tree produced by `painless_parser.declvar`. + * @param ctx the parse tree + */ + exitDeclvar?: (ctx: DeclvarContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.trap`. + * @param ctx the parse tree + */ + enterTrap?: (ctx: TrapContext) => void; + /** + * Exit a parse tree produced by `painless_parser.trap`. + * @param ctx the parse tree + */ + exitTrap?: (ctx: TrapContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + enterNoncondexpression?: (ctx: NoncondexpressionContext) => void; + /** + * Exit a parse tree produced by `painless_parser.noncondexpression`. + * @param ctx the parse tree + */ + exitNoncondexpression?: (ctx: NoncondexpressionContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.expression`. + * @param ctx the parse tree + */ + enterExpression?: (ctx: ExpressionContext) => void; + /** + * Exit a parse tree produced by `painless_parser.expression`. + * @param ctx the parse tree + */ + exitExpression?: (ctx: ExpressionContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.unary`. + * @param ctx the parse tree + */ + enterUnary?: (ctx: UnaryContext) => void; + /** + * Exit a parse tree produced by `painless_parser.unary`. + * @param ctx the parse tree + */ + exitUnary?: (ctx: UnaryContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + enterUnarynotaddsub?: (ctx: UnarynotaddsubContext) => void; + /** + * Exit a parse tree produced by `painless_parser.unarynotaddsub`. + * @param ctx the parse tree + */ + exitUnarynotaddsub?: (ctx: UnarynotaddsubContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.castexpression`. + * @param ctx the parse tree + */ + enterCastexpression?: (ctx: CastexpressionContext) => void; + /** + * Exit a parse tree produced by `painless_parser.castexpression`. + * @param ctx the parse tree + */ + exitCastexpression?: (ctx: CastexpressionContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.primordefcasttype`. + * @param ctx the parse tree + */ + enterPrimordefcasttype?: (ctx: PrimordefcasttypeContext) => void; + /** + * Exit a parse tree produced by `painless_parser.primordefcasttype`. + * @param ctx the parse tree + */ + exitPrimordefcasttype?: (ctx: PrimordefcasttypeContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.refcasttype`. + * @param ctx the parse tree + */ + enterRefcasttype?: (ctx: RefcasttypeContext) => void; + /** + * Exit a parse tree produced by `painless_parser.refcasttype`. + * @param ctx the parse tree + */ + exitRefcasttype?: (ctx: RefcasttypeContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.chain`. + * @param ctx the parse tree + */ + enterChain?: (ctx: ChainContext) => void; + /** + * Exit a parse tree produced by `painless_parser.chain`. + * @param ctx the parse tree + */ + exitChain?: (ctx: ChainContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.primary`. + * @param ctx the parse tree + */ + enterPrimary?: (ctx: PrimaryContext) => void; + /** + * Exit a parse tree produced by `painless_parser.primary`. + * @param ctx the parse tree + */ + exitPrimary?: (ctx: PrimaryContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.postfix`. + * @param ctx the parse tree + */ + enterPostfix?: (ctx: PostfixContext) => void; + /** + * Exit a parse tree produced by `painless_parser.postfix`. + * @param ctx the parse tree + */ + exitPostfix?: (ctx: PostfixContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.postdot`. + * @param ctx the parse tree + */ + enterPostdot?: (ctx: PostdotContext) => void; + /** + * Exit a parse tree produced by `painless_parser.postdot`. + * @param ctx the parse tree + */ + exitPostdot?: (ctx: PostdotContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.callinvoke`. + * @param ctx the parse tree + */ + enterCallinvoke?: (ctx: CallinvokeContext) => void; + /** + * Exit a parse tree produced by `painless_parser.callinvoke`. + * @param ctx the parse tree + */ + exitCallinvoke?: (ctx: CallinvokeContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.fieldaccess`. + * @param ctx the parse tree + */ + enterFieldaccess?: (ctx: FieldaccessContext) => void; + /** + * Exit a parse tree produced by `painless_parser.fieldaccess`. + * @param ctx the parse tree + */ + exitFieldaccess?: (ctx: FieldaccessContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.braceaccess`. + * @param ctx the parse tree + */ + enterBraceaccess?: (ctx: BraceaccessContext) => void; + /** + * Exit a parse tree produced by `painless_parser.braceaccess`. + * @param ctx the parse tree + */ + exitBraceaccess?: (ctx: BraceaccessContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.arrayinitializer`. + * @param ctx the parse tree + */ + enterArrayinitializer?: (ctx: ArrayinitializerContext) => void; + /** + * Exit a parse tree produced by `painless_parser.arrayinitializer`. + * @param ctx the parse tree + */ + exitArrayinitializer?: (ctx: ArrayinitializerContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.listinitializer`. + * @param ctx the parse tree + */ + enterListinitializer?: (ctx: ListinitializerContext) => void; + /** + * Exit a parse tree produced by `painless_parser.listinitializer`. + * @param ctx the parse tree + */ + exitListinitializer?: (ctx: ListinitializerContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.mapinitializer`. + * @param ctx the parse tree + */ + enterMapinitializer?: (ctx: MapinitializerContext) => void; + /** + * Exit a parse tree produced by `painless_parser.mapinitializer`. + * @param ctx the parse tree + */ + exitMapinitializer?: (ctx: MapinitializerContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.maptoken`. + * @param ctx the parse tree + */ + enterMaptoken?: (ctx: MaptokenContext) => void; + /** + * Exit a parse tree produced by `painless_parser.maptoken`. + * @param ctx the parse tree + */ + exitMaptoken?: (ctx: MaptokenContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.arguments`. + * @param ctx the parse tree + */ + enterArguments?: (ctx: ArgumentsContext) => void; + /** + * Exit a parse tree produced by `painless_parser.arguments`. + * @param ctx the parse tree + */ + exitArguments?: (ctx: ArgumentsContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.argument`. + * @param ctx the parse tree + */ + enterArgument?: (ctx: ArgumentContext) => void; + /** + * Exit a parse tree produced by `painless_parser.argument`. + * @param ctx the parse tree + */ + exitArgument?: (ctx: ArgumentContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.lambda`. + * @param ctx the parse tree + */ + enterLambda?: (ctx: LambdaContext) => void; + /** + * Exit a parse tree produced by `painless_parser.lambda`. + * @param ctx the parse tree + */ + exitLambda?: (ctx: LambdaContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.lamtype`. + * @param ctx the parse tree + */ + enterLamtype?: (ctx: LamtypeContext) => void; + /** + * Exit a parse tree produced by `painless_parser.lamtype`. + * @param ctx the parse tree + */ + exitLamtype?: (ctx: LamtypeContext) => void; + + /** + * Enter a parse tree produced by `painless_parser.funcref`. + * @param ctx the parse tree + */ + enterFuncref?: (ctx: FuncrefContext) => void; + /** + * Exit a parse tree produced by `painless_parser.funcref`. + * @param ctx the parse tree + */ + exitFuncref?: (ctx: FuncrefContext) => void; +} + diff --git a/packages/kbn-monaco/src/painless/completion_adapter.ts b/packages/kbn-monaco/src/painless/completion_adapter.ts index b07018e71b61d..1eb91c6c386b9 100644 --- a/packages/kbn-monaco/src/painless/completion_adapter.ts +++ b/packages/kbn-monaco/src/painless/completion_adapter.ts @@ -18,7 +18,7 @@ */ import { monaco } from '../monaco_imports'; -import { EditorStateService } from './services'; +import { EditorStateService } from './lib'; import { PainlessCompletionResult, PainlessCompletionKind } from './types'; import { PainlessWorker } from './worker'; diff --git a/packages/kbn-monaco/src/painless/diagnostics_adapter.ts b/packages/kbn-monaco/src/painless/diagnostics_adapter.ts new file mode 100644 index 0000000000000..95c4ec19cea1f --- /dev/null +++ b/packages/kbn-monaco/src/painless/diagnostics_adapter.ts @@ -0,0 +1,56 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { monaco } from '../monaco_imports'; +import { ID } from './constants'; +import { WorkerAccessor } from './language'; +import { PainlessError } from './worker'; + +const toDiagnostics = (error: PainlessError): monaco.editor.IMarkerData => { + return { + ...error, + severity: monaco.MarkerSeverity.Error, + }; +}; + +export class DiagnosticsAdapter { + constructor(private worker: WorkerAccessor) { + const onModelAdd = (model: monaco.editor.IModel): void => { + let handle: any; + model.onDidChangeContent(() => { + // Every time a new change is made, wait 500ms before validating + clearTimeout(handle); + handle = setTimeout(() => this.validate(model.uri), 500); + }); + + this.validate(model.uri); + }; + monaco.editor.onDidCreateModel(onModelAdd); + monaco.editor.getModels().forEach(onModelAdd); + } + + private async validate(resource: monaco.Uri): Promise { + const worker = await this.worker(resource); + const errorMarkers = await worker.getSyntaxErrors(); + + const model = monaco.editor.getModel(resource); + + // Set the error markers and underline them with "Error" severity + monaco.editor.setModelMarkers(model!, ID, errorMarkers.map(toDiagnostics)); + } +} diff --git a/packages/kbn-monaco/src/painless/index.ts b/packages/kbn-monaco/src/painless/index.ts index 3c81f265f9b0d..10c82d2ae6695 100644 --- a/packages/kbn-monaco/src/painless/index.ts +++ b/packages/kbn-monaco/src/painless/index.ts @@ -18,9 +18,9 @@ */ import { ID } from './constants'; -import { lexerRules } from './lexer_rules'; +import { lexerRules, languageConfiguration } from './lexer_rules'; import { getSuggestionProvider } from './language'; -export const PainlessLang = { ID, getSuggestionProvider, lexerRules }; +export const PainlessLang = { ID, getSuggestionProvider, lexerRules, languageConfiguration }; -export { PainlessContext } from './types'; +export { PainlessContext, PainlessAutocompleteField } from './types'; diff --git a/packages/kbn-monaco/src/painless/language.ts b/packages/kbn-monaco/src/painless/language.ts index f64094dbb482e..01212f80b00dc 100644 --- a/packages/kbn-monaco/src/painless/language.ts +++ b/packages/kbn-monaco/src/painless/language.ts @@ -19,27 +19,33 @@ import { monaco } from '../monaco_imports'; -import { WorkerProxyService, EditorStateService } from './services'; +import { WorkerProxyService, EditorStateService } from './lib'; import { ID } from './constants'; -import { PainlessContext, Field } from './types'; +import { PainlessContext, PainlessAutocompleteField } from './types'; import { PainlessWorker } from './worker'; import { PainlessCompletionAdapter } from './completion_adapter'; +import { DiagnosticsAdapter } from './diagnostics_adapter'; const workerProxyService = new WorkerProxyService(); const editorStateService = new EditorStateService(); -type WorkerAccessor = (...uris: monaco.Uri[]) => Promise; +export type WorkerAccessor = (...uris: monaco.Uri[]) => Promise; const worker: WorkerAccessor = (...uris: monaco.Uri[]): Promise => { return workerProxyService.getWorker(uris); }; -monaco.languages.onLanguage(ID, async () => { - workerProxyService.setup(); -}); - -export const getSuggestionProvider = (context: PainlessContext, fields?: Field[]) => { +export const getSuggestionProvider = ( + context: PainlessContext, + fields?: PainlessAutocompleteField[] +) => { editorStateService.setup(context, fields); return new PainlessCompletionAdapter(worker, editorStateService); }; + +monaco.languages.onLanguage(ID, async () => { + workerProxyService.setup(); + + new DiagnosticsAdapter(worker); +}); diff --git a/packages/kbn-monaco/src/painless/lexer_rules/index.ts b/packages/kbn-monaco/src/painless/lexer_rules/index.ts index 7cf9064c6aa51..718231b4fe0cd 100644 --- a/packages/kbn-monaco/src/painless/lexer_rules/index.ts +++ b/packages/kbn-monaco/src/painless/lexer_rules/index.ts @@ -17,4 +17,4 @@ * under the License. */ -export { lexerRules } from './painless'; +export { lexerRules, languageConfiguration } from './painless'; diff --git a/packages/kbn-monaco/src/painless/lexer_rules/painless.ts b/packages/kbn-monaco/src/painless/lexer_rules/painless.ts index 2f4383911c9ad..580c6f9499569 100644 --- a/packages/kbn-monaco/src/painless/lexer_rules/painless.ts +++ b/packages/kbn-monaco/src/painless/lexer_rules/painless.ts @@ -180,3 +180,17 @@ export const lexerRules = { ], }, } as Language; + +export const languageConfiguration: monaco.languages.LanguageConfiguration = { + brackets: [ + ['{', '}'], + ['[', ']'], + ['(', ')'], + ], + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' }, + ], +}; diff --git a/packages/kbn-monaco/src/painless/services/editor_state.ts b/packages/kbn-monaco/src/painless/lib/editor_state.ts similarity index 82% rename from packages/kbn-monaco/src/painless/services/editor_state.ts rename to packages/kbn-monaco/src/painless/lib/editor_state.ts index b54744152e34d..3003f266dca62 100644 --- a/packages/kbn-monaco/src/painless/services/editor_state.ts +++ b/packages/kbn-monaco/src/painless/lib/editor_state.ts @@ -17,16 +17,16 @@ * under the License. */ -import { PainlessContext, Field } from '../types'; +import { PainlessContext, PainlessAutocompleteField } from '../types'; export interface EditorState { context: PainlessContext; - fields?: Field[]; + fields?: PainlessAutocompleteField[]; } export class EditorStateService { context: PainlessContext = 'painless_test'; - fields: Field[] = []; + fields: PainlessAutocompleteField[] = []; public getState(): EditorState { return { @@ -35,7 +35,7 @@ export class EditorStateService { }; } - public setup(context: PainlessContext, fields?: Field[]) { + public setup(context: PainlessContext, fields?: PainlessAutocompleteField[]) { this.context = context; if (fields) { diff --git a/packages/kbn-monaco/src/painless/services/index.ts b/packages/kbn-monaco/src/painless/lib/index.ts similarity index 100% rename from packages/kbn-monaco/src/painless/services/index.ts rename to packages/kbn-monaco/src/painless/lib/index.ts diff --git a/packages/kbn-monaco/src/painless/services/worker_proxy.ts b/packages/kbn-monaco/src/painless/lib/worker_proxy.ts similarity index 100% rename from packages/kbn-monaco/src/painless/services/worker_proxy.ts rename to packages/kbn-monaco/src/painless/lib/worker_proxy.ts diff --git a/packages/kbn-monaco/src/painless/types.ts b/packages/kbn-monaco/src/painless/types.ts index 8afc3dc7ddd88..a56ca4f9b695a 100644 --- a/packages/kbn-monaco/src/painless/types.ts +++ b/packages/kbn-monaco/src/painless/types.ts @@ -51,7 +51,7 @@ export interface PainlessCompletionResult { suggestions: PainlessCompletionItem[]; } -export interface Field { +export interface PainlessAutocompleteField { name: string; type: string; } diff --git a/packages/kbn-monaco/src/painless/worker/index.ts b/packages/kbn-monaco/src/painless/worker/index.ts index 2f55271ab9958..3250a41759e09 100644 --- a/packages/kbn-monaco/src/painless/worker/index.ts +++ b/packages/kbn-monaco/src/painless/worker/index.ts @@ -18,3 +18,5 @@ */ export { PainlessWorker } from './painless_worker'; + +export { PainlessError } from './lib'; diff --git a/packages/kbn-monaco/src/painless/worker/lib/autocomplete.test.ts b/packages/kbn-monaco/src/painless/worker/lib/autocomplete.test.ts index 8cc5d21d9d7e0..4a975596affba 100644 --- a/packages/kbn-monaco/src/painless/worker/lib/autocomplete.test.ts +++ b/packages/kbn-monaco/src/painless/worker/lib/autocomplete.test.ts @@ -18,7 +18,6 @@ */ import { PainlessCompletionItem } from '../../types'; -import { lexerRules } from '../../lexer_rules'; import { getStaticSuggestions, @@ -26,17 +25,11 @@ import { getClassMemberSuggestions, getPrimitives, getConstructorSuggestions, + getKeywords, Suggestion, } from './autocomplete'; -const keywords: PainlessCompletionItem[] = lexerRules.keywords.map((keyword) => { - return { - label: keyword, - kind: 'keyword', - documentation: 'Keyword: char', - insertText: keyword, - }; -}); +const keywords: PainlessCompletionItem[] = getKeywords(); const testSuggestions: Suggestion[] = [ { @@ -101,7 +94,7 @@ const testSuggestions: Suggestion[] = [ describe('Autocomplete lib', () => { describe('Static suggestions', () => { test('returns static suggestions', () => { - expect(getStaticSuggestions(testSuggestions, false)).toEqual({ + expect(getStaticSuggestions({ suggestions: testSuggestions })).toEqual({ isIncomplete: false, suggestions: [ { @@ -134,12 +127,26 @@ describe('Autocomplete lib', () => { }); test('returns doc keyword when fields exist', () => { - const autocompletion = getStaticSuggestions(testSuggestions, true); + const autocompletion = getStaticSuggestions({ + suggestions: testSuggestions, + hasFields: true, + }); const docSuggestion = autocompletion.suggestions.find( (suggestion) => suggestion.label === 'doc' ); expect(Boolean(docSuggestion)).toBe(true); }); + + test('returns emit keyword for runtime fields', () => { + const autocompletion = getStaticSuggestions({ + suggestions: testSuggestions, + isRuntimeContext: true, + }); + const emitSuggestion = autocompletion.suggestions.find( + (suggestion) => suggestion.label === 'emit' + ); + expect(Boolean(emitSuggestion)).toBe(true); + }); }); describe('getPrimitives()', () => { diff --git a/packages/kbn-monaco/src/painless/worker/lib/autocomplete.ts b/packages/kbn-monaco/src/painless/worker/lib/autocomplete.ts index 5536da828be42..9bdaa298fb1c9 100644 --- a/packages/kbn-monaco/src/painless/worker/lib/autocomplete.ts +++ b/packages/kbn-monaco/src/painless/worker/lib/autocomplete.ts @@ -23,7 +23,7 @@ import { PainlessCompletionResult, PainlessCompletionItem, PainlessContext, - Field, + PainlessAutocompleteField, } from '../../types'; import { @@ -53,14 +53,42 @@ export interface Suggestion extends PainlessCompletionItem { constructorDefinition?: PainlessCompletionItem; } -const keywords: PainlessCompletionItem[] = lexerRules.keywords.map((keyword) => { - return { - label: keyword, - kind: 'keyword', - documentation: 'Keyword: char', - insertText: keyword, - }; -}); +export const getKeywords = (): PainlessCompletionItem[] => { + const lexerKeywords: PainlessCompletionItem[] = lexerRules.keywords.map((keyword) => { + return { + label: keyword, + kind: 'keyword', + documentation: `Keyword: ${keyword}`, + insertText: keyword, + }; + }); + + const allKeywords: PainlessCompletionItem[] = [ + ...lexerKeywords, + { + label: 'params', + kind: 'keyword', + documentation: i18n.translate( + 'monaco.painlessLanguage.autocomplete.paramsKeywordDescription', + { + defaultMessage: 'Access variables passed into the script.', + } + ), + insertText: 'params', + }, + ]; + + return allKeywords; +}; + +const runtimeContexts: PainlessContext[] = [ + 'boolean_script_field_script_field', + 'date_script_field', + 'double_script_field_script_field', + 'ip_script_field_script_field', + 'long_script_field_script_field', + 'string_script_field_script_field', +]; const mapContextToData: { [key: string]: { suggestions: any[] } } = { painless_test: painlessTestContext, @@ -75,16 +103,23 @@ const mapContextToData: { [key: string]: { suggestions: any[] } } = { string_script_field_script_field: stringScriptFieldScriptFieldContext, }; -export const getStaticSuggestions = ( - suggestions: Suggestion[], - hasFields: boolean -): PainlessCompletionResult => { +export const getStaticSuggestions = ({ + suggestions, + hasFields, + isRuntimeContext, +}: { + suggestions: Suggestion[]; + hasFields?: boolean; + isRuntimeContext?: boolean; +}): PainlessCompletionResult => { const classSuggestions: PainlessCompletionItem[] = suggestions.map((suggestion) => { const { properties, constructorDefinition, ...rootSuggestion } = suggestion; return rootSuggestion; }); - const keywordSuggestions: PainlessCompletionItem[] = hasFields + const keywords = getKeywords(); + + let keywordSuggestions: PainlessCompletionItem[] = hasFields ? [ ...keywords, { @@ -102,6 +137,23 @@ export const getStaticSuggestions = ( ] : keywords; + keywordSuggestions = isRuntimeContext + ? [ + ...keywordSuggestions, + { + label: 'emit', + kind: 'keyword', + documentation: i18n.translate( + 'monaco.painlessLanguage.autocomplete.emitKeywordDescription', + { + defaultMessage: 'Emit value without returning.', + } + ), + insertText: 'emit', + }, + ] + : keywordSuggestions; + return { isIncomplete: false, suggestions: [...classSuggestions, ...keywordSuggestions], @@ -124,7 +176,9 @@ export const getClassMemberSuggestions = ( }; }; -export const getFieldSuggestions = (fields: Field[]): PainlessCompletionResult => { +export const getFieldSuggestions = ( + fields: PainlessAutocompleteField[] +): PainlessCompletionResult => { const suggestions: PainlessCompletionItem[] = fields.map(({ name }) => { return { label: name, @@ -168,12 +222,18 @@ export const getConstructorSuggestions = (suggestions: Suggestion[]): PainlessCo export const getAutocompleteSuggestions = ( painlessContext: PainlessContext, words: string[], - fields?: Field[] + fields?: PainlessAutocompleteField[] ): PainlessCompletionResult => { const suggestions = mapContextToData[painlessContext].suggestions; // What the user is currently typing const activeTyping = words[words.length - 1]; const primitives = getPrimitives(suggestions); + // This logic may end up needing to be more robust as we integrate autocomplete into more editors + // For now, we're assuming there is a list of painless contexts that are only applicable in runtime fields + const isRuntimeContext = runtimeContexts.includes(painlessContext); + // "text" field types are not available in doc values and should be removed for autocompletion + const filteredFields = fields?.filter((field) => field.type !== 'text'); + const hasFields = Boolean(filteredFields?.length); let autocompleteSuggestions: PainlessCompletionResult = { isIncomplete: false, @@ -182,13 +242,13 @@ export const getAutocompleteSuggestions = ( if (isConstructorInstance(words)) { autocompleteSuggestions = getConstructorSuggestions(suggestions); - } else if (fields && isDeclaringField(activeTyping)) { - autocompleteSuggestions = getFieldSuggestions(fields); + } else if (filteredFields && isDeclaringField(activeTyping)) { + autocompleteSuggestions = getFieldSuggestions(filteredFields); } else if (isAccessingProperty(activeTyping)) { const className = activeTyping.substring(0, activeTyping.length - 1).split('.')[0]; autocompleteSuggestions = getClassMemberSuggestions(suggestions, className); } else if (showStaticSuggestions(activeTyping, words, primitives)) { - autocompleteSuggestions = getStaticSuggestions(suggestions, Boolean(fields?.length)); + autocompleteSuggestions = getStaticSuggestions({ suggestions, hasFields, isRuntimeContext }); } return autocompleteSuggestions; }; diff --git a/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.test.ts b/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.test.ts index d9420719f6923..802fd0073963a 100644 --- a/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.test.ts +++ b/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.test.ts @@ -23,6 +23,8 @@ import { hasDeclaredType, isAccessingProperty, showStaticSuggestions, + isDefiningString, + isDefiningBoolean, } from './autocomplete_utils'; const primitives = ['boolean', 'int', 'char', 'float', 'double']; @@ -62,6 +64,24 @@ describe('Utils', () => { }); }); + describe('isDefiningBoolean()', () => { + test('returns true or false depending if an array contains a boolean type and "=" token at a specific index', () => { + expect(isDefiningBoolean(['boolean', 'myBoolean', '=', 't'])).toEqual(true); + expect(isDefiningBoolean(['double', 'myBoolean', '=', 't'])).toEqual(false); + expect(isDefiningBoolean(['boolean', '='])).toEqual(false); + }); + }); + + describe('isDefiningString()', () => { + test('returns true or false depending if active typing contains a single or double quotation mark', () => { + expect(isDefiningString(`'mystring'`)).toEqual(true); + expect(isDefiningString(`"mystring"`)).toEqual(true); + expect(isDefiningString(`'`)).toEqual(true); + expect(isDefiningString(`"`)).toEqual(true); + expect(isDefiningString('mystring')).toEqual(false); + }); + }); + describe('showStaticSuggestions()', () => { test('returns true or false depending if a type is declared or the string contains a "."', () => { expect(showStaticSuggestions('a', ['a'], primitives)).toEqual(true); diff --git a/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.ts b/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.ts index 7c53d2f8167bd..97a05daf37842 100644 --- a/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.ts +++ b/packages/kbn-monaco/src/painless/worker/lib/autocomplete_utils.ts @@ -36,11 +36,39 @@ export const isAccessingProperty = (activeTyping: string): boolean => { /** * If the preceding word is a primitive type, e.g., "boolean", * we assume the user is declaring a variable and will skip autocomplete + * + * Note: this isn't entirely exhaustive. For example, "def myVar =" is not included in context + * It's also acceptable to use a class as a type, e.g., "String myVar =" */ export const hasDeclaredType = (activeLineWords: string[], primitives: string[]): boolean => { return activeLineWords.length === 2 && primitives.includes(activeLineWords[0]); }; +/** + * If the active line words contains the "boolean" type and "=" token, + * we assume the user is defining a boolean value and skip autocomplete + */ +export const isDefiningBoolean = (activeLineWords: string[]): boolean => { + if (activeLineWords.length === 4) { + const maybePrimitiveType = activeLineWords[0]; + const maybeEqualToken = activeLineWords[2]; + return maybePrimitiveType === 'boolean' && maybeEqualToken === '='; + } + return false; +}; + +/** + * If the active typing contains a start or end quotation mark, + * we assume the user is defining a string and skip autocomplete + */ +export const isDefiningString = (activeTyping: string): boolean => { + const quoteTokens = [`'`, `"`]; + const activeTypingParts = activeTyping.split(''); + const startCharacter = activeTypingParts[0]; + const endCharacter = activeTypingParts[activeTypingParts.length - 1]; + return quoteTokens.includes(startCharacter) || quoteTokens.includes(endCharacter); +}; + /** * Check if the preceding word contains the "new" keyword */ @@ -62,8 +90,10 @@ export const isDeclaringField = (activeTyping: string): boolean => { /** * Static suggestions serve as a catch-all most of the time * However, there are a few situations where we do not want to show them and instead default to the built-in monaco (abc) autocomplete - * 1. If the preceding word is a type, e.g., "boolean", we assume the user is declaring a variable name + * 1. If the preceding word is a primitive type, e.g., "boolean", we assume the user is declaring a variable name * 2. If the string contains a "dot" character, we assume the user is attempting to access a property that we do not have information for + * 3. If the user is defining a variable with a boolean type, e.g., "boolean myBoolean =" + * 4. If the user is defining a string */ export const showStaticSuggestions = ( activeTyping: string, @@ -72,5 +102,10 @@ export const showStaticSuggestions = ( ): boolean => { const activeTypingParts = activeTyping.split('.'); - return hasDeclaredType(activeLineWords, primitives) === false && activeTypingParts.length === 1; + return ( + hasDeclaredType(activeLineWords, primitives) === false && + isDefiningBoolean(activeLineWords) === false && + isDefiningString(activeTyping) === false && + activeTypingParts.length === 1 + ); }; diff --git a/packages/kbn-monaco/src/painless/worker/lib/error_listener.ts b/packages/kbn-monaco/src/painless/worker/lib/error_listener.ts new file mode 100644 index 0000000000000..96a19b4547ee0 --- /dev/null +++ b/packages/kbn-monaco/src/painless/worker/lib/error_listener.ts @@ -0,0 +1,59 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ANTLRErrorListener, RecognitionException, Recognizer } from 'antlr4ts'; + +export interface PainlessError { + startLineNumber: number; + startColumn: number; + endLineNumber: number; + endColumn: number; + message: string; +} + +export class PainlessErrorListener implements ANTLRErrorListener { + private errors: PainlessError[] = []; + + syntaxError( + recognizer: Recognizer, + offendingSymbol: any, + line: number, + column: number, + message: string, + e: RecognitionException | undefined + ): void { + let endColumn = column + 1; + + if (offendingSymbol?._text) { + endColumn = column + offendingSymbol._text.length; + } + + this.errors.push({ + startLineNumber: line, + endLineNumber: line, + startColumn: column, + endColumn, + message, + }); + } + + getErrors(): PainlessError[] { + return this.errors; + } +} diff --git a/packages/kbn-monaco/src/painless/worker/lib/index.ts b/packages/kbn-monaco/src/painless/worker/lib/index.ts index b2d4fc1f4faf4..1a89cbecb67b5 100644 --- a/packages/kbn-monaco/src/painless/worker/lib/index.ts +++ b/packages/kbn-monaco/src/painless/worker/lib/index.ts @@ -18,3 +18,7 @@ */ export { getAutocompleteSuggestions } from './autocomplete'; + +export { PainlessError } from './error_listener'; + +export { parseAndGetSyntaxErrors } from './parser'; diff --git a/packages/kbn-monaco/src/painless/worker/lib/lexer.ts b/packages/kbn-monaco/src/painless/worker/lib/lexer.ts new file mode 100644 index 0000000000000..343e3b3b06864 --- /dev/null +++ b/packages/kbn-monaco/src/painless/worker/lib/lexer.ts @@ -0,0 +1,56 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { CharStream } from 'antlr4ts'; +import { painless_lexer as PainlessLexer } from '../../antlr/painless_lexer'; + +/* + * This extends the PainlessLexer class in order to handle backslashes appropriately + * It is being invoked in painless_lexer.g4 + * Based on the Java implementation: https://github.com/elastic/elasticsearch/blob/feab123ba400b150f3dcd04dd27cf57474b70d5a/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/EnhancedPainlessLexer.java#L73 + */ +export class PainlessLexerEnhanced extends PainlessLexer { + constructor(input: CharStream) { + super(input); + } + + isSlashRegex(): boolean { + const lastToken = super.nextToken(); + + if (lastToken == null) { + return true; + } + + // @ts-ignore + switch (lastToken._type) { + case PainlessLexer.RBRACE: + case PainlessLexer.RP: + case PainlessLexer.OCTAL: + case PainlessLexer.HEX: + case PainlessLexer.INTEGER: + case PainlessLexer.DECIMAL: + case PainlessLexer.ID: + case PainlessLexer.DOTINTEGER: + case PainlessLexer.DOTID: + return false; + default: + return true; + } + } +} diff --git a/packages/kbn-monaco/src/painless/worker/lib/parser.ts b/packages/kbn-monaco/src/painless/worker/lib/parser.ts new file mode 100644 index 0000000000000..7cf5b730a81e6 --- /dev/null +++ b/packages/kbn-monaco/src/painless/worker/lib/parser.ts @@ -0,0 +1,54 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { CommonTokenStream, CharStreams } from 'antlr4ts'; +import { painless_parser as PainlessParser, SourceContext } from '../../antlr/painless_parser'; +import { PainlessError, PainlessErrorListener } from './error_listener'; +import { PainlessLexerEnhanced } from './lexer'; + +const parse = ( + code: string +): { + source: SourceContext; + errors: PainlessError[]; +} => { + const inputStream = CharStreams.fromString(code); + const lexer = new PainlessLexerEnhanced(inputStream); + const painlessLangErrorListener = new PainlessErrorListener(); + const tokenStream = new CommonTokenStream(lexer); + const parser = new PainlessParser(tokenStream); + + lexer.removeErrorListeners(); + parser.removeErrorListeners(); + + lexer.addErrorListener(painlessLangErrorListener); + parser.addErrorListener(painlessLangErrorListener); + + const errors: PainlessError[] = painlessLangErrorListener.getErrors(); + + return { + source: parser.source(), + errors, + }; +}; + +export const parseAndGetSyntaxErrors = (code: string): PainlessError[] => { + const { errors } = parse(code); + return errors; +}; diff --git a/packages/kbn-monaco/src/painless/worker/painless.worker.ts b/packages/kbn-monaco/src/painless/worker/painless.worker.ts index de40fda360d76..b220cb86a8425 100644 --- a/packages/kbn-monaco/src/painless/worker/painless.worker.ts +++ b/packages/kbn-monaco/src/painless/worker/painless.worker.ts @@ -23,10 +23,11 @@ import 'regenerator-runtime/runtime'; // @ts-ignore import * as worker from 'monaco-editor/esm/vs/editor/editor.worker'; +import { monaco } from '../../monaco_imports'; import { PainlessWorker } from './painless_worker'; self.onmessage = () => { - worker.initialize((ctx: any, createData: any) => { - return new PainlessWorker(); + worker.initialize((ctx: monaco.worker.IWorkerContext, createData: any) => { + return new PainlessWorker(ctx); }); }; diff --git a/packages/kbn-monaco/src/painless/worker/painless_worker.ts b/packages/kbn-monaco/src/painless/worker/painless_worker.ts index 357d81354ac43..ce4ba024a4caa 100644 --- a/packages/kbn-monaco/src/painless/worker/painless_worker.ts +++ b/packages/kbn-monaco/src/painless/worker/painless_worker.ts @@ -17,15 +17,31 @@ * under the License. */ -import { PainlessCompletionResult, PainlessContext, Field } from '../types'; - -import { getAutocompleteSuggestions } from './lib'; +import { monaco } from '../../monaco_imports'; +import { PainlessCompletionResult, PainlessContext, PainlessAutocompleteField } from '../types'; +import { getAutocompleteSuggestions, parseAndGetSyntaxErrors } from './lib'; export class PainlessWorker { + private _ctx: monaco.worker.IWorkerContext; + + constructor(ctx: monaco.worker.IWorkerContext) { + this._ctx = ctx; + } + + private getTextDocument(): string { + const model = this._ctx.getMirrorModels()[0]; + return model.getValue(); + } + + public async getSyntaxErrors() { + const code = this.getTextDocument(); + return parseAndGetSyntaxErrors(code); + } + public provideAutocompleteSuggestions( currentLineChars: string, context: PainlessContext, - fields?: Field[] + fields?: PainlessAutocompleteField[] ): PainlessCompletionResult { // Array of the active line words, e.g., [boolean, isTrue, =, true] const words = currentLineChars.replace('\t', '').split(' '); diff --git a/packages/kbn-monaco/src/register_globals.ts b/packages/kbn-monaco/src/register_globals.ts index 630467dd81711..db97b69c013af 100644 --- a/packages/kbn-monaco/src/register_globals.ts +++ b/packages/kbn-monaco/src/register_globals.ts @@ -36,6 +36,7 @@ monaco.languages.setMonarchTokensProvider(XJsonLang.ID, XJsonLang.lexerRules); monaco.languages.setLanguageConfiguration(XJsonLang.ID, XJsonLang.languageConfiguration); monaco.languages.register({ id: PainlessLang.ID }); monaco.languages.setMonarchTokensProvider(PainlessLang.ID, PainlessLang.lexerRules); +monaco.languages.setLanguageConfiguration(PainlessLang.ID, PainlessLang.languageConfiguration); monaco.languages.register({ id: EsqlLang.ID }); monaco.languages.setMonarchTokensProvider(EsqlLang.ID, EsqlLang.lexerRules); diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 15df6b34e22ff..3afd4a5cb98e8 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -133,6 +133,12 @@ export class DocLinksService { dashboardSettings: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/advanced-options.html#kibana-dashboard-settings`, visualizationSettings: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/advanced-options.html#kibana-visualization-settings`, }, + ml: { + guide: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/index.html`, + anomalyDetection: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/xpack-ml.html`, + anomalyDetectionJobs: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-jobs.html`, + dataFrameAnalytics: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics.html`, + }, visualize: { guide: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/visualize.html`, timelionDeprecation: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/dashboard.html#timelion-deprecation`, @@ -242,6 +248,12 @@ export interface DocLinksStart { readonly dateMath: string; }; readonly management: Record; + readonly ml: { + readonly guide: string; + readonly anomalyDetection: string; + readonly anomalyDetectionJobs: string; + readonly dataFrameAnalytics: string; + }; readonly visualize: Record; }; } diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 51fc65441b3b5..3c4608773b783 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -568,6 +568,12 @@ export interface DocLinksStart { readonly dateMath: string; }; readonly management: Record; + readonly ml: { + readonly guide: string; + readonly anomalyDetection: string; + readonly anomalyDetectionJobs: string; + readonly dataFrameAnalytics: string; + }; readonly visualize: Record; }; } diff --git a/src/core/server/elasticsearch/client/errors.ts b/src/core/server/elasticsearch/client/errors.ts index 31a27170e1155..ffbb21f530f2c 100644 --- a/src/core/server/elasticsearch/client/errors.ts +++ b/src/core/server/elasticsearch/client/errors.ts @@ -23,10 +23,10 @@ export type UnauthorizedError = ResponseError & { statusCode: 401; }; -export function isResponseError(error: any): error is ResponseError { - return Boolean(error.body && error.statusCode && error.headers); +export function isResponseError(error: unknown): error is ResponseError { + return error instanceof ResponseError; } -export function isUnauthorizedError(error: any): error is UnauthorizedError { +export function isUnauthorizedError(error: unknown): error is UnauthorizedError { return isResponseError(error) && error.statusCode === 401; } diff --git a/src/core/server/http/base_path_proxy_server.ts b/src/core/server/http/base_path_proxy_server.ts index 737aab00cff0e..d461abe54ccbd 100644 --- a/src/core/server/http/base_path_proxy_server.ts +++ b/src/core/server/http/base_path_proxy_server.ts @@ -52,6 +52,14 @@ export class BasePathProxyServer { return this.devConfig.basePathProxyTargetPort; } + public get host() { + return this.httpConfig.host; + } + + public get port() { + return this.httpConfig.port; + } + constructor( private readonly log: Logger, private readonly httpConfig: HttpConfig, @@ -92,7 +100,10 @@ export class BasePathProxyServer { await this.server.start(); this.log.info( - `basepath proxy server running at ${this.server.info.uri}${this.httpConfig.basePath}` + `basepath proxy server running at ${Url.format({ + host: this.server.info.uri, + pathname: this.httpConfig.basePath, + })}` ); } diff --git a/src/dev/build/tasks/bin/scripts/kibana-keystore.bat b/src/dev/build/tasks/bin/scripts/kibana-keystore.bat index 2214769efc410..c40145e7d6817 100755 --- a/src/dev/build/tasks/bin/scripts/kibana-keystore.bat +++ b/src/dev/build/tasks/bin/scripts/kibana-keystore.bat @@ -14,11 +14,11 @@ If Not Exist "%NODE%" ( set CONFIG_DIR=%KBN_PATH_CONF% If [%KBN_PATH_CONF%] == [] ( - set CONFIG_DIR=%DIR%\config + set "CONFIG_DIR=%DIR%\config" ) IF EXIST "%CONFIG_DIR%\node.options" ( - for /F "eol=# tokens=*" %%i in (%CONFIG_DIR%\node.options) do ( + for /F "usebackq eol=# tokens=*" %%i in ("%CONFIG_DIR%\node.options") do ( If [!NODE_OPTIONS!] == [] ( set "NODE_OPTIONS=%%i" ) Else ( diff --git a/src/dev/build/tasks/bin/scripts/kibana-plugin.bat b/src/dev/build/tasks/bin/scripts/kibana-plugin.bat index 0a6d135565e50..d1282f8cf32ac 100755 --- a/src/dev/build/tasks/bin/scripts/kibana-plugin.bat +++ b/src/dev/build/tasks/bin/scripts/kibana-plugin.bat @@ -15,11 +15,11 @@ If Not Exist "%NODE%" ( set CONFIG_DIR=%KBN_PATH_CONF% If [%KBN_PATH_CONF%] == [] ( - set CONFIG_DIR=%DIR%\config + set "CONFIG_DIR=%DIR%\config" ) IF EXIST "%CONFIG_DIR%\node.options" ( - for /F "eol=# tokens=*" %%i in (%CONFIG_DIR%\node.options) do ( + for /F "usebackq eol=# tokens=*" %%i in ("%CONFIG_DIR%\node.options") do ( If [!NODE_OPTIONS!] == [] ( set "NODE_OPTIONS=%%i" ) Else ( diff --git a/src/dev/build/tasks/bin/scripts/kibana.bat b/src/dev/build/tasks/bin/scripts/kibana.bat index 19bf8157ed7c8..4fc62804ca9a1 100755 --- a/src/dev/build/tasks/bin/scripts/kibana.bat +++ b/src/dev/build/tasks/bin/scripts/kibana.bat @@ -16,11 +16,11 @@ If Not Exist "%NODE%" ( set CONFIG_DIR=%KBN_PATH_CONF% If [%KBN_PATH_CONF%] == [] ( - set CONFIG_DIR=%DIR%\config + set "CONFIG_DIR=%DIR%\config" ) IF EXIST "%CONFIG_DIR%\node.options" ( - for /F "eol=# tokens=*" %%i in (%CONFIG_DIR%\node.options) do ( + for /F "usebackq eol=# tokens=*" %%i in ("%CONFIG_DIR%\node.options") do ( If [!NODE_OPTIONS!] == [] ( set "NODE_OPTIONS=%%i" ) Else ( diff --git a/src/dev/cli_dev_mode/cli_dev_mode.test.ts b/src/dev/cli_dev_mode/cli_dev_mode.test.ts index b86100d161bd3..a6905df8d0c27 100644 --- a/src/dev/cli_dev_mode/cli_dev_mode.test.ts +++ b/src/dev/cli_dev_mode/cli_dev_mode.test.ts @@ -95,6 +95,7 @@ it('passes correct args to sub-classes', () => { ], "gracefulTimeout": 5000, "log": , + "mapLogLine": [Function], "script": /scripts/kibana, "watcher": Watcher { "serverShouldRestart$": [MockFunction], diff --git a/src/dev/cli_dev_mode/cli_dev_mode.ts b/src/dev/cli_dev_mode/cli_dev_mode.ts index 3cb97b08b75c2..58d5e499f189b 100644 --- a/src/dev/cli_dev_mode/cli_dev_mode.ts +++ b/src/dev/cli_dev_mode/cli_dev_mode.ts @@ -21,7 +21,7 @@ import Path from 'path'; import { REPO_ROOT } from '@kbn/dev-utils'; import * as Rx from 'rxjs'; -import { mapTo, filter, take } from 'rxjs/operators'; +import { mapTo, filter, take, tap, distinctUntilChanged, switchMap } from 'rxjs/operators'; import { CliArgs } from '../../core/server/config'; import { LegacyConfig } from '../../core/server/legacy'; @@ -142,6 +142,15 @@ export class CliDevMode { ] : []), ], + mapLogLine: (line) => { + if (!this.basePathProxy) { + return line; + } + + return line + .split(`${this.basePathProxy.host}:${this.basePathProxy.targetPort}`) + .join(`${this.basePathProxy.host}:${this.basePathProxy.port}`); + }, }); this.optimizer = new Optimizer({ @@ -168,10 +177,41 @@ export class CliDevMode { this.subscription = new Rx.Subscription(); if (basePathProxy) { - const delay$ = firstAllTrue(this.devServer.isReady$(), this.optimizer.isReady$()); + const serverReady$ = new Rx.BehaviorSubject(false); + const optimizerReady$ = new Rx.BehaviorSubject(false); + const userWaiting$ = new Rx.BehaviorSubject(false); + + this.subscription.add( + Rx.merge( + this.devServer.isReady$().pipe(tap(serverReady$)), + this.optimizer.isReady$().pipe(tap(optimizerReady$)), + userWaiting$.pipe( + distinctUntilChanged(), + switchMap((waiting) => + !waiting + ? Rx.EMPTY + : Rx.timer(1000).pipe( + tap(() => { + this.log.warn( + 'please hold', + !optimizerReady$.getValue() + ? 'optimizer is still bundling so requests have been paused' + : 'server is not ready so requests have been paused' + ); + }) + ) + ) + ) + ).subscribe(this.observer('readiness checks')) + ); basePathProxy.start({ - delayUntil: () => delay$, + delayUntil: () => { + userWaiting$.next(true); + return firstAllTrue(serverReady$, optimizerReady$).pipe( + tap(() => userWaiting$.next(false)) + ); + }, shouldRedirectFromOldBasePath, }); diff --git a/src/dev/cli_dev_mode/dev_server.ts b/src/dev/cli_dev_mode/dev_server.ts index da64c680a3c2d..f832acd38c641 100644 --- a/src/dev/cli_dev_mode/dev_server.ts +++ b/src/dev/cli_dev_mode/dev_server.ts @@ -45,6 +45,7 @@ export interface Options { processExit$?: Rx.Observable; sigint$?: Rx.Observable; sigterm$?: Rx.Observable; + mapLogLine?: DevServer['mapLogLine']; } export class DevServer { @@ -59,6 +60,7 @@ export class DevServer { private readonly script: string; private readonly argv: string[]; private readonly gracefulTimeout: number; + private readonly mapLogLine?: (line: string) => string | null; constructor(options: Options) { this.log = options.log; @@ -70,6 +72,7 @@ export class DevServer { this.processExit$ = options.processExit$ ?? Rx.fromEvent(process as EventEmitter, 'exit'); this.sigint$ = options.sigint$ ?? Rx.fromEvent(process as EventEmitter, 'SIGINT'); this.sigterm$ = options.sigterm$ ?? Rx.fromEvent(process as EventEmitter, 'SIGTERM'); + this.mapLogLine = options.mapLogLine; } isReady$() { @@ -124,8 +127,11 @@ export class DevServer { // observable which emits devServer states containing lines // logged to stdout/stderr, completes when stdio streams complete const log$ = Rx.merge(observeLines(proc.stdout!), observeLines(proc.stderr!)).pipe( - tap((line) => { - this.log.write(line); + tap((observedLine) => { + const line = this.mapLogLine ? this.mapLogLine(observedLine) : observedLine; + if (line !== null) { + this.log.write(line); + } }) ); diff --git a/src/dev/cli_dev_mode/using_server_process.ts b/src/dev/cli_dev_mode/using_server_process.ts index 23423fcacb2fc..438e1001672a2 100644 --- a/src/dev/cli_dev_mode/using_server_process.ts +++ b/src/dev/cli_dev_mode/using_server_process.ts @@ -41,7 +41,7 @@ export function usingServerProcess( nodeOptions: [ ...process.execArgv, ...(ACTIVE_INSPECT_FLAG ? [`${ACTIVE_INSPECT_FLAG}=${process.debugPort + 1}`] : []), - ].filter((arg) => !arg.includes('inspect')), + ], env: { ...process.env, NODE_OPTIONS: process.env.NODE_OPTIONS, diff --git a/src/plugins/data/README.md b/src/plugins/data/README.md index 33c07078c5348..0c3d8d4072aae 100644 --- a/src/plugins/data/README.md +++ b/src/plugins/data/README.md @@ -48,6 +48,405 @@ Coming soon. Coming soon. +### Index Patterns HTTP API + +Index patterns provide Rest-like HTTP CRUD+ API with the following endpoints: + +- Index Patterns API + - Create an index pattern — `POST /api/index_patterns/index_pattern` + - Fetch an index pattern by `{id}` — `GET /api/index_patterns/index_pattern/{id}` + - Delete an index pattern by `{id}` — `DELETE /api/index_patterns/index_pattern/{id}` + - Partially update an index pattern by `{id}` — `POST /api/index_patterns/index_pattern/{id}` +- Fields API + - Update field — `POST /api/index_patterns/index_pattern/{id}/fields` +- Scripted Fields API + - Create a scripted field — `POST /api/index_patterns/index_pattern/{id}/scripted_field` + - Upsert a scripted field — `PUT /api/index_patterns/index_pattern/{id}/scripted_field` + - Fetch a scripted field — `GET /api/index_patterns/index_pattern/{id}/scripted_field/{name}` + - Remove a scripted field — `DELETE /api/index_patterns/index_pattern/{id}/scripted_field/{name}` + - Update a scripted field — `POST /api/index_patterns/index_pattern/{id}/scripted_field/{name}` + + +### Index Patterns API + +Index Patterns CURD API allows you to create, retrieve and delete index patterns. I also +exposes an update endpoint which allows you to update specific fields without changing +the rest of the index pattern object. + +#### Create an index pattern + +Create an index pattern with a custom title. + +``` +POST /api/index_patterns/index_pattern +{ + "index_pattern": { + "title": "hello" + } +} +``` + +Customize creation behavior with: + +- `override` — if set to `true`, replaces an existing index pattern if an + index pattern with the provided title already exists. Defaults to `false`. +- `refresh_fields` — if set to `true` reloads index pattern fields after + the index pattern is stored. Defaults to `false`. + +``` +POST /api/index_patterns/index_pattern +{ + "override": false, + "refresh_fields": true, + "index_pattern": { + "title": "hello" + } +} +``` + +At creation all index pattern fields are option and you can provide them. + +``` +POST /api/index_patterns/index_pattern +{ + "index_pattern": { + "id": "...", + "version": "...", + "title": "...", + "type": "...", + "intervalName": "...", + "timeFieldName": "...", + "sourceFilters": [], + "fields": {}, + "typeMeta": {}, + "fieldFormats": {}, + "fieldAttrs": {} + } +} +``` + +The endpoint returns the created index pattern object. + +```json +{ + "index_pattern": {} +} +``` + + +#### Fetch an index pattern by ID + +Retrieve and index pattern by its ID. + +``` +GET /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +``` + +Returns an index pattern object. + +```json +{ + "index_pattern": { + "id": "...", + "version": "...", + "title": "...", + "type": "...", + "intervalName": "...", + "timeFieldName": "...", + "sourceFilters": [], + "fields": {}, + "typeMeta": {}, + "fieldFormats": {}, + "fieldAttrs": {} + } +} +``` + + +#### Delete an index pattern by ID + +Delete and index pattern by its ID. + +``` +DELETE /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +``` + +Returns an '200 OK` response with empty body on success. + + +#### Partially update an index pattern by ID + +Update part of an index pattern. Only provided fields will be updated on the +index pattern, missing fields will stay as they are persisted. + +These fields can be update partially: + - `title` + - `timeFieldName` + - `intervalName` + - `fields` (optionally refresh fields) + - `sourceFilters` + - `fieldFormatMap` + - `type` + - `typeMeta` + +Update a title of an index pattern. + +``` +POST /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +{ + "index_pattern": { + "title": "new_title" + } +} +``` + +All update fields are optional, you can specify the following fields. + +``` +POST /api/index_patterns/index_pattern +{ + "index_pattern": { + "title": "...", + "timeFieldName": "...", + "intervalName": "...", + "sourceFilters": [], + "fieldFormats": {}, + "type": "...", + "typeMeta": {}, + "fields": {} + } +} +``` + +- `refresh_fields` — if set to `true` reloads index pattern fields after + the index pattern is stored. Defaults to `false`. + +``` +POST /api/index_patterns/index_pattern +{ + "refresh_fields": true, + "index_pattern": { + "fields": {} + } +} +``` + +This endpoint returns the updated index pattern object. + +```json +{ + "index_pattern": { + + } +} +``` + + +### Fields API + +Fields API allows to change field metadata, such as `count`, `customLabel`, and `format`. + + +#### Update fields + +Update endpoint allows you to update fields presentation metadata, such as `count`, +`customLabel`, and `format`. You can update multiple fields in one request. Updates +are merges with persisted metadata. To remove existing metadata specify `null` as value. + +Set popularity `count` for field `foo`: + +``` +POST /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/fields +{ + "fields": { + "foo": { + "count": 123 + } + } +} +``` + +Update multiple metadata values and fields in one request: + +``` +POST /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/fields +{ + "fields": { + "foo": { + "count": 123, + "customLabel": "Foo" + }, + "bar": { + "customLabel": "Bar" + } + } +} +``` + +Use `null` value to delete metadata: + +``` +POST /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/fields +{ + "fields": { + "foo": { + "customLabel": null + } + } +} +``` + +This endpoint returns the updated index pattern object. + +```json +{ + "index_pattern": { + + } +} +``` + + +### Scripted Fields API + +Scripted Fields API provides CRUD API for scripted fields of an index pattern. + +#### Create a scripted field + +Create a field by simply specifying its name, will default to `string` type. Returns +an error if a field with the provided name already exists. + +``` +POST /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/scripted_field +{ + "field": { + "name": "my_field" + } +} +``` + +Create a field by specifying all field properties. + +``` +POST /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/scripted_field +{ + "field": { + "name": "", + "type": "", + "searchable": false, + "aggregatable": false, + "count": 0, + "script": "", + "scripted": false, + "lang": "", + "conflictDescriptions": {}, + "format": {}, + "esTypes": [], + "readFromDocValues": false, + "subType": {}, + "indexed": false, + "customLabel": "", + "shortDotsEnable": false + } +} +``` + +#### Upsert a scripted field + +Creates a new field or updates an existing one, if one already exists with the same name. + +Create a field by simply specifying its name. + +``` +PUT /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/scripted_field +{ + "field": { + "name": "my_field" + } +} +``` + +Create a field by specifying all field properties. + +``` +PUT /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/scripted_field +{ + "field": { + "name": "", + "type": "", + "searchable": false, + "aggregatable": false, + "count": 0, + "script": "", + "scripted": false, + "lang": "", + "conflictDescriptions": {}, + "format": {}, + "esTypes": [], + "readFromDocValues": false, + "subType": {}, + "indexed": false, + "customLabel": "", + "shortDotsEnable": false + } +} +``` + +#### Fetch a scripted field + +Fetch an existing index pattern field by field name. + +``` +GET /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/scripted_field/ +``` + +Returns the field object. + +```json +{ + "field": {} +} +``` + +#### Delete a scripted field + +Delete a field of an index pattern. + +``` +DELETE /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/scripted_field/ +``` + +#### Update a an existing scripted field + +Updates an exiting field by mergin provided properties with the existing ones. If +there is no existing field with the specified name, returns a `404 Not Found` error. + +You can specify any field properties, except `name` which is specified in the URL path. + +``` +POST /api/index_patterns/index_pattern/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/scripted_field/ +{ + "field": { + "type": "", + "searchable": false, + "aggregatable": false, + "count": 0, + "script": "", + "scripted": false, + "lang": "", + "conflictDescriptions": {}, + "format": {}, + "esTypes": [], + "readFromDocValues": false, + "subType": {}, + "indexed": false, + "customLabel": "", + "shortDotsEnable": false + } +} +``` + + ## Query The query service is responsible for managing the configuration of a search query (`QueryState`): filters, time range, query string, and settings such as the auto refresh behavior and saved queries. diff --git a/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts b/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts index 4dd2d29f38e9f..a7160f2e27f90 100644 --- a/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts +++ b/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts @@ -42,7 +42,7 @@ export class IndexPatternField implements IFieldType { return this.spec.count || 0; } - public set count(count) { + public set count(count: number) { this.spec.count = count; } @@ -149,6 +149,10 @@ export class IndexPatternField implements IFieldType { return this.aggregatable && !notVisualizableFieldTypes.includes(this.spec.type); } + public deleteCount() { + delete this.spec.count; + } + public toJSON() { return { count: this.count, diff --git a/src/plugins/data/common/index_patterns/index.ts b/src/plugins/data/common/index_patterns/index.ts index 08f478404be2c..de0078df1b9e4 100644 --- a/src/plugins/data/common/index_patterns/index.ts +++ b/src/plugins/data/common/index_patterns/index.ts @@ -19,6 +19,6 @@ export * from './fields'; export * from './types'; -export { IndexPatternsService } from './index_patterns'; +export { IndexPatternsService, IndexPatternsContract } from './index_patterns'; export type { IndexPattern } from './index_patterns'; export * from './errors'; diff --git a/src/plugins/data/common/index_patterns/index_patterns/__snapshots__/index_pattern.test.ts.snap b/src/plugins/data/common/index_patterns/index_patterns/__snapshots__/index_pattern.test.ts.snap index e2bdb0009c20a..19ec286307a09 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/__snapshots__/index_pattern.test.ts.snap +++ b/src/plugins/data/common/index_patterns/index_patterns/__snapshots__/index_pattern.test.ts.snap @@ -687,6 +687,7 @@ Object { }, }, "id": "test-pattern", + "intervalName": undefined, "sourceFilters": undefined, "timeFieldName": "timestamp", "title": "title", diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts index 52672c71dcce4..4c89cbeb446a0 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts @@ -109,16 +109,9 @@ export class IndexPattern implements IIndexPattern { this.type = spec.type; this.typeMeta = spec.typeMeta; this.fieldAttrs = spec.fieldAttrs || {}; + this.intervalName = spec.intervalName; } - setFieldFormat = (fieldName: string, format: SerializedFieldFormat) => { - this.fieldFormatMap[fieldName] = format; - }; - - deleteFieldFormat = (fieldName: string) => { - delete this.fieldFormatMap[fieldName]; - }; - /** * Get last saved saved object fields */ @@ -210,6 +203,7 @@ export class IndexPattern implements IIndexPattern { type: this.type, fieldFormats: this.fieldFormatMap, fieldAttrs: this.fieldAttrs, + intervalName: this.intervalName, }; } @@ -346,4 +340,48 @@ export class IndexPattern implements IIndexPattern { return this.fieldFormats.getInstance(formatSpec.id, formatSpec.params); } } + + protected setFieldAttrs( + fieldName: string, + attrName: K, + value: FieldAttrSet[K] + ) { + if (!this.fieldAttrs[fieldName]) { + this.fieldAttrs[fieldName] = {} as FieldAttrSet; + } + this.fieldAttrs[fieldName][attrName] = value; + } + + public setFieldCustomLabel(fieldName: string, customLabel: string | undefined | null) { + const fieldObject = this.fields.getByName(fieldName); + const newCustomLabel: string | undefined = customLabel === null ? undefined : customLabel; + + if (fieldObject) { + fieldObject.customLabel = newCustomLabel; + return; + } + + this.setFieldAttrs(fieldName, 'customLabel', newCustomLabel); + } + + public setFieldCount(fieldName: string, count: number | undefined | null) { + const fieldObject = this.fields.getByName(fieldName); + const newCount: number | undefined = count === null ? undefined : count; + + if (fieldObject) { + if (!newCount) fieldObject.deleteCount(); + else fieldObject.count = newCount; + return; + } + + this.setFieldAttrs(fieldName, 'count', newCount); + } + + public readonly setFieldFormat = (fieldName: string, format: SerializedFieldFormat) => { + this.fieldFormatMap[fieldName] = format; + }; + + public readonly deleteFieldFormat = (fieldName: string) => { + delete this.fieldFormatMap[fieldName]; + }; } diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts index 4a266b3cad649..0235f748ec1e0 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts @@ -281,10 +281,10 @@ export class IndexPatternsService { options: GetFieldsOptions, fieldAttrs: FieldAttrs = {} ) => { - const scriptdFields = Object.values(fields).filter((field) => field.scripted); + const scriptedFields = Object.values(fields).filter((field) => field.scripted); try { const newFields = (await this.getFieldsForWildcard(options)) as FieldSpec[]; - return this.fieldArrayToMap([...newFields, ...scriptdFields], fieldAttrs); + return this.fieldArrayToMap([...newFields, ...scriptedFields], fieldAttrs); } catch (err) { if (err instanceof IndexPatternMissingIndices) { this.onNotification({ title: (err as any).message, color: 'danger', iconType: 'alert' }); @@ -456,14 +456,14 @@ export class IndexPatternsService { /** * Create a new index pattern and save it right away * @param spec - * @param override Overwrite if existing index pattern exists - * @param skipFetchFields + * @param override Overwrite if existing index pattern exists. + * @param skipFetchFields Whether to skip field refresh step. */ async createAndSave(spec: IndexPatternSpec, override = false, skipFetchFields = false) { const indexPattern = await this.create(spec, skipFetchFields); await this.createSavedObject(indexPattern, override); - await this.setDefault(indexPattern.id as string); + await this.setDefault(indexPattern.id!); return indexPattern; } diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 78c789a451c5b..df599a7c0188e 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -1116,7 +1116,7 @@ export class IndexPattern implements IIndexPattern { constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps); addScriptedField(name: string, script: string, fieldType?: string): Promise; // (undocumented) - deleteFieldFormat: (fieldName: string) => void; + readonly deleteFieldFormat: (fieldName: string) => void; // Warning: (ae-forgotten-export) The symbol "FieldAttrs" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -1206,7 +1206,13 @@ export class IndexPattern implements IIndexPattern { removeScriptedField(fieldName: string): void; resetOriginalSavedObjectBody: () => void; // (undocumented) - setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; + protected setFieldAttrs(fieldName: string, attrName: K, value: FieldAttrSet[K]): void; + // (undocumented) + setFieldCount(fieldName: string, count: number | undefined | null): void; + // (undocumented) + setFieldCustomLabel(fieldName: string, customLabel: string | undefined | null): void; + // (undocumented) + readonly setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; // Warning: (ae-forgotten-export) The symbol "SourceFilter" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -1276,6 +1282,8 @@ export class IndexPatternField implements IFieldType { get customLabel(): string | undefined; set customLabel(customLabel: string | undefined); // (undocumented) + deleteCount(): void; + // (undocumented) get displayName(): string; // (undocumented) get esTypes(): string[] | undefined; @@ -2406,7 +2414,7 @@ export const UI_SETTINGS: { // src/plugins/data/common/es_query/filters/phrase_filter.ts:33:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/phrases_filter.ts:31:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:64:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:135:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:128:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/common/search/aggs/types.ts:113:51 - (ae-forgotten-export) The symbol "AggTypesRegistryStart" needs to be exported by the entry point index.d.ts // src/plugins/data/common/search/search_source/search_source.ts:197:7 - (ae-forgotten-export) The symbol "SearchFieldValue" needs to be exported by the entry point index.d.ts // src/plugins/data/public/field_formats/field_formats_service.ts:67:3 - (ae-forgotten-export) The symbol "FormatFactory" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index 4a4e1df2cf45f..9c483de95df46 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -317,4 +317,4 @@ export const config: PluginConfigDescriptor = { schema: configSchema, }; -export type { IndexPatternsService } from './index_patterns'; +export type { IndexPatternsServiceProvider as IndexPatternsService } from './index_patterns'; diff --git a/src/plugins/data/server/index_patterns/error.ts b/src/plugins/data/server/index_patterns/error.ts new file mode 100644 index 0000000000000..3e369d3275d9a --- /dev/null +++ b/src/plugins/data/server/index_patterns/error.ts @@ -0,0 +1,36 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* eslint-disable max-classes-per-file */ + +export class ErrorIndexPatternNotFound extends Error { + public readonly is404 = true; + + constructor(message: string) { + super(message); + + Object.setPrototypeOf(this, ErrorIndexPatternNotFound.prototype); + } +} + +export class ErrorIndexPatternFieldNotFound extends ErrorIndexPatternNotFound { + constructor(indexPatternId: string, fieldName: string) { + super(`Field [index_pattern = ${indexPatternId}, field = ${fieldName}] not found.`); + } +} diff --git a/src/plugins/data/server/index_patterns/index.ts b/src/plugins/data/server/index_patterns/index.ts index 3305b1bb9a92f..b5bcd7cf5c483 100644 --- a/src/plugins/data/server/index_patterns/index.ts +++ b/src/plugins/data/server/index_patterns/index.ts @@ -24,4 +24,4 @@ export { mergeCapabilitiesWithFields, getCapabilitiesForRollupIndices, } from './fetcher'; -export { IndexPatternsService, IndexPatternsServiceStart } from './index_patterns_service'; +export { IndexPatternsServiceProvider, IndexPatternsServiceStart } from './index_patterns_service'; diff --git a/src/plugins/data/server/index_patterns/index_patterns_service.ts b/src/plugins/data/server/index_patterns/index_patterns_service.ts index 82c96ba4ff7dc..0893fc787e526 100644 --- a/src/plugins/data/server/index_patterns/index_patterns_service.ts +++ b/src/plugins/data/server/index_patterns/index_patterns_service.ts @@ -53,7 +53,7 @@ export interface IndexPatternsServiceStartDeps { logger: Logger; } -export class IndexPatternsService implements Plugin { +export class IndexPatternsServiceProvider implements Plugin { public setup( core: CoreSetup, { expressions }: IndexPatternsServiceSetupDeps @@ -61,7 +61,7 @@ export class IndexPatternsService implements Plugin +) { const parseMetaFields = (metaFields: string | string[]) => { let parsedFields: string[] = []; if (typeof metaFields === 'string') { @@ -33,6 +47,23 @@ export function registerRoutes(http: HttpServiceSetup) { }; const router = http.createRouter(); + + // Index Patterns API + registerCreateIndexPatternRoute(router, getStartServices); + registerGetIndexPatternRoute(router, getStartServices); + registerDeleteIndexPatternRoute(router, getStartServices); + registerUpdateIndexPatternRoute(router, getStartServices); + + // Fields API + registerUpdateFieldsRoute(router, getStartServices); + + // Scripted Field API + registerCreateScriptedFieldRoute(router, getStartServices); + registerPutScriptedFieldRoute(router, getStartServices); + registerGetScriptedFieldRoute(router, getStartServices); + registerDeleteScriptedFieldRoute(router, getStartServices); + registerUpdateScriptedFieldRoute(router, getStartServices); + router.get( { path: '/api/index_patterns/_fields_for_wildcard', diff --git a/src/plugins/data/server/index_patterns/routes/create_index_pattern.ts b/src/plugins/data/server/index_patterns/routes/create_index_pattern.ts new file mode 100644 index 0000000000000..57a745b19748d --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/create_index_pattern.ts @@ -0,0 +1,97 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { IndexPatternSpec } from 'src/plugins/data/common'; +import { handleErrors } from './util/handle_errors'; +import { fieldSpecSchema, serializedFieldFormatSchema } from './util/schemas'; +import { IRouter, StartServicesAccessor } from '../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../plugin'; + +const indexPatternSpecSchema = schema.object({ + title: schema.string(), + + id: schema.maybe(schema.string()), + version: schema.maybe(schema.string()), + type: schema.maybe(schema.string()), + timeFieldName: schema.maybe(schema.string()), + sourceFilters: schema.maybe( + schema.arrayOf( + schema.object({ + value: schema.string(), + }) + ) + ), + fields: schema.maybe(schema.recordOf(schema.string(), fieldSpecSchema)), + typeMeta: schema.maybe(schema.object({}, { unknowns: 'allow' })), + fieldFormats: schema.maybe(schema.recordOf(schema.string(), serializedFieldFormatSchema)), + fieldAttrs: schema.maybe( + schema.recordOf( + schema.string(), + schema.object({ + customLabel: schema.maybe(schema.string()), + count: schema.maybe(schema.number()), + }) + ) + ), +}); + +export const registerCreateIndexPatternRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.post( + { + path: '/api/index_patterns/index_pattern', + validate: { + body: schema.object({ + override: schema.maybe(schema.boolean({ defaultValue: false })), + refresh_fields: schema.maybe(schema.boolean({ defaultValue: false })), + index_pattern: indexPatternSpecSchema, + }), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const body = req.body; + const indexPattern = await indexPatternsService.createAndSave( + body.index_pattern as IndexPatternSpec, + body.override, + !body.refresh_fields + ); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + index_pattern: indexPattern.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/delete_index_pattern.ts b/src/plugins/data/server/index_patterns/routes/delete_index_pattern.ts new file mode 100644 index 0000000000000..c73718342355f --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/delete_index_pattern.ts @@ -0,0 +1,65 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { handleErrors } from './util/handle_errors'; +import { IRouter, StartServicesAccessor } from '../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../plugin'; + +export const registerDeleteIndexPatternRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.delete( + { + path: '/api/index_patterns/index_pattern/{id}', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + + await indexPatternsService.delete(id); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/fields/update_fields.ts b/src/plugins/data/server/index_patterns/routes/fields/update_fields.ts new file mode 100644 index 0000000000000..4dd9046e70ad1 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/fields/update_fields.ts @@ -0,0 +1,125 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { handleErrors } from '../util/handle_errors'; +import { serializedFieldFormatSchema } from '../util/schemas'; +import { IRouter, StartServicesAccessor } from '../../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../../plugin'; + +export const registerUpdateFieldsRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.post( + { + path: '/api/index_patterns/index_pattern/{id}/fields', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + body: schema.object({ + fields: schema.recordOf( + schema.string({ + minLength: 1, + maxLength: 1_000, + }), + schema.object({ + customLabel: schema.maybe( + schema.nullable( + schema.string({ + minLength: 1, + maxLength: 1_000, + }) + ) + ), + count: schema.maybe(schema.nullable(schema.number())), + format: schema.maybe(schema.nullable(serializedFieldFormatSchema)), + }) + ), + }), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + const { fields } = req.body; + const fieldNames = Object.keys(fields); + + if (fieldNames.length < 1) { + throw new Error('No fields provided.'); + } + + const indexPattern = await indexPatternsService.get(id); + + let changeCount = 0; + for (const fieldName of fieldNames) { + const field = fields[fieldName]; + + if (field.customLabel !== undefined) { + changeCount++; + indexPattern.setFieldCustomLabel(fieldName, field.customLabel); + } + + if (field.count !== undefined) { + changeCount++; + indexPattern.setFieldCount(fieldName, field.count); + } + + if (field.format !== undefined) { + changeCount++; + if (field.format) { + indexPattern.setFieldFormat(fieldName, field.format); + } else { + indexPattern.deleteFieldFormat(fieldName); + } + } + } + + if (changeCount < 1) { + throw new Error('Change set is empty.'); + } + + await indexPatternsService.updateSavedObject(indexPattern); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + index_pattern: indexPattern.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/get_index_pattern.ts b/src/plugins/data/server/index_patterns/routes/get_index_pattern.ts new file mode 100644 index 0000000000000..5f7825e9cff90 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/get_index_pattern.ts @@ -0,0 +1,67 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { handleErrors } from './util/handle_errors'; +import { IRouter, StartServicesAccessor } from '../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../plugin'; + +export const registerGetIndexPatternRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.get( + { + path: '/api/index_patterns/index_pattern/{id}', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + const indexPattern = await indexPatternsService.get(id); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + index_pattern: indexPattern.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/scripted_fields/create_scripted_field.ts b/src/plugins/data/server/index_patterns/routes/scripted_fields/create_scripted_field.ts new file mode 100644 index 0000000000000..23a293d5d9141 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/scripted_fields/create_scripted_field.ts @@ -0,0 +1,93 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { handleErrors } from '../util/handle_errors'; +import { fieldSpecSchema } from '../util/schemas'; +import { IRouter, StartServicesAccessor } from '../../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../../plugin'; + +export const registerCreateScriptedFieldRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.post( + { + path: '/api/index_patterns/index_pattern/{id}/scripted_field', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + body: schema.object({ + field: fieldSpecSchema, + }), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + const { field } = req.body; + + if (!field.scripted) { + throw new Error('Only scripted fields can be created.'); + } + + const indexPattern = await indexPatternsService.get(id); + + if (indexPattern.fields.getByName(field.name)) { + throw new Error(`Field [name = ${field.name}] already exists.`); + } + + indexPattern.fields.add({ + ...field, + aggregatable: true, + searchable: true, + }); + + await indexPatternsService.updateSavedObject(indexPattern); + + const fieldObject = indexPattern.fields.getByName(field.name); + if (!fieldObject) throw new Error(`Could not create a field [name = ${field.name}].`); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + field: fieldObject.toSpec(), + index_pattern: indexPattern.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/scripted_fields/delete_scripted_field.ts b/src/plugins/data/server/index_patterns/routes/scripted_fields/delete_scripted_field.ts new file mode 100644 index 0000000000000..453ad1fdc16ed --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/scripted_fields/delete_scripted_field.ts @@ -0,0 +1,84 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { ErrorIndexPatternFieldNotFound } from '../../error'; +import { handleErrors } from '../util/handle_errors'; +import { IRouter, StartServicesAccessor } from '../../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../../plugin'; + +export const registerDeleteScriptedFieldRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.delete( + { + path: '/api/index_patterns/index_pattern/{id}/scripted_field/{name}', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + name: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + const name = req.params.name; + + const indexPattern = await indexPatternsService.get(id); + const field = indexPattern.fields.getByName(name); + + if (!field) { + throw new ErrorIndexPatternFieldNotFound(id, name); + } + + if (!field.scripted) { + throw new Error('Only scripted fields can be deleted.'); + } + + indexPattern.fields.remove(field); + + await indexPatternsService.updateSavedObject(indexPattern); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/scripted_fields/get_scripted_field.ts b/src/plugins/data/server/index_patterns/routes/scripted_fields/get_scripted_field.ts new file mode 100644 index 0000000000000..35b0e673a7e56 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/scripted_fields/get_scripted_field.ts @@ -0,0 +1,83 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { ErrorIndexPatternFieldNotFound } from '../../error'; +import { handleErrors } from '../util/handle_errors'; +import { IRouter, StartServicesAccessor } from '../../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../../plugin'; + +export const registerGetScriptedFieldRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.get( + { + path: '/api/index_patterns/index_pattern/{id}/scripted_field/{name}', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + name: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + const name = req.params.name; + + const indexPattern = await indexPatternsService.get(id); + const field = indexPattern.fields.getByName(name); + + if (!field) { + throw new ErrorIndexPatternFieldNotFound(id, name); + } + + if (!field.scripted) { + throw new Error('Only scripted fields can be retrieved.'); + } + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + field: field.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/scripted_fields/put_scripted_field.ts b/src/plugins/data/server/index_patterns/routes/scripted_fields/put_scripted_field.ts new file mode 100644 index 0000000000000..a789affab3579 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/scripted_fields/put_scripted_field.ts @@ -0,0 +1,94 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { handleErrors } from '../util/handle_errors'; +import { fieldSpecSchema } from '../util/schemas'; +import { IRouter, StartServicesAccessor } from '../../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../../plugin'; + +export const registerPutScriptedFieldRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.put( + { + path: '/api/index_patterns/index_pattern/{id}/scripted_field', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + body: schema.object({ + field: fieldSpecSchema, + }), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + const { field } = req.body; + + if (!field.scripted) { + throw new Error('Only scripted fields can be put.'); + } + + const indexPattern = await indexPatternsService.get(id); + + const oldFieldObject = indexPattern.fields.getByName(field.name); + if (!!oldFieldObject) { + indexPattern.fields.remove(oldFieldObject); + } + + indexPattern.fields.add({ + ...field, + aggregatable: true, + searchable: true, + }); + + await indexPatternsService.updateSavedObject(indexPattern); + + const fieldObject = indexPattern.fields.getByName(field.name); + if (!fieldObject) throw new Error(`Could not create a field [name = ${field.name}].`); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + field: fieldObject.toSpec(), + index_pattern: indexPattern.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/scripted_fields/update_scripted_field.ts b/src/plugins/data/server/index_patterns/routes/scripted_fields/update_scripted_field.ts new file mode 100644 index 0000000000000..9b937aafd6aa7 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/scripted_fields/update_scripted_field.ts @@ -0,0 +1,118 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { FieldSpec } from 'src/plugins/data/common'; +import { ErrorIndexPatternFieldNotFound } from '../../error'; +import { handleErrors } from '../util/handle_errors'; +import { fieldSpecSchemaFields } from '../util/schemas'; +import { IRouter, StartServicesAccessor } from '../../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../../plugin'; + +export const registerUpdateScriptedFieldRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.post( + { + path: '/api/index_patterns/index_pattern/{id}/scripted_field/{name}', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + name: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + body: schema.object({ + field: schema.object({ + ...fieldSpecSchemaFields, + + // We need to overwrite the below fields on top of `fieldSpecSchemaFields`, + // because `name` field must not appear here and other below fields + // should be possible to not provide `schema.maybe()` instead of + // them being required with a default value in `fieldSpecSchemaFields`. + name: schema.never(), + type: schema.maybe( + schema.string({ + maxLength: 1_000, + }) + ), + searchable: schema.maybe(schema.boolean()), + aggregatable: schema.maybe(schema.boolean()), + }), + }), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + const name = req.params.name; + const field = ({ ...req.body.field, name } as unknown) as FieldSpec; + + const indexPattern = await indexPatternsService.get(id); + let fieldObject = indexPattern.fields.getByName(field.name); + + if (!fieldObject) { + throw new ErrorIndexPatternFieldNotFound(id, name); + } + + if (!fieldObject.scripted) { + throw new Error('Only scripted fields can be updated.'); + } + + const oldSpec = fieldObject.toSpec(); + + indexPattern.fields.remove(fieldObject); + indexPattern.fields.add({ + ...oldSpec, + ...field, + }); + + await indexPatternsService.updateSavedObject(indexPattern); + + fieldObject = indexPattern.fields.getByName(field.name); + if (!fieldObject) throw new Error(`Could not create a field [name = ${field.name}].`); + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + field: fieldObject.toSpec(), + index_pattern: indexPattern.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/update_index_pattern.ts b/src/plugins/data/server/index_patterns/routes/update_index_pattern.ts new file mode 100644 index 0000000000000..10567544af6ea --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/update_index_pattern.ts @@ -0,0 +1,165 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; +import { handleErrors } from './util/handle_errors'; +import { fieldSpecSchema, serializedFieldFormatSchema } from './util/schemas'; +import { IRouter, StartServicesAccessor } from '../../../../../core/server'; +import type { DataPluginStart, DataPluginStartDependencies } from '../../plugin'; + +const indexPatternUpdateSchema = schema.object({ + title: schema.maybe(schema.string()), + type: schema.maybe(schema.string()), + typeMeta: schema.maybe(schema.object({}, { unknowns: 'allow' })), + timeFieldName: schema.maybe(schema.string()), + intervalName: schema.maybe(schema.string()), + sourceFilters: schema.maybe( + schema.arrayOf( + schema.object({ + value: schema.string(), + }) + ) + ), + fieldFormats: schema.maybe(schema.recordOf(schema.string(), serializedFieldFormatSchema)), + fields: schema.maybe(schema.recordOf(schema.string(), fieldSpecSchema)), +}); + +export const registerUpdateIndexPatternRoute = ( + router: IRouter, + getStartServices: StartServicesAccessor +) => { + router.post( + { + path: '/api/index_patterns/index_pattern/{id}', + validate: { + params: schema.object( + { + id: schema.string({ + minLength: 1, + maxLength: 1_000, + }), + }, + { unknowns: 'allow' } + ), + body: schema.object({ + refresh_fields: schema.maybe(schema.boolean({ defaultValue: false })), + index_pattern: indexPatternUpdateSchema, + }), + }, + }, + router.handleLegacyErrors( + handleErrors(async (ctx, req, res) => { + const savedObjectsClient = ctx.core.savedObjects.client; + const elasticsearchClient = ctx.core.elasticsearch.client.asCurrentUser; + const [, , { indexPatterns }] = await getStartServices(); + const indexPatternsService = await indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); + const id = req.params.id; + + const indexPattern = await indexPatternsService.get(id); + + const { + // eslint-disable-next-line @typescript-eslint/naming-convention + refresh_fields = true, + index_pattern: { + title, + timeFieldName, + intervalName, + sourceFilters, + fieldFormats, + type, + typeMeta, + fields, + }, + } = req.body; + + let changeCount = 0; + let doRefreshFields = false; + + if (title !== undefined && title !== indexPattern.title) { + changeCount++; + indexPattern.title = title; + } + + if (timeFieldName !== undefined && timeFieldName !== indexPattern.timeFieldName) { + changeCount++; + indexPattern.timeFieldName = timeFieldName; + } + + if (intervalName !== undefined && intervalName !== indexPattern.intervalName) { + changeCount++; + indexPattern.intervalName = intervalName; + } + + if (sourceFilters !== undefined) { + changeCount++; + indexPattern.sourceFilters = sourceFilters; + } + + if (fieldFormats !== undefined) { + changeCount++; + indexPattern.fieldFormatMap = fieldFormats; + } + + if (type !== undefined) { + changeCount++; + indexPattern.type = type; + } + + if (typeMeta !== undefined) { + changeCount++; + indexPattern.typeMeta = typeMeta; + } + + if (fields !== undefined) { + changeCount++; + doRefreshFields = true; + indexPattern.fields.replaceAll( + Object.values(fields || {}).map((field) => ({ + ...field, + aggregatable: true, + searchable: true, + })) + ); + } + + if (changeCount < 1) { + throw new Error('Index pattern change set is empty.'); + } + + await indexPatternsService.updateSavedObject(indexPattern); + + if (doRefreshFields && refresh_fields) { + await indexPatternsService.refreshFields(indexPattern); + } + + return res.ok({ + headers: { + 'content-type': 'application/json', + }, + body: JSON.stringify({ + index_pattern: indexPattern.toSpec(), + }), + }); + }) + ) + ); +}; diff --git a/src/plugins/data/server/index_patterns/routes/util/handle_errors.ts b/src/plugins/data/server/index_patterns/routes/util/handle_errors.ts new file mode 100644 index 0000000000000..01b8fefb5fab7 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/util/handle_errors.ts @@ -0,0 +1,80 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestHandler, RouteMethod } from 'src/core/server'; +import { ErrorIndexPatternNotFound } from '../../error'; + +interface ErrorResponseBody { + message: string; + attributes?: object; +} + +interface ErrorWithData { + data?: object; +} + +/** + * This higher order request handler makes sure that errors are returned with + * body formatted in the following shape: + * + * ```json + * { + * "message": "...", + * "attributes": {} + * } + * ``` + */ +export const handleErrors = ( + handler: RequestHandler +): RequestHandler => async (context, request, response) => { + try { + return await handler(context, request, response); + } catch (error) { + if (error instanceof Error) { + const body: ErrorResponseBody = { + message: error.message, + }; + + if (typeof (error as ErrorWithData).data === 'object') { + body.attributes = (error as ErrorWithData).data; + } + + const is404 = + (error as ErrorIndexPatternNotFound).is404 || (error as any)?.output?.statusCode === 404; + + if (is404) { + return response.notFound({ + headers: { + 'content-type': 'application/json', + }, + body, + }); + } + + return response.badRequest({ + headers: { + 'content-type': 'application/json', + }, + body, + }); + } + + throw error; + } +}; diff --git a/src/plugins/data/server/index_patterns/routes/util/schemas.ts b/src/plugins/data/server/index_patterns/routes/util/schemas.ts new file mode 100644 index 0000000000000..08b99c727b4a5 --- /dev/null +++ b/src/plugins/data/server/index_patterns/routes/util/schemas.ts @@ -0,0 +1,66 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema } from '@kbn/config-schema'; + +export const serializedFieldFormatSchema = schema.object({ + id: schema.maybe(schema.string()), + params: schema.maybe(schema.any()), +}); + +export const fieldSpecSchemaFields = { + name: schema.string({ + maxLength: 1_000, + }), + type: schema.string({ + defaultValue: 'string', + maxLength: 1_000, + }), + count: schema.maybe( + schema.number({ + min: 0, + }) + ), + script: schema.maybe( + schema.string({ + maxLength: 1_000_000, + }) + ), + format: schema.maybe(serializedFieldFormatSchema), + esTypes: schema.maybe(schema.arrayOf(schema.string())), + scripted: schema.maybe(schema.boolean()), + subType: schema.maybe( + schema.object({ + multi: schema.maybe( + schema.object({ + parent: schema.string(), + }) + ), + nested: schema.maybe( + schema.object({ + path: schema.string(), + }) + ), + }) + ), + customLabel: schema.maybe(schema.string()), + shortDotsEnable: schema.maybe(schema.boolean()), +}; + +export const fieldSpecSchema = schema.object(fieldSpecSchemaFields); diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index 12ad0dec0ccd1..f5efdad856e08 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -21,7 +21,7 @@ import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from ' import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; import { BfetchServerSetup } from 'src/plugins/bfetch/server'; import { ConfigSchema } from '../config'; -import { IndexPatternsService, IndexPatternsServiceStart } from './index_patterns'; +import { IndexPatternsServiceProvider, IndexPatternsServiceStart } from './index_patterns'; import { ISearchSetup, ISearchStart, SearchEnhancements } from './search'; import { SearchService } from './search/search_service'; import { QueryService } from './query/query_service'; @@ -72,7 +72,7 @@ export class DataServerPlugin private readonly scriptsService: ScriptsService; private readonly kqlTelemetryService: KqlTelemetryService; private readonly autocompleteService: AutocompleteService; - private readonly indexPatterns = new IndexPatternsService(); + private readonly indexPatterns = new IndexPatternsServiceProvider(); private readonly fieldFormats = new FieldFormatsService(); private readonly queryService = new QueryService(); private readonly logger: Logger; @@ -89,11 +89,11 @@ export class DataServerPlugin core: CoreSetup, { bfetch, expressions, usageCollection }: DataPluginSetupDependencies ) { - this.indexPatterns.setup(core, { expressions }); this.scriptsService.setup(core); this.queryService.setup(core); this.autocompleteService.setup(core); this.kqlTelemetryService.setup(core, { usageCollection }); + this.indexPatterns.setup(core, { expressions }); core.uiSettings.register(getUiSettings()); diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 2a3c2738023b7..d5ecea527506e 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -556,7 +556,7 @@ export class IndexPattern implements IIndexPattern { constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps); addScriptedField(name: string, script: string, fieldType?: string): Promise; // (undocumented) - deleteFieldFormat: (fieldName: string) => void; + readonly deleteFieldFormat: (fieldName: string) => void; // Warning: (ae-forgotten-export) The symbol "FieldAttrs" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -649,10 +649,16 @@ export class IndexPattern implements IIndexPattern { metaFields: string[]; removeScriptedField(fieldName: string): void; resetOriginalSavedObjectBody: () => void; + // (undocumented) + protected setFieldAttrs(fieldName: string, attrName: K, value: FieldAttrSet[K]): void; + // (undocumented) + setFieldCount(fieldName: string, count: number | undefined | null): void; + // (undocumented) + setFieldCustomLabel(fieldName: string, customLabel: string | undefined | null): void; // Warning: (ae-forgotten-export) The symbol "SerializedFieldFormat" needs to be exported by the entry point index.d.ts // // (undocumented) - setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; + readonly setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; // Warning: (ae-forgotten-export) The symbol "SourceFilter" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -730,7 +736,7 @@ export class IndexPatternsFetcher { } // Warning: (ae-forgotten-export) The symbol "IndexPatternsServiceStart" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "IndexPatternsService" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "IndexPatternsServiceProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export class IndexPatternsService implements Plugin_3 { @@ -1239,7 +1245,7 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // src/plugins/data/common/es_query/filters/meta_filter.ts:54:3 - (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:58:45 - (ae-forgotten-export) The symbol "IndexPatternFieldMap" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:64:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:135:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:128:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:40:23 - (ae-forgotten-export) The symbol "buildCustomFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:40:23 - (ae-forgotten-export) The symbol "buildFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:57:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/discover/public/application/helpers/popularize_field.ts b/src/plugins/discover/public/application/helpers/popularize_field.ts index 0aea86e47c954..0623ac84c55e1 100644 --- a/src/plugins/discover/public/application/helpers/popularize_field.ts +++ b/src/plugins/discover/public/application/helpers/popularize_field.ts @@ -31,6 +31,7 @@ async function popularizeField( } field.count++; + // Catch 409 errors caused by user adding columns in a higher frequency that the changes can be persisted to Elasticsearch try { await indexPatternsService.updateSavedObject(indexPattern, 0, true); diff --git a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx index c9f5f1fcb4a31..55fc1e6eb521e 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx @@ -200,7 +200,7 @@ describe('FieldEditor', () => { }, }; indexPattern.fieldFormatMap = { test: field }; - indexPattern.deleteFieldFormat = jest.fn(); + (indexPattern.deleteFieldFormat as any) = jest.fn(); const component = createComponentWithContext( FieldEditor, diff --git a/src/plugins/kibana_overview/kibana.json b/src/plugins/kibana_overview/kibana.json index 9ddcaabdaed6b..f09fe0cc16a31 100644 --- a/src/plugins/kibana_overview/kibana.json +++ b/src/plugins/kibana_overview/kibana.json @@ -4,6 +4,6 @@ "server": false, "ui": true, "requiredPlugins": ["navigation", "data", "home"], - "optionalPlugins": ["newsfeed"], + "optionalPlugins": ["newsfeed", "usageCollection"], "requiredBundles": ["kibanaReact", "newsfeed"] } diff --git a/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap b/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap index 42623abd79ac0..25538d2eda287 100644 --- a/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap +++ b/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap @@ -61,6 +61,7 @@ exports[`AddData render 1`] = ` iconType="indexOpen" id="home_tutorial_directory" isBeta={false} + onClick={[Function]} title="Ingest data" url="/app/home#/tutorial_directory" wrapInPanel={true} @@ -76,6 +77,7 @@ exports[`AddData render 1`] = ` iconType="indexManagementApp" id="ingestManager" isBeta={false} + onClick={[Function]} title="Add Elastic Agent" url="/app/ingestManager" wrapInPanel={true} @@ -91,6 +93,7 @@ exports[`AddData render 1`] = ` iconType="document" id="ml_file_data_visualizer" isBeta={false} + onClick={[Function]} title="Upload a file" url="/app/ml#/filedatavisualizer" wrapInPanel={true} diff --git a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx index c04aa9db87ace..6b3aead0391fc 100644 --- a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx @@ -55,6 +55,10 @@ const mockFeatures = [ }, ]; +jest.mock('../../lib/ui_metric', () => ({ + trackUiMetric: jest.fn(), +})); + const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); describe('AddData', () => { diff --git a/src/plugins/kibana_overview/public/components/add_data/add_data.tsx b/src/plugins/kibana_overview/public/components/add_data/add_data.tsx index e29c2a08395cf..acb1cf726a28c 100644 --- a/src/plugins/kibana_overview/public/components/add_data/add_data.tsx +++ b/src/plugins/kibana_overview/public/components/add_data/add_data.tsx @@ -26,6 +26,7 @@ import { RedirectAppLinks, useKibana } from '../../../../../../src/plugins/kiban import { FeatureCatalogueEntry } from '../../../../../../src/plugins/home/public'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; +import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; interface Props { addBasePath: (path: string) => string; @@ -82,6 +83,9 @@ export const AddData: FC = ({ addBasePath, features }) => { title={feature.title} url={addBasePath(feature.path)} wrapInPanel + onClick={() => { + trackUiMetric(METRIC_TYPE.CLICK, `ingest_data_card_${feature.id}`); + }} /> diff --git a/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap b/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap index 4be9e4df6b736..9abb7c9c12147 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap +++ b/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap @@ -41,6 +41,7 @@ exports[`ManageData render 1`] = ` iconType="securityApp" id="security" isBeta={false} + onClick={[Function]} title="Protect your data" url="path-to-security-roles" wrapInPanel={true} @@ -57,6 +58,7 @@ exports[`ManageData render 1`] = ` iconType="monitoringApp" id="monitoring" isBeta={false} + onClick={[Function]} title="Monitor the stack" url="path-to-monitoring" wrapInPanel={true} @@ -73,6 +75,7 @@ exports[`ManageData render 1`] = ` iconType="storage" id="snapshot_restore" isBeta={false} + onClick={[Function]} title="Store & recover backups" url="path-to-snapshot-restore" wrapInPanel={true} @@ -89,6 +92,7 @@ exports[`ManageData render 1`] = ` iconType="indexSettings" id="index_lifecycle_management" isBeta={false} + onClick={[Function]} title="Manage index lifecycles" url="path-to-index-lifecycle-management" wrapInPanel={true} diff --git a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx index 69ef12f217738..e4298aeb191b6 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx @@ -66,6 +66,10 @@ const mockFeatures = [ }, ]; +jest.mock('../../lib/ui_metric', () => ({ + trackUiMetric: jest.fn(), +})); + const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); describe('ManageData', () => { diff --git a/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx b/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx index f7a40b9370efd..5ceff207b2809 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx +++ b/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx @@ -26,6 +26,7 @@ import { RedirectAppLinks, useKibana } from '../../../../../../src/plugins/kiban import { FeatureCatalogueEntry } from '../../../../../../src/plugins/home/public'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; +import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; interface Props { addBasePath: (path: string) => string; @@ -68,6 +69,9 @@ export const ManageData: FC = ({ addBasePath, features }) => { title={feature.title} url={addBasePath(feature.path)} wrapInPanel + onClick={() => { + trackUiMetric(METRIC_TYPE.CLICK, `ingest_data_card_${feature.id}`); + }} /> diff --git a/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap b/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap index 028bf085c8c06..142fe37ae932f 100644 --- a/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap +++ b/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap @@ -204,6 +204,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png" + onClick={[Function]} title="Kibana" titleElement="h3" titleSize="xs" @@ -229,6 +230,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png" + onClick={[Function]} title="Solution two" titleElement="h3" titleSize="xs" @@ -254,6 +256,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png" + onClick={[Function]} title="Solution three" titleElement="h3" titleSize="xs" @@ -279,6 +282,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png" + onClick={[Function]} title="Solution four" titleElement="h3" titleSize="xs" @@ -358,6 +362,8 @@ exports[`Overview render 1`] = ` ], } } + onChangeDefaultRoute={[Function]} + onSetDefaultRoute={[Function]} path="/app/kibana_overview" /> @@ -624,6 +630,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png" + onClick={[Function]} title="Kibana" titleElement="h3" titleSize="xs" @@ -649,6 +656,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png" + onClick={[Function]} title="Solution two" titleElement="h3" titleSize="xs" @@ -674,6 +682,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png" + onClick={[Function]} title="Solution three" titleElement="h3" titleSize="xs" @@ -699,6 +708,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png" + onClick={[Function]} title="Solution four" titleElement="h3" titleSize="xs" @@ -834,6 +844,8 @@ exports[`Overview without features 1`] = ` ], } } + onChangeDefaultRoute={[Function]} + onSetDefaultRoute={[Function]} path="/app/kibana_overview" /> @@ -1215,6 +1227,8 @@ exports[`Overview without solutions 1`] = ` ], } } + onChangeDefaultRoute={[Function]} + onSetDefaultRoute={[Function]} path="/app/kibana_overview" /> diff --git a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx index 07c3a6e69c15c..9748c60776330 100644 --- a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx +++ b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx @@ -36,6 +36,10 @@ jest.mock('../../../../../../src/plugins/kibana_react/public', () => ({ OverviewPageHeader: jest.fn().mockReturnValue(<>), })); +jest.mock('../../lib/ui_metric', () => ({ + trackUiMetric: jest.fn(), +})); + afterAll(() => jest.clearAllMocks()); const mockNewsFetchResult = { diff --git a/src/plugins/kibana_overview/public/components/overview/overview.tsx b/src/plugins/kibana_overview/public/components/overview/overview.tsx index c951c01aa361e..0a2bcda7ebb15 100644 --- a/src/plugins/kibana_overview/public/components/overview/overview.tsx +++ b/src/plugins/kibana_overview/public/components/overview/overview.tsx @@ -49,6 +49,7 @@ import { AddData } from '../add_data'; import { GettingStarted } from '../getting_started'; import { ManageData } from '../manage_data'; import { NewsFeed } from '../news_feed'; +import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; const sortByOrder = (featureA: FeatureCatalogueEntry, featureB: FeatureCatalogueEntry) => (featureA.order || Infinity) - (featureB.order || Infinity); @@ -108,6 +109,9 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) => { + trackUiMetric(METRIC_TYPE.CLICK, `app_card_${appId}`); + }} image={addBasePath( `/plugins/${PLUGIN_ID}/assets/kibana_${appId}_${IS_DARK_THEME ? 'dark' : 'light'}.svg` )} @@ -222,6 +226,9 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) => title={title} titleElement="h3" titleSize="xs" + onClick={() => { + trackUiMetric(METRIC_TYPE.CLICK, `solution_panel_${id}`); + }} /> @@ -252,7 +259,16 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) =>