diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index b3df19804bc..7f30b79234a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -27,7 +27,7 @@ jobs: - name: Python Lint run: | - python -m flake8 tests detection_rules --ignore D203 --max-line-length 120 + python -m flake8 tests detection_rules esql --ignore D203 --max-line-length 120 --exclude="esql/generated/*.py" - name: Python License Check run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58347fc9b5d..d1c67bfefde 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: rev: 5.0.4 hooks: - id: flake8 - args: ['--ignore=D203,C901,E501,W503', '--max-line-length=120','--max-complexity=10', '--statistics'] + args: ['--ignore=D203,C901,E501,W503', '--max-line-length=120','--max-complexity=10', '--statistics', '--exclude="esql/generated/*.py"'] exclude: '^rta|^kql' - repo: https://github.com/PyCQA/bandit rev: 1.7.4 diff --git a/Makefile b/Makefile index d61e611ba28..9d9028ebe32 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ license-check: $(VENV) deps .PHONY: lint lint: $(VENV) deps @echo "LINTING" - $(PYTHON) -m flake8 tests detection_rules --ignore D203 --max-line-length 120 + $(PYTHON) -m flake8 tests detection_rules esql --ignore D203 --max-line-length 120 --exclude="esql/generated/*.py" .PHONY: test test: $(VENV) lint pytest diff --git a/detection_rules/devtools.py b/detection_rules/devtools.py index ba3f2c63cdc..65ac3047a28 100644 --- a/detection_rules/devtools.py +++ b/detection_rules/devtools.py @@ -58,6 +58,7 @@ from .version_lock import VersionLockFile, default_version_lock RULES_DIR = get_path('rules') +ESQL_DIR = get_path('esql') GH_CONFIG = Path.home() / ".config" / "gh" / "hosts.yml" NAVIGATOR_GIST_ID = '1a3f65224822a30a8228a8ed20289a89' NAVIGATOR_URL = 'https://ela.st/detection-rules-navigator' @@ -1488,3 +1489,77 @@ def guide_plugin_to_rule(ctx: click.Context, rule_path: Path, save: bool = True) updated_rule.save_toml() return updated_rule + + +@dev_group.group('esql') +def esql_group(): + """Commands for managing ESQL library.""" + + +@esql_group.command('pull-grammar') +@click.option('--token', required=True, prompt=get_github_token() is None, + default=get_github_token(), help='GitHub personal access token.') +@click.option('--version', required=True, help='Version of the ESQL grammar to pull (e.g., 8.11.0).') +@click.pass_context +def pull_grammar(ctx: click.Context, token: str, version: str, branch: str = 'esql/lang'): + """Pull the ESQL grammar from the specified repository.""" + github = GithubClient(token) + client = github.authenticated_client + repo_instance = client.get_repo('elastic/elasticsearch-internal') + + formatted_version = f"v{'_'.join(version.split('.'))}" + grammar_dir = Path(ESQL_DIR) / "grammar" / formatted_version + grammar_dir.mkdir(parents=True, exist_ok=True) + + for filename, path in definitions.ELASTICSEARCH_ESQL_GRAMMAR_PATHS.items(): + try: + file_content = repo_instance.get_contents(path, ref=branch).decoded_content.decode("utf-8") + + # Write content to file + with open(grammar_dir / filename, 'w') as file: + file.write(file_content) + + click.echo(f"Successfully downloaded {filename}.") + + except Exception as e: + click.echo(f"Failed to download {filename}. Error: {e}") + + +@esql_group.command('build-parser') +@click.option('--version', required=True, help='Version of the ESQL grammar to build (e.g., 8.11.0).') +@click.pass_context +def build_parser(antlr_jar: str, version: str): + """Build the ESQL parser using ANTLR.""" + # Define paths + formatted_version = f"v{'_'.join(version.split('.'))}" + grammar_dir = Path(ESQL_DIR) / 'grammar' / formatted_version + lexer_file = grammar_dir / 'EsqlBaseLexer.g4' + parser_file = grammar_dir / 'EsqlBaseParser.g4' + output_dir = Path(ESQL_DIR) / 'generated' / formatted_version + + # Ensure files exist + if not lexer_file.exists() or not parser_file.exists(): + click.echo("Error: Required grammar files are missing.") + return + + # Create the output directory if it doesn't exist + output_dir.mkdir(parents=True, exist_ok=True) + + # Use the antlr4 binary installed with the python dependencies to generate parser and lexer + cmd_common = [ + "antlr4", + "-Dlanguage=Python3", + "-o", str(output_dir) + ] + cmd_lexer = cmd_common + [str(lexer_file)] + cmd_parser = cmd_common + [str(parser_file)] + + try: + subprocess.run(cmd_lexer, check=True, cwd=grammar_dir) + subprocess.run(cmd_parser, check=True, cwd=grammar_dir) + + # Create __init__.py file in the generated directory + (output_dir / '__init__.py').touch() + click.echo("ES|QL parser and lexer generated successfully.") + except subprocess.CalledProcessError: + click.echo("Failed to generate ES|QLparser and lexer.") diff --git a/detection_rules/ecs.py b/detection_rules/ecs.py index 1418c964794..7952a1a94aa 100644 --- a/detection_rules/ecs.py +++ b/detection_rules/ecs.py @@ -19,6 +19,7 @@ from .utils import (DateTimeEncoder, cached, get_etc_path, gzip_compress, load_etc_dump, read_gzip, unzip) +from .integrations import get_integration_schema_data ECS_NAME = "ecs_schemas" ECS_SCHEMAS_DIR = get_etc_path(ECS_NAME) @@ -321,3 +322,26 @@ def get_endpoint_schemas() -> dict: for f in existing: schema.update(json.loads(read_gzip(f))) return schema + + +def get_combined_schemas(data, meta, package_integrations, indices=[]): + """Get the schemas for ECS, beats and integrations""" + # TODO: Revisit and update to account for all validator classes + # validate_integration methods have redundant code + current_stack_version = "" + combined_schema = {} + for integration_schema_data in get_integration_schema_data(data, meta, package_integrations): + integration_schema = integration_schema_data['schema'] + stack_version = integration_schema_data['stack_version'] + + if stack_version != current_stack_version: + # reset the combined schema for each stack version + current_stack_version = stack_version + combined_schema = {} + + if indices: + for index_name in indices: + integration_schema.update(**flatten(get_index_schema(index_name))) + integration_schema.update(**flatten(get_endpoint_schemas())) + combined_schema.update(**integration_schema) + return combined_schema diff --git a/detection_rules/rule.py b/detection_rules/rule.py index 730d9f45ca6..975fa41c4e9 100644 --- a/detection_rules/rule.py +++ b/detection_rules/rule.py @@ -604,20 +604,6 @@ def validates_query_data(self, data, **kwargs): raise ValidationError("Alert suppression is only valid for query rule type.") -@dataclass(frozen=True) -class ESQLRuleData(QueryRuleData): - """ESQL rules are a special case of query rules.""" - type: Literal["esql"] - language: Literal["esql"] - query: str - - @validates_schema - def validate_esql_data(self, data, **kwargs): - """Custom validation for esql rule type.""" - if data.get('index'): - raise ValidationError("Index is not valid for esql rule type.") - - @dataclass(frozen=True) class MachineLearningRuleData(BaseRuleData): type: Literal["machine_learning"] @@ -730,6 +716,20 @@ def interval_ratio(self) -> Optional[float]: return interval / self.max_span +@dataclass(frozen=True) +class ESQLRuleData(QueryRuleData): + """ESQL rules are a special case of query rules.""" + type: Literal["esql"] + language: Literal["esql"] + query: str + + @validates_schema + def validate_esql_data(self, data, **kwargs): + """Custom validation for esql rule type.""" + if data.get('index'): + raise ValidationError("Index is not valid for esql rule type.") + + @dataclass(frozen=True) class ThreatMatchRuleData(QueryRuleData): """Specific fields for indicator (threat) match rule.""" @@ -979,6 +979,7 @@ def _convert_add_related_integrations(self, obj: dict) -> None: """Add restricted field related_integrations to the obj.""" field_name = "related_integrations" package_integrations = obj.get(field_name, []) + event_dataset = [] if not package_integrations and self.metadata.integration: packages_manifest = load_integrations_manifests() @@ -988,8 +989,10 @@ def _convert_add_related_integrations(self, obj: dict) -> None: if (isinstance(self.data, QueryRuleData) or isinstance(self.data, MachineLearningRuleData)): if (self.data.get('language') is not None and self.data.get('language') != 'lucene') or \ self.data.get('type') == 'machine_learning': + if isinstance(self.data, ESQLRuleData): + event_dataset = list(set(self.data.validator.event_datasets)) package_integrations = self.get_packaged_integrations(self.data, self.metadata, - packages_manifest) + packages_manifest, event_dataset) if not package_integrations: return @@ -1096,9 +1099,9 @@ def compare_field_versions(min_stack: Version, max_stack: Version) -> bool: @classmethod def get_packaged_integrations(cls, data: QueryRuleData, meta: RuleMeta, - package_manifest: dict) -> Optional[List[dict]]: + package_manifest: dict, datasets: list = []) -> Optional[List[dict]]: packaged_integrations = [] - datasets = set() + datasets = set(datasets) if data.type != "esql": for node in data.get('ast', []): diff --git a/detection_rules/rule_validators.py b/detection_rules/rule_validators.py index ea9185b072f..d358124e1b6 100644 --- a/detection_rules/rule_validators.py +++ b/detection_rules/rule_validators.py @@ -4,19 +4,28 @@ # 2.0. """Validation logic for rules containing queries.""" +import sys from functools import cached_property -from typing import List, Optional, Union, Tuple -from semver import Version +from io import StringIO +from typing import List, Optional, Tuple, Union import eql +from antlr4 import Parser, ParserRuleContext, ParseTreeWalker +from semver import Version import kql +from esql.errors import ESQLErrorListener, ESQLSyntaxError +from esql.iesql_listener import ESQLListenerFactory, IESQLListener +from esql.iesql_parser import ESQLParserFactory +from esql.utils import get_node, pretty_print_tree from . import ecs, endgame -from .integrations import get_integration_schema_data, load_integrations_manifests +from .integrations import (get_integration_schema_data, + load_integrations_manifests) from .misc import load_current_package_version +from .rule import (EQLRuleData, QueryRuleData, QueryValidator, RuleMeta, + TOMLRuleContents, set_eql_config) from .schemas import get_stack_schemas -from .rule import QueryRuleData, QueryValidator, RuleMeta, TOMLRuleContents, EQLRuleData, set_eql_config EQL_ERROR_TYPES = Union[eql.EqlCompileError, eql.EqlError, @@ -348,22 +357,104 @@ def validate_rule_type_configurations(self, data: EQLRuleData, meta: RuleMeta) - class ESQLValidator(QueryValidator): """Validate specific fields for ESQL query event types.""" + field_list = [] + event_datasets = [] + min_stack_version = None @cached_property - def ast(self): + def ast(self) -> ParserRuleContext: """Return an AST.""" - return None + # Capture stderr + original_stderr = sys.stderr + sys.stderr = StringIO() + + try: + tree = self.parser.singleStatement() + + # Check for errors captured by the custom error listener + if self.error_listener.errors: + + # Check for additional errors (like predictive errors usually printed to stderr) + stderr_output = sys.stderr.getvalue() + error_message = "\n".join(self.error_listener.errors) + raise ESQLSyntaxError(f"\n\n{stderr_output}{error_message}") + finally: + # Restore the original stderr + sys.stderr = original_stderr + return tree + + @cached_property + def listener(self) -> IESQLListener: + """Return a listener instance.""" + if Version.parse(self.min_stack_version) >= Version.parse("8.11.0"): + version = self.min_stack_version + return ESQLListenerFactory.getListener(version) + else: + raise ValueError(f"Unsupported ES|QL grammar version {self.min_stack_version}") + + def run_walker(self, ctx_class=None): + """Walk the AST with the listener.""" + generic_walker = ParseTreeWalker() + tree = self.ast + + if ctx_class: + ctx_objs = get_node(tree, ctx_class) + if not ctx_objs: + # warning message + print(f"Warning: Could not find {ctx_class} in {tree}") + if ctx_objs: + for ctx_obj in ctx_objs: + generic_walker.enterRule(self.listener, ctx_obj) + generic_walker.exitRule(self.listener, ctx_obj) + else: + generic_walker.walk(self.listener, tree) + + @cached_property + def parser(self) -> Parser: + """Return a parser instance.""" + return ESQLParserFactory.createParser(self.query, self.min_stack_version) + + @cached_property + def error_listener(self) -> ESQLErrorListener: + """Return an error listener instance.""" + + # Attach the custom error listener + self.parser.removeErrorListeners() + error_listener = ESQLErrorListener() + self.parser.addErrorListener(error_listener) + return error_listener @cached_property def unique_fields(self) -> List[str]: """Return a list of unique fields in the query.""" - # return empty list for ES|QL rules until ast is available (friendlier than raising error) - # raise NotImplementedError('ES|QL query parsing not yet supported') - return [] + # return empty list for ES|QL rules until ast is available + return set(self.field_list) def validate(self, data: 'QueryRuleData', meta: RuleMeta) -> None: """Validate an ESQL query while checking TOMLRule.""" - # temporarily override to NOP until ES|QL query parsing is supported + + self.min_stack_version = meta.min_stack_version + if Version.parse(meta.min_stack_version) < Version.parse("8.11.0"): + raise ESQLSyntaxError(f"Rule minstack must be greater than 8.10.0 {data.rule_id}") + + # Traverse the AST to extract event datasets + self.run_walker(self.parser.BooleanDefaultContext) + + tree = self.ast + pretty_print_tree(tree) + + # get event datasets + self.event_datasets = self.listener.event_datasets + self.field_list = self.listener.field_list + + # Create an instance of the listener with schema + packages_manifest = load_integrations_manifests() + package_integrations = TOMLRuleContents.get_packaged_integrations(data, meta, packages_manifest, + self.event_datasets) + combined_schemas = ecs.get_combined_schemas(data, meta, package_integrations) + self.listener.schema = combined_schemas + self.run_walker() + print("Validation completed successfully.") def extract_error_field(exc: Union[eql.EqlParseError, kql.KqlParseError]) -> Optional[str]: diff --git a/detection_rules/schemas/definitions.py b/detection_rules/schemas/definitions.py index 240d3f8bda8..70113cb6e94 100644 --- a/detection_rules/schemas/definitions.py +++ b/detection_rules/schemas/definitions.py @@ -33,6 +33,12 @@ "allow_sample": (Version.parse('8.6.0'), None), "elasticsearch_validate_optional_fields": (Version.parse('7.16.0'), None) } +ELASTICSEARCH_ESQL_GRAMMAR_PATHS = { + "EsqlBaseLexer.g4": "x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4", + "EsqlBaseParser.g4": "x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4", + "EsqlBaseLexer.tokens": "x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens", + "EsqlBaseParser.tokens": "x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.tokens" +} NON_DATASET_PACKAGES = ['apm', 'endpoint', 'system', 'windows', 'cloud_defend', 'network_traffic'] NON_PUBLIC_FIELDS = { "related_integrations": (Version.parse('8.3.0'), None), diff --git a/esql/__init__.py b/esql/__init__.py new file mode 100644 index 00000000000..72ea1f6e244 --- /dev/null +++ b/esql/__init__.py @@ -0,0 +1,4 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. diff --git a/esql/errors.py b/esql/errors.py new file mode 100644 index 00000000000..4528c0bd219 --- /dev/null +++ b/esql/errors.py @@ -0,0 +1,39 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. + +"""Custom error handling for ESQL.""" +from antlr4.error.ErrorListener import ErrorListener + + +class ESQLSyntaxError(Exception): + """Exception raised for syntax errors of an ESQL query.""" + + def __init__(self, message): + """Initialize the custom syntax ESQL exception.""" + message = f"ESQL syntax error: {message}" + super().__init__(message) + print(message) + + +class ESQLSemanticError(Exception): + """Exception raised for semantic errors of an ESQL query.""" + + def __init__(self, message): + """Initialize the custom semantic ESQL exception.""" + message = f"ESQL semantic error: {message}" + super().__init__(message) + print(message) + + +class ESQLErrorListener(ErrorListener): + """Custom error listener for ESQL.""" + def __init__(self): + """Initialize the custom error listener.""" + super().__init__() + self.errors = [] + + def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e): # noqa: N802,N803 + """Handle syntax errors.""" + self.errors.append(f"Line {line}:{column} {msg}") diff --git a/esql/esql_listener_v8_11_0_adapter.py b/esql/esql_listener_v8_11_0_adapter.py new file mode 100644 index 00000000000..1bce96d1d90 --- /dev/null +++ b/esql/esql_listener_v8_11_0_adapter.py @@ -0,0 +1,216 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. + +"""Adapter for 8.11.0 ESQL listener.""" +from antlr4 import ParserRuleContext + +from esql.errors import ESQLSemanticError +from esql.generated.v8_11_0.EsqlBaseParser import EsqlBaseParser +from esql.generated.v8_11_0.EsqlBaseParserListener import EsqlBaseParserListener +from esql.iesql_listener import IESQLListener +from esql.utils import get_node + + +class ESQLListenerV8_11_0Adapter(IESQLListener, EsqlBaseParserListener): # noqa: N801 + """Validate specific fields for ESQL query event types.""" + + def __init__(self, schema: dict = {}): + """Initialize the listener with a schema.""" + self.schema = schema # schema is a dictionary of field names and types + self.field_list = [] # list of fields used in the query + self.indices = [] # indices used in the query (e.g. 'logs-*') + self.event_datasets = [] # event.dataset field values used in the query + + def enterQualifiedName(self, ctx: EsqlBaseParser.QualifiedNameContext): # noqa: N802 + """Extract field from context (ctx).""" + + # Check if a field can be set in any processing command and ignore these parents + if ( + not isinstance(ctx.parentCtx, EsqlBaseParser.EvalCommandContext) # noqa: W503 + and not isinstance(ctx.parentCtx, EsqlBaseParser.MetadataContext) # noqa: W503 + and not isinstance( # noqa: W503 + ctx.parentCtx.parentCtx.parentCtx, EsqlBaseParser.StatsCommandContext + ) + ): + field = ctx.getText() + self.field_list.append(field) + + if self.schema and field not in self.schema: + raise ESQLSemanticError(f"Invalid field: {field}") + + def enterSourceIdentifier(self, ctx: EsqlBaseParser.SourceIdentifierContext): # noqa: N802 + """Extract index and fields from context (ctx).""" + + # Check if the parent context is NOT 'FromCommandContext' + if ( + not isinstance(ctx.parentCtx, EsqlBaseParser.FromCommandContext) # noqa: W503 + and not isinstance(ctx.parentCtx, EsqlBaseParser.MetadataContext) # noqa: W503 + and not isinstance( # noqa: W503 + ctx.parentCtx.parentCtx.parentCtx, EsqlBaseParser.StatsCommandContext + ) + ): + # Extract field from context (ctx) + # The implementation depends on your parse tree structure + # For example, if the field name is directly the text of this context: + field = ctx.getText() + self.field_list.append(field) + + if self.schema and field not in self.schema: + raise ESQLSemanticError(f"Invalid field: {field}") + else: + # check index against integrations? + self.indices.append(ctx.getText()) + + def enterSingleStatement(self, ctx: EsqlBaseParser.SingleStatementContext): # noqa: N802 + """Override entry method for SingleStatementContext.""" + + # check if metadata is present for ES|QL queries with no stats command + metadata_ctx = get_node(ctx, EsqlBaseParser.MetadataContext) + if not metadata_ctx: + stats_ctx = get_node(ctx, EsqlBaseParser.StatsCommandContext) + if not stats_ctx: + raise ESQLSemanticError("Missing metadata for ES|QL query with no stats command") + + def check_literal_type(self, ctx: ParserRuleContext): + """Check the type of a literal against the schema.""" + field, context_type = self.find_associated_field_and_context(ctx) + + if field and field in self.schema: + expected_type = self.schema[field] + actual_type = self.get_literal_type(ctx, context_type) + + if expected_type != actual_type: + raise ESQLSemanticError( + f"Field '{field}' in context '{context_type}'" + f"expects type '{expected_type}', but got '{actual_type}'" + ) + + def find_associated_field_and_context(self, ctx: ParserRuleContext): + """Find the field and context type associated with a literal.""" + parent_ctx = ctx.parentCtx + while parent_ctx: + if isinstance(parent_ctx, EsqlBaseParser.ComparisonContext): + field_ctx = parent_ctx.operatorExpression(0).getChild(0) + field = field_ctx.getText() if field_ctx else None + return field, "Comparison" + elif isinstance(parent_ctx, EsqlBaseParser.LogicalInContext): + field_ctx = parent_ctx.valueExpression(0).getChild(0) + return field_ctx.getText() if field_ctx else None, "LogicalIn" + elif isinstance(parent_ctx, EsqlBaseParser.RegexBooleanExpressionContext): + field_ctx = parent_ctx.valueExpression().getChild(0) + return field_ctx.getText() if field_ctx else None, "RegexBoolean" + elif isinstance(parent_ctx, EsqlBaseParser.FunctionExpressionContext): + # Handling function expressions + field_ctx = parent_ctx.identifier() + field = field_ctx.getText() if field_ctx else None + return field, "FunctionExpression" + elif isinstance(parent_ctx, EsqlBaseParser.ArithmeticBinaryContext): + # Handling arithmetic binary operations + field_ctx = parent_ctx.operatorExpression(0).getChild(0) + field = field_ctx.getText() if field_ctx else None + return field, "ArithmeticBinary" + elif isinstance(parent_ctx, EsqlBaseParser.OrderExpressionContext): + # Handling order by expressions + field_ctx = parent_ctx.booleanExpression().getChild(0) + field = field_ctx.getText() if field_ctx else None + return field, "OrderExpression" + # TODO: Add more conditions for other contexts as necessary + parent_ctx = parent_ctx.parentCtx + return None, None + + def get_literal_type(self, ctx: ParserRuleContext, context_type: str): + """Get the type of a literal.""" + # Determine the type of the literal based on the context type + # https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html + if context_type in ["Comparison", "LogicalIn", "RegexBoolean", + "FunctionExpression", "ArithmeticBinary", "OrderExpression"]: + if isinstance(ctx, EsqlBaseParser.StringLiteralContext): + return "keyword" # or 'text'?, depending on usage + elif isinstance(ctx, EsqlBaseParser.IntegerLiteralContext): + return "integer" + elif isinstance(ctx, EsqlBaseParser.QualifiedIntegerLiteralContext): + return "long" # Assuming qualified integers are longs + elif isinstance(ctx, EsqlBaseParser.DecimalLiteralContext): + return "double" + elif isinstance(ctx, EsqlBaseParser.BooleanLiteralContext): + return "boolean" + elif isinstance(ctx, EsqlBaseParser.NullLiteralContext): + return "null" # 'null' type for missing or null values + elif ( + isinstance(ctx, EsqlBaseParser.NumericArrayLiteralContext) + or isinstance(ctx, EsqlBaseParser.StringArrayLiteralContext) # noqa: W503 + or isinstance(ctx, EsqlBaseParser.BooleanArrayLiteralContext) # noqa: W503 + ): + return "nested" # Array of integers, text, or booleans + else: + # Unsupported ECS types in the grammar: + # match_only_text + # constant_keyword + # unsigned_long + # binary + # histogram + # scaled_float + # half_float + # text + # alias + # array + # float + # wildcard + # short + # ip + # object + # flattened + # byte + # geo_point + # date + return "unknown" + + # Override methods to use check_literal_type + def enterNullLiteral(self, ctx: EsqlBaseParser.NullLiteralContext): # noqa: N802 + """Check the type of a null literal against the schema.""" + self.check_literal_type(ctx) + + def enterQualifiedIntegerLiteral(self, ctx: EsqlBaseParser.QualifiedIntegerLiteralContext): # noqa: N802 + """Check the type of a qualified integer literal against the schema.""" + self.check_literal_type(ctx) + + def enterDecimalLiteral(self, ctx: EsqlBaseParser.DecimalLiteralContext): # noqa: N802 + """Check the type of a decimal literal against the schema.""" + self.check_literal_type(ctx) + + def enterIntegerLiteral(self, ctx: EsqlBaseParser.IntegerLiteralContext): # noqa: N802 + """Check the type of an integer literal against the schema.""" + self.check_literal_type(ctx) + + def enterBooleanLiteral(self, ctx: EsqlBaseParser.BooleanLiteralContext): # noqa: N802 + """Check the type of a boolean literal against the schema.""" + self.check_literal_type(ctx) + + def enterStringLiteral(self, ctx: EsqlBaseParser.StringLiteralContext): # noqa: N802 + """Check the type of a string literal against the schema.""" + self.check_literal_type(ctx) + + def enterNumericArrayLiteral(self, ctx: EsqlBaseParser.NumericArrayLiteralContext): # noqa: N802 + """Check the type of a numeric array literal against the schema.""" + self.check_literal_type(ctx) + + def enterBooleanArrayLiteral(self, ctx: EsqlBaseParser.BooleanArrayLiteralContext): # noqa: N802 + """Check the type of a boolean array literal against the schema.""" + self.check_literal_type(ctx) + + def enterStringArrayLiteral(self, ctx: EsqlBaseParser.StringArrayLiteralContext): # noqa: N802 + """Check the type of a string array literal against the schema.""" + self.check_literal_type(ctx) + + def enterBooleanDefault(self, ctx: EsqlBaseParser.BooleanDefaultContext): # noqa: N802 + """Check the type of a boolean default context against the schema.""" + self.check_literal_type(ctx) + + # extract event datasets + value = ctx.getText() + if "event.dataset" in value: + string_nodes = get_node(ctx, EsqlBaseParser.StringLiteralContext) + for node in string_nodes: + self.event_datasets.append(node.getText().strip('"')) diff --git a/esql/generated/__init__.py b/esql/generated/__init__.py new file mode 100644 index 00000000000..ba92cb5cb52 --- /dev/null +++ b/esql/generated/__init__.py @@ -0,0 +1,4 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. \ No newline at end of file diff --git a/esql/generated/v8_11_0/EsqlBaseLexer.interp b/esql/generated/v8_11_0/EsqlBaseLexer.interp new file mode 100644 index 00000000000..cba4b4514d3 --- /dev/null +++ b/esql/generated/v8_11_0/EsqlBaseLexer.interp @@ -0,0 +1,272 @@ +token literal names: +null +'dissect' +'drop' +'enrich' +'eval' +'explain' +'from' +'grok' +'inlinestats' +'keep' +'limit' +'mv_expand' +'project' +'rename' +'row' +'show' +'sort' +'stats' +'where' +null +null +null +null +null +null +null +null +null +null +null +'by' +'and' +'asc' +null +null +'desc' +'.' +'false' +'first' +'last' +'(' +'in' +'like' +'not' +'null' +'nulls' +'or' +'?' +'rlike' +')' +'true' +'info' +'functions' +'==' +'!=' +'<' +'<=' +'>' +'>=' +'+' +'-' +'*' +'/' +'%' +null +']' +null +null +null +null +null +'as' +'metadata' +'on' +'with' +null +null +null +null +null +null + +token symbolic names: +null +DISSECT +DROP +ENRICH +EVAL +EXPLAIN +FROM +GROK +INLINESTATS +KEEP +LIMIT +MV_EXPAND +PROJECT +RENAME +ROW +SHOW +SORT +STATS +WHERE +UNKNOWN_CMD +LINE_COMMENT +MULTILINE_COMMENT +WS +EXPLAIN_WS +EXPLAIN_LINE_COMMENT +EXPLAIN_MULTILINE_COMMENT +PIPE +STRING +INTEGER_LITERAL +DECIMAL_LITERAL +BY +AND +ASC +ASSIGN +COMMA +DESC +DOT +FALSE +FIRST +LAST +LP +IN +LIKE +NOT +NULL +NULLS +OR +PARAM +RLIKE +RP +TRUE +INFO +FUNCTIONS +EQ +NEQ +LT +LTE +GT +GTE +PLUS +MINUS +ASTERISK +SLASH +PERCENT +OPENING_BRACKET +CLOSING_BRACKET +UNQUOTED_IDENTIFIER +QUOTED_IDENTIFIER +EXPR_LINE_COMMENT +EXPR_MULTILINE_COMMENT +EXPR_WS +AS +METADATA +ON +WITH +SRC_UNQUOTED_IDENTIFIER +SRC_QUOTED_IDENTIFIER +SRC_LINE_COMMENT +SRC_MULTILINE_COMMENT +SRC_WS +EXPLAIN_PIPE + +rule names: +DISSECT +DROP +ENRICH +EVAL +EXPLAIN +FROM +GROK +INLINESTATS +KEEP +LIMIT +MV_EXPAND +PROJECT +RENAME +ROW +SHOW +SORT +STATS +WHERE +UNKNOWN_CMD +LINE_COMMENT +MULTILINE_COMMENT +WS +EXPLAIN_OPENING_BRACKET +EXPLAIN_PIPE +EXPLAIN_WS +EXPLAIN_LINE_COMMENT +EXPLAIN_MULTILINE_COMMENT +PIPE +DIGIT +LETTER +ESCAPE_SEQUENCE +UNESCAPED_CHARS +EXPONENT +STRING +INTEGER_LITERAL +DECIMAL_LITERAL +BY +AND +ASC +ASSIGN +COMMA +DESC +DOT +FALSE +FIRST +LAST +LP +IN +LIKE +NOT +NULL +NULLS +OR +PARAM +RLIKE +RP +TRUE +INFO +FUNCTIONS +EQ +NEQ +LT +LTE +GT +GTE +PLUS +MINUS +ASTERISK +SLASH +PERCENT +OPENING_BRACKET +CLOSING_BRACKET +UNQUOTED_IDENTIFIER +QUOTED_IDENTIFIER +EXPR_LINE_COMMENT +EXPR_MULTILINE_COMMENT +EXPR_WS +SRC_PIPE +SRC_OPENING_BRACKET +SRC_CLOSING_BRACKET +SRC_COMMA +SRC_ASSIGN +AS +METADATA +ON +WITH +SRC_UNQUOTED_IDENTIFIER +SRC_UNQUOTED_IDENTIFIER_PART +SRC_QUOTED_IDENTIFIER +SRC_LINE_COMMENT +SRC_MULTILINE_COMMENT +SRC_WS + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE +EXPLAIN_MODE +EXPRESSION +SOURCE_IDENTIFIERS + +atn: +[4, 0, 80, 759, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 4, 18, 343, 8, 18, 11, 18, 12, 18, 344, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 353, 8, 19, 10, 19, 12, 19, 356, 9, 19, 1, 19, 3, 19, 359, 8, 19, 1, 19, 3, 19, 362, 8, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 371, 8, 20, 10, 20, 12, 20, 374, 9, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 4, 21, 382, 8, 21, 11, 21, 12, 21, 383, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 3, 32, 425, 8, 32, 1, 32, 4, 32, 428, 8, 32, 11, 32, 12, 32, 429, 1, 33, 1, 33, 1, 33, 5, 33, 435, 8, 33, 10, 33, 12, 33, 438, 9, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 5, 33, 446, 8, 33, 10, 33, 12, 33, 449, 9, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 456, 8, 33, 1, 33, 3, 33, 459, 8, 33, 3, 33, 461, 8, 33, 1, 34, 4, 34, 464, 8, 34, 11, 34, 12, 34, 465, 1, 35, 4, 35, 469, 8, 35, 11, 35, 12, 35, 470, 1, 35, 1, 35, 5, 35, 475, 8, 35, 10, 35, 12, 35, 478, 9, 35, 1, 35, 1, 35, 4, 35, 482, 8, 35, 11, 35, 12, 35, 483, 1, 35, 4, 35, 487, 8, 35, 11, 35, 12, 35, 488, 1, 35, 1, 35, 5, 35, 493, 8, 35, 10, 35, 12, 35, 496, 9, 35, 3, 35, 498, 8, 35, 1, 35, 1, 35, 1, 35, 1, 35, 4, 35, 504, 8, 35, 11, 35, 12, 35, 505, 1, 35, 1, 35, 3, 35, 510, 8, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 5, 72, 649, 8, 72, 10, 72, 12, 72, 652, 9, 72, 1, 72, 1, 72, 1, 72, 1, 72, 4, 72, 658, 8, 72, 11, 72, 12, 72, 659, 3, 72, 662, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 5, 73, 668, 8, 73, 10, 73, 12, 73, 671, 9, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 4, 86, 733, 8, 86, 11, 86, 12, 86, 734, 1, 87, 4, 87, 738, 8, 87, 11, 87, 12, 87, 739, 1, 87, 1, 87, 3, 87, 744, 8, 87, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 2, 372, 447, 0, 92, 4, 1, 6, 2, 8, 3, 10, 4, 12, 5, 14, 6, 16, 7, 18, 8, 20, 9, 22, 10, 24, 11, 26, 12, 28, 13, 30, 14, 32, 15, 34, 16, 36, 17, 38, 18, 40, 19, 42, 20, 44, 21, 46, 22, 48, 0, 50, 80, 52, 23, 54, 24, 56, 25, 58, 26, 60, 0, 62, 0, 64, 0, 66, 0, 68, 0, 70, 27, 72, 28, 74, 29, 76, 30, 78, 31, 80, 32, 82, 33, 84, 34, 86, 35, 88, 36, 90, 37, 92, 38, 94, 39, 96, 40, 98, 41, 100, 42, 102, 43, 104, 44, 106, 45, 108, 46, 110, 47, 112, 48, 114, 49, 116, 50, 118, 51, 120, 52, 122, 53, 124, 54, 126, 55, 128, 56, 130, 57, 132, 58, 134, 59, 136, 60, 138, 61, 140, 62, 142, 63, 144, 64, 146, 65, 148, 66, 150, 67, 152, 68, 154, 69, 156, 70, 158, 0, 160, 0, 162, 0, 164, 0, 166, 0, 168, 71, 170, 72, 172, 73, 174, 74, 176, 75, 178, 0, 180, 76, 182, 77, 184, 78, 186, 79, 4, 0, 1, 2, 3, 13, 6, 0, 9, 10, 13, 13, 32, 32, 47, 47, 91, 91, 93, 93, 2, 0, 10, 10, 13, 13, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 5, 0, 34, 34, 92, 92, 110, 110, 114, 114, 116, 116, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 2, 0, 69, 69, 101, 101, 2, 0, 43, 43, 45, 45, 2, 0, 64, 64, 95, 95, 1, 0, 96, 96, 10, 0, 9, 10, 13, 13, 32, 32, 44, 44, 47, 47, 61, 61, 91, 91, 93, 93, 96, 96, 124, 124, 2, 0, 42, 42, 47, 47, 787, 0, 4, 1, 0, 0, 0, 0, 6, 1, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 10, 1, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 14, 1, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 26, 1, 0, 0, 0, 0, 28, 1, 0, 0, 0, 0, 30, 1, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 34, 1, 0, 0, 0, 0, 36, 1, 0, 0, 0, 0, 38, 1, 0, 0, 0, 0, 40, 1, 0, 0, 0, 0, 42, 1, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0, 46, 1, 0, 0, 0, 1, 48, 1, 0, 0, 0, 1, 50, 1, 0, 0, 0, 1, 52, 1, 0, 0, 0, 1, 54, 1, 0, 0, 0, 1, 56, 1, 0, 0, 0, 2, 58, 1, 0, 0, 0, 2, 70, 1, 0, 0, 0, 2, 72, 1, 0, 0, 0, 2, 74, 1, 0, 0, 0, 2, 76, 1, 0, 0, 0, 2, 78, 1, 0, 0, 0, 2, 80, 1, 0, 0, 0, 2, 82, 1, 0, 0, 0, 2, 84, 1, 0, 0, 0, 2, 86, 1, 0, 0, 0, 2, 88, 1, 0, 0, 0, 2, 90, 1, 0, 0, 0, 2, 92, 1, 0, 0, 0, 2, 94, 1, 0, 0, 0, 2, 96, 1, 0, 0, 0, 2, 98, 1, 0, 0, 0, 2, 100, 1, 0, 0, 0, 2, 102, 1, 0, 0, 0, 2, 104, 1, 0, 0, 0, 2, 106, 1, 0, 0, 0, 2, 108, 1, 0, 0, 0, 2, 110, 1, 0, 0, 0, 2, 112, 1, 0, 0, 0, 2, 114, 1, 0, 0, 0, 2, 116, 1, 0, 0, 0, 2, 118, 1, 0, 0, 0, 2, 120, 1, 0, 0, 0, 2, 122, 1, 0, 0, 0, 2, 124, 1, 0, 0, 0, 2, 126, 1, 0, 0, 0, 2, 128, 1, 0, 0, 0, 2, 130, 1, 0, 0, 0, 2, 132, 1, 0, 0, 0, 2, 134, 1, 0, 0, 0, 2, 136, 1, 0, 0, 0, 2, 138, 1, 0, 0, 0, 2, 140, 1, 0, 0, 0, 2, 142, 1, 0, 0, 0, 2, 144, 1, 0, 0, 0, 2, 146, 1, 0, 0, 0, 2, 148, 1, 0, 0, 0, 2, 150, 1, 0, 0, 0, 2, 152, 1, 0, 0, 0, 2, 154, 1, 0, 0, 0, 2, 156, 1, 0, 0, 0, 3, 158, 1, 0, 0, 0, 3, 160, 1, 0, 0, 0, 3, 162, 1, 0, 0, 0, 3, 164, 1, 0, 0, 0, 3, 166, 1, 0, 0, 0, 3, 168, 1, 0, 0, 0, 3, 170, 1, 0, 0, 0, 3, 172, 1, 0, 0, 0, 3, 174, 1, 0, 0, 0, 3, 176, 1, 0, 0, 0, 3, 180, 1, 0, 0, 0, 3, 182, 1, 0, 0, 0, 3, 184, 1, 0, 0, 0, 3, 186, 1, 0, 0, 0, 4, 188, 1, 0, 0, 0, 6, 198, 1, 0, 0, 0, 8, 205, 1, 0, 0, 0, 10, 214, 1, 0, 0, 0, 12, 221, 1, 0, 0, 0, 14, 231, 1, 0, 0, 0, 16, 238, 1, 0, 0, 0, 18, 245, 1, 0, 0, 0, 20, 259, 1, 0, 0, 0, 22, 266, 1, 0, 0, 0, 24, 274, 1, 0, 0, 0, 26, 286, 1, 0, 0, 0, 28, 296, 1, 0, 0, 0, 30, 305, 1, 0, 0, 0, 32, 311, 1, 0, 0, 0, 34, 318, 1, 0, 0, 0, 36, 325, 1, 0, 0, 0, 38, 333, 1, 0, 0, 0, 40, 342, 1, 0, 0, 0, 42, 348, 1, 0, 0, 0, 44, 365, 1, 0, 0, 0, 46, 381, 1, 0, 0, 0, 48, 387, 1, 0, 0, 0, 50, 392, 1, 0, 0, 0, 52, 397, 1, 0, 0, 0, 54, 401, 1, 0, 0, 0, 56, 405, 1, 0, 0, 0, 58, 409, 1, 0, 0, 0, 60, 413, 1, 0, 0, 0, 62, 415, 1, 0, 0, 0, 64, 417, 1, 0, 0, 0, 66, 420, 1, 0, 0, 0, 68, 422, 1, 0, 0, 0, 70, 460, 1, 0, 0, 0, 72, 463, 1, 0, 0, 0, 74, 509, 1, 0, 0, 0, 76, 511, 1, 0, 0, 0, 78, 514, 1, 0, 0, 0, 80, 518, 1, 0, 0, 0, 82, 522, 1, 0, 0, 0, 84, 524, 1, 0, 0, 0, 86, 526, 1, 0, 0, 0, 88, 531, 1, 0, 0, 0, 90, 533, 1, 0, 0, 0, 92, 539, 1, 0, 0, 0, 94, 545, 1, 0, 0, 0, 96, 550, 1, 0, 0, 0, 98, 552, 1, 0, 0, 0, 100, 555, 1, 0, 0, 0, 102, 560, 1, 0, 0, 0, 104, 564, 1, 0, 0, 0, 106, 569, 1, 0, 0, 0, 108, 575, 1, 0, 0, 0, 110, 578, 1, 0, 0, 0, 112, 580, 1, 0, 0, 0, 114, 586, 1, 0, 0, 0, 116, 588, 1, 0, 0, 0, 118, 593, 1, 0, 0, 0, 120, 598, 1, 0, 0, 0, 122, 608, 1, 0, 0, 0, 124, 611, 1, 0, 0, 0, 126, 614, 1, 0, 0, 0, 128, 616, 1, 0, 0, 0, 130, 619, 1, 0, 0, 0, 132, 621, 1, 0, 0, 0, 134, 624, 1, 0, 0, 0, 136, 626, 1, 0, 0, 0, 138, 628, 1, 0, 0, 0, 140, 630, 1, 0, 0, 0, 142, 632, 1, 0, 0, 0, 144, 634, 1, 0, 0, 0, 146, 639, 1, 0, 0, 0, 148, 661, 1, 0, 0, 0, 150, 663, 1, 0, 0, 0, 152, 674, 1, 0, 0, 0, 154, 678, 1, 0, 0, 0, 156, 682, 1, 0, 0, 0, 158, 686, 1, 0, 0, 0, 160, 691, 1, 0, 0, 0, 162, 697, 1, 0, 0, 0, 164, 703, 1, 0, 0, 0, 166, 707, 1, 0, 0, 0, 168, 711, 1, 0, 0, 0, 170, 714, 1, 0, 0, 0, 172, 723, 1, 0, 0, 0, 174, 726, 1, 0, 0, 0, 176, 732, 1, 0, 0, 0, 178, 743, 1, 0, 0, 0, 180, 745, 1, 0, 0, 0, 182, 747, 1, 0, 0, 0, 184, 751, 1, 0, 0, 0, 186, 755, 1, 0, 0, 0, 188, 189, 5, 100, 0, 0, 189, 190, 5, 105, 0, 0, 190, 191, 5, 115, 0, 0, 191, 192, 5, 115, 0, 0, 192, 193, 5, 101, 0, 0, 193, 194, 5, 99, 0, 0, 194, 195, 5, 116, 0, 0, 195, 196, 1, 0, 0, 0, 196, 197, 6, 0, 0, 0, 197, 5, 1, 0, 0, 0, 198, 199, 5, 100, 0, 0, 199, 200, 5, 114, 0, 0, 200, 201, 5, 111, 0, 0, 201, 202, 5, 112, 0, 0, 202, 203, 1, 0, 0, 0, 203, 204, 6, 1, 1, 0, 204, 7, 1, 0, 0, 0, 205, 206, 5, 101, 0, 0, 206, 207, 5, 110, 0, 0, 207, 208, 5, 114, 0, 0, 208, 209, 5, 105, 0, 0, 209, 210, 5, 99, 0, 0, 210, 211, 5, 104, 0, 0, 211, 212, 1, 0, 0, 0, 212, 213, 6, 2, 1, 0, 213, 9, 1, 0, 0, 0, 214, 215, 5, 101, 0, 0, 215, 216, 5, 118, 0, 0, 216, 217, 5, 97, 0, 0, 217, 218, 5, 108, 0, 0, 218, 219, 1, 0, 0, 0, 219, 220, 6, 3, 0, 0, 220, 11, 1, 0, 0, 0, 221, 222, 5, 101, 0, 0, 222, 223, 5, 120, 0, 0, 223, 224, 5, 112, 0, 0, 224, 225, 5, 108, 0, 0, 225, 226, 5, 97, 0, 0, 226, 227, 5, 105, 0, 0, 227, 228, 5, 110, 0, 0, 228, 229, 1, 0, 0, 0, 229, 230, 6, 4, 2, 0, 230, 13, 1, 0, 0, 0, 231, 232, 5, 102, 0, 0, 232, 233, 5, 114, 0, 0, 233, 234, 5, 111, 0, 0, 234, 235, 5, 109, 0, 0, 235, 236, 1, 0, 0, 0, 236, 237, 6, 5, 1, 0, 237, 15, 1, 0, 0, 0, 238, 239, 5, 103, 0, 0, 239, 240, 5, 114, 0, 0, 240, 241, 5, 111, 0, 0, 241, 242, 5, 107, 0, 0, 242, 243, 1, 0, 0, 0, 243, 244, 6, 6, 0, 0, 244, 17, 1, 0, 0, 0, 245, 246, 5, 105, 0, 0, 246, 247, 5, 110, 0, 0, 247, 248, 5, 108, 0, 0, 248, 249, 5, 105, 0, 0, 249, 250, 5, 110, 0, 0, 250, 251, 5, 101, 0, 0, 251, 252, 5, 115, 0, 0, 252, 253, 5, 116, 0, 0, 253, 254, 5, 97, 0, 0, 254, 255, 5, 116, 0, 0, 255, 256, 5, 115, 0, 0, 256, 257, 1, 0, 0, 0, 257, 258, 6, 7, 0, 0, 258, 19, 1, 0, 0, 0, 259, 260, 5, 107, 0, 0, 260, 261, 5, 101, 0, 0, 261, 262, 5, 101, 0, 0, 262, 263, 5, 112, 0, 0, 263, 264, 1, 0, 0, 0, 264, 265, 6, 8, 1, 0, 265, 21, 1, 0, 0, 0, 266, 267, 5, 108, 0, 0, 267, 268, 5, 105, 0, 0, 268, 269, 5, 109, 0, 0, 269, 270, 5, 105, 0, 0, 270, 271, 5, 116, 0, 0, 271, 272, 1, 0, 0, 0, 272, 273, 6, 9, 0, 0, 273, 23, 1, 0, 0, 0, 274, 275, 5, 109, 0, 0, 275, 276, 5, 118, 0, 0, 276, 277, 5, 95, 0, 0, 277, 278, 5, 101, 0, 0, 278, 279, 5, 120, 0, 0, 279, 280, 5, 112, 0, 0, 280, 281, 5, 97, 0, 0, 281, 282, 5, 110, 0, 0, 282, 283, 5, 100, 0, 0, 283, 284, 1, 0, 0, 0, 284, 285, 6, 10, 1, 0, 285, 25, 1, 0, 0, 0, 286, 287, 5, 112, 0, 0, 287, 288, 5, 114, 0, 0, 288, 289, 5, 111, 0, 0, 289, 290, 5, 106, 0, 0, 290, 291, 5, 101, 0, 0, 291, 292, 5, 99, 0, 0, 292, 293, 5, 116, 0, 0, 293, 294, 1, 0, 0, 0, 294, 295, 6, 11, 1, 0, 295, 27, 1, 0, 0, 0, 296, 297, 5, 114, 0, 0, 297, 298, 5, 101, 0, 0, 298, 299, 5, 110, 0, 0, 299, 300, 5, 97, 0, 0, 300, 301, 5, 109, 0, 0, 301, 302, 5, 101, 0, 0, 302, 303, 1, 0, 0, 0, 303, 304, 6, 12, 1, 0, 304, 29, 1, 0, 0, 0, 305, 306, 5, 114, 0, 0, 306, 307, 5, 111, 0, 0, 307, 308, 5, 119, 0, 0, 308, 309, 1, 0, 0, 0, 309, 310, 6, 13, 0, 0, 310, 31, 1, 0, 0, 0, 311, 312, 5, 115, 0, 0, 312, 313, 5, 104, 0, 0, 313, 314, 5, 111, 0, 0, 314, 315, 5, 119, 0, 0, 315, 316, 1, 0, 0, 0, 316, 317, 6, 14, 0, 0, 317, 33, 1, 0, 0, 0, 318, 319, 5, 115, 0, 0, 319, 320, 5, 111, 0, 0, 320, 321, 5, 114, 0, 0, 321, 322, 5, 116, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 6, 15, 0, 0, 324, 35, 1, 0, 0, 0, 325, 326, 5, 115, 0, 0, 326, 327, 5, 116, 0, 0, 327, 328, 5, 97, 0, 0, 328, 329, 5, 116, 0, 0, 329, 330, 5, 115, 0, 0, 330, 331, 1, 0, 0, 0, 331, 332, 6, 16, 0, 0, 332, 37, 1, 0, 0, 0, 333, 334, 5, 119, 0, 0, 334, 335, 5, 104, 0, 0, 335, 336, 5, 101, 0, 0, 336, 337, 5, 114, 0, 0, 337, 338, 5, 101, 0, 0, 338, 339, 1, 0, 0, 0, 339, 340, 6, 17, 0, 0, 340, 39, 1, 0, 0, 0, 341, 343, 8, 0, 0, 0, 342, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 344, 345, 1, 0, 0, 0, 345, 346, 1, 0, 0, 0, 346, 347, 6, 18, 0, 0, 347, 41, 1, 0, 0, 0, 348, 349, 5, 47, 0, 0, 349, 350, 5, 47, 0, 0, 350, 354, 1, 0, 0, 0, 351, 353, 8, 1, 0, 0, 352, 351, 1, 0, 0, 0, 353, 356, 1, 0, 0, 0, 354, 352, 1, 0, 0, 0, 354, 355, 1, 0, 0, 0, 355, 358, 1, 0, 0, 0, 356, 354, 1, 0, 0, 0, 357, 359, 5, 13, 0, 0, 358, 357, 1, 0, 0, 0, 358, 359, 1, 0, 0, 0, 359, 361, 1, 0, 0, 0, 360, 362, 5, 10, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 363, 1, 0, 0, 0, 363, 364, 6, 19, 3, 0, 364, 43, 1, 0, 0, 0, 365, 366, 5, 47, 0, 0, 366, 367, 5, 42, 0, 0, 367, 372, 1, 0, 0, 0, 368, 371, 3, 44, 20, 0, 369, 371, 9, 0, 0, 0, 370, 368, 1, 0, 0, 0, 370, 369, 1, 0, 0, 0, 371, 374, 1, 0, 0, 0, 372, 373, 1, 0, 0, 0, 372, 370, 1, 0, 0, 0, 373, 375, 1, 0, 0, 0, 374, 372, 1, 0, 0, 0, 375, 376, 5, 42, 0, 0, 376, 377, 5, 47, 0, 0, 377, 378, 1, 0, 0, 0, 378, 379, 6, 20, 3, 0, 379, 45, 1, 0, 0, 0, 380, 382, 7, 2, 0, 0, 381, 380, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 381, 1, 0, 0, 0, 383, 384, 1, 0, 0, 0, 384, 385, 1, 0, 0, 0, 385, 386, 6, 21, 3, 0, 386, 47, 1, 0, 0, 0, 387, 388, 5, 91, 0, 0, 388, 389, 1, 0, 0, 0, 389, 390, 6, 22, 4, 0, 390, 391, 6, 22, 5, 0, 391, 49, 1, 0, 0, 0, 392, 393, 5, 124, 0, 0, 393, 394, 1, 0, 0, 0, 394, 395, 6, 23, 6, 0, 395, 396, 6, 23, 7, 0, 396, 51, 1, 0, 0, 0, 397, 398, 3, 46, 21, 0, 398, 399, 1, 0, 0, 0, 399, 400, 6, 24, 3, 0, 400, 53, 1, 0, 0, 0, 401, 402, 3, 42, 19, 0, 402, 403, 1, 0, 0, 0, 403, 404, 6, 25, 3, 0, 404, 55, 1, 0, 0, 0, 405, 406, 3, 44, 20, 0, 406, 407, 1, 0, 0, 0, 407, 408, 6, 26, 3, 0, 408, 57, 1, 0, 0, 0, 409, 410, 5, 124, 0, 0, 410, 411, 1, 0, 0, 0, 411, 412, 6, 27, 7, 0, 412, 59, 1, 0, 0, 0, 413, 414, 7, 3, 0, 0, 414, 61, 1, 0, 0, 0, 415, 416, 7, 4, 0, 0, 416, 63, 1, 0, 0, 0, 417, 418, 5, 92, 0, 0, 418, 419, 7, 5, 0, 0, 419, 65, 1, 0, 0, 0, 420, 421, 8, 6, 0, 0, 421, 67, 1, 0, 0, 0, 422, 424, 7, 7, 0, 0, 423, 425, 7, 8, 0, 0, 424, 423, 1, 0, 0, 0, 424, 425, 1, 0, 0, 0, 425, 427, 1, 0, 0, 0, 426, 428, 3, 60, 28, 0, 427, 426, 1, 0, 0, 0, 428, 429, 1, 0, 0, 0, 429, 427, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 69, 1, 0, 0, 0, 431, 436, 5, 34, 0, 0, 432, 435, 3, 64, 30, 0, 433, 435, 3, 66, 31, 0, 434, 432, 1, 0, 0, 0, 434, 433, 1, 0, 0, 0, 435, 438, 1, 0, 0, 0, 436, 434, 1, 0, 0, 0, 436, 437, 1, 0, 0, 0, 437, 439, 1, 0, 0, 0, 438, 436, 1, 0, 0, 0, 439, 461, 5, 34, 0, 0, 440, 441, 5, 34, 0, 0, 441, 442, 5, 34, 0, 0, 442, 443, 5, 34, 0, 0, 443, 447, 1, 0, 0, 0, 444, 446, 8, 1, 0, 0, 445, 444, 1, 0, 0, 0, 446, 449, 1, 0, 0, 0, 447, 448, 1, 0, 0, 0, 447, 445, 1, 0, 0, 0, 448, 450, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 450, 451, 5, 34, 0, 0, 451, 452, 5, 34, 0, 0, 452, 453, 5, 34, 0, 0, 453, 455, 1, 0, 0, 0, 454, 456, 5, 34, 0, 0, 455, 454, 1, 0, 0, 0, 455, 456, 1, 0, 0, 0, 456, 458, 1, 0, 0, 0, 457, 459, 5, 34, 0, 0, 458, 457, 1, 0, 0, 0, 458, 459, 1, 0, 0, 0, 459, 461, 1, 0, 0, 0, 460, 431, 1, 0, 0, 0, 460, 440, 1, 0, 0, 0, 461, 71, 1, 0, 0, 0, 462, 464, 3, 60, 28, 0, 463, 462, 1, 0, 0, 0, 464, 465, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 73, 1, 0, 0, 0, 467, 469, 3, 60, 28, 0, 468, 467, 1, 0, 0, 0, 469, 470, 1, 0, 0, 0, 470, 468, 1, 0, 0, 0, 470, 471, 1, 0, 0, 0, 471, 472, 1, 0, 0, 0, 472, 476, 3, 88, 42, 0, 473, 475, 3, 60, 28, 0, 474, 473, 1, 0, 0, 0, 475, 478, 1, 0, 0, 0, 476, 474, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 510, 1, 0, 0, 0, 478, 476, 1, 0, 0, 0, 479, 481, 3, 88, 42, 0, 480, 482, 3, 60, 28, 0, 481, 480, 1, 0, 0, 0, 482, 483, 1, 0, 0, 0, 483, 481, 1, 0, 0, 0, 483, 484, 1, 0, 0, 0, 484, 510, 1, 0, 0, 0, 485, 487, 3, 60, 28, 0, 486, 485, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 488, 486, 1, 0, 0, 0, 488, 489, 1, 0, 0, 0, 489, 497, 1, 0, 0, 0, 490, 494, 3, 88, 42, 0, 491, 493, 3, 60, 28, 0, 492, 491, 1, 0, 0, 0, 493, 496, 1, 0, 0, 0, 494, 492, 1, 0, 0, 0, 494, 495, 1, 0, 0, 0, 495, 498, 1, 0, 0, 0, 496, 494, 1, 0, 0, 0, 497, 490, 1, 0, 0, 0, 497, 498, 1, 0, 0, 0, 498, 499, 1, 0, 0, 0, 499, 500, 3, 68, 32, 0, 500, 510, 1, 0, 0, 0, 501, 503, 3, 88, 42, 0, 502, 504, 3, 60, 28, 0, 503, 502, 1, 0, 0, 0, 504, 505, 1, 0, 0, 0, 505, 503, 1, 0, 0, 0, 505, 506, 1, 0, 0, 0, 506, 507, 1, 0, 0, 0, 507, 508, 3, 68, 32, 0, 508, 510, 1, 0, 0, 0, 509, 468, 1, 0, 0, 0, 509, 479, 1, 0, 0, 0, 509, 486, 1, 0, 0, 0, 509, 501, 1, 0, 0, 0, 510, 75, 1, 0, 0, 0, 511, 512, 5, 98, 0, 0, 512, 513, 5, 121, 0, 0, 513, 77, 1, 0, 0, 0, 514, 515, 5, 97, 0, 0, 515, 516, 5, 110, 0, 0, 516, 517, 5, 100, 0, 0, 517, 79, 1, 0, 0, 0, 518, 519, 5, 97, 0, 0, 519, 520, 5, 115, 0, 0, 520, 521, 5, 99, 0, 0, 521, 81, 1, 0, 0, 0, 522, 523, 5, 61, 0, 0, 523, 83, 1, 0, 0, 0, 524, 525, 5, 44, 0, 0, 525, 85, 1, 0, 0, 0, 526, 527, 5, 100, 0, 0, 527, 528, 5, 101, 0, 0, 528, 529, 5, 115, 0, 0, 529, 530, 5, 99, 0, 0, 530, 87, 1, 0, 0, 0, 531, 532, 5, 46, 0, 0, 532, 89, 1, 0, 0, 0, 533, 534, 5, 102, 0, 0, 534, 535, 5, 97, 0, 0, 535, 536, 5, 108, 0, 0, 536, 537, 5, 115, 0, 0, 537, 538, 5, 101, 0, 0, 538, 91, 1, 0, 0, 0, 539, 540, 5, 102, 0, 0, 540, 541, 5, 105, 0, 0, 541, 542, 5, 114, 0, 0, 542, 543, 5, 115, 0, 0, 543, 544, 5, 116, 0, 0, 544, 93, 1, 0, 0, 0, 545, 546, 5, 108, 0, 0, 546, 547, 5, 97, 0, 0, 547, 548, 5, 115, 0, 0, 548, 549, 5, 116, 0, 0, 549, 95, 1, 0, 0, 0, 550, 551, 5, 40, 0, 0, 551, 97, 1, 0, 0, 0, 552, 553, 5, 105, 0, 0, 553, 554, 5, 110, 0, 0, 554, 99, 1, 0, 0, 0, 555, 556, 5, 108, 0, 0, 556, 557, 5, 105, 0, 0, 557, 558, 5, 107, 0, 0, 558, 559, 5, 101, 0, 0, 559, 101, 1, 0, 0, 0, 560, 561, 5, 110, 0, 0, 561, 562, 5, 111, 0, 0, 562, 563, 5, 116, 0, 0, 563, 103, 1, 0, 0, 0, 564, 565, 5, 110, 0, 0, 565, 566, 5, 117, 0, 0, 566, 567, 5, 108, 0, 0, 567, 568, 5, 108, 0, 0, 568, 105, 1, 0, 0, 0, 569, 570, 5, 110, 0, 0, 570, 571, 5, 117, 0, 0, 571, 572, 5, 108, 0, 0, 572, 573, 5, 108, 0, 0, 573, 574, 5, 115, 0, 0, 574, 107, 1, 0, 0, 0, 575, 576, 5, 111, 0, 0, 576, 577, 5, 114, 0, 0, 577, 109, 1, 0, 0, 0, 578, 579, 5, 63, 0, 0, 579, 111, 1, 0, 0, 0, 580, 581, 5, 114, 0, 0, 581, 582, 5, 108, 0, 0, 582, 583, 5, 105, 0, 0, 583, 584, 5, 107, 0, 0, 584, 585, 5, 101, 0, 0, 585, 113, 1, 0, 0, 0, 586, 587, 5, 41, 0, 0, 587, 115, 1, 0, 0, 0, 588, 589, 5, 116, 0, 0, 589, 590, 5, 114, 0, 0, 590, 591, 5, 117, 0, 0, 591, 592, 5, 101, 0, 0, 592, 117, 1, 0, 0, 0, 593, 594, 5, 105, 0, 0, 594, 595, 5, 110, 0, 0, 595, 596, 5, 102, 0, 0, 596, 597, 5, 111, 0, 0, 597, 119, 1, 0, 0, 0, 598, 599, 5, 102, 0, 0, 599, 600, 5, 117, 0, 0, 600, 601, 5, 110, 0, 0, 601, 602, 5, 99, 0, 0, 602, 603, 5, 116, 0, 0, 603, 604, 5, 105, 0, 0, 604, 605, 5, 111, 0, 0, 605, 606, 5, 110, 0, 0, 606, 607, 5, 115, 0, 0, 607, 121, 1, 0, 0, 0, 608, 609, 5, 61, 0, 0, 609, 610, 5, 61, 0, 0, 610, 123, 1, 0, 0, 0, 611, 612, 5, 33, 0, 0, 612, 613, 5, 61, 0, 0, 613, 125, 1, 0, 0, 0, 614, 615, 5, 60, 0, 0, 615, 127, 1, 0, 0, 0, 616, 617, 5, 60, 0, 0, 617, 618, 5, 61, 0, 0, 618, 129, 1, 0, 0, 0, 619, 620, 5, 62, 0, 0, 620, 131, 1, 0, 0, 0, 621, 622, 5, 62, 0, 0, 622, 623, 5, 61, 0, 0, 623, 133, 1, 0, 0, 0, 624, 625, 5, 43, 0, 0, 625, 135, 1, 0, 0, 0, 626, 627, 5, 45, 0, 0, 627, 137, 1, 0, 0, 0, 628, 629, 5, 42, 0, 0, 629, 139, 1, 0, 0, 0, 630, 631, 5, 47, 0, 0, 631, 141, 1, 0, 0, 0, 632, 633, 5, 37, 0, 0, 633, 143, 1, 0, 0, 0, 634, 635, 5, 91, 0, 0, 635, 636, 1, 0, 0, 0, 636, 637, 6, 70, 0, 0, 637, 638, 6, 70, 0, 0, 638, 145, 1, 0, 0, 0, 639, 640, 5, 93, 0, 0, 640, 641, 1, 0, 0, 0, 641, 642, 6, 71, 7, 0, 642, 643, 6, 71, 7, 0, 643, 147, 1, 0, 0, 0, 644, 650, 3, 62, 29, 0, 645, 649, 3, 62, 29, 0, 646, 649, 3, 60, 28, 0, 647, 649, 5, 95, 0, 0, 648, 645, 1, 0, 0, 0, 648, 646, 1, 0, 0, 0, 648, 647, 1, 0, 0, 0, 649, 652, 1, 0, 0, 0, 650, 648, 1, 0, 0, 0, 650, 651, 1, 0, 0, 0, 651, 662, 1, 0, 0, 0, 652, 650, 1, 0, 0, 0, 653, 657, 7, 9, 0, 0, 654, 658, 3, 62, 29, 0, 655, 658, 3, 60, 28, 0, 656, 658, 5, 95, 0, 0, 657, 654, 1, 0, 0, 0, 657, 655, 1, 0, 0, 0, 657, 656, 1, 0, 0, 0, 658, 659, 1, 0, 0, 0, 659, 657, 1, 0, 0, 0, 659, 660, 1, 0, 0, 0, 660, 662, 1, 0, 0, 0, 661, 644, 1, 0, 0, 0, 661, 653, 1, 0, 0, 0, 662, 149, 1, 0, 0, 0, 663, 669, 5, 96, 0, 0, 664, 668, 8, 10, 0, 0, 665, 666, 5, 96, 0, 0, 666, 668, 5, 96, 0, 0, 667, 664, 1, 0, 0, 0, 667, 665, 1, 0, 0, 0, 668, 671, 1, 0, 0, 0, 669, 667, 1, 0, 0, 0, 669, 670, 1, 0, 0, 0, 670, 672, 1, 0, 0, 0, 671, 669, 1, 0, 0, 0, 672, 673, 5, 96, 0, 0, 673, 151, 1, 0, 0, 0, 674, 675, 3, 42, 19, 0, 675, 676, 1, 0, 0, 0, 676, 677, 6, 74, 3, 0, 677, 153, 1, 0, 0, 0, 678, 679, 3, 44, 20, 0, 679, 680, 1, 0, 0, 0, 680, 681, 6, 75, 3, 0, 681, 155, 1, 0, 0, 0, 682, 683, 3, 46, 21, 0, 683, 684, 1, 0, 0, 0, 684, 685, 6, 76, 3, 0, 685, 157, 1, 0, 0, 0, 686, 687, 5, 124, 0, 0, 687, 688, 1, 0, 0, 0, 688, 689, 6, 77, 6, 0, 689, 690, 6, 77, 7, 0, 690, 159, 1, 0, 0, 0, 691, 692, 5, 91, 0, 0, 692, 693, 1, 0, 0, 0, 693, 694, 6, 78, 4, 0, 694, 695, 6, 78, 1, 0, 695, 696, 6, 78, 1, 0, 696, 161, 1, 0, 0, 0, 697, 698, 5, 93, 0, 0, 698, 699, 1, 0, 0, 0, 699, 700, 6, 79, 7, 0, 700, 701, 6, 79, 7, 0, 701, 702, 6, 79, 8, 0, 702, 163, 1, 0, 0, 0, 703, 704, 5, 44, 0, 0, 704, 705, 1, 0, 0, 0, 705, 706, 6, 80, 9, 0, 706, 165, 1, 0, 0, 0, 707, 708, 5, 61, 0, 0, 708, 709, 1, 0, 0, 0, 709, 710, 6, 81, 10, 0, 710, 167, 1, 0, 0, 0, 711, 712, 5, 97, 0, 0, 712, 713, 5, 115, 0, 0, 713, 169, 1, 0, 0, 0, 714, 715, 5, 109, 0, 0, 715, 716, 5, 101, 0, 0, 716, 717, 5, 116, 0, 0, 717, 718, 5, 97, 0, 0, 718, 719, 5, 100, 0, 0, 719, 720, 5, 97, 0, 0, 720, 721, 5, 116, 0, 0, 721, 722, 5, 97, 0, 0, 722, 171, 1, 0, 0, 0, 723, 724, 5, 111, 0, 0, 724, 725, 5, 110, 0, 0, 725, 173, 1, 0, 0, 0, 726, 727, 5, 119, 0, 0, 727, 728, 5, 105, 0, 0, 728, 729, 5, 116, 0, 0, 729, 730, 5, 104, 0, 0, 730, 175, 1, 0, 0, 0, 731, 733, 3, 178, 87, 0, 732, 731, 1, 0, 0, 0, 733, 734, 1, 0, 0, 0, 734, 732, 1, 0, 0, 0, 734, 735, 1, 0, 0, 0, 735, 177, 1, 0, 0, 0, 736, 738, 8, 11, 0, 0, 737, 736, 1, 0, 0, 0, 738, 739, 1, 0, 0, 0, 739, 737, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, 740, 744, 1, 0, 0, 0, 741, 742, 5, 47, 0, 0, 742, 744, 8, 12, 0, 0, 743, 737, 1, 0, 0, 0, 743, 741, 1, 0, 0, 0, 744, 179, 1, 0, 0, 0, 745, 746, 3, 150, 73, 0, 746, 181, 1, 0, 0, 0, 747, 748, 3, 42, 19, 0, 748, 749, 1, 0, 0, 0, 749, 750, 6, 89, 3, 0, 750, 183, 1, 0, 0, 0, 751, 752, 3, 44, 20, 0, 752, 753, 1, 0, 0, 0, 753, 754, 6, 90, 3, 0, 754, 185, 1, 0, 0, 0, 755, 756, 3, 46, 21, 0, 756, 757, 1, 0, 0, 0, 757, 758, 6, 91, 3, 0, 758, 187, 1, 0, 0, 0, 38, 0, 1, 2, 3, 344, 354, 358, 361, 370, 372, 383, 424, 429, 434, 436, 447, 455, 458, 460, 465, 470, 476, 483, 488, 494, 497, 505, 509, 648, 650, 657, 659, 661, 667, 669, 734, 739, 743, 11, 5, 2, 0, 5, 3, 0, 5, 1, 0, 0, 1, 0, 7, 64, 0, 5, 0, 0, 7, 26, 0, 4, 0, 0, 7, 65, 0, 7, 34, 0, 7, 33, 0] \ No newline at end of file diff --git a/esql/generated/v8_11_0/EsqlBaseLexer.py b/esql/generated/v8_11_0/EsqlBaseLexer.py new file mode 100644 index 00000000000..5b45701d70d --- /dev/null +++ b/esql/generated/v8_11_0/EsqlBaseLexer.py @@ -0,0 +1,445 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. + +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,80,759,6,-1,6,-1,6,-1,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2, + 4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11, + 2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18, + 7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24, + 2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31, + 7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37, + 2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44, + 7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50, + 2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57, + 7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63, + 2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70, + 7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76, + 2,77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83, + 7,83,2,84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89, + 2,90,7,90,2,91,7,91,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3, + 1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7, + 1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8, + 1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10, + 1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11, + 1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12, + 1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14, + 1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16, + 1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,18,4,18, + 343,8,18,11,18,12,18,344,1,18,1,18,1,19,1,19,1,19,1,19,5,19,353, + 8,19,10,19,12,19,356,9,19,1,19,3,19,359,8,19,1,19,3,19,362,8,19, + 1,19,1,19,1,20,1,20,1,20,1,20,1,20,5,20,371,8,20,10,20,12,20,374, + 9,20,1,20,1,20,1,20,1,20,1,20,1,21,4,21,382,8,21,11,21,12,21,383, + 1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,24, + 1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,27,1,27, + 1,27,1,27,1,28,1,28,1,29,1,29,1,30,1,30,1,30,1,31,1,31,1,32,1,32, + 3,32,425,8,32,1,32,4,32,428,8,32,11,32,12,32,429,1,33,1,33,1,33, + 5,33,435,8,33,10,33,12,33,438,9,33,1,33,1,33,1,33,1,33,1,33,1,33, + 5,33,446,8,33,10,33,12,33,449,9,33,1,33,1,33,1,33,1,33,1,33,3,33, + 456,8,33,1,33,3,33,459,8,33,3,33,461,8,33,1,34,4,34,464,8,34,11, + 34,12,34,465,1,35,4,35,469,8,35,11,35,12,35,470,1,35,1,35,5,35,475, + 8,35,10,35,12,35,478,9,35,1,35,1,35,4,35,482,8,35,11,35,12,35,483, + 1,35,4,35,487,8,35,11,35,12,35,488,1,35,1,35,5,35,493,8,35,10,35, + 12,35,496,9,35,3,35,498,8,35,1,35,1,35,1,35,1,35,4,35,504,8,35,11, + 35,12,35,505,1,35,1,35,3,35,510,8,35,1,36,1,36,1,36,1,37,1,37,1, + 37,1,37,1,38,1,38,1,38,1,38,1,39,1,39,1,40,1,40,1,41,1,41,1,41,1, + 41,1,41,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1, + 44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,47,1,47,1,47,1, + 48,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,50,1,50,1,50,1,50,1, + 50,1,51,1,51,1,51,1,51,1,51,1,51,1,52,1,52,1,52,1,53,1,53,1,54,1, + 54,1,54,1,54,1,54,1,54,1,55,1,55,1,56,1,56,1,56,1,56,1,56,1,57,1, + 57,1,57,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1, + 58,1,59,1,59,1,59,1,60,1,60,1,60,1,61,1,61,1,62,1,62,1,62,1,63,1, + 63,1,64,1,64,1,64,1,65,1,65,1,66,1,66,1,67,1,67,1,68,1,68,1,69,1, + 69,1,70,1,70,1,70,1,70,1,70,1,71,1,71,1,71,1,71,1,71,1,72,1,72,1, + 72,1,72,5,72,649,8,72,10,72,12,72,652,9,72,1,72,1,72,1,72,1,72,4, + 72,658,8,72,11,72,12,72,659,3,72,662,8,72,1,73,1,73,1,73,1,73,5, + 73,668,8,73,10,73,12,73,671,9,73,1,73,1,73,1,74,1,74,1,74,1,74,1, + 75,1,75,1,75,1,75,1,76,1,76,1,76,1,76,1,77,1,77,1,77,1,77,1,77,1, + 78,1,78,1,78,1,78,1,78,1,78,1,79,1,79,1,79,1,79,1,79,1,79,1,80,1, + 80,1,80,1,80,1,81,1,81,1,81,1,81,1,82,1,82,1,82,1,83,1,83,1,83,1, + 83,1,83,1,83,1,83,1,83,1,83,1,84,1,84,1,84,1,85,1,85,1,85,1,85,1, + 85,1,86,4,86,733,8,86,11,86,12,86,734,1,87,4,87,738,8,87,11,87,12, + 87,739,1,87,1,87,3,87,744,8,87,1,88,1,88,1,89,1,89,1,89,1,89,1,90, + 1,90,1,90,1,90,1,91,1,91,1,91,1,91,2,372,447,0,92,4,1,6,2,8,3,10, + 4,12,5,14,6,16,7,18,8,20,9,22,10,24,11,26,12,28,13,30,14,32,15,34, + 16,36,17,38,18,40,19,42,20,44,21,46,22,48,0,50,80,52,23,54,24,56, + 25,58,26,60,0,62,0,64,0,66,0,68,0,70,27,72,28,74,29,76,30,78,31, + 80,32,82,33,84,34,86,35,88,36,90,37,92,38,94,39,96,40,98,41,100, + 42,102,43,104,44,106,45,108,46,110,47,112,48,114,49,116,50,118,51, + 120,52,122,53,124,54,126,55,128,56,130,57,132,58,134,59,136,60,138, + 61,140,62,142,63,144,64,146,65,148,66,150,67,152,68,154,69,156,70, + 158,0,160,0,162,0,164,0,166,0,168,71,170,72,172,73,174,74,176,75, + 178,0,180,76,182,77,184,78,186,79,4,0,1,2,3,13,6,0,9,10,13,13,32, + 32,47,47,91,91,93,93,2,0,10,10,13,13,3,0,9,10,13,13,32,32,1,0,48, + 57,2,0,65,90,97,122,5,0,34,34,92,92,110,110,114,114,116,116,4,0, + 10,10,13,13,34,34,92,92,2,0,69,69,101,101,2,0,43,43,45,45,2,0,64, + 64,95,95,1,0,96,96,10,0,9,10,13,13,32,32,44,44,47,47,61,61,91,91, + 93,93,96,96,124,124,2,0,42,42,47,47,787,0,4,1,0,0,0,0,6,1,0,0,0, + 0,8,1,0,0,0,0,10,1,0,0,0,0,12,1,0,0,0,0,14,1,0,0,0,0,16,1,0,0,0, + 0,18,1,0,0,0,0,20,1,0,0,0,0,22,1,0,0,0,0,24,1,0,0,0,0,26,1,0,0,0, + 0,28,1,0,0,0,0,30,1,0,0,0,0,32,1,0,0,0,0,34,1,0,0,0,0,36,1,0,0,0, + 0,38,1,0,0,0,0,40,1,0,0,0,0,42,1,0,0,0,0,44,1,0,0,0,0,46,1,0,0,0, + 1,48,1,0,0,0,1,50,1,0,0,0,1,52,1,0,0,0,1,54,1,0,0,0,1,56,1,0,0,0, + 2,58,1,0,0,0,2,70,1,0,0,0,2,72,1,0,0,0,2,74,1,0,0,0,2,76,1,0,0,0, + 2,78,1,0,0,0,2,80,1,0,0,0,2,82,1,0,0,0,2,84,1,0,0,0,2,86,1,0,0,0, + 2,88,1,0,0,0,2,90,1,0,0,0,2,92,1,0,0,0,2,94,1,0,0,0,2,96,1,0,0,0, + 2,98,1,0,0,0,2,100,1,0,0,0,2,102,1,0,0,0,2,104,1,0,0,0,2,106,1,0, + 0,0,2,108,1,0,0,0,2,110,1,0,0,0,2,112,1,0,0,0,2,114,1,0,0,0,2,116, + 1,0,0,0,2,118,1,0,0,0,2,120,1,0,0,0,2,122,1,0,0,0,2,124,1,0,0,0, + 2,126,1,0,0,0,2,128,1,0,0,0,2,130,1,0,0,0,2,132,1,0,0,0,2,134,1, + 0,0,0,2,136,1,0,0,0,2,138,1,0,0,0,2,140,1,0,0,0,2,142,1,0,0,0,2, + 144,1,0,0,0,2,146,1,0,0,0,2,148,1,0,0,0,2,150,1,0,0,0,2,152,1,0, + 0,0,2,154,1,0,0,0,2,156,1,0,0,0,3,158,1,0,0,0,3,160,1,0,0,0,3,162, + 1,0,0,0,3,164,1,0,0,0,3,166,1,0,0,0,3,168,1,0,0,0,3,170,1,0,0,0, + 3,172,1,0,0,0,3,174,1,0,0,0,3,176,1,0,0,0,3,180,1,0,0,0,3,182,1, + 0,0,0,3,184,1,0,0,0,3,186,1,0,0,0,4,188,1,0,0,0,6,198,1,0,0,0,8, + 205,1,0,0,0,10,214,1,0,0,0,12,221,1,0,0,0,14,231,1,0,0,0,16,238, + 1,0,0,0,18,245,1,0,0,0,20,259,1,0,0,0,22,266,1,0,0,0,24,274,1,0, + 0,0,26,286,1,0,0,0,28,296,1,0,0,0,30,305,1,0,0,0,32,311,1,0,0,0, + 34,318,1,0,0,0,36,325,1,0,0,0,38,333,1,0,0,0,40,342,1,0,0,0,42,348, + 1,0,0,0,44,365,1,0,0,0,46,381,1,0,0,0,48,387,1,0,0,0,50,392,1,0, + 0,0,52,397,1,0,0,0,54,401,1,0,0,0,56,405,1,0,0,0,58,409,1,0,0,0, + 60,413,1,0,0,0,62,415,1,0,0,0,64,417,1,0,0,0,66,420,1,0,0,0,68,422, + 1,0,0,0,70,460,1,0,0,0,72,463,1,0,0,0,74,509,1,0,0,0,76,511,1,0, + 0,0,78,514,1,0,0,0,80,518,1,0,0,0,82,522,1,0,0,0,84,524,1,0,0,0, + 86,526,1,0,0,0,88,531,1,0,0,0,90,533,1,0,0,0,92,539,1,0,0,0,94,545, + 1,0,0,0,96,550,1,0,0,0,98,552,1,0,0,0,100,555,1,0,0,0,102,560,1, + 0,0,0,104,564,1,0,0,0,106,569,1,0,0,0,108,575,1,0,0,0,110,578,1, + 0,0,0,112,580,1,0,0,0,114,586,1,0,0,0,116,588,1,0,0,0,118,593,1, + 0,0,0,120,598,1,0,0,0,122,608,1,0,0,0,124,611,1,0,0,0,126,614,1, + 0,0,0,128,616,1,0,0,0,130,619,1,0,0,0,132,621,1,0,0,0,134,624,1, + 0,0,0,136,626,1,0,0,0,138,628,1,0,0,0,140,630,1,0,0,0,142,632,1, + 0,0,0,144,634,1,0,0,0,146,639,1,0,0,0,148,661,1,0,0,0,150,663,1, + 0,0,0,152,674,1,0,0,0,154,678,1,0,0,0,156,682,1,0,0,0,158,686,1, + 0,0,0,160,691,1,0,0,0,162,697,1,0,0,0,164,703,1,0,0,0,166,707,1, + 0,0,0,168,711,1,0,0,0,170,714,1,0,0,0,172,723,1,0,0,0,174,726,1, + 0,0,0,176,732,1,0,0,0,178,743,1,0,0,0,180,745,1,0,0,0,182,747,1, + 0,0,0,184,751,1,0,0,0,186,755,1,0,0,0,188,189,5,100,0,0,189,190, + 5,105,0,0,190,191,5,115,0,0,191,192,5,115,0,0,192,193,5,101,0,0, + 193,194,5,99,0,0,194,195,5,116,0,0,195,196,1,0,0,0,196,197,6,0,0, + 0,197,5,1,0,0,0,198,199,5,100,0,0,199,200,5,114,0,0,200,201,5,111, + 0,0,201,202,5,112,0,0,202,203,1,0,0,0,203,204,6,1,1,0,204,7,1,0, + 0,0,205,206,5,101,0,0,206,207,5,110,0,0,207,208,5,114,0,0,208,209, + 5,105,0,0,209,210,5,99,0,0,210,211,5,104,0,0,211,212,1,0,0,0,212, + 213,6,2,1,0,213,9,1,0,0,0,214,215,5,101,0,0,215,216,5,118,0,0,216, + 217,5,97,0,0,217,218,5,108,0,0,218,219,1,0,0,0,219,220,6,3,0,0,220, + 11,1,0,0,0,221,222,5,101,0,0,222,223,5,120,0,0,223,224,5,112,0,0, + 224,225,5,108,0,0,225,226,5,97,0,0,226,227,5,105,0,0,227,228,5,110, + 0,0,228,229,1,0,0,0,229,230,6,4,2,0,230,13,1,0,0,0,231,232,5,102, + 0,0,232,233,5,114,0,0,233,234,5,111,0,0,234,235,5,109,0,0,235,236, + 1,0,0,0,236,237,6,5,1,0,237,15,1,0,0,0,238,239,5,103,0,0,239,240, + 5,114,0,0,240,241,5,111,0,0,241,242,5,107,0,0,242,243,1,0,0,0,243, + 244,6,6,0,0,244,17,1,0,0,0,245,246,5,105,0,0,246,247,5,110,0,0,247, + 248,5,108,0,0,248,249,5,105,0,0,249,250,5,110,0,0,250,251,5,101, + 0,0,251,252,5,115,0,0,252,253,5,116,0,0,253,254,5,97,0,0,254,255, + 5,116,0,0,255,256,5,115,0,0,256,257,1,0,0,0,257,258,6,7,0,0,258, + 19,1,0,0,0,259,260,5,107,0,0,260,261,5,101,0,0,261,262,5,101,0,0, + 262,263,5,112,0,0,263,264,1,0,0,0,264,265,6,8,1,0,265,21,1,0,0,0, + 266,267,5,108,0,0,267,268,5,105,0,0,268,269,5,109,0,0,269,270,5, + 105,0,0,270,271,5,116,0,0,271,272,1,0,0,0,272,273,6,9,0,0,273,23, + 1,0,0,0,274,275,5,109,0,0,275,276,5,118,0,0,276,277,5,95,0,0,277, + 278,5,101,0,0,278,279,5,120,0,0,279,280,5,112,0,0,280,281,5,97,0, + 0,281,282,5,110,0,0,282,283,5,100,0,0,283,284,1,0,0,0,284,285,6, + 10,1,0,285,25,1,0,0,0,286,287,5,112,0,0,287,288,5,114,0,0,288,289, + 5,111,0,0,289,290,5,106,0,0,290,291,5,101,0,0,291,292,5,99,0,0,292, + 293,5,116,0,0,293,294,1,0,0,0,294,295,6,11,1,0,295,27,1,0,0,0,296, + 297,5,114,0,0,297,298,5,101,0,0,298,299,5,110,0,0,299,300,5,97,0, + 0,300,301,5,109,0,0,301,302,5,101,0,0,302,303,1,0,0,0,303,304,6, + 12,1,0,304,29,1,0,0,0,305,306,5,114,0,0,306,307,5,111,0,0,307,308, + 5,119,0,0,308,309,1,0,0,0,309,310,6,13,0,0,310,31,1,0,0,0,311,312, + 5,115,0,0,312,313,5,104,0,0,313,314,5,111,0,0,314,315,5,119,0,0, + 315,316,1,0,0,0,316,317,6,14,0,0,317,33,1,0,0,0,318,319,5,115,0, + 0,319,320,5,111,0,0,320,321,5,114,0,0,321,322,5,116,0,0,322,323, + 1,0,0,0,323,324,6,15,0,0,324,35,1,0,0,0,325,326,5,115,0,0,326,327, + 5,116,0,0,327,328,5,97,0,0,328,329,5,116,0,0,329,330,5,115,0,0,330, + 331,1,0,0,0,331,332,6,16,0,0,332,37,1,0,0,0,333,334,5,119,0,0,334, + 335,5,104,0,0,335,336,5,101,0,0,336,337,5,114,0,0,337,338,5,101, + 0,0,338,339,1,0,0,0,339,340,6,17,0,0,340,39,1,0,0,0,341,343,8,0, + 0,0,342,341,1,0,0,0,343,344,1,0,0,0,344,342,1,0,0,0,344,345,1,0, + 0,0,345,346,1,0,0,0,346,347,6,18,0,0,347,41,1,0,0,0,348,349,5,47, + 0,0,349,350,5,47,0,0,350,354,1,0,0,0,351,353,8,1,0,0,352,351,1,0, + 0,0,353,356,1,0,0,0,354,352,1,0,0,0,354,355,1,0,0,0,355,358,1,0, + 0,0,356,354,1,0,0,0,357,359,5,13,0,0,358,357,1,0,0,0,358,359,1,0, + 0,0,359,361,1,0,0,0,360,362,5,10,0,0,361,360,1,0,0,0,361,362,1,0, + 0,0,362,363,1,0,0,0,363,364,6,19,3,0,364,43,1,0,0,0,365,366,5,47, + 0,0,366,367,5,42,0,0,367,372,1,0,0,0,368,371,3,44,20,0,369,371,9, + 0,0,0,370,368,1,0,0,0,370,369,1,0,0,0,371,374,1,0,0,0,372,373,1, + 0,0,0,372,370,1,0,0,0,373,375,1,0,0,0,374,372,1,0,0,0,375,376,5, + 42,0,0,376,377,5,47,0,0,377,378,1,0,0,0,378,379,6,20,3,0,379,45, + 1,0,0,0,380,382,7,2,0,0,381,380,1,0,0,0,382,383,1,0,0,0,383,381, + 1,0,0,0,383,384,1,0,0,0,384,385,1,0,0,0,385,386,6,21,3,0,386,47, + 1,0,0,0,387,388,5,91,0,0,388,389,1,0,0,0,389,390,6,22,4,0,390,391, + 6,22,5,0,391,49,1,0,0,0,392,393,5,124,0,0,393,394,1,0,0,0,394,395, + 6,23,6,0,395,396,6,23,7,0,396,51,1,0,0,0,397,398,3,46,21,0,398,399, + 1,0,0,0,399,400,6,24,3,0,400,53,1,0,0,0,401,402,3,42,19,0,402,403, + 1,0,0,0,403,404,6,25,3,0,404,55,1,0,0,0,405,406,3,44,20,0,406,407, + 1,0,0,0,407,408,6,26,3,0,408,57,1,0,0,0,409,410,5,124,0,0,410,411, + 1,0,0,0,411,412,6,27,7,0,412,59,1,0,0,0,413,414,7,3,0,0,414,61,1, + 0,0,0,415,416,7,4,0,0,416,63,1,0,0,0,417,418,5,92,0,0,418,419,7, + 5,0,0,419,65,1,0,0,0,420,421,8,6,0,0,421,67,1,0,0,0,422,424,7,7, + 0,0,423,425,7,8,0,0,424,423,1,0,0,0,424,425,1,0,0,0,425,427,1,0, + 0,0,426,428,3,60,28,0,427,426,1,0,0,0,428,429,1,0,0,0,429,427,1, + 0,0,0,429,430,1,0,0,0,430,69,1,0,0,0,431,436,5,34,0,0,432,435,3, + 64,30,0,433,435,3,66,31,0,434,432,1,0,0,0,434,433,1,0,0,0,435,438, + 1,0,0,0,436,434,1,0,0,0,436,437,1,0,0,0,437,439,1,0,0,0,438,436, + 1,0,0,0,439,461,5,34,0,0,440,441,5,34,0,0,441,442,5,34,0,0,442,443, + 5,34,0,0,443,447,1,0,0,0,444,446,8,1,0,0,445,444,1,0,0,0,446,449, + 1,0,0,0,447,448,1,0,0,0,447,445,1,0,0,0,448,450,1,0,0,0,449,447, + 1,0,0,0,450,451,5,34,0,0,451,452,5,34,0,0,452,453,5,34,0,0,453,455, + 1,0,0,0,454,456,5,34,0,0,455,454,1,0,0,0,455,456,1,0,0,0,456,458, + 1,0,0,0,457,459,5,34,0,0,458,457,1,0,0,0,458,459,1,0,0,0,459,461, + 1,0,0,0,460,431,1,0,0,0,460,440,1,0,0,0,461,71,1,0,0,0,462,464,3, + 60,28,0,463,462,1,0,0,0,464,465,1,0,0,0,465,463,1,0,0,0,465,466, + 1,0,0,0,466,73,1,0,0,0,467,469,3,60,28,0,468,467,1,0,0,0,469,470, + 1,0,0,0,470,468,1,0,0,0,470,471,1,0,0,0,471,472,1,0,0,0,472,476, + 3,88,42,0,473,475,3,60,28,0,474,473,1,0,0,0,475,478,1,0,0,0,476, + 474,1,0,0,0,476,477,1,0,0,0,477,510,1,0,0,0,478,476,1,0,0,0,479, + 481,3,88,42,0,480,482,3,60,28,0,481,480,1,0,0,0,482,483,1,0,0,0, + 483,481,1,0,0,0,483,484,1,0,0,0,484,510,1,0,0,0,485,487,3,60,28, + 0,486,485,1,0,0,0,487,488,1,0,0,0,488,486,1,0,0,0,488,489,1,0,0, + 0,489,497,1,0,0,0,490,494,3,88,42,0,491,493,3,60,28,0,492,491,1, + 0,0,0,493,496,1,0,0,0,494,492,1,0,0,0,494,495,1,0,0,0,495,498,1, + 0,0,0,496,494,1,0,0,0,497,490,1,0,0,0,497,498,1,0,0,0,498,499,1, + 0,0,0,499,500,3,68,32,0,500,510,1,0,0,0,501,503,3,88,42,0,502,504, + 3,60,28,0,503,502,1,0,0,0,504,505,1,0,0,0,505,503,1,0,0,0,505,506, + 1,0,0,0,506,507,1,0,0,0,507,508,3,68,32,0,508,510,1,0,0,0,509,468, + 1,0,0,0,509,479,1,0,0,0,509,486,1,0,0,0,509,501,1,0,0,0,510,75,1, + 0,0,0,511,512,5,98,0,0,512,513,5,121,0,0,513,77,1,0,0,0,514,515, + 5,97,0,0,515,516,5,110,0,0,516,517,5,100,0,0,517,79,1,0,0,0,518, + 519,5,97,0,0,519,520,5,115,0,0,520,521,5,99,0,0,521,81,1,0,0,0,522, + 523,5,61,0,0,523,83,1,0,0,0,524,525,5,44,0,0,525,85,1,0,0,0,526, + 527,5,100,0,0,527,528,5,101,0,0,528,529,5,115,0,0,529,530,5,99,0, + 0,530,87,1,0,0,0,531,532,5,46,0,0,532,89,1,0,0,0,533,534,5,102,0, + 0,534,535,5,97,0,0,535,536,5,108,0,0,536,537,5,115,0,0,537,538,5, + 101,0,0,538,91,1,0,0,0,539,540,5,102,0,0,540,541,5,105,0,0,541,542, + 5,114,0,0,542,543,5,115,0,0,543,544,5,116,0,0,544,93,1,0,0,0,545, + 546,5,108,0,0,546,547,5,97,0,0,547,548,5,115,0,0,548,549,5,116,0, + 0,549,95,1,0,0,0,550,551,5,40,0,0,551,97,1,0,0,0,552,553,5,105,0, + 0,553,554,5,110,0,0,554,99,1,0,0,0,555,556,5,108,0,0,556,557,5,105, + 0,0,557,558,5,107,0,0,558,559,5,101,0,0,559,101,1,0,0,0,560,561, + 5,110,0,0,561,562,5,111,0,0,562,563,5,116,0,0,563,103,1,0,0,0,564, + 565,5,110,0,0,565,566,5,117,0,0,566,567,5,108,0,0,567,568,5,108, + 0,0,568,105,1,0,0,0,569,570,5,110,0,0,570,571,5,117,0,0,571,572, + 5,108,0,0,572,573,5,108,0,0,573,574,5,115,0,0,574,107,1,0,0,0,575, + 576,5,111,0,0,576,577,5,114,0,0,577,109,1,0,0,0,578,579,5,63,0,0, + 579,111,1,0,0,0,580,581,5,114,0,0,581,582,5,108,0,0,582,583,5,105, + 0,0,583,584,5,107,0,0,584,585,5,101,0,0,585,113,1,0,0,0,586,587, + 5,41,0,0,587,115,1,0,0,0,588,589,5,116,0,0,589,590,5,114,0,0,590, + 591,5,117,0,0,591,592,5,101,0,0,592,117,1,0,0,0,593,594,5,105,0, + 0,594,595,5,110,0,0,595,596,5,102,0,0,596,597,5,111,0,0,597,119, + 1,0,0,0,598,599,5,102,0,0,599,600,5,117,0,0,600,601,5,110,0,0,601, + 602,5,99,0,0,602,603,5,116,0,0,603,604,5,105,0,0,604,605,5,111,0, + 0,605,606,5,110,0,0,606,607,5,115,0,0,607,121,1,0,0,0,608,609,5, + 61,0,0,609,610,5,61,0,0,610,123,1,0,0,0,611,612,5,33,0,0,612,613, + 5,61,0,0,613,125,1,0,0,0,614,615,5,60,0,0,615,127,1,0,0,0,616,617, + 5,60,0,0,617,618,5,61,0,0,618,129,1,0,0,0,619,620,5,62,0,0,620,131, + 1,0,0,0,621,622,5,62,0,0,622,623,5,61,0,0,623,133,1,0,0,0,624,625, + 5,43,0,0,625,135,1,0,0,0,626,627,5,45,0,0,627,137,1,0,0,0,628,629, + 5,42,0,0,629,139,1,0,0,0,630,631,5,47,0,0,631,141,1,0,0,0,632,633, + 5,37,0,0,633,143,1,0,0,0,634,635,5,91,0,0,635,636,1,0,0,0,636,637, + 6,70,0,0,637,638,6,70,0,0,638,145,1,0,0,0,639,640,5,93,0,0,640,641, + 1,0,0,0,641,642,6,71,7,0,642,643,6,71,7,0,643,147,1,0,0,0,644,650, + 3,62,29,0,645,649,3,62,29,0,646,649,3,60,28,0,647,649,5,95,0,0,648, + 645,1,0,0,0,648,646,1,0,0,0,648,647,1,0,0,0,649,652,1,0,0,0,650, + 648,1,0,0,0,650,651,1,0,0,0,651,662,1,0,0,0,652,650,1,0,0,0,653, + 657,7,9,0,0,654,658,3,62,29,0,655,658,3,60,28,0,656,658,5,95,0,0, + 657,654,1,0,0,0,657,655,1,0,0,0,657,656,1,0,0,0,658,659,1,0,0,0, + 659,657,1,0,0,0,659,660,1,0,0,0,660,662,1,0,0,0,661,644,1,0,0,0, + 661,653,1,0,0,0,662,149,1,0,0,0,663,669,5,96,0,0,664,668,8,10,0, + 0,665,666,5,96,0,0,666,668,5,96,0,0,667,664,1,0,0,0,667,665,1,0, + 0,0,668,671,1,0,0,0,669,667,1,0,0,0,669,670,1,0,0,0,670,672,1,0, + 0,0,671,669,1,0,0,0,672,673,5,96,0,0,673,151,1,0,0,0,674,675,3,42, + 19,0,675,676,1,0,0,0,676,677,6,74,3,0,677,153,1,0,0,0,678,679,3, + 44,20,0,679,680,1,0,0,0,680,681,6,75,3,0,681,155,1,0,0,0,682,683, + 3,46,21,0,683,684,1,0,0,0,684,685,6,76,3,0,685,157,1,0,0,0,686,687, + 5,124,0,0,687,688,1,0,0,0,688,689,6,77,6,0,689,690,6,77,7,0,690, + 159,1,0,0,0,691,692,5,91,0,0,692,693,1,0,0,0,693,694,6,78,4,0,694, + 695,6,78,1,0,695,696,6,78,1,0,696,161,1,0,0,0,697,698,5,93,0,0,698, + 699,1,0,0,0,699,700,6,79,7,0,700,701,6,79,7,0,701,702,6,79,8,0,702, + 163,1,0,0,0,703,704,5,44,0,0,704,705,1,0,0,0,705,706,6,80,9,0,706, + 165,1,0,0,0,707,708,5,61,0,0,708,709,1,0,0,0,709,710,6,81,10,0,710, + 167,1,0,0,0,711,712,5,97,0,0,712,713,5,115,0,0,713,169,1,0,0,0,714, + 715,5,109,0,0,715,716,5,101,0,0,716,717,5,116,0,0,717,718,5,97,0, + 0,718,719,5,100,0,0,719,720,5,97,0,0,720,721,5,116,0,0,721,722,5, + 97,0,0,722,171,1,0,0,0,723,724,5,111,0,0,724,725,5,110,0,0,725,173, + 1,0,0,0,726,727,5,119,0,0,727,728,5,105,0,0,728,729,5,116,0,0,729, + 730,5,104,0,0,730,175,1,0,0,0,731,733,3,178,87,0,732,731,1,0,0,0, + 733,734,1,0,0,0,734,732,1,0,0,0,734,735,1,0,0,0,735,177,1,0,0,0, + 736,738,8,11,0,0,737,736,1,0,0,0,738,739,1,0,0,0,739,737,1,0,0,0, + 739,740,1,0,0,0,740,744,1,0,0,0,741,742,5,47,0,0,742,744,8,12,0, + 0,743,737,1,0,0,0,743,741,1,0,0,0,744,179,1,0,0,0,745,746,3,150, + 73,0,746,181,1,0,0,0,747,748,3,42,19,0,748,749,1,0,0,0,749,750,6, + 89,3,0,750,183,1,0,0,0,751,752,3,44,20,0,752,753,1,0,0,0,753,754, + 6,90,3,0,754,185,1,0,0,0,755,756,3,46,21,0,756,757,1,0,0,0,757,758, + 6,91,3,0,758,187,1,0,0,0,38,0,1,2,3,344,354,358,361,370,372,383, + 424,429,434,436,447,455,458,460,465,470,476,483,488,494,497,505, + 509,648,650,657,659,661,667,669,734,739,743,11,5,2,0,5,3,0,5,1,0, + 0,1,0,7,64,0,5,0,0,7,26,0,4,0,0,7,65,0,7,34,0,7,33,0 + ] + +class EsqlBaseLexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + EXPLAIN_MODE = 1 + EXPRESSION = 2 + SOURCE_IDENTIFIERS = 3 + + DISSECT = 1 + DROP = 2 + ENRICH = 3 + EVAL = 4 + EXPLAIN = 5 + FROM = 6 + GROK = 7 + INLINESTATS = 8 + KEEP = 9 + LIMIT = 10 + MV_EXPAND = 11 + PROJECT = 12 + RENAME = 13 + ROW = 14 + SHOW = 15 + SORT = 16 + STATS = 17 + WHERE = 18 + UNKNOWN_CMD = 19 + LINE_COMMENT = 20 + MULTILINE_COMMENT = 21 + WS = 22 + EXPLAIN_WS = 23 + EXPLAIN_LINE_COMMENT = 24 + EXPLAIN_MULTILINE_COMMENT = 25 + PIPE = 26 + STRING = 27 + INTEGER_LITERAL = 28 + DECIMAL_LITERAL = 29 + BY = 30 + AND = 31 + ASC = 32 + ASSIGN = 33 + COMMA = 34 + DESC = 35 + DOT = 36 + FALSE = 37 + FIRST = 38 + LAST = 39 + LP = 40 + IN = 41 + LIKE = 42 + NOT = 43 + NULL = 44 + NULLS = 45 + OR = 46 + PARAM = 47 + RLIKE = 48 + RP = 49 + TRUE = 50 + INFO = 51 + FUNCTIONS = 52 + EQ = 53 + NEQ = 54 + LT = 55 + LTE = 56 + GT = 57 + GTE = 58 + PLUS = 59 + MINUS = 60 + ASTERISK = 61 + SLASH = 62 + PERCENT = 63 + OPENING_BRACKET = 64 + CLOSING_BRACKET = 65 + UNQUOTED_IDENTIFIER = 66 + QUOTED_IDENTIFIER = 67 + EXPR_LINE_COMMENT = 68 + EXPR_MULTILINE_COMMENT = 69 + EXPR_WS = 70 + AS = 71 + METADATA = 72 + ON = 73 + WITH = 74 + SRC_UNQUOTED_IDENTIFIER = 75 + SRC_QUOTED_IDENTIFIER = 76 + SRC_LINE_COMMENT = 77 + SRC_MULTILINE_COMMENT = 78 + SRC_WS = 79 + EXPLAIN_PIPE = 80 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE", "EXPLAIN_MODE", "EXPRESSION", "SOURCE_IDENTIFIERS" ] + + literalNames = [ "", + "'dissect'", "'drop'", "'enrich'", "'eval'", "'explain'", "'from'", + "'grok'", "'inlinestats'", "'keep'", "'limit'", "'mv_expand'", + "'project'", "'rename'", "'row'", "'show'", "'sort'", "'stats'", + "'where'", "'by'", "'and'", "'asc'", "'desc'", "'.'", "'false'", + "'first'", "'last'", "'('", "'in'", "'like'", "'not'", "'null'", + "'nulls'", "'or'", "'?'", "'rlike'", "')'", "'true'", "'info'", + "'functions'", "'=='", "'!='", "'<'", "'<='", "'>'", "'>='", + "'+'", "'-'", "'*'", "'/'", "'%'", "']'", "'as'", "'metadata'", + "'on'", "'with'" ] + + symbolicNames = [ "", + "DISSECT", "DROP", "ENRICH", "EVAL", "EXPLAIN", "FROM", "GROK", + "INLINESTATS", "KEEP", "LIMIT", "MV_EXPAND", "PROJECT", "RENAME", + "ROW", "SHOW", "SORT", "STATS", "WHERE", "UNKNOWN_CMD", "LINE_COMMENT", + "MULTILINE_COMMENT", "WS", "EXPLAIN_WS", "EXPLAIN_LINE_COMMENT", + "EXPLAIN_MULTILINE_COMMENT", "PIPE", "STRING", "INTEGER_LITERAL", + "DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN", "COMMA", "DESC", + "DOT", "FALSE", "FIRST", "LAST", "LP", "IN", "LIKE", "NOT", + "NULL", "NULLS", "OR", "PARAM", "RLIKE", "RP", "TRUE", "INFO", + "FUNCTIONS", "EQ", "NEQ", "LT", "LTE", "GT", "GTE", "PLUS", + "MINUS", "ASTERISK", "SLASH", "PERCENT", "OPENING_BRACKET", + "CLOSING_BRACKET", "UNQUOTED_IDENTIFIER", "QUOTED_IDENTIFIER", + "EXPR_LINE_COMMENT", "EXPR_MULTILINE_COMMENT", "EXPR_WS", "AS", + "METADATA", "ON", "WITH", "SRC_UNQUOTED_IDENTIFIER", "SRC_QUOTED_IDENTIFIER", + "SRC_LINE_COMMENT", "SRC_MULTILINE_COMMENT", "SRC_WS", "EXPLAIN_PIPE" ] + + ruleNames = [ "DISSECT", "DROP", "ENRICH", "EVAL", "EXPLAIN", "FROM", + "GROK", "INLINESTATS", "KEEP", "LIMIT", "MV_EXPAND", "PROJECT", + "RENAME", "ROW", "SHOW", "SORT", "STATS", "WHERE", "UNKNOWN_CMD", + "LINE_COMMENT", "MULTILINE_COMMENT", "WS", "EXPLAIN_OPENING_BRACKET", + "EXPLAIN_PIPE", "EXPLAIN_WS", "EXPLAIN_LINE_COMMENT", + "EXPLAIN_MULTILINE_COMMENT", "PIPE", "DIGIT", "LETTER", + "ESCAPE_SEQUENCE", "UNESCAPED_CHARS", "EXPONENT", "STRING", + "INTEGER_LITERAL", "DECIMAL_LITERAL", "BY", "AND", "ASC", + "ASSIGN", "COMMA", "DESC", "DOT", "FALSE", "FIRST", "LAST", + "LP", "IN", "LIKE", "NOT", "NULL", "NULLS", "OR", "PARAM", + "RLIKE", "RP", "TRUE", "INFO", "FUNCTIONS", "EQ", "NEQ", + "LT", "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", + "SLASH", "PERCENT", "OPENING_BRACKET", "CLOSING_BRACKET", + "UNQUOTED_IDENTIFIER", "QUOTED_IDENTIFIER", "EXPR_LINE_COMMENT", + "EXPR_MULTILINE_COMMENT", "EXPR_WS", "SRC_PIPE", "SRC_OPENING_BRACKET", + "SRC_CLOSING_BRACKET", "SRC_COMMA", "SRC_ASSIGN", "AS", + "METADATA", "ON", "WITH", "SRC_UNQUOTED_IDENTIFIER", "SRC_UNQUOTED_IDENTIFIER_PART", + "SRC_QUOTED_IDENTIFIER", "SRC_LINE_COMMENT", "SRC_MULTILINE_COMMENT", + "SRC_WS" ] + + grammarFileName = "EsqlBaseLexer.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.1") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + diff --git a/esql/generated/v8_11_0/EsqlBaseLexer.tokens b/esql/generated/v8_11_0/EsqlBaseLexer.tokens new file mode 100644 index 00000000000..e8040376185 --- /dev/null +++ b/esql/generated/v8_11_0/EsqlBaseLexer.tokens @@ -0,0 +1,135 @@ +DISSECT=1 +DROP=2 +ENRICH=3 +EVAL=4 +EXPLAIN=5 +FROM=6 +GROK=7 +INLINESTATS=8 +KEEP=9 +LIMIT=10 +MV_EXPAND=11 +PROJECT=12 +RENAME=13 +ROW=14 +SHOW=15 +SORT=16 +STATS=17 +WHERE=18 +UNKNOWN_CMD=19 +LINE_COMMENT=20 +MULTILINE_COMMENT=21 +WS=22 +EXPLAIN_WS=23 +EXPLAIN_LINE_COMMENT=24 +EXPLAIN_MULTILINE_COMMENT=25 +PIPE=26 +STRING=27 +INTEGER_LITERAL=28 +DECIMAL_LITERAL=29 +BY=30 +AND=31 +ASC=32 +ASSIGN=33 +COMMA=34 +DESC=35 +DOT=36 +FALSE=37 +FIRST=38 +LAST=39 +LP=40 +IN=41 +LIKE=42 +NOT=43 +NULL=44 +NULLS=45 +OR=46 +PARAM=47 +RLIKE=48 +RP=49 +TRUE=50 +INFO=51 +FUNCTIONS=52 +EQ=53 +NEQ=54 +LT=55 +LTE=56 +GT=57 +GTE=58 +PLUS=59 +MINUS=60 +ASTERISK=61 +SLASH=62 +PERCENT=63 +OPENING_BRACKET=64 +CLOSING_BRACKET=65 +UNQUOTED_IDENTIFIER=66 +QUOTED_IDENTIFIER=67 +EXPR_LINE_COMMENT=68 +EXPR_MULTILINE_COMMENT=69 +EXPR_WS=70 +AS=71 +METADATA=72 +ON=73 +WITH=74 +SRC_UNQUOTED_IDENTIFIER=75 +SRC_QUOTED_IDENTIFIER=76 +SRC_LINE_COMMENT=77 +SRC_MULTILINE_COMMENT=78 +SRC_WS=79 +EXPLAIN_PIPE=80 +'dissect'=1 +'drop'=2 +'enrich'=3 +'eval'=4 +'explain'=5 +'from'=6 +'grok'=7 +'inlinestats'=8 +'keep'=9 +'limit'=10 +'mv_expand'=11 +'project'=12 +'rename'=13 +'row'=14 +'show'=15 +'sort'=16 +'stats'=17 +'where'=18 +'by'=30 +'and'=31 +'asc'=32 +'desc'=35 +'.'=36 +'false'=37 +'first'=38 +'last'=39 +'('=40 +'in'=41 +'like'=42 +'not'=43 +'null'=44 +'nulls'=45 +'or'=46 +'?'=47 +'rlike'=48 +')'=49 +'true'=50 +'info'=51 +'functions'=52 +'=='=53 +'!='=54 +'<'=55 +'<='=56 +'>'=57 +'>='=58 +'+'=59 +'-'=60 +'*'=61 +'/'=62 +'%'=63 +']'=65 +'as'=71 +'metadata'=72 +'on'=73 +'with'=74 diff --git a/esql/generated/v8_11_0/EsqlBaseParser.interp b/esql/generated/v8_11_0/EsqlBaseParser.interp new file mode 100644 index 00000000000..c2a836d1d6d --- /dev/null +++ b/esql/generated/v8_11_0/EsqlBaseParser.interp @@ -0,0 +1,217 @@ +token literal names: +null +'dissect' +'drop' +'enrich' +'eval' +'explain' +'from' +'grok' +'inlinestats' +'keep' +'limit' +'mv_expand' +'project' +'rename' +'row' +'show' +'sort' +'stats' +'where' +null +null +null +null +null +null +null +null +null +null +null +'by' +'and' +'asc' +null +null +'desc' +'.' +'false' +'first' +'last' +'(' +'in' +'like' +'not' +'null' +'nulls' +'or' +'?' +'rlike' +')' +'true' +'info' +'functions' +'==' +'!=' +'<' +'<=' +'>' +'>=' +'+' +'-' +'*' +'/' +'%' +null +']' +null +null +null +null +null +'as' +'metadata' +'on' +'with' +null +null +null +null +null +null + +token symbolic names: +null +DISSECT +DROP +ENRICH +EVAL +EXPLAIN +FROM +GROK +INLINESTATS +KEEP +LIMIT +MV_EXPAND +PROJECT +RENAME +ROW +SHOW +SORT +STATS +WHERE +UNKNOWN_CMD +LINE_COMMENT +MULTILINE_COMMENT +WS +EXPLAIN_WS +EXPLAIN_LINE_COMMENT +EXPLAIN_MULTILINE_COMMENT +PIPE +STRING +INTEGER_LITERAL +DECIMAL_LITERAL +BY +AND +ASC +ASSIGN +COMMA +DESC +DOT +FALSE +FIRST +LAST +LP +IN +LIKE +NOT +NULL +NULLS +OR +PARAM +RLIKE +RP +TRUE +INFO +FUNCTIONS +EQ +NEQ +LT +LTE +GT +GTE +PLUS +MINUS +ASTERISK +SLASH +PERCENT +OPENING_BRACKET +CLOSING_BRACKET +UNQUOTED_IDENTIFIER +QUOTED_IDENTIFIER +EXPR_LINE_COMMENT +EXPR_MULTILINE_COMMENT +EXPR_WS +AS +METADATA +ON +WITH +SRC_UNQUOTED_IDENTIFIER +SRC_QUOTED_IDENTIFIER +SRC_LINE_COMMENT +SRC_MULTILINE_COMMENT +SRC_WS +EXPLAIN_PIPE + +rule names: +singleStatement +query +sourceCommand +processingCommand +whereCommand +booleanExpression +regexBooleanExpression +valueExpression +operatorExpression +primaryExpression +rowCommand +fields +field +fromCommand +metadata +evalCommand +statsCommand +inlinestatsCommand +grouping +sourceIdentifier +qualifiedName +identifier +constant +limitCommand +sortCommand +orderExpression +keepCommand +dropCommand +renameCommand +renameClause +dissectCommand +grokCommand +mvExpandCommand +commandOptions +commandOption +booleanValue +numericValue +decimalValue +integerValue +string +comparisonOperator +explainCommand +subqueryExpression +showCommand +enrichCommand +enrichWithClause + + +atn: +[4, 1, 80, 488, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 102, 8, 1, 10, 1, 12, 1, 105, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 111, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 126, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 138, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 145, 8, 5, 10, 5, 12, 5, 148, 9, 5, 1, 5, 1, 5, 3, 5, 152, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 160, 8, 5, 10, 5, 12, 5, 163, 9, 5, 1, 6, 1, 6, 3, 6, 167, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 174, 8, 6, 1, 6, 1, 6, 1, 6, 3, 6, 179, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 186, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 192, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 200, 8, 8, 10, 8, 12, 8, 203, 9, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 5, 9, 216, 8, 9, 10, 9, 12, 9, 219, 9, 9, 3, 9, 221, 8, 9, 1, 9, 1, 9, 3, 9, 225, 8, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 5, 11, 233, 8, 11, 10, 11, 12, 11, 236, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 243, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 249, 8, 13, 10, 13, 12, 13, 252, 9, 13, 1, 13, 3, 13, 255, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 262, 8, 14, 10, 14, 12, 14, 265, 9, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 274, 8, 16, 1, 16, 1, 16, 3, 16, 278, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 284, 8, 17, 1, 18, 1, 18, 1, 18, 5, 18, 289, 8, 18, 10, 18, 12, 18, 292, 9, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 5, 20, 299, 8, 20, 10, 20, 12, 20, 302, 9, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 319, 8, 22, 10, 22, 12, 22, 322, 9, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 330, 8, 22, 10, 22, 12, 22, 333, 9, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 341, 8, 22, 10, 22, 12, 22, 344, 9, 22, 1, 22, 1, 22, 3, 22, 348, 8, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 357, 8, 24, 10, 24, 12, 24, 360, 9, 24, 1, 25, 1, 25, 3, 25, 364, 8, 25, 1, 25, 1, 25, 3, 25, 368, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 374, 8, 26, 10, 26, 12, 26, 377, 9, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 383, 8, 26, 10, 26, 12, 26, 386, 9, 26, 3, 26, 388, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 5, 27, 394, 8, 27, 10, 27, 12, 27, 397, 9, 27, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 403, 8, 28, 10, 28, 12, 28, 406, 9, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 3, 30, 416, 8, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 5, 33, 428, 8, 33, 10, 33, 12, 33, 431, 9, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 3, 36, 441, 8, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 3, 43, 462, 8, 43, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 468, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 474, 8, 44, 10, 44, 12, 44, 477, 9, 44, 3, 44, 479, 8, 44, 1, 45, 1, 45, 1, 45, 3, 45, 484, 8, 45, 1, 45, 1, 45, 1, 45, 0, 3, 2, 10, 16, 46, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 0, 8, 1, 0, 59, 60, 1, 0, 61, 63, 1, 0, 75, 76, 1, 0, 66, 67, 2, 0, 32, 32, 35, 35, 1, 0, 38, 39, 2, 0, 37, 37, 50, 50, 1, 0, 53, 58, 514, 0, 92, 1, 0, 0, 0, 2, 95, 1, 0, 0, 0, 4, 110, 1, 0, 0, 0, 6, 125, 1, 0, 0, 0, 8, 127, 1, 0, 0, 0, 10, 151, 1, 0, 0, 0, 12, 178, 1, 0, 0, 0, 14, 185, 1, 0, 0, 0, 16, 191, 1, 0, 0, 0, 18, 224, 1, 0, 0, 0, 20, 226, 1, 0, 0, 0, 22, 229, 1, 0, 0, 0, 24, 242, 1, 0, 0, 0, 26, 244, 1, 0, 0, 0, 28, 256, 1, 0, 0, 0, 30, 268, 1, 0, 0, 0, 32, 271, 1, 0, 0, 0, 34, 279, 1, 0, 0, 0, 36, 285, 1, 0, 0, 0, 38, 293, 1, 0, 0, 0, 40, 295, 1, 0, 0, 0, 42, 303, 1, 0, 0, 0, 44, 347, 1, 0, 0, 0, 46, 349, 1, 0, 0, 0, 48, 352, 1, 0, 0, 0, 50, 361, 1, 0, 0, 0, 52, 387, 1, 0, 0, 0, 54, 389, 1, 0, 0, 0, 56, 398, 1, 0, 0, 0, 58, 407, 1, 0, 0, 0, 60, 411, 1, 0, 0, 0, 62, 417, 1, 0, 0, 0, 64, 421, 1, 0, 0, 0, 66, 424, 1, 0, 0, 0, 68, 432, 1, 0, 0, 0, 70, 436, 1, 0, 0, 0, 72, 440, 1, 0, 0, 0, 74, 442, 1, 0, 0, 0, 76, 444, 1, 0, 0, 0, 78, 446, 1, 0, 0, 0, 80, 448, 1, 0, 0, 0, 82, 450, 1, 0, 0, 0, 84, 453, 1, 0, 0, 0, 86, 461, 1, 0, 0, 0, 88, 463, 1, 0, 0, 0, 90, 483, 1, 0, 0, 0, 92, 93, 3, 2, 1, 0, 93, 94, 5, 0, 0, 1, 94, 1, 1, 0, 0, 0, 95, 96, 6, 1, -1, 0, 96, 97, 3, 4, 2, 0, 97, 103, 1, 0, 0, 0, 98, 99, 10, 1, 0, 0, 99, 100, 5, 26, 0, 0, 100, 102, 3, 6, 3, 0, 101, 98, 1, 0, 0, 0, 102, 105, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 3, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 106, 111, 3, 82, 41, 0, 107, 111, 3, 26, 13, 0, 108, 111, 3, 20, 10, 0, 109, 111, 3, 86, 43, 0, 110, 106, 1, 0, 0, 0, 110, 107, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 110, 109, 1, 0, 0, 0, 111, 5, 1, 0, 0, 0, 112, 126, 3, 30, 15, 0, 113, 126, 3, 34, 17, 0, 114, 126, 3, 46, 23, 0, 115, 126, 3, 52, 26, 0, 116, 126, 3, 48, 24, 0, 117, 126, 3, 32, 16, 0, 118, 126, 3, 8, 4, 0, 119, 126, 3, 54, 27, 0, 120, 126, 3, 56, 28, 0, 121, 126, 3, 60, 30, 0, 122, 126, 3, 62, 31, 0, 123, 126, 3, 88, 44, 0, 124, 126, 3, 64, 32, 0, 125, 112, 1, 0, 0, 0, 125, 113, 1, 0, 0, 0, 125, 114, 1, 0, 0, 0, 125, 115, 1, 0, 0, 0, 125, 116, 1, 0, 0, 0, 125, 117, 1, 0, 0, 0, 125, 118, 1, 0, 0, 0, 125, 119, 1, 0, 0, 0, 125, 120, 1, 0, 0, 0, 125, 121, 1, 0, 0, 0, 125, 122, 1, 0, 0, 0, 125, 123, 1, 0, 0, 0, 125, 124, 1, 0, 0, 0, 126, 7, 1, 0, 0, 0, 127, 128, 5, 18, 0, 0, 128, 129, 3, 10, 5, 0, 129, 9, 1, 0, 0, 0, 130, 131, 6, 5, -1, 0, 131, 132, 5, 43, 0, 0, 132, 152, 3, 10, 5, 6, 133, 152, 3, 14, 7, 0, 134, 152, 3, 12, 6, 0, 135, 137, 3, 14, 7, 0, 136, 138, 5, 43, 0, 0, 137, 136, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 140, 5, 41, 0, 0, 140, 141, 5, 40, 0, 0, 141, 146, 3, 14, 7, 0, 142, 143, 5, 34, 0, 0, 143, 145, 3, 14, 7, 0, 144, 142, 1, 0, 0, 0, 145, 148, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 146, 147, 1, 0, 0, 0, 147, 149, 1, 0, 0, 0, 148, 146, 1, 0, 0, 0, 149, 150, 5, 49, 0, 0, 150, 152, 1, 0, 0, 0, 151, 130, 1, 0, 0, 0, 151, 133, 1, 0, 0, 0, 151, 134, 1, 0, 0, 0, 151, 135, 1, 0, 0, 0, 152, 161, 1, 0, 0, 0, 153, 154, 10, 3, 0, 0, 154, 155, 5, 31, 0, 0, 155, 160, 3, 10, 5, 4, 156, 157, 10, 2, 0, 0, 157, 158, 5, 46, 0, 0, 158, 160, 3, 10, 5, 3, 159, 153, 1, 0, 0, 0, 159, 156, 1, 0, 0, 0, 160, 163, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 11, 1, 0, 0, 0, 163, 161, 1, 0, 0, 0, 164, 166, 3, 14, 7, 0, 165, 167, 5, 43, 0, 0, 166, 165, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 169, 5, 42, 0, 0, 169, 170, 3, 78, 39, 0, 170, 179, 1, 0, 0, 0, 171, 173, 3, 14, 7, 0, 172, 174, 5, 43, 0, 0, 173, 172, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 176, 5, 48, 0, 0, 176, 177, 3, 78, 39, 0, 177, 179, 1, 0, 0, 0, 178, 164, 1, 0, 0, 0, 178, 171, 1, 0, 0, 0, 179, 13, 1, 0, 0, 0, 180, 186, 3, 16, 8, 0, 181, 182, 3, 16, 8, 0, 182, 183, 3, 80, 40, 0, 183, 184, 3, 16, 8, 0, 184, 186, 1, 0, 0, 0, 185, 180, 1, 0, 0, 0, 185, 181, 1, 0, 0, 0, 186, 15, 1, 0, 0, 0, 187, 188, 6, 8, -1, 0, 188, 192, 3, 18, 9, 0, 189, 190, 7, 0, 0, 0, 190, 192, 3, 16, 8, 3, 191, 187, 1, 0, 0, 0, 191, 189, 1, 0, 0, 0, 192, 201, 1, 0, 0, 0, 193, 194, 10, 2, 0, 0, 194, 195, 7, 1, 0, 0, 195, 200, 3, 16, 8, 3, 196, 197, 10, 1, 0, 0, 197, 198, 7, 0, 0, 0, 198, 200, 3, 16, 8, 2, 199, 193, 1, 0, 0, 0, 199, 196, 1, 0, 0, 0, 200, 203, 1, 0, 0, 0, 201, 199, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 17, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 204, 225, 3, 44, 22, 0, 205, 225, 3, 40, 20, 0, 206, 207, 5, 40, 0, 0, 207, 208, 3, 10, 5, 0, 208, 209, 5, 49, 0, 0, 209, 225, 1, 0, 0, 0, 210, 211, 3, 42, 21, 0, 211, 220, 5, 40, 0, 0, 212, 217, 3, 10, 5, 0, 213, 214, 5, 34, 0, 0, 214, 216, 3, 10, 5, 0, 215, 213, 1, 0, 0, 0, 216, 219, 1, 0, 0, 0, 217, 215, 1, 0, 0, 0, 217, 218, 1, 0, 0, 0, 218, 221, 1, 0, 0, 0, 219, 217, 1, 0, 0, 0, 220, 212, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 222, 1, 0, 0, 0, 222, 223, 5, 49, 0, 0, 223, 225, 1, 0, 0, 0, 224, 204, 1, 0, 0, 0, 224, 205, 1, 0, 0, 0, 224, 206, 1, 0, 0, 0, 224, 210, 1, 0, 0, 0, 225, 19, 1, 0, 0, 0, 226, 227, 5, 14, 0, 0, 227, 228, 3, 22, 11, 0, 228, 21, 1, 0, 0, 0, 229, 234, 3, 24, 12, 0, 230, 231, 5, 34, 0, 0, 231, 233, 3, 24, 12, 0, 232, 230, 1, 0, 0, 0, 233, 236, 1, 0, 0, 0, 234, 232, 1, 0, 0, 0, 234, 235, 1, 0, 0, 0, 235, 23, 1, 0, 0, 0, 236, 234, 1, 0, 0, 0, 237, 243, 3, 10, 5, 0, 238, 239, 3, 40, 20, 0, 239, 240, 5, 33, 0, 0, 240, 241, 3, 10, 5, 0, 241, 243, 1, 0, 0, 0, 242, 237, 1, 0, 0, 0, 242, 238, 1, 0, 0, 0, 243, 25, 1, 0, 0, 0, 244, 245, 5, 6, 0, 0, 245, 250, 3, 38, 19, 0, 246, 247, 5, 34, 0, 0, 247, 249, 3, 38, 19, 0, 248, 246, 1, 0, 0, 0, 249, 252, 1, 0, 0, 0, 250, 248, 1, 0, 0, 0, 250, 251, 1, 0, 0, 0, 251, 254, 1, 0, 0, 0, 252, 250, 1, 0, 0, 0, 253, 255, 3, 28, 14, 0, 254, 253, 1, 0, 0, 0, 254, 255, 1, 0, 0, 0, 255, 27, 1, 0, 0, 0, 256, 257, 5, 64, 0, 0, 257, 258, 5, 72, 0, 0, 258, 263, 3, 38, 19, 0, 259, 260, 5, 34, 0, 0, 260, 262, 3, 38, 19, 0, 261, 259, 1, 0, 0, 0, 262, 265, 1, 0, 0, 0, 263, 261, 1, 0, 0, 0, 263, 264, 1, 0, 0, 0, 264, 266, 1, 0, 0, 0, 265, 263, 1, 0, 0, 0, 266, 267, 5, 65, 0, 0, 267, 29, 1, 0, 0, 0, 268, 269, 5, 4, 0, 0, 269, 270, 3, 22, 11, 0, 270, 31, 1, 0, 0, 0, 271, 273, 5, 17, 0, 0, 272, 274, 3, 22, 11, 0, 273, 272, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 277, 1, 0, 0, 0, 275, 276, 5, 30, 0, 0, 276, 278, 3, 36, 18, 0, 277, 275, 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 33, 1, 0, 0, 0, 279, 280, 5, 8, 0, 0, 280, 283, 3, 22, 11, 0, 281, 282, 5, 30, 0, 0, 282, 284, 3, 36, 18, 0, 283, 281, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 35, 1, 0, 0, 0, 285, 290, 3, 40, 20, 0, 286, 287, 5, 34, 0, 0, 287, 289, 3, 40, 20, 0, 288, 286, 1, 0, 0, 0, 289, 292, 1, 0, 0, 0, 290, 288, 1, 0, 0, 0, 290, 291, 1, 0, 0, 0, 291, 37, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, 293, 294, 7, 2, 0, 0, 294, 39, 1, 0, 0, 0, 295, 300, 3, 42, 21, 0, 296, 297, 5, 36, 0, 0, 297, 299, 3, 42, 21, 0, 298, 296, 1, 0, 0, 0, 299, 302, 1, 0, 0, 0, 300, 298, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 41, 1, 0, 0, 0, 302, 300, 1, 0, 0, 0, 303, 304, 7, 3, 0, 0, 304, 43, 1, 0, 0, 0, 305, 348, 5, 44, 0, 0, 306, 307, 3, 76, 38, 0, 307, 308, 5, 66, 0, 0, 308, 348, 1, 0, 0, 0, 309, 348, 3, 74, 37, 0, 310, 348, 3, 76, 38, 0, 311, 348, 3, 70, 35, 0, 312, 348, 5, 47, 0, 0, 313, 348, 3, 78, 39, 0, 314, 315, 5, 64, 0, 0, 315, 320, 3, 72, 36, 0, 316, 317, 5, 34, 0, 0, 317, 319, 3, 72, 36, 0, 318, 316, 1, 0, 0, 0, 319, 322, 1, 0, 0, 0, 320, 318, 1, 0, 0, 0, 320, 321, 1, 0, 0, 0, 321, 323, 1, 0, 0, 0, 322, 320, 1, 0, 0, 0, 323, 324, 5, 65, 0, 0, 324, 348, 1, 0, 0, 0, 325, 326, 5, 64, 0, 0, 326, 331, 3, 70, 35, 0, 327, 328, 5, 34, 0, 0, 328, 330, 3, 70, 35, 0, 329, 327, 1, 0, 0, 0, 330, 333, 1, 0, 0, 0, 331, 329, 1, 0, 0, 0, 331, 332, 1, 0, 0, 0, 332, 334, 1, 0, 0, 0, 333, 331, 1, 0, 0, 0, 334, 335, 5, 65, 0, 0, 335, 348, 1, 0, 0, 0, 336, 337, 5, 64, 0, 0, 337, 342, 3, 78, 39, 0, 338, 339, 5, 34, 0, 0, 339, 341, 3, 78, 39, 0, 340, 338, 1, 0, 0, 0, 341, 344, 1, 0, 0, 0, 342, 340, 1, 0, 0, 0, 342, 343, 1, 0, 0, 0, 343, 345, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 345, 346, 5, 65, 0, 0, 346, 348, 1, 0, 0, 0, 347, 305, 1, 0, 0, 0, 347, 306, 1, 0, 0, 0, 347, 309, 1, 0, 0, 0, 347, 310, 1, 0, 0, 0, 347, 311, 1, 0, 0, 0, 347, 312, 1, 0, 0, 0, 347, 313, 1, 0, 0, 0, 347, 314, 1, 0, 0, 0, 347, 325, 1, 0, 0, 0, 347, 336, 1, 0, 0, 0, 348, 45, 1, 0, 0, 0, 349, 350, 5, 10, 0, 0, 350, 351, 5, 28, 0, 0, 351, 47, 1, 0, 0, 0, 352, 353, 5, 16, 0, 0, 353, 358, 3, 50, 25, 0, 354, 355, 5, 34, 0, 0, 355, 357, 3, 50, 25, 0, 356, 354, 1, 0, 0, 0, 357, 360, 1, 0, 0, 0, 358, 356, 1, 0, 0, 0, 358, 359, 1, 0, 0, 0, 359, 49, 1, 0, 0, 0, 360, 358, 1, 0, 0, 0, 361, 363, 3, 10, 5, 0, 362, 364, 7, 4, 0, 0, 363, 362, 1, 0, 0, 0, 363, 364, 1, 0, 0, 0, 364, 367, 1, 0, 0, 0, 365, 366, 5, 45, 0, 0, 366, 368, 7, 5, 0, 0, 367, 365, 1, 0, 0, 0, 367, 368, 1, 0, 0, 0, 368, 51, 1, 0, 0, 0, 369, 370, 5, 9, 0, 0, 370, 375, 3, 38, 19, 0, 371, 372, 5, 34, 0, 0, 372, 374, 3, 38, 19, 0, 373, 371, 1, 0, 0, 0, 374, 377, 1, 0, 0, 0, 375, 373, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 388, 1, 0, 0, 0, 377, 375, 1, 0, 0, 0, 378, 379, 5, 12, 0, 0, 379, 384, 3, 38, 19, 0, 380, 381, 5, 34, 0, 0, 381, 383, 3, 38, 19, 0, 382, 380, 1, 0, 0, 0, 383, 386, 1, 0, 0, 0, 384, 382, 1, 0, 0, 0, 384, 385, 1, 0, 0, 0, 385, 388, 1, 0, 0, 0, 386, 384, 1, 0, 0, 0, 387, 369, 1, 0, 0, 0, 387, 378, 1, 0, 0, 0, 388, 53, 1, 0, 0, 0, 389, 390, 5, 2, 0, 0, 390, 395, 3, 38, 19, 0, 391, 392, 5, 34, 0, 0, 392, 394, 3, 38, 19, 0, 393, 391, 1, 0, 0, 0, 394, 397, 1, 0, 0, 0, 395, 393, 1, 0, 0, 0, 395, 396, 1, 0, 0, 0, 396, 55, 1, 0, 0, 0, 397, 395, 1, 0, 0, 0, 398, 399, 5, 13, 0, 0, 399, 404, 3, 58, 29, 0, 400, 401, 5, 34, 0, 0, 401, 403, 3, 58, 29, 0, 402, 400, 1, 0, 0, 0, 403, 406, 1, 0, 0, 0, 404, 402, 1, 0, 0, 0, 404, 405, 1, 0, 0, 0, 405, 57, 1, 0, 0, 0, 406, 404, 1, 0, 0, 0, 407, 408, 3, 38, 19, 0, 408, 409, 5, 71, 0, 0, 409, 410, 3, 38, 19, 0, 410, 59, 1, 0, 0, 0, 411, 412, 5, 1, 0, 0, 412, 413, 3, 18, 9, 0, 413, 415, 3, 78, 39, 0, 414, 416, 3, 66, 33, 0, 415, 414, 1, 0, 0, 0, 415, 416, 1, 0, 0, 0, 416, 61, 1, 0, 0, 0, 417, 418, 5, 7, 0, 0, 418, 419, 3, 18, 9, 0, 419, 420, 3, 78, 39, 0, 420, 63, 1, 0, 0, 0, 421, 422, 5, 11, 0, 0, 422, 423, 3, 38, 19, 0, 423, 65, 1, 0, 0, 0, 424, 429, 3, 68, 34, 0, 425, 426, 5, 34, 0, 0, 426, 428, 3, 68, 34, 0, 427, 425, 1, 0, 0, 0, 428, 431, 1, 0, 0, 0, 429, 427, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 67, 1, 0, 0, 0, 431, 429, 1, 0, 0, 0, 432, 433, 3, 42, 21, 0, 433, 434, 5, 33, 0, 0, 434, 435, 3, 44, 22, 0, 435, 69, 1, 0, 0, 0, 436, 437, 7, 6, 0, 0, 437, 71, 1, 0, 0, 0, 438, 441, 3, 74, 37, 0, 439, 441, 3, 76, 38, 0, 440, 438, 1, 0, 0, 0, 440, 439, 1, 0, 0, 0, 441, 73, 1, 0, 0, 0, 442, 443, 5, 29, 0, 0, 443, 75, 1, 0, 0, 0, 444, 445, 5, 28, 0, 0, 445, 77, 1, 0, 0, 0, 446, 447, 5, 27, 0, 0, 447, 79, 1, 0, 0, 0, 448, 449, 7, 7, 0, 0, 449, 81, 1, 0, 0, 0, 450, 451, 5, 5, 0, 0, 451, 452, 3, 84, 42, 0, 452, 83, 1, 0, 0, 0, 453, 454, 5, 64, 0, 0, 454, 455, 3, 2, 1, 0, 455, 456, 5, 65, 0, 0, 456, 85, 1, 0, 0, 0, 457, 458, 5, 15, 0, 0, 458, 462, 5, 51, 0, 0, 459, 460, 5, 15, 0, 0, 460, 462, 5, 52, 0, 0, 461, 457, 1, 0, 0, 0, 461, 459, 1, 0, 0, 0, 462, 87, 1, 0, 0, 0, 463, 464, 5, 3, 0, 0, 464, 467, 3, 38, 19, 0, 465, 466, 5, 73, 0, 0, 466, 468, 3, 38, 19, 0, 467, 465, 1, 0, 0, 0, 467, 468, 1, 0, 0, 0, 468, 478, 1, 0, 0, 0, 469, 470, 5, 74, 0, 0, 470, 475, 3, 90, 45, 0, 471, 472, 5, 34, 0, 0, 472, 474, 3, 90, 45, 0, 473, 471, 1, 0, 0, 0, 474, 477, 1, 0, 0, 0, 475, 473, 1, 0, 0, 0, 475, 476, 1, 0, 0, 0, 476, 479, 1, 0, 0, 0, 477, 475, 1, 0, 0, 0, 478, 469, 1, 0, 0, 0, 478, 479, 1, 0, 0, 0, 479, 89, 1, 0, 0, 0, 480, 481, 3, 38, 19, 0, 481, 482, 5, 33, 0, 0, 482, 484, 1, 0, 0, 0, 483, 480, 1, 0, 0, 0, 483, 484, 1, 0, 0, 0, 484, 485, 1, 0, 0, 0, 485, 486, 3, 38, 19, 0, 486, 91, 1, 0, 0, 0, 48, 103, 110, 125, 137, 146, 151, 159, 161, 166, 173, 178, 185, 191, 199, 201, 217, 220, 224, 234, 242, 250, 254, 263, 273, 277, 283, 290, 300, 320, 331, 342, 347, 358, 363, 367, 375, 384, 387, 395, 404, 415, 429, 440, 461, 467, 475, 478, 483] \ No newline at end of file diff --git a/esql/generated/v8_11_0/EsqlBaseParser.py b/esql/generated/v8_11_0/EsqlBaseParser.py new file mode 100644 index 00000000000..a22bd68238c --- /dev/null +++ b/esql/generated/v8_11_0/EsqlBaseParser.py @@ -0,0 +1,4277 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. + +# encoding: utf-8 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + +def serializedATN(): + return [ + 4,1,80,488,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, + 2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20, + 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26, + 2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33, + 7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39, + 2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,1,0, + 1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,5,1,102,8,1,10,1,12,1,105,9,1,1, + 2,1,2,1,2,1,2,3,2,111,8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1, + 3,1,3,1,3,1,3,3,3,126,8,3,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1, + 5,3,5,138,8,5,1,5,1,5,1,5,1,5,1,5,5,5,145,8,5,10,5,12,5,148,9,5, + 1,5,1,5,3,5,152,8,5,1,5,1,5,1,5,1,5,1,5,1,5,5,5,160,8,5,10,5,12, + 5,163,9,5,1,6,1,6,3,6,167,8,6,1,6,1,6,1,6,1,6,1,6,3,6,174,8,6,1, + 6,1,6,1,6,3,6,179,8,6,1,7,1,7,1,7,1,7,1,7,3,7,186,8,7,1,8,1,8,1, + 8,1,8,3,8,192,8,8,1,8,1,8,1,8,1,8,1,8,1,8,5,8,200,8,8,10,8,12,8, + 203,9,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,5,9,216,8,9, + 10,9,12,9,219,9,9,3,9,221,8,9,1,9,1,9,3,9,225,8,9,1,10,1,10,1,10, + 1,11,1,11,1,11,5,11,233,8,11,10,11,12,11,236,9,11,1,12,1,12,1,12, + 1,12,1,12,3,12,243,8,12,1,13,1,13,1,13,1,13,5,13,249,8,13,10,13, + 12,13,252,9,13,1,13,3,13,255,8,13,1,14,1,14,1,14,1,14,1,14,5,14, + 262,8,14,10,14,12,14,265,9,14,1,14,1,14,1,15,1,15,1,15,1,16,1,16, + 3,16,274,8,16,1,16,1,16,3,16,278,8,16,1,17,1,17,1,17,1,17,3,17,284, + 8,17,1,18,1,18,1,18,5,18,289,8,18,10,18,12,18,292,9,18,1,19,1,19, + 1,20,1,20,1,20,5,20,299,8,20,10,20,12,20,302,9,20,1,21,1,21,1,22, + 1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,5,22, + 319,8,22,10,22,12,22,322,9,22,1,22,1,22,1,22,1,22,1,22,1,22,5,22, + 330,8,22,10,22,12,22,333,9,22,1,22,1,22,1,22,1,22,1,22,1,22,5,22, + 341,8,22,10,22,12,22,344,9,22,1,22,1,22,3,22,348,8,22,1,23,1,23, + 1,23,1,24,1,24,1,24,1,24,5,24,357,8,24,10,24,12,24,360,9,24,1,25, + 1,25,3,25,364,8,25,1,25,1,25,3,25,368,8,25,1,26,1,26,1,26,1,26,5, + 26,374,8,26,10,26,12,26,377,9,26,1,26,1,26,1,26,1,26,5,26,383,8, + 26,10,26,12,26,386,9,26,3,26,388,8,26,1,27,1,27,1,27,1,27,5,27,394, + 8,27,10,27,12,27,397,9,27,1,28,1,28,1,28,1,28,5,28,403,8,28,10,28, + 12,28,406,9,28,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,3,30,416, + 8,30,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,5,33,428, + 8,33,10,33,12,33,431,9,33,1,34,1,34,1,34,1,34,1,35,1,35,1,36,1,36, + 3,36,441,8,36,1,37,1,37,1,38,1,38,1,39,1,39,1,40,1,40,1,41,1,41, + 1,41,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,3,43,462,8,43,1,44, + 1,44,1,44,1,44,3,44,468,8,44,1,44,1,44,1,44,1,44,5,44,474,8,44,10, + 44,12,44,477,9,44,3,44,479,8,44,1,45,1,45,1,45,3,45,484,8,45,1,45, + 1,45,1,45,0,3,2,10,16,46,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28, + 30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72, + 74,76,78,80,82,84,86,88,90,0,8,1,0,59,60,1,0,61,63,1,0,75,76,1,0, + 66,67,2,0,32,32,35,35,1,0,38,39,2,0,37,37,50,50,1,0,53,58,514,0, + 92,1,0,0,0,2,95,1,0,0,0,4,110,1,0,0,0,6,125,1,0,0,0,8,127,1,0,0, + 0,10,151,1,0,0,0,12,178,1,0,0,0,14,185,1,0,0,0,16,191,1,0,0,0,18, + 224,1,0,0,0,20,226,1,0,0,0,22,229,1,0,0,0,24,242,1,0,0,0,26,244, + 1,0,0,0,28,256,1,0,0,0,30,268,1,0,0,0,32,271,1,0,0,0,34,279,1,0, + 0,0,36,285,1,0,0,0,38,293,1,0,0,0,40,295,1,0,0,0,42,303,1,0,0,0, + 44,347,1,0,0,0,46,349,1,0,0,0,48,352,1,0,0,0,50,361,1,0,0,0,52,387, + 1,0,0,0,54,389,1,0,0,0,56,398,1,0,0,0,58,407,1,0,0,0,60,411,1,0, + 0,0,62,417,1,0,0,0,64,421,1,0,0,0,66,424,1,0,0,0,68,432,1,0,0,0, + 70,436,1,0,0,0,72,440,1,0,0,0,74,442,1,0,0,0,76,444,1,0,0,0,78,446, + 1,0,0,0,80,448,1,0,0,0,82,450,1,0,0,0,84,453,1,0,0,0,86,461,1,0, + 0,0,88,463,1,0,0,0,90,483,1,0,0,0,92,93,3,2,1,0,93,94,5,0,0,1,94, + 1,1,0,0,0,95,96,6,1,-1,0,96,97,3,4,2,0,97,103,1,0,0,0,98,99,10,1, + 0,0,99,100,5,26,0,0,100,102,3,6,3,0,101,98,1,0,0,0,102,105,1,0,0, + 0,103,101,1,0,0,0,103,104,1,0,0,0,104,3,1,0,0,0,105,103,1,0,0,0, + 106,111,3,82,41,0,107,111,3,26,13,0,108,111,3,20,10,0,109,111,3, + 86,43,0,110,106,1,0,0,0,110,107,1,0,0,0,110,108,1,0,0,0,110,109, + 1,0,0,0,111,5,1,0,0,0,112,126,3,30,15,0,113,126,3,34,17,0,114,126, + 3,46,23,0,115,126,3,52,26,0,116,126,3,48,24,0,117,126,3,32,16,0, + 118,126,3,8,4,0,119,126,3,54,27,0,120,126,3,56,28,0,121,126,3,60, + 30,0,122,126,3,62,31,0,123,126,3,88,44,0,124,126,3,64,32,0,125,112, + 1,0,0,0,125,113,1,0,0,0,125,114,1,0,0,0,125,115,1,0,0,0,125,116, + 1,0,0,0,125,117,1,0,0,0,125,118,1,0,0,0,125,119,1,0,0,0,125,120, + 1,0,0,0,125,121,1,0,0,0,125,122,1,0,0,0,125,123,1,0,0,0,125,124, + 1,0,0,0,126,7,1,0,0,0,127,128,5,18,0,0,128,129,3,10,5,0,129,9,1, + 0,0,0,130,131,6,5,-1,0,131,132,5,43,0,0,132,152,3,10,5,6,133,152, + 3,14,7,0,134,152,3,12,6,0,135,137,3,14,7,0,136,138,5,43,0,0,137, + 136,1,0,0,0,137,138,1,0,0,0,138,139,1,0,0,0,139,140,5,41,0,0,140, + 141,5,40,0,0,141,146,3,14,7,0,142,143,5,34,0,0,143,145,3,14,7,0, + 144,142,1,0,0,0,145,148,1,0,0,0,146,144,1,0,0,0,146,147,1,0,0,0, + 147,149,1,0,0,0,148,146,1,0,0,0,149,150,5,49,0,0,150,152,1,0,0,0, + 151,130,1,0,0,0,151,133,1,0,0,0,151,134,1,0,0,0,151,135,1,0,0,0, + 152,161,1,0,0,0,153,154,10,3,0,0,154,155,5,31,0,0,155,160,3,10,5, + 4,156,157,10,2,0,0,157,158,5,46,0,0,158,160,3,10,5,3,159,153,1,0, + 0,0,159,156,1,0,0,0,160,163,1,0,0,0,161,159,1,0,0,0,161,162,1,0, + 0,0,162,11,1,0,0,0,163,161,1,0,0,0,164,166,3,14,7,0,165,167,5,43, + 0,0,166,165,1,0,0,0,166,167,1,0,0,0,167,168,1,0,0,0,168,169,5,42, + 0,0,169,170,3,78,39,0,170,179,1,0,0,0,171,173,3,14,7,0,172,174,5, + 43,0,0,173,172,1,0,0,0,173,174,1,0,0,0,174,175,1,0,0,0,175,176,5, + 48,0,0,176,177,3,78,39,0,177,179,1,0,0,0,178,164,1,0,0,0,178,171, + 1,0,0,0,179,13,1,0,0,0,180,186,3,16,8,0,181,182,3,16,8,0,182,183, + 3,80,40,0,183,184,3,16,8,0,184,186,1,0,0,0,185,180,1,0,0,0,185,181, + 1,0,0,0,186,15,1,0,0,0,187,188,6,8,-1,0,188,192,3,18,9,0,189,190, + 7,0,0,0,190,192,3,16,8,3,191,187,1,0,0,0,191,189,1,0,0,0,192,201, + 1,0,0,0,193,194,10,2,0,0,194,195,7,1,0,0,195,200,3,16,8,3,196,197, + 10,1,0,0,197,198,7,0,0,0,198,200,3,16,8,2,199,193,1,0,0,0,199,196, + 1,0,0,0,200,203,1,0,0,0,201,199,1,0,0,0,201,202,1,0,0,0,202,17,1, + 0,0,0,203,201,1,0,0,0,204,225,3,44,22,0,205,225,3,40,20,0,206,207, + 5,40,0,0,207,208,3,10,5,0,208,209,5,49,0,0,209,225,1,0,0,0,210,211, + 3,42,21,0,211,220,5,40,0,0,212,217,3,10,5,0,213,214,5,34,0,0,214, + 216,3,10,5,0,215,213,1,0,0,0,216,219,1,0,0,0,217,215,1,0,0,0,217, + 218,1,0,0,0,218,221,1,0,0,0,219,217,1,0,0,0,220,212,1,0,0,0,220, + 221,1,0,0,0,221,222,1,0,0,0,222,223,5,49,0,0,223,225,1,0,0,0,224, + 204,1,0,0,0,224,205,1,0,0,0,224,206,1,0,0,0,224,210,1,0,0,0,225, + 19,1,0,0,0,226,227,5,14,0,0,227,228,3,22,11,0,228,21,1,0,0,0,229, + 234,3,24,12,0,230,231,5,34,0,0,231,233,3,24,12,0,232,230,1,0,0,0, + 233,236,1,0,0,0,234,232,1,0,0,0,234,235,1,0,0,0,235,23,1,0,0,0,236, + 234,1,0,0,0,237,243,3,10,5,0,238,239,3,40,20,0,239,240,5,33,0,0, + 240,241,3,10,5,0,241,243,1,0,0,0,242,237,1,0,0,0,242,238,1,0,0,0, + 243,25,1,0,0,0,244,245,5,6,0,0,245,250,3,38,19,0,246,247,5,34,0, + 0,247,249,3,38,19,0,248,246,1,0,0,0,249,252,1,0,0,0,250,248,1,0, + 0,0,250,251,1,0,0,0,251,254,1,0,0,0,252,250,1,0,0,0,253,255,3,28, + 14,0,254,253,1,0,0,0,254,255,1,0,0,0,255,27,1,0,0,0,256,257,5,64, + 0,0,257,258,5,72,0,0,258,263,3,38,19,0,259,260,5,34,0,0,260,262, + 3,38,19,0,261,259,1,0,0,0,262,265,1,0,0,0,263,261,1,0,0,0,263,264, + 1,0,0,0,264,266,1,0,0,0,265,263,1,0,0,0,266,267,5,65,0,0,267,29, + 1,0,0,0,268,269,5,4,0,0,269,270,3,22,11,0,270,31,1,0,0,0,271,273, + 5,17,0,0,272,274,3,22,11,0,273,272,1,0,0,0,273,274,1,0,0,0,274,277, + 1,0,0,0,275,276,5,30,0,0,276,278,3,36,18,0,277,275,1,0,0,0,277,278, + 1,0,0,0,278,33,1,0,0,0,279,280,5,8,0,0,280,283,3,22,11,0,281,282, + 5,30,0,0,282,284,3,36,18,0,283,281,1,0,0,0,283,284,1,0,0,0,284,35, + 1,0,0,0,285,290,3,40,20,0,286,287,5,34,0,0,287,289,3,40,20,0,288, + 286,1,0,0,0,289,292,1,0,0,0,290,288,1,0,0,0,290,291,1,0,0,0,291, + 37,1,0,0,0,292,290,1,0,0,0,293,294,7,2,0,0,294,39,1,0,0,0,295,300, + 3,42,21,0,296,297,5,36,0,0,297,299,3,42,21,0,298,296,1,0,0,0,299, + 302,1,0,0,0,300,298,1,0,0,0,300,301,1,0,0,0,301,41,1,0,0,0,302,300, + 1,0,0,0,303,304,7,3,0,0,304,43,1,0,0,0,305,348,5,44,0,0,306,307, + 3,76,38,0,307,308,5,66,0,0,308,348,1,0,0,0,309,348,3,74,37,0,310, + 348,3,76,38,0,311,348,3,70,35,0,312,348,5,47,0,0,313,348,3,78,39, + 0,314,315,5,64,0,0,315,320,3,72,36,0,316,317,5,34,0,0,317,319,3, + 72,36,0,318,316,1,0,0,0,319,322,1,0,0,0,320,318,1,0,0,0,320,321, + 1,0,0,0,321,323,1,0,0,0,322,320,1,0,0,0,323,324,5,65,0,0,324,348, + 1,0,0,0,325,326,5,64,0,0,326,331,3,70,35,0,327,328,5,34,0,0,328, + 330,3,70,35,0,329,327,1,0,0,0,330,333,1,0,0,0,331,329,1,0,0,0,331, + 332,1,0,0,0,332,334,1,0,0,0,333,331,1,0,0,0,334,335,5,65,0,0,335, + 348,1,0,0,0,336,337,5,64,0,0,337,342,3,78,39,0,338,339,5,34,0,0, + 339,341,3,78,39,0,340,338,1,0,0,0,341,344,1,0,0,0,342,340,1,0,0, + 0,342,343,1,0,0,0,343,345,1,0,0,0,344,342,1,0,0,0,345,346,5,65,0, + 0,346,348,1,0,0,0,347,305,1,0,0,0,347,306,1,0,0,0,347,309,1,0,0, + 0,347,310,1,0,0,0,347,311,1,0,0,0,347,312,1,0,0,0,347,313,1,0,0, + 0,347,314,1,0,0,0,347,325,1,0,0,0,347,336,1,0,0,0,348,45,1,0,0,0, + 349,350,5,10,0,0,350,351,5,28,0,0,351,47,1,0,0,0,352,353,5,16,0, + 0,353,358,3,50,25,0,354,355,5,34,0,0,355,357,3,50,25,0,356,354,1, + 0,0,0,357,360,1,0,0,0,358,356,1,0,0,0,358,359,1,0,0,0,359,49,1,0, + 0,0,360,358,1,0,0,0,361,363,3,10,5,0,362,364,7,4,0,0,363,362,1,0, + 0,0,363,364,1,0,0,0,364,367,1,0,0,0,365,366,5,45,0,0,366,368,7,5, + 0,0,367,365,1,0,0,0,367,368,1,0,0,0,368,51,1,0,0,0,369,370,5,9,0, + 0,370,375,3,38,19,0,371,372,5,34,0,0,372,374,3,38,19,0,373,371,1, + 0,0,0,374,377,1,0,0,0,375,373,1,0,0,0,375,376,1,0,0,0,376,388,1, + 0,0,0,377,375,1,0,0,0,378,379,5,12,0,0,379,384,3,38,19,0,380,381, + 5,34,0,0,381,383,3,38,19,0,382,380,1,0,0,0,383,386,1,0,0,0,384,382, + 1,0,0,0,384,385,1,0,0,0,385,388,1,0,0,0,386,384,1,0,0,0,387,369, + 1,0,0,0,387,378,1,0,0,0,388,53,1,0,0,0,389,390,5,2,0,0,390,395,3, + 38,19,0,391,392,5,34,0,0,392,394,3,38,19,0,393,391,1,0,0,0,394,397, + 1,0,0,0,395,393,1,0,0,0,395,396,1,0,0,0,396,55,1,0,0,0,397,395,1, + 0,0,0,398,399,5,13,0,0,399,404,3,58,29,0,400,401,5,34,0,0,401,403, + 3,58,29,0,402,400,1,0,0,0,403,406,1,0,0,0,404,402,1,0,0,0,404,405, + 1,0,0,0,405,57,1,0,0,0,406,404,1,0,0,0,407,408,3,38,19,0,408,409, + 5,71,0,0,409,410,3,38,19,0,410,59,1,0,0,0,411,412,5,1,0,0,412,413, + 3,18,9,0,413,415,3,78,39,0,414,416,3,66,33,0,415,414,1,0,0,0,415, + 416,1,0,0,0,416,61,1,0,0,0,417,418,5,7,0,0,418,419,3,18,9,0,419, + 420,3,78,39,0,420,63,1,0,0,0,421,422,5,11,0,0,422,423,3,38,19,0, + 423,65,1,0,0,0,424,429,3,68,34,0,425,426,5,34,0,0,426,428,3,68,34, + 0,427,425,1,0,0,0,428,431,1,0,0,0,429,427,1,0,0,0,429,430,1,0,0, + 0,430,67,1,0,0,0,431,429,1,0,0,0,432,433,3,42,21,0,433,434,5,33, + 0,0,434,435,3,44,22,0,435,69,1,0,0,0,436,437,7,6,0,0,437,71,1,0, + 0,0,438,441,3,74,37,0,439,441,3,76,38,0,440,438,1,0,0,0,440,439, + 1,0,0,0,441,73,1,0,0,0,442,443,5,29,0,0,443,75,1,0,0,0,444,445,5, + 28,0,0,445,77,1,0,0,0,446,447,5,27,0,0,447,79,1,0,0,0,448,449,7, + 7,0,0,449,81,1,0,0,0,450,451,5,5,0,0,451,452,3,84,42,0,452,83,1, + 0,0,0,453,454,5,64,0,0,454,455,3,2,1,0,455,456,5,65,0,0,456,85,1, + 0,0,0,457,458,5,15,0,0,458,462,5,51,0,0,459,460,5,15,0,0,460,462, + 5,52,0,0,461,457,1,0,0,0,461,459,1,0,0,0,462,87,1,0,0,0,463,464, + 5,3,0,0,464,467,3,38,19,0,465,466,5,73,0,0,466,468,3,38,19,0,467, + 465,1,0,0,0,467,468,1,0,0,0,468,478,1,0,0,0,469,470,5,74,0,0,470, + 475,3,90,45,0,471,472,5,34,0,0,472,474,3,90,45,0,473,471,1,0,0,0, + 474,477,1,0,0,0,475,473,1,0,0,0,475,476,1,0,0,0,476,479,1,0,0,0, + 477,475,1,0,0,0,478,469,1,0,0,0,478,479,1,0,0,0,479,89,1,0,0,0,480, + 481,3,38,19,0,481,482,5,33,0,0,482,484,1,0,0,0,483,480,1,0,0,0,483, + 484,1,0,0,0,484,485,1,0,0,0,485,486,3,38,19,0,486,91,1,0,0,0,48, + 103,110,125,137,146,151,159,161,166,173,178,185,191,199,201,217, + 220,224,234,242,250,254,263,273,277,283,290,300,320,331,342,347, + 358,363,367,375,384,387,395,404,415,429,440,461,467,475,478,483 + ] + +class EsqlBaseParser ( Parser ): + + grammarFileName = "EsqlBaseParser.g4" + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + sharedContextCache = PredictionContextCache() + + literalNames = [ "", "'dissect'", "'drop'", "'enrich'", "'eval'", + "'explain'", "'from'", "'grok'", "'inlinestats'", "'keep'", + "'limit'", "'mv_expand'", "'project'", "'rename'", + "'row'", "'show'", "'sort'", "'stats'", "'where'", + "", "", "", "", + "", "", "", "", + "", "", "", "'by'", "'and'", + "'asc'", "", "", "'desc'", "'.'", + "'false'", "'first'", "'last'", "'('", "'in'", "'like'", + "'not'", "'null'", "'nulls'", "'or'", "'?'", "'rlike'", + "')'", "'true'", "'info'", "'functions'", "'=='", "'!='", + "'<'", "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", + "'/'", "'%'", "", "']'", "", "", + "", "", "", "'as'", "'metadata'", + "'on'", "'with'" ] + + symbolicNames = [ "", "DISSECT", "DROP", "ENRICH", "EVAL", + "EXPLAIN", "FROM", "GROK", "INLINESTATS", "KEEP", + "LIMIT", "MV_EXPAND", "PROJECT", "RENAME", "ROW", + "SHOW", "SORT", "STATS", "WHERE", "UNKNOWN_CMD", "LINE_COMMENT", + "MULTILINE_COMMENT", "WS", "EXPLAIN_WS", "EXPLAIN_LINE_COMMENT", + "EXPLAIN_MULTILINE_COMMENT", "PIPE", "STRING", "INTEGER_LITERAL", + "DECIMAL_LITERAL", "BY", "AND", "ASC", "ASSIGN", "COMMA", + "DESC", "DOT", "FALSE", "FIRST", "LAST", "LP", "IN", + "LIKE", "NOT", "NULL", "NULLS", "OR", "PARAM", "RLIKE", + "RP", "TRUE", "INFO", "FUNCTIONS", "EQ", "NEQ", "LT", + "LTE", "GT", "GTE", "PLUS", "MINUS", "ASTERISK", "SLASH", + "PERCENT", "OPENING_BRACKET", "CLOSING_BRACKET", "UNQUOTED_IDENTIFIER", + "QUOTED_IDENTIFIER", "EXPR_LINE_COMMENT", "EXPR_MULTILINE_COMMENT", + "EXPR_WS", "AS", "METADATA", "ON", "WITH", "SRC_UNQUOTED_IDENTIFIER", + "SRC_QUOTED_IDENTIFIER", "SRC_LINE_COMMENT", "SRC_MULTILINE_COMMENT", + "SRC_WS", "EXPLAIN_PIPE" ] + + RULE_singleStatement = 0 + RULE_query = 1 + RULE_sourceCommand = 2 + RULE_processingCommand = 3 + RULE_whereCommand = 4 + RULE_booleanExpression = 5 + RULE_regexBooleanExpression = 6 + RULE_valueExpression = 7 + RULE_operatorExpression = 8 + RULE_primaryExpression = 9 + RULE_rowCommand = 10 + RULE_fields = 11 + RULE_field = 12 + RULE_fromCommand = 13 + RULE_metadata = 14 + RULE_evalCommand = 15 + RULE_statsCommand = 16 + RULE_inlinestatsCommand = 17 + RULE_grouping = 18 + RULE_sourceIdentifier = 19 + RULE_qualifiedName = 20 + RULE_identifier = 21 + RULE_constant = 22 + RULE_limitCommand = 23 + RULE_sortCommand = 24 + RULE_orderExpression = 25 + RULE_keepCommand = 26 + RULE_dropCommand = 27 + RULE_renameCommand = 28 + RULE_renameClause = 29 + RULE_dissectCommand = 30 + RULE_grokCommand = 31 + RULE_mvExpandCommand = 32 + RULE_commandOptions = 33 + RULE_commandOption = 34 + RULE_booleanValue = 35 + RULE_numericValue = 36 + RULE_decimalValue = 37 + RULE_integerValue = 38 + RULE_string = 39 + RULE_comparisonOperator = 40 + RULE_explainCommand = 41 + RULE_subqueryExpression = 42 + RULE_showCommand = 43 + RULE_enrichCommand = 44 + RULE_enrichWithClause = 45 + + ruleNames = [ "singleStatement", "query", "sourceCommand", "processingCommand", + "whereCommand", "booleanExpression", "regexBooleanExpression", + "valueExpression", "operatorExpression", "primaryExpression", + "rowCommand", "fields", "field", "fromCommand", "metadata", + "evalCommand", "statsCommand", "inlinestatsCommand", + "grouping", "sourceIdentifier", "qualifiedName", "identifier", + "constant", "limitCommand", "sortCommand", "orderExpression", + "keepCommand", "dropCommand", "renameCommand", "renameClause", + "dissectCommand", "grokCommand", "mvExpandCommand", "commandOptions", + "commandOption", "booleanValue", "numericValue", "decimalValue", + "integerValue", "string", "comparisonOperator", "explainCommand", + "subqueryExpression", "showCommand", "enrichCommand", + "enrichWithClause" ] + + EOF = Token.EOF + DISSECT=1 + DROP=2 + ENRICH=3 + EVAL=4 + EXPLAIN=5 + FROM=6 + GROK=7 + INLINESTATS=8 + KEEP=9 + LIMIT=10 + MV_EXPAND=11 + PROJECT=12 + RENAME=13 + ROW=14 + SHOW=15 + SORT=16 + STATS=17 + WHERE=18 + UNKNOWN_CMD=19 + LINE_COMMENT=20 + MULTILINE_COMMENT=21 + WS=22 + EXPLAIN_WS=23 + EXPLAIN_LINE_COMMENT=24 + EXPLAIN_MULTILINE_COMMENT=25 + PIPE=26 + STRING=27 + INTEGER_LITERAL=28 + DECIMAL_LITERAL=29 + BY=30 + AND=31 + ASC=32 + ASSIGN=33 + COMMA=34 + DESC=35 + DOT=36 + FALSE=37 + FIRST=38 + LAST=39 + LP=40 + IN=41 + LIKE=42 + NOT=43 + NULL=44 + NULLS=45 + OR=46 + PARAM=47 + RLIKE=48 + RP=49 + TRUE=50 + INFO=51 + FUNCTIONS=52 + EQ=53 + NEQ=54 + LT=55 + LTE=56 + GT=57 + GTE=58 + PLUS=59 + MINUS=60 + ASTERISK=61 + SLASH=62 + PERCENT=63 + OPENING_BRACKET=64 + CLOSING_BRACKET=65 + UNQUOTED_IDENTIFIER=66 + QUOTED_IDENTIFIER=67 + EXPR_LINE_COMMENT=68 + EXPR_MULTILINE_COMMENT=69 + EXPR_WS=70 + AS=71 + METADATA=72 + ON=73 + WITH=74 + SRC_UNQUOTED_IDENTIFIER=75 + SRC_QUOTED_IDENTIFIER=76 + SRC_LINE_COMMENT=77 + SRC_MULTILINE_COMMENT=78 + SRC_WS=79 + EXPLAIN_PIPE=80 + + def __init__(self, input:TokenStream, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.1") + self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) + self._predicates = None + + + + + class SingleStatementContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def query(self): + return self.getTypedRuleContext(EsqlBaseParser.QueryContext,0) + + + def EOF(self): + return self.getToken(EsqlBaseParser.EOF, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_singleStatement + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSingleStatement" ): + listener.enterSingleStatement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSingleStatement" ): + listener.exitSingleStatement(self) + + + + + def singleStatement(self): + + localctx = EsqlBaseParser.SingleStatementContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_singleStatement) + try: + self.enterOuterAlt(localctx, 1) + self.state = 92 + self.query(0) + self.state = 93 + self.match(EsqlBaseParser.EOF) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class QueryContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_query + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + class CompositeQueryContext(QueryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.QueryContext + super().__init__(parser) + self.copyFrom(ctx) + + def query(self): + return self.getTypedRuleContext(EsqlBaseParser.QueryContext,0) + + def PIPE(self): + return self.getToken(EsqlBaseParser.PIPE, 0) + def processingCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.ProcessingCommandContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCompositeQuery" ): + listener.enterCompositeQuery(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCompositeQuery" ): + listener.exitCompositeQuery(self) + + + class SingleCommandQueryContext(QueryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.QueryContext + super().__init__(parser) + self.copyFrom(ctx) + + def sourceCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.SourceCommandContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSingleCommandQuery" ): + listener.enterSingleCommandQuery(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSingleCommandQuery" ): + listener.exitSingleCommandQuery(self) + + + + def query(self, _p:int=0): + _parentctx = self._ctx + _parentState = self.state + localctx = EsqlBaseParser.QueryContext(self, self._ctx, _parentState) + _prevctx = localctx + _startState = 2 + self.enterRecursionRule(localctx, 2, self.RULE_query, _p) + try: + self.enterOuterAlt(localctx, 1) + localctx = EsqlBaseParser.SingleCommandQueryContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + + self.state = 96 + self.sourceCommand() + self._ctx.stop = self._input.LT(-1) + self.state = 103 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,0,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + if self._parseListeners is not None: + self.triggerExitRuleEvent() + _prevctx = localctx + localctx = EsqlBaseParser.CompositeQueryContext(self, EsqlBaseParser.QueryContext(self, _parentctx, _parentState)) + self.pushNewRecursionContext(localctx, _startState, self.RULE_query) + self.state = 98 + if not self.precpred(self._ctx, 1): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") + self.state = 99 + self.match(EsqlBaseParser.PIPE) + self.state = 100 + self.processingCommand() + self.state = 105 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,0,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.unrollRecursionContexts(_parentctx) + return localctx + + + class SourceCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def explainCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.ExplainCommandContext,0) + + + def fromCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.FromCommandContext,0) + + + def rowCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.RowCommandContext,0) + + + def showCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.ShowCommandContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_sourceCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSourceCommand" ): + listener.enterSourceCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSourceCommand" ): + listener.exitSourceCommand(self) + + + + + def sourceCommand(self): + + localctx = EsqlBaseParser.SourceCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 4, self.RULE_sourceCommand) + try: + self.state = 110 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [5]: + self.enterOuterAlt(localctx, 1) + self.state = 106 + self.explainCommand() + pass + elif token in [6]: + self.enterOuterAlt(localctx, 2) + self.state = 107 + self.fromCommand() + pass + elif token in [14]: + self.enterOuterAlt(localctx, 3) + self.state = 108 + self.rowCommand() + pass + elif token in [15]: + self.enterOuterAlt(localctx, 4) + self.state = 109 + self.showCommand() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ProcessingCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def evalCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.EvalCommandContext,0) + + + def inlinestatsCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.InlinestatsCommandContext,0) + + + def limitCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.LimitCommandContext,0) + + + def keepCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.KeepCommandContext,0) + + + def sortCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.SortCommandContext,0) + + + def statsCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.StatsCommandContext,0) + + + def whereCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.WhereCommandContext,0) + + + def dropCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.DropCommandContext,0) + + + def renameCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.RenameCommandContext,0) + + + def dissectCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.DissectCommandContext,0) + + + def grokCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.GrokCommandContext,0) + + + def enrichCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.EnrichCommandContext,0) + + + def mvExpandCommand(self): + return self.getTypedRuleContext(EsqlBaseParser.MvExpandCommandContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_processingCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterProcessingCommand" ): + listener.enterProcessingCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitProcessingCommand" ): + listener.exitProcessingCommand(self) + + + + + def processingCommand(self): + + localctx = EsqlBaseParser.ProcessingCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_processingCommand) + try: + self.state = 125 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [4]: + self.enterOuterAlt(localctx, 1) + self.state = 112 + self.evalCommand() + pass + elif token in [8]: + self.enterOuterAlt(localctx, 2) + self.state = 113 + self.inlinestatsCommand() + pass + elif token in [10]: + self.enterOuterAlt(localctx, 3) + self.state = 114 + self.limitCommand() + pass + elif token in [9, 12]: + self.enterOuterAlt(localctx, 4) + self.state = 115 + self.keepCommand() + pass + elif token in [16]: + self.enterOuterAlt(localctx, 5) + self.state = 116 + self.sortCommand() + pass + elif token in [17]: + self.enterOuterAlt(localctx, 6) + self.state = 117 + self.statsCommand() + pass + elif token in [18]: + self.enterOuterAlt(localctx, 7) + self.state = 118 + self.whereCommand() + pass + elif token in [2]: + self.enterOuterAlt(localctx, 8) + self.state = 119 + self.dropCommand() + pass + elif token in [13]: + self.enterOuterAlt(localctx, 9) + self.state = 120 + self.renameCommand() + pass + elif token in [1]: + self.enterOuterAlt(localctx, 10) + self.state = 121 + self.dissectCommand() + pass + elif token in [7]: + self.enterOuterAlt(localctx, 11) + self.state = 122 + self.grokCommand() + pass + elif token in [3]: + self.enterOuterAlt(localctx, 12) + self.state = 123 + self.enrichCommand() + pass + elif token in [11]: + self.enterOuterAlt(localctx, 13) + self.state = 124 + self.mvExpandCommand() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class WhereCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def WHERE(self): + return self.getToken(EsqlBaseParser.WHERE, 0) + + def booleanExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.BooleanExpressionContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_whereCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterWhereCommand" ): + listener.enterWhereCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitWhereCommand" ): + listener.exitWhereCommand(self) + + + + + def whereCommand(self): + + localctx = EsqlBaseParser.WhereCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_whereCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 127 + self.match(EsqlBaseParser.WHERE) + self.state = 128 + self.booleanExpression(0) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class BooleanExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_booleanExpression + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + class LogicalNotContext(BooleanExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.BooleanExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def NOT(self): + return self.getToken(EsqlBaseParser.NOT, 0) + def booleanExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.BooleanExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterLogicalNot" ): + listener.enterLogicalNot(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitLogicalNot" ): + listener.exitLogicalNot(self) + + + class BooleanDefaultContext(BooleanExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.BooleanExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def valueExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.ValueExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBooleanDefault" ): + listener.enterBooleanDefault(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBooleanDefault" ): + listener.exitBooleanDefault(self) + + + class RegexExpressionContext(BooleanExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.BooleanExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def regexBooleanExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.RegexBooleanExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterRegexExpression" ): + listener.enterRegexExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitRegexExpression" ): + listener.exitRegexExpression(self) + + + class LogicalInContext(BooleanExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.BooleanExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def valueExpression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.ValueExpressionContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.ValueExpressionContext,i) + + def IN(self): + return self.getToken(EsqlBaseParser.IN, 0) + def LP(self): + return self.getToken(EsqlBaseParser.LP, 0) + def RP(self): + return self.getToken(EsqlBaseParser.RP, 0) + def NOT(self): + return self.getToken(EsqlBaseParser.NOT, 0) + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterLogicalIn" ): + listener.enterLogicalIn(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitLogicalIn" ): + listener.exitLogicalIn(self) + + + class LogicalBinaryContext(BooleanExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.BooleanExpressionContext + super().__init__(parser) + self.left = None # BooleanExpressionContext + self.operator = None # Token + self.right = None # BooleanExpressionContext + self.copyFrom(ctx) + + def booleanExpression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.BooleanExpressionContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.BooleanExpressionContext,i) + + def AND(self): + return self.getToken(EsqlBaseParser.AND, 0) + def OR(self): + return self.getToken(EsqlBaseParser.OR, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterLogicalBinary" ): + listener.enterLogicalBinary(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitLogicalBinary" ): + listener.exitLogicalBinary(self) + + + + def booleanExpression(self, _p:int=0): + _parentctx = self._ctx + _parentState = self.state + localctx = EsqlBaseParser.BooleanExpressionContext(self, self._ctx, _parentState) + _prevctx = localctx + _startState = 10 + self.enterRecursionRule(localctx, 10, self.RULE_booleanExpression, _p) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 151 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,5,self._ctx) + if la_ == 1: + localctx = EsqlBaseParser.LogicalNotContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + + self.state = 131 + self.match(EsqlBaseParser.NOT) + self.state = 132 + self.booleanExpression(6) + pass + + elif la_ == 2: + localctx = EsqlBaseParser.BooleanDefaultContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 133 + self.valueExpression() + pass + + elif la_ == 3: + localctx = EsqlBaseParser.RegexExpressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 134 + self.regexBooleanExpression() + pass + + elif la_ == 4: + localctx = EsqlBaseParser.LogicalInContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 135 + self.valueExpression() + self.state = 137 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==43: + self.state = 136 + self.match(EsqlBaseParser.NOT) + + + self.state = 139 + self.match(EsqlBaseParser.IN) + self.state = 140 + self.match(EsqlBaseParser.LP) + self.state = 141 + self.valueExpression() + self.state = 146 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==34: + self.state = 142 + self.match(EsqlBaseParser.COMMA) + self.state = 143 + self.valueExpression() + self.state = 148 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 149 + self.match(EsqlBaseParser.RP) + pass + + + self._ctx.stop = self._input.LT(-1) + self.state = 161 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,7,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + if self._parseListeners is not None: + self.triggerExitRuleEvent() + _prevctx = localctx + self.state = 159 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,6,self._ctx) + if la_ == 1: + localctx = EsqlBaseParser.LogicalBinaryContext(self, EsqlBaseParser.BooleanExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_booleanExpression) + self.state = 153 + if not self.precpred(self._ctx, 3): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") + self.state = 154 + localctx.operator = self.match(EsqlBaseParser.AND) + self.state = 155 + localctx.right = self.booleanExpression(4) + pass + + elif la_ == 2: + localctx = EsqlBaseParser.LogicalBinaryContext(self, EsqlBaseParser.BooleanExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_booleanExpression) + self.state = 156 + if not self.precpred(self._ctx, 2): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") + self.state = 157 + localctx.operator = self.match(EsqlBaseParser.OR) + self.state = 158 + localctx.right = self.booleanExpression(3) + pass + + + self.state = 163 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,7,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.unrollRecursionContexts(_parentctx) + return localctx + + + class RegexBooleanExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.kind = None # Token + self.pattern = None # StringContext + + def valueExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.ValueExpressionContext,0) + + + def LIKE(self): + return self.getToken(EsqlBaseParser.LIKE, 0) + + def string(self): + return self.getTypedRuleContext(EsqlBaseParser.StringContext,0) + + + def NOT(self): + return self.getToken(EsqlBaseParser.NOT, 0) + + def RLIKE(self): + return self.getToken(EsqlBaseParser.RLIKE, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_regexBooleanExpression + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterRegexBooleanExpression" ): + listener.enterRegexBooleanExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitRegexBooleanExpression" ): + listener.exitRegexBooleanExpression(self) + + + + + def regexBooleanExpression(self): + + localctx = EsqlBaseParser.RegexBooleanExpressionContext(self, self._ctx, self.state) + self.enterRule(localctx, 12, self.RULE_regexBooleanExpression) + self._la = 0 # Token type + try: + self.state = 178 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,10,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 164 + self.valueExpression() + self.state = 166 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==43: + self.state = 165 + self.match(EsqlBaseParser.NOT) + + + self.state = 168 + localctx.kind = self.match(EsqlBaseParser.LIKE) + self.state = 169 + localctx.pattern = self.string() + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 171 + self.valueExpression() + self.state = 173 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==43: + self.state = 172 + self.match(EsqlBaseParser.NOT) + + + self.state = 175 + localctx.kind = self.match(EsqlBaseParser.RLIKE) + self.state = 176 + localctx.pattern = self.string() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ValueExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_valueExpression + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class ValueExpressionDefaultContext(ValueExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ValueExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def operatorExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.OperatorExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterValueExpressionDefault" ): + listener.enterValueExpressionDefault(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitValueExpressionDefault" ): + listener.exitValueExpressionDefault(self) + + + class ComparisonContext(ValueExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ValueExpressionContext + super().__init__(parser) + self.left = None # OperatorExpressionContext + self.right = None # OperatorExpressionContext + self.copyFrom(ctx) + + def comparisonOperator(self): + return self.getTypedRuleContext(EsqlBaseParser.ComparisonOperatorContext,0) + + def operatorExpression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.OperatorExpressionContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.OperatorExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterComparison" ): + listener.enterComparison(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitComparison" ): + listener.exitComparison(self) + + + + def valueExpression(self): + + localctx = EsqlBaseParser.ValueExpressionContext(self, self._ctx, self.state) + self.enterRule(localctx, 14, self.RULE_valueExpression) + try: + self.state = 185 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,11,self._ctx) + if la_ == 1: + localctx = EsqlBaseParser.ValueExpressionDefaultContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 180 + self.operatorExpression(0) + pass + + elif la_ == 2: + localctx = EsqlBaseParser.ComparisonContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 181 + localctx.left = self.operatorExpression(0) + self.state = 182 + self.comparisonOperator() + self.state = 183 + localctx.right = self.operatorExpression(0) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class OperatorExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_operatorExpression + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + class OperatorExpressionDefaultContext(OperatorExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.OperatorExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def primaryExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.PrimaryExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterOperatorExpressionDefault" ): + listener.enterOperatorExpressionDefault(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitOperatorExpressionDefault" ): + listener.exitOperatorExpressionDefault(self) + + + class ArithmeticBinaryContext(OperatorExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.OperatorExpressionContext + super().__init__(parser) + self.left = None # OperatorExpressionContext + self.operator = None # Token + self.right = None # OperatorExpressionContext + self.copyFrom(ctx) + + def operatorExpression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.OperatorExpressionContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.OperatorExpressionContext,i) + + def ASTERISK(self): + return self.getToken(EsqlBaseParser.ASTERISK, 0) + def SLASH(self): + return self.getToken(EsqlBaseParser.SLASH, 0) + def PERCENT(self): + return self.getToken(EsqlBaseParser.PERCENT, 0) + def PLUS(self): + return self.getToken(EsqlBaseParser.PLUS, 0) + def MINUS(self): + return self.getToken(EsqlBaseParser.MINUS, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterArithmeticBinary" ): + listener.enterArithmeticBinary(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitArithmeticBinary" ): + listener.exitArithmeticBinary(self) + + + class ArithmeticUnaryContext(OperatorExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.OperatorExpressionContext + super().__init__(parser) + self.operator = None # Token + self.copyFrom(ctx) + + def operatorExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.OperatorExpressionContext,0) + + def MINUS(self): + return self.getToken(EsqlBaseParser.MINUS, 0) + def PLUS(self): + return self.getToken(EsqlBaseParser.PLUS, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterArithmeticUnary" ): + listener.enterArithmeticUnary(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitArithmeticUnary" ): + listener.exitArithmeticUnary(self) + + + + def operatorExpression(self, _p:int=0): + _parentctx = self._ctx + _parentState = self.state + localctx = EsqlBaseParser.OperatorExpressionContext(self, self._ctx, _parentState) + _prevctx = localctx + _startState = 16 + self.enterRecursionRule(localctx, 16, self.RULE_operatorExpression, _p) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 191 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [27, 28, 29, 37, 40, 44, 47, 50, 64, 66, 67]: + localctx = EsqlBaseParser.OperatorExpressionDefaultContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + + self.state = 188 + self.primaryExpression() + pass + elif token in [59, 60]: + localctx = EsqlBaseParser.ArithmeticUnaryContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 189 + localctx.operator = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==59 or _la==60): + localctx.operator = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 190 + self.operatorExpression(3) + pass + else: + raise NoViableAltException(self) + + self._ctx.stop = self._input.LT(-1) + self.state = 201 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,14,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + if self._parseListeners is not None: + self.triggerExitRuleEvent() + _prevctx = localctx + self.state = 199 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,13,self._ctx) + if la_ == 1: + localctx = EsqlBaseParser.ArithmeticBinaryContext(self, EsqlBaseParser.OperatorExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_operatorExpression) + self.state = 193 + if not self.precpred(self._ctx, 2): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") + self.state = 194 + localctx.operator = self._input.LT(1) + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & -2305843009213693952) != 0)): + localctx.operator = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 195 + localctx.right = self.operatorExpression(3) + pass + + elif la_ == 2: + localctx = EsqlBaseParser.ArithmeticBinaryContext(self, EsqlBaseParser.OperatorExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_operatorExpression) + self.state = 196 + if not self.precpred(self._ctx, 1): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") + self.state = 197 + localctx.operator = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==59 or _la==60): + localctx.operator = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 198 + localctx.right = self.operatorExpression(2) + pass + + + self.state = 203 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,14,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.unrollRecursionContexts(_parentctx) + return localctx + + + class PrimaryExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_primaryExpression + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class DereferenceContext(PrimaryExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.PrimaryExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def qualifiedName(self): + return self.getTypedRuleContext(EsqlBaseParser.QualifiedNameContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDereference" ): + listener.enterDereference(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDereference" ): + listener.exitDereference(self) + + + class ConstantDefaultContext(PrimaryExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.PrimaryExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def constant(self): + return self.getTypedRuleContext(EsqlBaseParser.ConstantContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterConstantDefault" ): + listener.enterConstantDefault(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitConstantDefault" ): + listener.exitConstantDefault(self) + + + class ParenthesizedExpressionContext(PrimaryExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.PrimaryExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def LP(self): + return self.getToken(EsqlBaseParser.LP, 0) + def booleanExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.BooleanExpressionContext,0) + + def RP(self): + return self.getToken(EsqlBaseParser.RP, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterParenthesizedExpression" ): + listener.enterParenthesizedExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitParenthesizedExpression" ): + listener.exitParenthesizedExpression(self) + + + class FunctionExpressionContext(PrimaryExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.PrimaryExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def identifier(self): + return self.getTypedRuleContext(EsqlBaseParser.IdentifierContext,0) + + def LP(self): + return self.getToken(EsqlBaseParser.LP, 0) + def RP(self): + return self.getToken(EsqlBaseParser.RP, 0) + def booleanExpression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.BooleanExpressionContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.BooleanExpressionContext,i) + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFunctionExpression" ): + listener.enterFunctionExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFunctionExpression" ): + listener.exitFunctionExpression(self) + + + + def primaryExpression(self): + + localctx = EsqlBaseParser.PrimaryExpressionContext(self, self._ctx, self.state) + self.enterRule(localctx, 18, self.RULE_primaryExpression) + self._la = 0 # Token type + try: + self.state = 224 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,17,self._ctx) + if la_ == 1: + localctx = EsqlBaseParser.ConstantDefaultContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 204 + self.constant() + pass + + elif la_ == 2: + localctx = EsqlBaseParser.DereferenceContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 205 + self.qualifiedName() + pass + + elif la_ == 3: + localctx = EsqlBaseParser.ParenthesizedExpressionContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 206 + self.match(EsqlBaseParser.LP) + self.state = 207 + self.booleanExpression(0) + self.state = 208 + self.match(EsqlBaseParser.RP) + pass + + elif la_ == 4: + localctx = EsqlBaseParser.FunctionExpressionContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 210 + self.identifier() + self.state = 211 + self.match(EsqlBaseParser.LP) + self.state = 220 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 27)) & ~0x3f) == 0 and ((1 << (_la - 27)) & 1799600940039) != 0): + self.state = 212 + self.booleanExpression(0) + self.state = 217 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==34: + self.state = 213 + self.match(EsqlBaseParser.COMMA) + self.state = 214 + self.booleanExpression(0) + self.state = 219 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + self.state = 222 + self.match(EsqlBaseParser.RP) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class RowCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def ROW(self): + return self.getToken(EsqlBaseParser.ROW, 0) + + def fields(self): + return self.getTypedRuleContext(EsqlBaseParser.FieldsContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_rowCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterRowCommand" ): + listener.enterRowCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitRowCommand" ): + listener.exitRowCommand(self) + + + + + def rowCommand(self): + + localctx = EsqlBaseParser.RowCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 20, self.RULE_rowCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 226 + self.match(EsqlBaseParser.ROW) + self.state = 227 + self.fields() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class FieldsContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def field(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.FieldContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.FieldContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_fields + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFields" ): + listener.enterFields(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFields" ): + listener.exitFields(self) + + + + + def fields(self): + + localctx = EsqlBaseParser.FieldsContext(self, self._ctx, self.state) + self.enterRule(localctx, 22, self.RULE_fields) + try: + self.enterOuterAlt(localctx, 1) + self.state = 229 + self.field() + self.state = 234 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,18,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 230 + self.match(EsqlBaseParser.COMMA) + self.state = 231 + self.field() + self.state = 236 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,18,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class FieldContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def booleanExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.BooleanExpressionContext,0) + + + def qualifiedName(self): + return self.getTypedRuleContext(EsqlBaseParser.QualifiedNameContext,0) + + + def ASSIGN(self): + return self.getToken(EsqlBaseParser.ASSIGN, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_field + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterField" ): + listener.enterField(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitField" ): + listener.exitField(self) + + + + + def field(self): + + localctx = EsqlBaseParser.FieldContext(self, self._ctx, self.state) + self.enterRule(localctx, 24, self.RULE_field) + try: + self.state = 242 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,19,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 237 + self.booleanExpression(0) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 238 + self.qualifiedName() + self.state = 239 + self.match(EsqlBaseParser.ASSIGN) + self.state = 240 + self.booleanExpression(0) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class FromCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def FROM(self): + return self.getToken(EsqlBaseParser.FROM, 0) + + def sourceIdentifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.SourceIdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def metadata(self): + return self.getTypedRuleContext(EsqlBaseParser.MetadataContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_fromCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFromCommand" ): + listener.enterFromCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFromCommand" ): + listener.exitFromCommand(self) + + + + + def fromCommand(self): + + localctx = EsqlBaseParser.FromCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 26, self.RULE_fromCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 244 + self.match(EsqlBaseParser.FROM) + self.state = 245 + self.sourceIdentifier() + self.state = 250 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,20,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 246 + self.match(EsqlBaseParser.COMMA) + self.state = 247 + self.sourceIdentifier() + self.state = 252 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,20,self._ctx) + + self.state = 254 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,21,self._ctx) + if la_ == 1: + self.state = 253 + self.metadata() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class MetadataContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def OPENING_BRACKET(self): + return self.getToken(EsqlBaseParser.OPENING_BRACKET, 0) + + def METADATA(self): + return self.getToken(EsqlBaseParser.METADATA, 0) + + def sourceIdentifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.SourceIdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,i) + + + def CLOSING_BRACKET(self): + return self.getToken(EsqlBaseParser.CLOSING_BRACKET, 0) + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_metadata + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterMetadata" ): + listener.enterMetadata(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitMetadata" ): + listener.exitMetadata(self) + + + + + def metadata(self): + + localctx = EsqlBaseParser.MetadataContext(self, self._ctx, self.state) + self.enterRule(localctx, 28, self.RULE_metadata) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 256 + self.match(EsqlBaseParser.OPENING_BRACKET) + self.state = 257 + self.match(EsqlBaseParser.METADATA) + self.state = 258 + self.sourceIdentifier() + self.state = 263 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==34: + self.state = 259 + self.match(EsqlBaseParser.COMMA) + self.state = 260 + self.sourceIdentifier() + self.state = 265 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 266 + self.match(EsqlBaseParser.CLOSING_BRACKET) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class EvalCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def EVAL(self): + return self.getToken(EsqlBaseParser.EVAL, 0) + + def fields(self): + return self.getTypedRuleContext(EsqlBaseParser.FieldsContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_evalCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEvalCommand" ): + listener.enterEvalCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEvalCommand" ): + listener.exitEvalCommand(self) + + + + + def evalCommand(self): + + localctx = EsqlBaseParser.EvalCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 30, self.RULE_evalCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 268 + self.match(EsqlBaseParser.EVAL) + self.state = 269 + self.fields() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class StatsCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def STATS(self): + return self.getToken(EsqlBaseParser.STATS, 0) + + def fields(self): + return self.getTypedRuleContext(EsqlBaseParser.FieldsContext,0) + + + def BY(self): + return self.getToken(EsqlBaseParser.BY, 0) + + def grouping(self): + return self.getTypedRuleContext(EsqlBaseParser.GroupingContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_statsCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStatsCommand" ): + listener.enterStatsCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStatsCommand" ): + listener.exitStatsCommand(self) + + + + + def statsCommand(self): + + localctx = EsqlBaseParser.StatsCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 32, self.RULE_statsCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 271 + self.match(EsqlBaseParser.STATS) + self.state = 273 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,23,self._ctx) + if la_ == 1: + self.state = 272 + self.fields() + + + self.state = 277 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,24,self._ctx) + if la_ == 1: + self.state = 275 + self.match(EsqlBaseParser.BY) + self.state = 276 + self.grouping() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class InlinestatsCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def INLINESTATS(self): + return self.getToken(EsqlBaseParser.INLINESTATS, 0) + + def fields(self): + return self.getTypedRuleContext(EsqlBaseParser.FieldsContext,0) + + + def BY(self): + return self.getToken(EsqlBaseParser.BY, 0) + + def grouping(self): + return self.getTypedRuleContext(EsqlBaseParser.GroupingContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_inlinestatsCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInlinestatsCommand" ): + listener.enterInlinestatsCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInlinestatsCommand" ): + listener.exitInlinestatsCommand(self) + + + + + def inlinestatsCommand(self): + + localctx = EsqlBaseParser.InlinestatsCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 34, self.RULE_inlinestatsCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 279 + self.match(EsqlBaseParser.INLINESTATS) + self.state = 280 + self.fields() + self.state = 283 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,25,self._ctx) + if la_ == 1: + self.state = 281 + self.match(EsqlBaseParser.BY) + self.state = 282 + self.grouping() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class GroupingContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def qualifiedName(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.QualifiedNameContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.QualifiedNameContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_grouping + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterGrouping" ): + listener.enterGrouping(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitGrouping" ): + listener.exitGrouping(self) + + + + + def grouping(self): + + localctx = EsqlBaseParser.GroupingContext(self, self._ctx, self.state) + self.enterRule(localctx, 36, self.RULE_grouping) + try: + self.enterOuterAlt(localctx, 1) + self.state = 285 + self.qualifiedName() + self.state = 290 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,26,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 286 + self.match(EsqlBaseParser.COMMA) + self.state = 287 + self.qualifiedName() + self.state = 292 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,26,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SourceIdentifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def SRC_UNQUOTED_IDENTIFIER(self): + return self.getToken(EsqlBaseParser.SRC_UNQUOTED_IDENTIFIER, 0) + + def SRC_QUOTED_IDENTIFIER(self): + return self.getToken(EsqlBaseParser.SRC_QUOTED_IDENTIFIER, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_sourceIdentifier + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSourceIdentifier" ): + listener.enterSourceIdentifier(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSourceIdentifier" ): + listener.exitSourceIdentifier(self) + + + + + def sourceIdentifier(self): + + localctx = EsqlBaseParser.SourceIdentifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 38, self.RULE_sourceIdentifier) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 293 + _la = self._input.LA(1) + if not(_la==75 or _la==76): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class QualifiedNameContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def identifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.IdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.IdentifierContext,i) + + + def DOT(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.DOT) + else: + return self.getToken(EsqlBaseParser.DOT, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_qualifiedName + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterQualifiedName" ): + listener.enterQualifiedName(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitQualifiedName" ): + listener.exitQualifiedName(self) + + + + + def qualifiedName(self): + + localctx = EsqlBaseParser.QualifiedNameContext(self, self._ctx, self.state) + self.enterRule(localctx, 40, self.RULE_qualifiedName) + try: + self.enterOuterAlt(localctx, 1) + self.state = 295 + self.identifier() + self.state = 300 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,27,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 296 + self.match(EsqlBaseParser.DOT) + self.state = 297 + self.identifier() + self.state = 302 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,27,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class IdentifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def UNQUOTED_IDENTIFIER(self): + return self.getToken(EsqlBaseParser.UNQUOTED_IDENTIFIER, 0) + + def QUOTED_IDENTIFIER(self): + return self.getToken(EsqlBaseParser.QUOTED_IDENTIFIER, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_identifier + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIdentifier" ): + listener.enterIdentifier(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIdentifier" ): + listener.exitIdentifier(self) + + + + + def identifier(self): + + localctx = EsqlBaseParser.IdentifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 42, self.RULE_identifier) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 303 + _la = self._input.LA(1) + if not(_la==66 or _la==67): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ConstantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_constant + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class BooleanArrayLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def OPENING_BRACKET(self): + return self.getToken(EsqlBaseParser.OPENING_BRACKET, 0) + def booleanValue(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.BooleanValueContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.BooleanValueContext,i) + + def CLOSING_BRACKET(self): + return self.getToken(EsqlBaseParser.CLOSING_BRACKET, 0) + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBooleanArrayLiteral" ): + listener.enterBooleanArrayLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBooleanArrayLiteral" ): + listener.exitBooleanArrayLiteral(self) + + + class DecimalLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def decimalValue(self): + return self.getTypedRuleContext(EsqlBaseParser.DecimalValueContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDecimalLiteral" ): + listener.enterDecimalLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDecimalLiteral" ): + listener.exitDecimalLiteral(self) + + + class NullLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def NULL(self): + return self.getToken(EsqlBaseParser.NULL, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNullLiteral" ): + listener.enterNullLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNullLiteral" ): + listener.exitNullLiteral(self) + + + class QualifiedIntegerLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def integerValue(self): + return self.getTypedRuleContext(EsqlBaseParser.IntegerValueContext,0) + + def UNQUOTED_IDENTIFIER(self): + return self.getToken(EsqlBaseParser.UNQUOTED_IDENTIFIER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterQualifiedIntegerLiteral" ): + listener.enterQualifiedIntegerLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitQualifiedIntegerLiteral" ): + listener.exitQualifiedIntegerLiteral(self) + + + class StringArrayLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def OPENING_BRACKET(self): + return self.getToken(EsqlBaseParser.OPENING_BRACKET, 0) + def string(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.StringContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.StringContext,i) + + def CLOSING_BRACKET(self): + return self.getToken(EsqlBaseParser.CLOSING_BRACKET, 0) + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStringArrayLiteral" ): + listener.enterStringArrayLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStringArrayLiteral" ): + listener.exitStringArrayLiteral(self) + + + class StringLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def string(self): + return self.getTypedRuleContext(EsqlBaseParser.StringContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStringLiteral" ): + listener.enterStringLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStringLiteral" ): + listener.exitStringLiteral(self) + + + class NumericArrayLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def OPENING_BRACKET(self): + return self.getToken(EsqlBaseParser.OPENING_BRACKET, 0) + def numericValue(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.NumericValueContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.NumericValueContext,i) + + def CLOSING_BRACKET(self): + return self.getToken(EsqlBaseParser.CLOSING_BRACKET, 0) + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNumericArrayLiteral" ): + listener.enterNumericArrayLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNumericArrayLiteral" ): + listener.exitNumericArrayLiteral(self) + + + class InputParamContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def PARAM(self): + return self.getToken(EsqlBaseParser.PARAM, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInputParam" ): + listener.enterInputParam(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInputParam" ): + listener.exitInputParam(self) + + + class IntegerLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def integerValue(self): + return self.getTypedRuleContext(EsqlBaseParser.IntegerValueContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIntegerLiteral" ): + listener.enterIntegerLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIntegerLiteral" ): + listener.exitIntegerLiteral(self) + + + class BooleanLiteralContext(ConstantContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ConstantContext + super().__init__(parser) + self.copyFrom(ctx) + + def booleanValue(self): + return self.getTypedRuleContext(EsqlBaseParser.BooleanValueContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBooleanLiteral" ): + listener.enterBooleanLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBooleanLiteral" ): + listener.exitBooleanLiteral(self) + + + + def constant(self): + + localctx = EsqlBaseParser.ConstantContext(self, self._ctx, self.state) + self.enterRule(localctx, 44, self.RULE_constant) + self._la = 0 # Token type + try: + self.state = 347 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,31,self._ctx) + if la_ == 1: + localctx = EsqlBaseParser.NullLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 305 + self.match(EsqlBaseParser.NULL) + pass + + elif la_ == 2: + localctx = EsqlBaseParser.QualifiedIntegerLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 306 + self.integerValue() + self.state = 307 + self.match(EsqlBaseParser.UNQUOTED_IDENTIFIER) + pass + + elif la_ == 3: + localctx = EsqlBaseParser.DecimalLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 309 + self.decimalValue() + pass + + elif la_ == 4: + localctx = EsqlBaseParser.IntegerLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 310 + self.integerValue() + pass + + elif la_ == 5: + localctx = EsqlBaseParser.BooleanLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 311 + self.booleanValue() + pass + + elif la_ == 6: + localctx = EsqlBaseParser.InputParamContext(self, localctx) + self.enterOuterAlt(localctx, 6) + self.state = 312 + self.match(EsqlBaseParser.PARAM) + pass + + elif la_ == 7: + localctx = EsqlBaseParser.StringLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 7) + self.state = 313 + self.string() + pass + + elif la_ == 8: + localctx = EsqlBaseParser.NumericArrayLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 8) + self.state = 314 + self.match(EsqlBaseParser.OPENING_BRACKET) + self.state = 315 + self.numericValue() + self.state = 320 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==34: + self.state = 316 + self.match(EsqlBaseParser.COMMA) + self.state = 317 + self.numericValue() + self.state = 322 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 323 + self.match(EsqlBaseParser.CLOSING_BRACKET) + pass + + elif la_ == 9: + localctx = EsqlBaseParser.BooleanArrayLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 9) + self.state = 325 + self.match(EsqlBaseParser.OPENING_BRACKET) + self.state = 326 + self.booleanValue() + self.state = 331 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==34: + self.state = 327 + self.match(EsqlBaseParser.COMMA) + self.state = 328 + self.booleanValue() + self.state = 333 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 334 + self.match(EsqlBaseParser.CLOSING_BRACKET) + pass + + elif la_ == 10: + localctx = EsqlBaseParser.StringArrayLiteralContext(self, localctx) + self.enterOuterAlt(localctx, 10) + self.state = 336 + self.match(EsqlBaseParser.OPENING_BRACKET) + self.state = 337 + self.string() + self.state = 342 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==34: + self.state = 338 + self.match(EsqlBaseParser.COMMA) + self.state = 339 + self.string() + self.state = 344 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 345 + self.match(EsqlBaseParser.CLOSING_BRACKET) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class LimitCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LIMIT(self): + return self.getToken(EsqlBaseParser.LIMIT, 0) + + def INTEGER_LITERAL(self): + return self.getToken(EsqlBaseParser.INTEGER_LITERAL, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_limitCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterLimitCommand" ): + listener.enterLimitCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitLimitCommand" ): + listener.exitLimitCommand(self) + + + + + def limitCommand(self): + + localctx = EsqlBaseParser.LimitCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 46, self.RULE_limitCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 349 + self.match(EsqlBaseParser.LIMIT) + self.state = 350 + self.match(EsqlBaseParser.INTEGER_LITERAL) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SortCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def SORT(self): + return self.getToken(EsqlBaseParser.SORT, 0) + + def orderExpression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.OrderExpressionContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.OrderExpressionContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_sortCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSortCommand" ): + listener.enterSortCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSortCommand" ): + listener.exitSortCommand(self) + + + + + def sortCommand(self): + + localctx = EsqlBaseParser.SortCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 48, self.RULE_sortCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 352 + self.match(EsqlBaseParser.SORT) + self.state = 353 + self.orderExpression() + self.state = 358 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,32,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 354 + self.match(EsqlBaseParser.COMMA) + self.state = 355 + self.orderExpression() + self.state = 360 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,32,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class OrderExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.ordering = None # Token + self.nullOrdering = None # Token + + def booleanExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.BooleanExpressionContext,0) + + + def NULLS(self): + return self.getToken(EsqlBaseParser.NULLS, 0) + + def ASC(self): + return self.getToken(EsqlBaseParser.ASC, 0) + + def DESC(self): + return self.getToken(EsqlBaseParser.DESC, 0) + + def FIRST(self): + return self.getToken(EsqlBaseParser.FIRST, 0) + + def LAST(self): + return self.getToken(EsqlBaseParser.LAST, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_orderExpression + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterOrderExpression" ): + listener.enterOrderExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitOrderExpression" ): + listener.exitOrderExpression(self) + + + + + def orderExpression(self): + + localctx = EsqlBaseParser.OrderExpressionContext(self, self._ctx, self.state) + self.enterRule(localctx, 50, self.RULE_orderExpression) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 361 + self.booleanExpression(0) + self.state = 363 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,33,self._ctx) + if la_ == 1: + self.state = 362 + localctx.ordering = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==32 or _la==35): + localctx.ordering = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + + + self.state = 367 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,34,self._ctx) + if la_ == 1: + self.state = 365 + self.match(EsqlBaseParser.NULLS) + self.state = 366 + localctx.nullOrdering = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==38 or _la==39): + localctx.nullOrdering = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class KeepCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def KEEP(self): + return self.getToken(EsqlBaseParser.KEEP, 0) + + def sourceIdentifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.SourceIdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def PROJECT(self): + return self.getToken(EsqlBaseParser.PROJECT, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_keepCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterKeepCommand" ): + listener.enterKeepCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitKeepCommand" ): + listener.exitKeepCommand(self) + + + + + def keepCommand(self): + + localctx = EsqlBaseParser.KeepCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 52, self.RULE_keepCommand) + try: + self.state = 387 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [9]: + self.enterOuterAlt(localctx, 1) + self.state = 369 + self.match(EsqlBaseParser.KEEP) + self.state = 370 + self.sourceIdentifier() + self.state = 375 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,35,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 371 + self.match(EsqlBaseParser.COMMA) + self.state = 372 + self.sourceIdentifier() + self.state = 377 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,35,self._ctx) + + pass + elif token in [12]: + self.enterOuterAlt(localctx, 2) + self.state = 378 + self.match(EsqlBaseParser.PROJECT) + self.state = 379 + self.sourceIdentifier() + self.state = 384 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,36,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 380 + self.match(EsqlBaseParser.COMMA) + self.state = 381 + self.sourceIdentifier() + self.state = 386 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,36,self._ctx) + + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DropCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def DROP(self): + return self.getToken(EsqlBaseParser.DROP, 0) + + def sourceIdentifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.SourceIdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_dropCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDropCommand" ): + listener.enterDropCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDropCommand" ): + listener.exitDropCommand(self) + + + + + def dropCommand(self): + + localctx = EsqlBaseParser.DropCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 54, self.RULE_dropCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 389 + self.match(EsqlBaseParser.DROP) + self.state = 390 + self.sourceIdentifier() + self.state = 395 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,38,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 391 + self.match(EsqlBaseParser.COMMA) + self.state = 392 + self.sourceIdentifier() + self.state = 397 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,38,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class RenameCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def RENAME(self): + return self.getToken(EsqlBaseParser.RENAME, 0) + + def renameClause(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.RenameClauseContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.RenameClauseContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_renameCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterRenameCommand" ): + listener.enterRenameCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitRenameCommand" ): + listener.exitRenameCommand(self) + + + + + def renameCommand(self): + + localctx = EsqlBaseParser.RenameCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 56, self.RULE_renameCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 398 + self.match(EsqlBaseParser.RENAME) + self.state = 399 + self.renameClause() + self.state = 404 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,39,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 400 + self.match(EsqlBaseParser.COMMA) + self.state = 401 + self.renameClause() + self.state = 406 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,39,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class RenameClauseContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.oldName = None # SourceIdentifierContext + self.newName = None # SourceIdentifierContext + + def AS(self): + return self.getToken(EsqlBaseParser.AS, 0) + + def sourceIdentifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.SourceIdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,i) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_renameClause + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterRenameClause" ): + listener.enterRenameClause(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitRenameClause" ): + listener.exitRenameClause(self) + + + + + def renameClause(self): + + localctx = EsqlBaseParser.RenameClauseContext(self, self._ctx, self.state) + self.enterRule(localctx, 58, self.RULE_renameClause) + try: + self.enterOuterAlt(localctx, 1) + self.state = 407 + localctx.oldName = self.sourceIdentifier() + self.state = 408 + self.match(EsqlBaseParser.AS) + self.state = 409 + localctx.newName = self.sourceIdentifier() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DissectCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def DISSECT(self): + return self.getToken(EsqlBaseParser.DISSECT, 0) + + def primaryExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.PrimaryExpressionContext,0) + + + def string(self): + return self.getTypedRuleContext(EsqlBaseParser.StringContext,0) + + + def commandOptions(self): + return self.getTypedRuleContext(EsqlBaseParser.CommandOptionsContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_dissectCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDissectCommand" ): + listener.enterDissectCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDissectCommand" ): + listener.exitDissectCommand(self) + + + + + def dissectCommand(self): + + localctx = EsqlBaseParser.DissectCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 60, self.RULE_dissectCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 411 + self.match(EsqlBaseParser.DISSECT) + self.state = 412 + self.primaryExpression() + self.state = 413 + self.string() + self.state = 415 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,40,self._ctx) + if la_ == 1: + self.state = 414 + self.commandOptions() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class GrokCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def GROK(self): + return self.getToken(EsqlBaseParser.GROK, 0) + + def primaryExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.PrimaryExpressionContext,0) + + + def string(self): + return self.getTypedRuleContext(EsqlBaseParser.StringContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_grokCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterGrokCommand" ): + listener.enterGrokCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitGrokCommand" ): + listener.exitGrokCommand(self) + + + + + def grokCommand(self): + + localctx = EsqlBaseParser.GrokCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 62, self.RULE_grokCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 417 + self.match(EsqlBaseParser.GROK) + self.state = 418 + self.primaryExpression() + self.state = 419 + self.string() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class MvExpandCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def MV_EXPAND(self): + return self.getToken(EsqlBaseParser.MV_EXPAND, 0) + + def sourceIdentifier(self): + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_mvExpandCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterMvExpandCommand" ): + listener.enterMvExpandCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitMvExpandCommand" ): + listener.exitMvExpandCommand(self) + + + + + def mvExpandCommand(self): + + localctx = EsqlBaseParser.MvExpandCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 64, self.RULE_mvExpandCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 421 + self.match(EsqlBaseParser.MV_EXPAND) + self.state = 422 + self.sourceIdentifier() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class CommandOptionsContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def commandOption(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.CommandOptionContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.CommandOptionContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_commandOptions + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCommandOptions" ): + listener.enterCommandOptions(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCommandOptions" ): + listener.exitCommandOptions(self) + + + + + def commandOptions(self): + + localctx = EsqlBaseParser.CommandOptionsContext(self, self._ctx, self.state) + self.enterRule(localctx, 66, self.RULE_commandOptions) + try: + self.enterOuterAlt(localctx, 1) + self.state = 424 + self.commandOption() + self.state = 429 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,41,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 425 + self.match(EsqlBaseParser.COMMA) + self.state = 426 + self.commandOption() + self.state = 431 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,41,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class CommandOptionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def identifier(self): + return self.getTypedRuleContext(EsqlBaseParser.IdentifierContext,0) + + + def ASSIGN(self): + return self.getToken(EsqlBaseParser.ASSIGN, 0) + + def constant(self): + return self.getTypedRuleContext(EsqlBaseParser.ConstantContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_commandOption + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCommandOption" ): + listener.enterCommandOption(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCommandOption" ): + listener.exitCommandOption(self) + + + + + def commandOption(self): + + localctx = EsqlBaseParser.CommandOptionContext(self, self._ctx, self.state) + self.enterRule(localctx, 68, self.RULE_commandOption) + try: + self.enterOuterAlt(localctx, 1) + self.state = 432 + self.identifier() + self.state = 433 + self.match(EsqlBaseParser.ASSIGN) + self.state = 434 + self.constant() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class BooleanValueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def TRUE(self): + return self.getToken(EsqlBaseParser.TRUE, 0) + + def FALSE(self): + return self.getToken(EsqlBaseParser.FALSE, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_booleanValue + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBooleanValue" ): + listener.enterBooleanValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBooleanValue" ): + listener.exitBooleanValue(self) + + + + + def booleanValue(self): + + localctx = EsqlBaseParser.BooleanValueContext(self, self._ctx, self.state) + self.enterRule(localctx, 70, self.RULE_booleanValue) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 436 + _la = self._input.LA(1) + if not(_la==37 or _la==50): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class NumericValueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def decimalValue(self): + return self.getTypedRuleContext(EsqlBaseParser.DecimalValueContext,0) + + + def integerValue(self): + return self.getTypedRuleContext(EsqlBaseParser.IntegerValueContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_numericValue + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNumericValue" ): + listener.enterNumericValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNumericValue" ): + listener.exitNumericValue(self) + + + + + def numericValue(self): + + localctx = EsqlBaseParser.NumericValueContext(self, self._ctx, self.state) + self.enterRule(localctx, 72, self.RULE_numericValue) + try: + self.state = 440 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [29]: + self.enterOuterAlt(localctx, 1) + self.state = 438 + self.decimalValue() + pass + elif token in [28]: + self.enterOuterAlt(localctx, 2) + self.state = 439 + self.integerValue() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DecimalValueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def DECIMAL_LITERAL(self): + return self.getToken(EsqlBaseParser.DECIMAL_LITERAL, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_decimalValue + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDecimalValue" ): + listener.enterDecimalValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDecimalValue" ): + listener.exitDecimalValue(self) + + + + + def decimalValue(self): + + localctx = EsqlBaseParser.DecimalValueContext(self, self._ctx, self.state) + self.enterRule(localctx, 74, self.RULE_decimalValue) + try: + self.enterOuterAlt(localctx, 1) + self.state = 442 + self.match(EsqlBaseParser.DECIMAL_LITERAL) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class IntegerValueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def INTEGER_LITERAL(self): + return self.getToken(EsqlBaseParser.INTEGER_LITERAL, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_integerValue + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIntegerValue" ): + listener.enterIntegerValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIntegerValue" ): + listener.exitIntegerValue(self) + + + + + def integerValue(self): + + localctx = EsqlBaseParser.IntegerValueContext(self, self._ctx, self.state) + self.enterRule(localctx, 76, self.RULE_integerValue) + try: + self.enterOuterAlt(localctx, 1) + self.state = 444 + self.match(EsqlBaseParser.INTEGER_LITERAL) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class StringContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def STRING(self): + return self.getToken(EsqlBaseParser.STRING, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_string + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterString" ): + listener.enterString(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitString" ): + listener.exitString(self) + + + + + def string(self): + + localctx = EsqlBaseParser.StringContext(self, self._ctx, self.state) + self.enterRule(localctx, 78, self.RULE_string) + try: + self.enterOuterAlt(localctx, 1) + self.state = 446 + self.match(EsqlBaseParser.STRING) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ComparisonOperatorContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def EQ(self): + return self.getToken(EsqlBaseParser.EQ, 0) + + def NEQ(self): + return self.getToken(EsqlBaseParser.NEQ, 0) + + def LT(self): + return self.getToken(EsqlBaseParser.LT, 0) + + def LTE(self): + return self.getToken(EsqlBaseParser.LTE, 0) + + def GT(self): + return self.getToken(EsqlBaseParser.GT, 0) + + def GTE(self): + return self.getToken(EsqlBaseParser.GTE, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_comparisonOperator + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterComparisonOperator" ): + listener.enterComparisonOperator(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitComparisonOperator" ): + listener.exitComparisonOperator(self) + + + + + def comparisonOperator(self): + + localctx = EsqlBaseParser.ComparisonOperatorContext(self, self._ctx, self.state) + self.enterRule(localctx, 80, self.RULE_comparisonOperator) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 448 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 567453553048682496) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExplainCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def EXPLAIN(self): + return self.getToken(EsqlBaseParser.EXPLAIN, 0) + + def subqueryExpression(self): + return self.getTypedRuleContext(EsqlBaseParser.SubqueryExpressionContext,0) + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_explainCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExplainCommand" ): + listener.enterExplainCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExplainCommand" ): + listener.exitExplainCommand(self) + + + + + def explainCommand(self): + + localctx = EsqlBaseParser.ExplainCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 82, self.RULE_explainCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 450 + self.match(EsqlBaseParser.EXPLAIN) + self.state = 451 + self.subqueryExpression() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SubqueryExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def OPENING_BRACKET(self): + return self.getToken(EsqlBaseParser.OPENING_BRACKET, 0) + + def query(self): + return self.getTypedRuleContext(EsqlBaseParser.QueryContext,0) + + + def CLOSING_BRACKET(self): + return self.getToken(EsqlBaseParser.CLOSING_BRACKET, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_subqueryExpression + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSubqueryExpression" ): + listener.enterSubqueryExpression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSubqueryExpression" ): + listener.exitSubqueryExpression(self) + + + + + def subqueryExpression(self): + + localctx = EsqlBaseParser.SubqueryExpressionContext(self, self._ctx, self.state) + self.enterRule(localctx, 84, self.RULE_subqueryExpression) + try: + self.enterOuterAlt(localctx, 1) + self.state = 453 + self.match(EsqlBaseParser.OPENING_BRACKET) + self.state = 454 + self.query(0) + self.state = 455 + self.match(EsqlBaseParser.CLOSING_BRACKET) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ShowCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return EsqlBaseParser.RULE_showCommand + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class ShowInfoContext(ShowCommandContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ShowCommandContext + super().__init__(parser) + self.copyFrom(ctx) + + def SHOW(self): + return self.getToken(EsqlBaseParser.SHOW, 0) + def INFO(self): + return self.getToken(EsqlBaseParser.INFO, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterShowInfo" ): + listener.enterShowInfo(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitShowInfo" ): + listener.exitShowInfo(self) + + + class ShowFunctionsContext(ShowCommandContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a EsqlBaseParser.ShowCommandContext + super().__init__(parser) + self.copyFrom(ctx) + + def SHOW(self): + return self.getToken(EsqlBaseParser.SHOW, 0) + def FUNCTIONS(self): + return self.getToken(EsqlBaseParser.FUNCTIONS, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterShowFunctions" ): + listener.enterShowFunctions(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitShowFunctions" ): + listener.exitShowFunctions(self) + + + + def showCommand(self): + + localctx = EsqlBaseParser.ShowCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 86, self.RULE_showCommand) + try: + self.state = 461 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,43,self._ctx) + if la_ == 1: + localctx = EsqlBaseParser.ShowInfoContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 457 + self.match(EsqlBaseParser.SHOW) + self.state = 458 + self.match(EsqlBaseParser.INFO) + pass + + elif la_ == 2: + localctx = EsqlBaseParser.ShowFunctionsContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 459 + self.match(EsqlBaseParser.SHOW) + self.state = 460 + self.match(EsqlBaseParser.FUNCTIONS) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class EnrichCommandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.policyName = None # SourceIdentifierContext + self.matchField = None # SourceIdentifierContext + + def ENRICH(self): + return self.getToken(EsqlBaseParser.ENRICH, 0) + + def sourceIdentifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.SourceIdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,i) + + + def ON(self): + return self.getToken(EsqlBaseParser.ON, 0) + + def WITH(self): + return self.getToken(EsqlBaseParser.WITH, 0) + + def enrichWithClause(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.EnrichWithClauseContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.EnrichWithClauseContext,i) + + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(EsqlBaseParser.COMMA) + else: + return self.getToken(EsqlBaseParser.COMMA, i) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_enrichCommand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEnrichCommand" ): + listener.enterEnrichCommand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEnrichCommand" ): + listener.exitEnrichCommand(self) + + + + + def enrichCommand(self): + + localctx = EsqlBaseParser.EnrichCommandContext(self, self._ctx, self.state) + self.enterRule(localctx, 88, self.RULE_enrichCommand) + try: + self.enterOuterAlt(localctx, 1) + self.state = 463 + self.match(EsqlBaseParser.ENRICH) + self.state = 464 + localctx.policyName = self.sourceIdentifier() + self.state = 467 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,44,self._ctx) + if la_ == 1: + self.state = 465 + self.match(EsqlBaseParser.ON) + self.state = 466 + localctx.matchField = self.sourceIdentifier() + + + self.state = 478 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,46,self._ctx) + if la_ == 1: + self.state = 469 + self.match(EsqlBaseParser.WITH) + self.state = 470 + self.enrichWithClause() + self.state = 475 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,45,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 471 + self.match(EsqlBaseParser.COMMA) + self.state = 472 + self.enrichWithClause() + self.state = 477 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,45,self._ctx) + + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class EnrichWithClauseContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.newName = None # SourceIdentifierContext + self.enrichField = None # SourceIdentifierContext + + def sourceIdentifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(EsqlBaseParser.SourceIdentifierContext) + else: + return self.getTypedRuleContext(EsqlBaseParser.SourceIdentifierContext,i) + + + def ASSIGN(self): + return self.getToken(EsqlBaseParser.ASSIGN, 0) + + def getRuleIndex(self): + return EsqlBaseParser.RULE_enrichWithClause + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEnrichWithClause" ): + listener.enterEnrichWithClause(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEnrichWithClause" ): + listener.exitEnrichWithClause(self) + + + + + def enrichWithClause(self): + + localctx = EsqlBaseParser.EnrichWithClauseContext(self, self._ctx, self.state) + self.enterRule(localctx, 90, self.RULE_enrichWithClause) + try: + self.enterOuterAlt(localctx, 1) + self.state = 483 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,47,self._ctx) + if la_ == 1: + self.state = 480 + localctx.newName = self.sourceIdentifier() + self.state = 481 + self.match(EsqlBaseParser.ASSIGN) + + + self.state = 485 + localctx.enrichField = self.sourceIdentifier() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + + def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int): + if self._predicates == None: + self._predicates = dict() + self._predicates[1] = self.query_sempred + self._predicates[5] = self.booleanExpression_sempred + self._predicates[8] = self.operatorExpression_sempred + pred = self._predicates.get(ruleIndex, None) + if pred is None: + raise Exception("No predicate with index:" + str(ruleIndex)) + else: + return pred(localctx, predIndex) + + def query_sempred(self, localctx:QueryContext, predIndex:int): + if predIndex == 0: + return self.precpred(self._ctx, 1) + + + def booleanExpression_sempred(self, localctx:BooleanExpressionContext, predIndex:int): + if predIndex == 1: + return self.precpred(self._ctx, 3) + + + if predIndex == 2: + return self.precpred(self._ctx, 2) + + + def operatorExpression_sempred(self, localctx:OperatorExpressionContext, predIndex:int): + if predIndex == 3: + return self.precpred(self._ctx, 2) + + + if predIndex == 4: + return self.precpred(self._ctx, 1) + + + + + diff --git a/esql/generated/v8_11_0/EsqlBaseParser.tokens b/esql/generated/v8_11_0/EsqlBaseParser.tokens new file mode 100644 index 00000000000..e8040376185 --- /dev/null +++ b/esql/generated/v8_11_0/EsqlBaseParser.tokens @@ -0,0 +1,135 @@ +DISSECT=1 +DROP=2 +ENRICH=3 +EVAL=4 +EXPLAIN=5 +FROM=6 +GROK=7 +INLINESTATS=8 +KEEP=9 +LIMIT=10 +MV_EXPAND=11 +PROJECT=12 +RENAME=13 +ROW=14 +SHOW=15 +SORT=16 +STATS=17 +WHERE=18 +UNKNOWN_CMD=19 +LINE_COMMENT=20 +MULTILINE_COMMENT=21 +WS=22 +EXPLAIN_WS=23 +EXPLAIN_LINE_COMMENT=24 +EXPLAIN_MULTILINE_COMMENT=25 +PIPE=26 +STRING=27 +INTEGER_LITERAL=28 +DECIMAL_LITERAL=29 +BY=30 +AND=31 +ASC=32 +ASSIGN=33 +COMMA=34 +DESC=35 +DOT=36 +FALSE=37 +FIRST=38 +LAST=39 +LP=40 +IN=41 +LIKE=42 +NOT=43 +NULL=44 +NULLS=45 +OR=46 +PARAM=47 +RLIKE=48 +RP=49 +TRUE=50 +INFO=51 +FUNCTIONS=52 +EQ=53 +NEQ=54 +LT=55 +LTE=56 +GT=57 +GTE=58 +PLUS=59 +MINUS=60 +ASTERISK=61 +SLASH=62 +PERCENT=63 +OPENING_BRACKET=64 +CLOSING_BRACKET=65 +UNQUOTED_IDENTIFIER=66 +QUOTED_IDENTIFIER=67 +EXPR_LINE_COMMENT=68 +EXPR_MULTILINE_COMMENT=69 +EXPR_WS=70 +AS=71 +METADATA=72 +ON=73 +WITH=74 +SRC_UNQUOTED_IDENTIFIER=75 +SRC_QUOTED_IDENTIFIER=76 +SRC_LINE_COMMENT=77 +SRC_MULTILINE_COMMENT=78 +SRC_WS=79 +EXPLAIN_PIPE=80 +'dissect'=1 +'drop'=2 +'enrich'=3 +'eval'=4 +'explain'=5 +'from'=6 +'grok'=7 +'inlinestats'=8 +'keep'=9 +'limit'=10 +'mv_expand'=11 +'project'=12 +'rename'=13 +'row'=14 +'show'=15 +'sort'=16 +'stats'=17 +'where'=18 +'by'=30 +'and'=31 +'asc'=32 +'desc'=35 +'.'=36 +'false'=37 +'first'=38 +'last'=39 +'('=40 +'in'=41 +'like'=42 +'not'=43 +'null'=44 +'nulls'=45 +'or'=46 +'?'=47 +'rlike'=48 +')'=49 +'true'=50 +'info'=51 +'functions'=52 +'=='=53 +'!='=54 +'<'=55 +'<='=56 +'>'=57 +'>='=58 +'+'=59 +'-'=60 +'*'=61 +'/'=62 +'%'=63 +']'=65 +'as'=71 +'metadata'=72 +'on'=73 +'with'=74 diff --git a/esql/generated/v8_11_0/EsqlBaseParserListener.py b/esql/generated/v8_11_0/EsqlBaseParserListener.py new file mode 100644 index 00000000000..d20e388eaf6 --- /dev/null +++ b/esql/generated/v8_11_0/EsqlBaseParserListener.py @@ -0,0 +1,619 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. + +from antlr4 import * +if "." in __name__: + from .EsqlBaseParser import EsqlBaseParser +else: + from EsqlBaseParser import EsqlBaseParser + +# This class defines a complete listener for a parse tree produced by EsqlBaseParser. +class EsqlBaseParserListener(ParseTreeListener): + + # Enter a parse tree produced by EsqlBaseParser#singleStatement. + def enterSingleStatement(self, ctx:EsqlBaseParser.SingleStatementContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#singleStatement. + def exitSingleStatement(self, ctx:EsqlBaseParser.SingleStatementContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#compositeQuery. + def enterCompositeQuery(self, ctx:EsqlBaseParser.CompositeQueryContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#compositeQuery. + def exitCompositeQuery(self, ctx:EsqlBaseParser.CompositeQueryContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#singleCommandQuery. + def enterSingleCommandQuery(self, ctx:EsqlBaseParser.SingleCommandQueryContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#singleCommandQuery. + def exitSingleCommandQuery(self, ctx:EsqlBaseParser.SingleCommandQueryContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#sourceCommand. + def enterSourceCommand(self, ctx:EsqlBaseParser.SourceCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#sourceCommand. + def exitSourceCommand(self, ctx:EsqlBaseParser.SourceCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#processingCommand. + def enterProcessingCommand(self, ctx:EsqlBaseParser.ProcessingCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#processingCommand. + def exitProcessingCommand(self, ctx:EsqlBaseParser.ProcessingCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#whereCommand. + def enterWhereCommand(self, ctx:EsqlBaseParser.WhereCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#whereCommand. + def exitWhereCommand(self, ctx:EsqlBaseParser.WhereCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#logicalNot. + def enterLogicalNot(self, ctx:EsqlBaseParser.LogicalNotContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#logicalNot. + def exitLogicalNot(self, ctx:EsqlBaseParser.LogicalNotContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#booleanDefault. + def enterBooleanDefault(self, ctx:EsqlBaseParser.BooleanDefaultContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#booleanDefault. + def exitBooleanDefault(self, ctx:EsqlBaseParser.BooleanDefaultContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#regexExpression. + def enterRegexExpression(self, ctx:EsqlBaseParser.RegexExpressionContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#regexExpression. + def exitRegexExpression(self, ctx:EsqlBaseParser.RegexExpressionContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#logicalIn. + def enterLogicalIn(self, ctx:EsqlBaseParser.LogicalInContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#logicalIn. + def exitLogicalIn(self, ctx:EsqlBaseParser.LogicalInContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#logicalBinary. + def enterLogicalBinary(self, ctx:EsqlBaseParser.LogicalBinaryContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#logicalBinary. + def exitLogicalBinary(self, ctx:EsqlBaseParser.LogicalBinaryContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#regexBooleanExpression. + def enterRegexBooleanExpression(self, ctx:EsqlBaseParser.RegexBooleanExpressionContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#regexBooleanExpression. + def exitRegexBooleanExpression(self, ctx:EsqlBaseParser.RegexBooleanExpressionContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#valueExpressionDefault. + def enterValueExpressionDefault(self, ctx:EsqlBaseParser.ValueExpressionDefaultContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#valueExpressionDefault. + def exitValueExpressionDefault(self, ctx:EsqlBaseParser.ValueExpressionDefaultContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#comparison. + def enterComparison(self, ctx:EsqlBaseParser.ComparisonContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#comparison. + def exitComparison(self, ctx:EsqlBaseParser.ComparisonContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#operatorExpressionDefault. + def enterOperatorExpressionDefault(self, ctx:EsqlBaseParser.OperatorExpressionDefaultContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#operatorExpressionDefault. + def exitOperatorExpressionDefault(self, ctx:EsqlBaseParser.OperatorExpressionDefaultContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#arithmeticBinary. + def enterArithmeticBinary(self, ctx:EsqlBaseParser.ArithmeticBinaryContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#arithmeticBinary. + def exitArithmeticBinary(self, ctx:EsqlBaseParser.ArithmeticBinaryContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#arithmeticUnary. + def enterArithmeticUnary(self, ctx:EsqlBaseParser.ArithmeticUnaryContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#arithmeticUnary. + def exitArithmeticUnary(self, ctx:EsqlBaseParser.ArithmeticUnaryContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#constantDefault. + def enterConstantDefault(self, ctx:EsqlBaseParser.ConstantDefaultContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#constantDefault. + def exitConstantDefault(self, ctx:EsqlBaseParser.ConstantDefaultContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#dereference. + def enterDereference(self, ctx:EsqlBaseParser.DereferenceContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#dereference. + def exitDereference(self, ctx:EsqlBaseParser.DereferenceContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#parenthesizedExpression. + def enterParenthesizedExpression(self, ctx:EsqlBaseParser.ParenthesizedExpressionContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#parenthesizedExpression. + def exitParenthesizedExpression(self, ctx:EsqlBaseParser.ParenthesizedExpressionContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#functionExpression. + def enterFunctionExpression(self, ctx:EsqlBaseParser.FunctionExpressionContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#functionExpression. + def exitFunctionExpression(self, ctx:EsqlBaseParser.FunctionExpressionContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#rowCommand. + def enterRowCommand(self, ctx:EsqlBaseParser.RowCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#rowCommand. + def exitRowCommand(self, ctx:EsqlBaseParser.RowCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#fields. + def enterFields(self, ctx:EsqlBaseParser.FieldsContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#fields. + def exitFields(self, ctx:EsqlBaseParser.FieldsContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#field. + def enterField(self, ctx:EsqlBaseParser.FieldContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#field. + def exitField(self, ctx:EsqlBaseParser.FieldContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#fromCommand. + def enterFromCommand(self, ctx:EsqlBaseParser.FromCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#fromCommand. + def exitFromCommand(self, ctx:EsqlBaseParser.FromCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#metadata. + def enterMetadata(self, ctx:EsqlBaseParser.MetadataContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#metadata. + def exitMetadata(self, ctx:EsqlBaseParser.MetadataContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#evalCommand. + def enterEvalCommand(self, ctx:EsqlBaseParser.EvalCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#evalCommand. + def exitEvalCommand(self, ctx:EsqlBaseParser.EvalCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#statsCommand. + def enterStatsCommand(self, ctx:EsqlBaseParser.StatsCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#statsCommand. + def exitStatsCommand(self, ctx:EsqlBaseParser.StatsCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#inlinestatsCommand. + def enterInlinestatsCommand(self, ctx:EsqlBaseParser.InlinestatsCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#inlinestatsCommand. + def exitInlinestatsCommand(self, ctx:EsqlBaseParser.InlinestatsCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#grouping. + def enterGrouping(self, ctx:EsqlBaseParser.GroupingContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#grouping. + def exitGrouping(self, ctx:EsqlBaseParser.GroupingContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#sourceIdentifier. + def enterSourceIdentifier(self, ctx:EsqlBaseParser.SourceIdentifierContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#sourceIdentifier. + def exitSourceIdentifier(self, ctx:EsqlBaseParser.SourceIdentifierContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#qualifiedName. + def enterQualifiedName(self, ctx:EsqlBaseParser.QualifiedNameContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#qualifiedName. + def exitQualifiedName(self, ctx:EsqlBaseParser.QualifiedNameContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#identifier. + def enterIdentifier(self, ctx:EsqlBaseParser.IdentifierContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#identifier. + def exitIdentifier(self, ctx:EsqlBaseParser.IdentifierContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#nullLiteral. + def enterNullLiteral(self, ctx:EsqlBaseParser.NullLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#nullLiteral. + def exitNullLiteral(self, ctx:EsqlBaseParser.NullLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#qualifiedIntegerLiteral. + def enterQualifiedIntegerLiteral(self, ctx:EsqlBaseParser.QualifiedIntegerLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#qualifiedIntegerLiteral. + def exitQualifiedIntegerLiteral(self, ctx:EsqlBaseParser.QualifiedIntegerLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#decimalLiteral. + def enterDecimalLiteral(self, ctx:EsqlBaseParser.DecimalLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#decimalLiteral. + def exitDecimalLiteral(self, ctx:EsqlBaseParser.DecimalLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#integerLiteral. + def enterIntegerLiteral(self, ctx:EsqlBaseParser.IntegerLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#integerLiteral. + def exitIntegerLiteral(self, ctx:EsqlBaseParser.IntegerLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#booleanLiteral. + def enterBooleanLiteral(self, ctx:EsqlBaseParser.BooleanLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#booleanLiteral. + def exitBooleanLiteral(self, ctx:EsqlBaseParser.BooleanLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#inputParam. + def enterInputParam(self, ctx:EsqlBaseParser.InputParamContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#inputParam. + def exitInputParam(self, ctx:EsqlBaseParser.InputParamContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#stringLiteral. + def enterStringLiteral(self, ctx:EsqlBaseParser.StringLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#stringLiteral. + def exitStringLiteral(self, ctx:EsqlBaseParser.StringLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#numericArrayLiteral. + def enterNumericArrayLiteral(self, ctx:EsqlBaseParser.NumericArrayLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#numericArrayLiteral. + def exitNumericArrayLiteral(self, ctx:EsqlBaseParser.NumericArrayLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#booleanArrayLiteral. + def enterBooleanArrayLiteral(self, ctx:EsqlBaseParser.BooleanArrayLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#booleanArrayLiteral. + def exitBooleanArrayLiteral(self, ctx:EsqlBaseParser.BooleanArrayLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#stringArrayLiteral. + def enterStringArrayLiteral(self, ctx:EsqlBaseParser.StringArrayLiteralContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#stringArrayLiteral. + def exitStringArrayLiteral(self, ctx:EsqlBaseParser.StringArrayLiteralContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#limitCommand. + def enterLimitCommand(self, ctx:EsqlBaseParser.LimitCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#limitCommand. + def exitLimitCommand(self, ctx:EsqlBaseParser.LimitCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#sortCommand. + def enterSortCommand(self, ctx:EsqlBaseParser.SortCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#sortCommand. + def exitSortCommand(self, ctx:EsqlBaseParser.SortCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#orderExpression. + def enterOrderExpression(self, ctx:EsqlBaseParser.OrderExpressionContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#orderExpression. + def exitOrderExpression(self, ctx:EsqlBaseParser.OrderExpressionContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#keepCommand. + def enterKeepCommand(self, ctx:EsqlBaseParser.KeepCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#keepCommand. + def exitKeepCommand(self, ctx:EsqlBaseParser.KeepCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#dropCommand. + def enterDropCommand(self, ctx:EsqlBaseParser.DropCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#dropCommand. + def exitDropCommand(self, ctx:EsqlBaseParser.DropCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#renameCommand. + def enterRenameCommand(self, ctx:EsqlBaseParser.RenameCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#renameCommand. + def exitRenameCommand(self, ctx:EsqlBaseParser.RenameCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#renameClause. + def enterRenameClause(self, ctx:EsqlBaseParser.RenameClauseContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#renameClause. + def exitRenameClause(self, ctx:EsqlBaseParser.RenameClauseContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#dissectCommand. + def enterDissectCommand(self, ctx:EsqlBaseParser.DissectCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#dissectCommand. + def exitDissectCommand(self, ctx:EsqlBaseParser.DissectCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#grokCommand. + def enterGrokCommand(self, ctx:EsqlBaseParser.GrokCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#grokCommand. + def exitGrokCommand(self, ctx:EsqlBaseParser.GrokCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#mvExpandCommand. + def enterMvExpandCommand(self, ctx:EsqlBaseParser.MvExpandCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#mvExpandCommand. + def exitMvExpandCommand(self, ctx:EsqlBaseParser.MvExpandCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#commandOptions. + def enterCommandOptions(self, ctx:EsqlBaseParser.CommandOptionsContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#commandOptions. + def exitCommandOptions(self, ctx:EsqlBaseParser.CommandOptionsContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#commandOption. + def enterCommandOption(self, ctx:EsqlBaseParser.CommandOptionContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#commandOption. + def exitCommandOption(self, ctx:EsqlBaseParser.CommandOptionContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#booleanValue. + def enterBooleanValue(self, ctx:EsqlBaseParser.BooleanValueContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#booleanValue. + def exitBooleanValue(self, ctx:EsqlBaseParser.BooleanValueContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#numericValue. + def enterNumericValue(self, ctx:EsqlBaseParser.NumericValueContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#numericValue. + def exitNumericValue(self, ctx:EsqlBaseParser.NumericValueContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#decimalValue. + def enterDecimalValue(self, ctx:EsqlBaseParser.DecimalValueContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#decimalValue. + def exitDecimalValue(self, ctx:EsqlBaseParser.DecimalValueContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#integerValue. + def enterIntegerValue(self, ctx:EsqlBaseParser.IntegerValueContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#integerValue. + def exitIntegerValue(self, ctx:EsqlBaseParser.IntegerValueContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#string. + def enterString(self, ctx:EsqlBaseParser.StringContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#string. + def exitString(self, ctx:EsqlBaseParser.StringContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#comparisonOperator. + def enterComparisonOperator(self, ctx:EsqlBaseParser.ComparisonOperatorContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#comparisonOperator. + def exitComparisonOperator(self, ctx:EsqlBaseParser.ComparisonOperatorContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#explainCommand. + def enterExplainCommand(self, ctx:EsqlBaseParser.ExplainCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#explainCommand. + def exitExplainCommand(self, ctx:EsqlBaseParser.ExplainCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#subqueryExpression. + def enterSubqueryExpression(self, ctx:EsqlBaseParser.SubqueryExpressionContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#subqueryExpression. + def exitSubqueryExpression(self, ctx:EsqlBaseParser.SubqueryExpressionContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#showInfo. + def enterShowInfo(self, ctx:EsqlBaseParser.ShowInfoContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#showInfo. + def exitShowInfo(self, ctx:EsqlBaseParser.ShowInfoContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#showFunctions. + def enterShowFunctions(self, ctx:EsqlBaseParser.ShowFunctionsContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#showFunctions. + def exitShowFunctions(self, ctx:EsqlBaseParser.ShowFunctionsContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#enrichCommand. + def enterEnrichCommand(self, ctx:EsqlBaseParser.EnrichCommandContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#enrichCommand. + def exitEnrichCommand(self, ctx:EsqlBaseParser.EnrichCommandContext): + pass + + + # Enter a parse tree produced by EsqlBaseParser#enrichWithClause. + def enterEnrichWithClause(self, ctx:EsqlBaseParser.EnrichWithClauseContext): + pass + + # Exit a parse tree produced by EsqlBaseParser#enrichWithClause. + def exitEnrichWithClause(self, ctx:EsqlBaseParser.EnrichWithClauseContext): + pass + + + +del EsqlBaseParser \ No newline at end of file diff --git a/esql/generated/v8_11_0/__init__.py b/esql/generated/v8_11_0/__init__.py new file mode 100644 index 00000000000..ba92cb5cb52 --- /dev/null +++ b/esql/generated/v8_11_0/__init__.py @@ -0,0 +1,4 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. \ No newline at end of file diff --git a/esql/grammar/v8_11_0/EsqlBaseLexer.g4 b/esql/grammar/v8_11_0/EsqlBaseLexer.g4 new file mode 100644 index 00000000000..abd2f2de4f6 --- /dev/null +++ b/esql/grammar/v8_11_0/EsqlBaseLexer.g4 @@ -0,0 +1,190 @@ +lexer grammar EsqlBaseLexer; + +DISSECT : 'dissect' -> pushMode(EXPRESSION); +DROP : 'drop' -> pushMode(SOURCE_IDENTIFIERS); +ENRICH : 'enrich' -> pushMode(SOURCE_IDENTIFIERS); +EVAL : 'eval' -> pushMode(EXPRESSION); +EXPLAIN : 'explain' -> pushMode(EXPLAIN_MODE); +FROM : 'from' -> pushMode(SOURCE_IDENTIFIERS); +GROK : 'grok' -> pushMode(EXPRESSION); +INLINESTATS : 'inlinestats' -> pushMode(EXPRESSION); +KEEP : 'keep' -> pushMode(SOURCE_IDENTIFIERS); +LIMIT : 'limit' -> pushMode(EXPRESSION); +MV_EXPAND : 'mv_expand' -> pushMode(SOURCE_IDENTIFIERS); +PROJECT : 'project' -> pushMode(SOURCE_IDENTIFIERS); +RENAME : 'rename' -> pushMode(SOURCE_IDENTIFIERS); +ROW : 'row' -> pushMode(EXPRESSION); +SHOW : 'show' -> pushMode(EXPRESSION); +SORT : 'sort' -> pushMode(EXPRESSION); +STATS : 'stats' -> pushMode(EXPRESSION); +WHERE : 'where' -> pushMode(EXPRESSION); +UNKNOWN_CMD : ~[ \r\n\t[\]/]+ -> pushMode(EXPRESSION); + +LINE_COMMENT + : '//' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN) + ; + +MULTILINE_COMMENT + : '/*' (MULTILINE_COMMENT|.)*? '*/' -> channel(HIDDEN) + ; + +WS + : [ \r\n\t]+ -> channel(HIDDEN) + ; + + +mode EXPLAIN_MODE; +EXPLAIN_OPENING_BRACKET : '[' -> type(OPENING_BRACKET), pushMode(DEFAULT_MODE); +EXPLAIN_PIPE : '|' -> type(PIPE), popMode; +EXPLAIN_WS : WS -> channel(HIDDEN); +EXPLAIN_LINE_COMMENT : LINE_COMMENT -> channel(HIDDEN); +EXPLAIN_MULTILINE_COMMENT : MULTILINE_COMMENT -> channel(HIDDEN); + +mode EXPRESSION; + +PIPE : '|' -> popMode; + +fragment DIGIT + : [0-9] + ; + +fragment LETTER + : [A-Za-z] + ; + +fragment ESCAPE_SEQUENCE + : '\\' [tnr"\\] + ; + +fragment UNESCAPED_CHARS + : ~[\r\n"\\] + ; + +fragment EXPONENT + : [Ee] [+-]? DIGIT+ + ; + +STRING + : '"' (ESCAPE_SEQUENCE | UNESCAPED_CHARS)* '"' + | '"""' (~[\r\n])*? '"""' '"'? '"'? + ; + +INTEGER_LITERAL + : DIGIT+ + ; + +DECIMAL_LITERAL + : DIGIT+ DOT DIGIT* + | DOT DIGIT+ + | DIGIT+ (DOT DIGIT*)? EXPONENT + | DOT DIGIT+ EXPONENT + ; + +BY : 'by'; + +AND : 'and'; +ASC : 'asc'; +ASSIGN : '='; +COMMA : ','; +DESC : 'desc'; +DOT : '.'; +FALSE : 'false'; +FIRST : 'first'; +LAST : 'last'; +LP : '('; +IN: 'in'; +LIKE: 'like'; +NOT : 'not'; +NULL : 'null'; +NULLS : 'nulls'; +OR : 'or'; +PARAM: '?'; +RLIKE: 'rlike'; +RP : ')'; +TRUE : 'true'; +INFO : 'info'; +FUNCTIONS : 'functions'; + +EQ : '=='; +NEQ : '!='; +LT : '<'; +LTE : '<='; +GT : '>'; +GTE : '>='; + +PLUS : '+'; +MINUS : '-'; +ASTERISK : '*'; +SLASH : '/'; +PERCENT : '%'; + +// Brackets are funny. We can happen upon a CLOSING_BRACKET in two ways - one +// way is to start in an explain command which then shifts us to expression +// mode. Thus, the two popModes on CLOSING_BRACKET. The other way could as +// the start of a multivalued field constant. To line up with the double pop +// the explain mode needs, we double push when we see that. +OPENING_BRACKET : '[' -> pushMode(EXPRESSION), pushMode(EXPRESSION); +CLOSING_BRACKET : ']' -> popMode, popMode; + + +UNQUOTED_IDENTIFIER + : LETTER (LETTER | DIGIT | '_')* + // only allow @ at beginning of identifier to keep the option to allow @ as infix operator in the future + // also, single `_` and `@` characters are not valid identifiers + | ('_' | '@') (LETTER | DIGIT | '_')+ + ; + +QUOTED_IDENTIFIER + : '`' ( ~'`' | '``' )* '`' + ; + +EXPR_LINE_COMMENT + : LINE_COMMENT -> channel(HIDDEN) + ; + +EXPR_MULTILINE_COMMENT + : MULTILINE_COMMENT -> channel(HIDDEN) + ; + +EXPR_WS + : WS -> channel(HIDDEN) + ; + + + +mode SOURCE_IDENTIFIERS; + +SRC_PIPE : '|' -> type(PIPE), popMode; +SRC_OPENING_BRACKET : '[' -> type(OPENING_BRACKET), pushMode(SOURCE_IDENTIFIERS), pushMode(SOURCE_IDENTIFIERS); +SRC_CLOSING_BRACKET : ']' -> popMode, popMode, type(CLOSING_BRACKET); +SRC_COMMA : ',' -> type(COMMA); +SRC_ASSIGN : '=' -> type(ASSIGN); +AS : 'as'; +METADATA: 'metadata'; +ON : 'on'; +WITH : 'with'; + +SRC_UNQUOTED_IDENTIFIER + : SRC_UNQUOTED_IDENTIFIER_PART+ + ; + +fragment SRC_UNQUOTED_IDENTIFIER_PART + : ~[=`|,[\]/ \t\r\n]+ + | '/' ~[*/] // allow single / but not followed by another / or * which would start a comment + ; + +SRC_QUOTED_IDENTIFIER + : QUOTED_IDENTIFIER + ; + +SRC_LINE_COMMENT + : LINE_COMMENT -> channel(HIDDEN) + ; + +SRC_MULTILINE_COMMENT + : MULTILINE_COMMENT -> channel(HIDDEN) + ; + +SRC_WS + : WS -> channel(HIDDEN) + ; diff --git a/esql/grammar/v8_11_0/EsqlBaseLexer.tokens b/esql/grammar/v8_11_0/EsqlBaseLexer.tokens new file mode 100644 index 00000000000..e8040376185 --- /dev/null +++ b/esql/grammar/v8_11_0/EsqlBaseLexer.tokens @@ -0,0 +1,135 @@ +DISSECT=1 +DROP=2 +ENRICH=3 +EVAL=4 +EXPLAIN=5 +FROM=6 +GROK=7 +INLINESTATS=8 +KEEP=9 +LIMIT=10 +MV_EXPAND=11 +PROJECT=12 +RENAME=13 +ROW=14 +SHOW=15 +SORT=16 +STATS=17 +WHERE=18 +UNKNOWN_CMD=19 +LINE_COMMENT=20 +MULTILINE_COMMENT=21 +WS=22 +EXPLAIN_WS=23 +EXPLAIN_LINE_COMMENT=24 +EXPLAIN_MULTILINE_COMMENT=25 +PIPE=26 +STRING=27 +INTEGER_LITERAL=28 +DECIMAL_LITERAL=29 +BY=30 +AND=31 +ASC=32 +ASSIGN=33 +COMMA=34 +DESC=35 +DOT=36 +FALSE=37 +FIRST=38 +LAST=39 +LP=40 +IN=41 +LIKE=42 +NOT=43 +NULL=44 +NULLS=45 +OR=46 +PARAM=47 +RLIKE=48 +RP=49 +TRUE=50 +INFO=51 +FUNCTIONS=52 +EQ=53 +NEQ=54 +LT=55 +LTE=56 +GT=57 +GTE=58 +PLUS=59 +MINUS=60 +ASTERISK=61 +SLASH=62 +PERCENT=63 +OPENING_BRACKET=64 +CLOSING_BRACKET=65 +UNQUOTED_IDENTIFIER=66 +QUOTED_IDENTIFIER=67 +EXPR_LINE_COMMENT=68 +EXPR_MULTILINE_COMMENT=69 +EXPR_WS=70 +AS=71 +METADATA=72 +ON=73 +WITH=74 +SRC_UNQUOTED_IDENTIFIER=75 +SRC_QUOTED_IDENTIFIER=76 +SRC_LINE_COMMENT=77 +SRC_MULTILINE_COMMENT=78 +SRC_WS=79 +EXPLAIN_PIPE=80 +'dissect'=1 +'drop'=2 +'enrich'=3 +'eval'=4 +'explain'=5 +'from'=6 +'grok'=7 +'inlinestats'=8 +'keep'=9 +'limit'=10 +'mv_expand'=11 +'project'=12 +'rename'=13 +'row'=14 +'show'=15 +'sort'=16 +'stats'=17 +'where'=18 +'by'=30 +'and'=31 +'asc'=32 +'desc'=35 +'.'=36 +'false'=37 +'first'=38 +'last'=39 +'('=40 +'in'=41 +'like'=42 +'not'=43 +'null'=44 +'nulls'=45 +'or'=46 +'?'=47 +'rlike'=48 +')'=49 +'true'=50 +'info'=51 +'functions'=52 +'=='=53 +'!='=54 +'<'=55 +'<='=56 +'>'=57 +'>='=58 +'+'=59 +'-'=60 +'*'=61 +'/'=62 +'%'=63 +']'=65 +'as'=71 +'metadata'=72 +'on'=73 +'with'=74 diff --git a/esql/grammar/v8_11_0/EsqlBaseParser.g4 b/esql/grammar/v8_11_0/EsqlBaseParser.g4 new file mode 100644 index 00000000000..34e56e6c20a --- /dev/null +++ b/esql/grammar/v8_11_0/EsqlBaseParser.g4 @@ -0,0 +1,242 @@ + +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +parser grammar EsqlBaseParser; + +options {tokenVocab=EsqlBaseLexer;} + +singleStatement + : query EOF + ; + +query + : sourceCommand #singleCommandQuery + | query PIPE processingCommand #compositeQuery + ; + +sourceCommand + : explainCommand + | fromCommand + | rowCommand + | showCommand + ; + +processingCommand + : evalCommand + | inlinestatsCommand + | limitCommand + | keepCommand + | sortCommand + | statsCommand + | whereCommand + | dropCommand + | renameCommand + | dissectCommand + | grokCommand + | enrichCommand + | mvExpandCommand + ; + +whereCommand + : WHERE booleanExpression + ; + +booleanExpression + : NOT booleanExpression #logicalNot + | valueExpression #booleanDefault + | regexBooleanExpression #regexExpression + | left=booleanExpression operator=AND right=booleanExpression #logicalBinary + | left=booleanExpression operator=OR right=booleanExpression #logicalBinary + | valueExpression (NOT)? IN LP valueExpression (COMMA valueExpression)* RP #logicalIn + ; + +regexBooleanExpression + : valueExpression (NOT)? kind=LIKE pattern=string + | valueExpression (NOT)? kind=RLIKE pattern=string + ; + +valueExpression + : operatorExpression #valueExpressionDefault + | left=operatorExpression comparisonOperator right=operatorExpression #comparison + ; + +operatorExpression + : primaryExpression #operatorExpressionDefault + | operator=(MINUS | PLUS) operatorExpression #arithmeticUnary + | left=operatorExpression operator=(ASTERISK | SLASH | PERCENT) right=operatorExpression #arithmeticBinary + | left=operatorExpression operator=(PLUS | MINUS) right=operatorExpression #arithmeticBinary + ; + +primaryExpression + : constant #constantDefault + | qualifiedName #dereference + | LP booleanExpression RP #parenthesizedExpression + | identifier LP (booleanExpression (COMMA booleanExpression)*)? RP #functionExpression + ; + +rowCommand + : ROW fields + ; + +fields + : field (COMMA field)* + ; + +field + : booleanExpression + | qualifiedName ASSIGN booleanExpression + ; + +fromCommand + : FROM sourceIdentifier (COMMA sourceIdentifier)* metadata? + ; + +metadata + : OPENING_BRACKET METADATA sourceIdentifier (COMMA sourceIdentifier)* CLOSING_BRACKET + ; + + +evalCommand + : EVAL fields + ; + +statsCommand + : STATS fields? (BY grouping)? + ; + +inlinestatsCommand + : INLINESTATS fields (BY grouping)? + ; + +grouping + : qualifiedName (COMMA qualifiedName)* + ; + +sourceIdentifier + : SRC_UNQUOTED_IDENTIFIER + | SRC_QUOTED_IDENTIFIER + ; + +qualifiedName + : identifier (DOT identifier)* + ; + + +identifier + : UNQUOTED_IDENTIFIER + | QUOTED_IDENTIFIER + ; + +constant + : NULL #nullLiteral + | integerValue UNQUOTED_IDENTIFIER #qualifiedIntegerLiteral + | decimalValue #decimalLiteral + | integerValue #integerLiteral + | booleanValue #booleanLiteral + | PARAM #inputParam + | string #stringLiteral + | OPENING_BRACKET numericValue (COMMA numericValue)* CLOSING_BRACKET #numericArrayLiteral + | OPENING_BRACKET booleanValue (COMMA booleanValue)* CLOSING_BRACKET #booleanArrayLiteral + | OPENING_BRACKET string (COMMA string)* CLOSING_BRACKET #stringArrayLiteral + ; + +limitCommand + : LIMIT INTEGER_LITERAL + ; + +sortCommand + : SORT orderExpression (COMMA orderExpression)* + ; + +orderExpression + : booleanExpression ordering=(ASC | DESC)? (NULLS nullOrdering=(FIRST | LAST))? + ; + +keepCommand + : KEEP sourceIdentifier (COMMA sourceIdentifier)* + | PROJECT sourceIdentifier (COMMA sourceIdentifier)* + ; + +dropCommand + : DROP sourceIdentifier (COMMA sourceIdentifier)* + ; + +renameCommand + : RENAME renameClause (COMMA renameClause)* + ; + +renameClause: + oldName=sourceIdentifier AS newName=sourceIdentifier + ; + +dissectCommand + : DISSECT primaryExpression string commandOptions? + ; + +grokCommand + : GROK primaryExpression string + ; + +mvExpandCommand + : MV_EXPAND sourceIdentifier + ; + +commandOptions + : commandOption (COMMA commandOption)* + ; + +commandOption + : identifier ASSIGN constant + ; + +booleanValue + : TRUE | FALSE + ; + +numericValue + : decimalValue + | integerValue + ; + +decimalValue + : DECIMAL_LITERAL + ; + +integerValue + : INTEGER_LITERAL + ; + +string + : STRING + ; + +comparisonOperator + : EQ | NEQ | LT | LTE | GT | GTE + ; + +explainCommand + : EXPLAIN subqueryExpression + ; + +subqueryExpression + : OPENING_BRACKET query CLOSING_BRACKET + ; + +showCommand + : SHOW INFO #showInfo + | SHOW FUNCTIONS #showFunctions + ; + +enrichCommand + : ENRICH policyName=sourceIdentifier (ON matchField=sourceIdentifier)? (WITH enrichWithClause (COMMA enrichWithClause)*)? + ; + +enrichWithClause + + : (newName=sourceIdentifier ASSIGN)? enrichField=sourceIdentifier + ; diff --git a/esql/grammar/v8_11_0/EsqlBaseParser.tokens b/esql/grammar/v8_11_0/EsqlBaseParser.tokens new file mode 100644 index 00000000000..e8040376185 --- /dev/null +++ b/esql/grammar/v8_11_0/EsqlBaseParser.tokens @@ -0,0 +1,135 @@ +DISSECT=1 +DROP=2 +ENRICH=3 +EVAL=4 +EXPLAIN=5 +FROM=6 +GROK=7 +INLINESTATS=8 +KEEP=9 +LIMIT=10 +MV_EXPAND=11 +PROJECT=12 +RENAME=13 +ROW=14 +SHOW=15 +SORT=16 +STATS=17 +WHERE=18 +UNKNOWN_CMD=19 +LINE_COMMENT=20 +MULTILINE_COMMENT=21 +WS=22 +EXPLAIN_WS=23 +EXPLAIN_LINE_COMMENT=24 +EXPLAIN_MULTILINE_COMMENT=25 +PIPE=26 +STRING=27 +INTEGER_LITERAL=28 +DECIMAL_LITERAL=29 +BY=30 +AND=31 +ASC=32 +ASSIGN=33 +COMMA=34 +DESC=35 +DOT=36 +FALSE=37 +FIRST=38 +LAST=39 +LP=40 +IN=41 +LIKE=42 +NOT=43 +NULL=44 +NULLS=45 +OR=46 +PARAM=47 +RLIKE=48 +RP=49 +TRUE=50 +INFO=51 +FUNCTIONS=52 +EQ=53 +NEQ=54 +LT=55 +LTE=56 +GT=57 +GTE=58 +PLUS=59 +MINUS=60 +ASTERISK=61 +SLASH=62 +PERCENT=63 +OPENING_BRACKET=64 +CLOSING_BRACKET=65 +UNQUOTED_IDENTIFIER=66 +QUOTED_IDENTIFIER=67 +EXPR_LINE_COMMENT=68 +EXPR_MULTILINE_COMMENT=69 +EXPR_WS=70 +AS=71 +METADATA=72 +ON=73 +WITH=74 +SRC_UNQUOTED_IDENTIFIER=75 +SRC_QUOTED_IDENTIFIER=76 +SRC_LINE_COMMENT=77 +SRC_MULTILINE_COMMENT=78 +SRC_WS=79 +EXPLAIN_PIPE=80 +'dissect'=1 +'drop'=2 +'enrich'=3 +'eval'=4 +'explain'=5 +'from'=6 +'grok'=7 +'inlinestats'=8 +'keep'=9 +'limit'=10 +'mv_expand'=11 +'project'=12 +'rename'=13 +'row'=14 +'show'=15 +'sort'=16 +'stats'=17 +'where'=18 +'by'=30 +'and'=31 +'asc'=32 +'desc'=35 +'.'=36 +'false'=37 +'first'=38 +'last'=39 +'('=40 +'in'=41 +'like'=42 +'not'=43 +'null'=44 +'nulls'=45 +'or'=46 +'?'=47 +'rlike'=48 +')'=49 +'true'=50 +'info'=51 +'functions'=52 +'=='=53 +'!='=54 +'<'=55 +'<='=56 +'>'=57 +'>='=58 +'+'=59 +'-'=60 +'*'=61 +'/'=62 +'%'=63 +']'=65 +'as'=71 +'metadata'=72 +'on'=73 +'with'=74 diff --git a/esql/iesql_listener.py b/esql/iesql_listener.py new file mode 100644 index 00000000000..0fbd00666f5 --- /dev/null +++ b/esql/iesql_listener.py @@ -0,0 +1,73 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. +"""Factory for creating ESQL listeners.""" + + +class IESQLListener: + """ + Interface for ESQL listeners. + This interface defines the methods that any ESQL listener should implement. + """ + + def enterQualifiedName(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterSourceIdentifier(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterSingleStatement(self, ctx): # noqa: N802 + raise NotImplementedError + + def check_literal_type(self, ctx): # noqa: N802 + raise NotImplementedError + + def find_associated_field_and_context(self, ctx): # noqa: N802 + raise NotImplementedError + + def get_literal_type(self, ctx, context_type: str): # noqa: N802 + raise NotImplementedError + + def enterNullLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterQualifiedIntegerLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterDecimalLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterIntegerLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterBooleanLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterStringLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterNumericArrayLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterBooleanArrayLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterStringArrayLiteral(self, ctx): # noqa: N802 + raise NotImplementedError + + def enterBooleanDefault(self, ctx): # noqa: N802 + raise NotImplementedError + + +class ESQLListenerFactory: + """ Factory for creating ESQL listeners. """ + + @staticmethod + def getListener(version) -> IESQLListener: + """Return the listener for the given version.""" # noqa: N802 + if version == '8.11.0': + from esql.esql_listener_v8_11_0_adapter import ESQLListenerV8_11_0Adapter # noqa: E501 + return ESQLListenerV8_11_0Adapter() + else: + raise ValueError("Unsupported grammar version") diff --git a/esql/iesql_parser.py b/esql/iesql_parser.py new file mode 100644 index 00000000000..35127987922 --- /dev/null +++ b/esql/iesql_parser.py @@ -0,0 +1,40 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. + +"""Factory for creating ESQL parsers.""" +from antlr4 import CommonTokenStream, InputStream, Lexer, Parser + +from esql.generated.v8_11_0.EsqlBaseLexer import EsqlBaseLexer as EsqlBaseLexerV8_11_0 +from esql.generated.v8_11_0.EsqlBaseParser import EsqlBaseParser as EsqlBaseParserV8_11_0 + + +class ESQLParserFactory: + """Factory for creating ESQL parsers.""" + + @staticmethod + def createParser(query, version) -> Parser: + """Create a parser for the given ESQL query.""" # noqa: N802 + input_stream = InputStream(query.lower()) + lexer = ESQLParserFactory.createLexer(input_stream, version) + token_stream = CommonTokenStream(lexer) + return ESQLParserFactory.getParser(token_stream, version) + + @staticmethod + def createLexer(input_stream, version) -> Lexer: + """Create a lexer for the given ESQL query.""" # noqa: N802 + if version == '8.11.0': + return EsqlBaseLexerV8_11_0(input_stream) + # Will add other conditions for different versions as they come out + # ... + raise ValueError(f"Unsupported version: {version}") + + @staticmethod + def getParser(token_stream, version) -> Parser: + """Get the parser for the given ESQL query.""" # noqa: N802 + if version == '8.11.0': + return EsqlBaseParserV8_11_0(token_stream) + # Will add other conditions for different versions as they come out + # ... + raise ValueError(f"Unsupported version: {version}") diff --git a/esql/utils.py b/esql/utils.py new file mode 100644 index 00000000000..ce801acf5bc --- /dev/null +++ b/esql/utils.py @@ -0,0 +1,51 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. +from antlr4 import ParserRuleContext +from antlr4.tree.Trees import Trees +from esql.errors import ESQLSemanticError +# from esql.EsqlBaseParser import EsqlBaseParser + + +# def print_tree(parser: EsqlBaseParser, ctx: ParserRuleContext): +def print_tree(parser, ctx: ParserRuleContext): + """Print the parse tree.""" + print(Trees.toStringTree(ctx, None, parser)) + + +# def pretty_print_tree(ctx: EsqlBaseParser.SingleStatementContext, indent: int = 0, is_last: bool = True): +def pretty_print_tree(ctx, indent: int = 0, is_last: bool = True): + """Pretty print the parse tree.""" + if ctx is None: + return + + # Indentation and prefix logic + indent_str = ' ' * indent + prefix = '└── ' if is_last else '├── ' + + # Print the current context + node_label = type(ctx).__name__ + ': ' + ctx.getText() + print(f"{indent_str}{prefix}{node_label}") + + # Recursively pretty print each child + children = [ctx.getChild(i) for i in range(ctx.getChildCount())] + for i, child in enumerate(children): + pretty_print_tree(child, indent + 1, i == len(children) - 1) + + +# def get_node(tree: EsqlBaseParser.SingleStatementContext, ctx: ParserRuleContext): +def get_node(tree, ctx: ParserRuleContext): + """Return the first node of type ctx in the tree.""" + # fail if ctx is not a valid context + if not issubclass(ctx, ParserRuleContext): + raise ESQLSemanticError(f"Invalid context: {ctx}") + + nodes = [] + for child in tree.children: + if isinstance(child, ctx): + nodes.append(child) + elif hasattr(child, "children"): + nodes.extend(get_node(child, ctx)) + + return nodes diff --git a/pyproject.toml b/pyproject.toml index bf5ec9f58ae..23ee7270c7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,8 @@ classifiers = [ "Topic :: Utilities" ] dependencies = [ + "antlr4-python3-runtime~=4.9", + "antlr4-tools==0.2.1", "Click~=8.1.0", "elasticsearch~=8.1", "eql==0.9.19", diff --git a/rules/integrations/okta/initial_access_success_okta_sso_esql.toml b/rules/integrations/okta/initial_access_success_okta_sso_esql.toml new file mode 100644 index 00000000000..f7efc6723f6 --- /dev/null +++ b/rules/integrations/okta/initial_access_success_okta_sso_esql.toml @@ -0,0 +1,92 @@ +[metadata] +creation_date = "2020/05/21" +integration = ["okta"] +maturity = "production" +min_stack_comments = "Breaking change in Okta integration bumping version to ^2.0.0" +min_stack_version = "8.11.0" +updated_date = "2023/10/24" + +[rule] +author = ["Elastic"] +description = """ +Detects when a user reports suspicious activity for their Okta account. These events should be investigated, as they can +help security teams identify when an adversary is attempting to gain access to their network. +""" +false_positives = ["A user may report suspicious activity on their Okta account in error."] +language = "esql" +license = "Elastic License v2" +name = "Suspicious Activity Reported by Okta User ESQL" +note = """## Setup + +The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.""" +references = [ + "https://developer.okta.com/docs/reference/api/system-log/", + "https://developer.okta.com/docs/reference/api/event-types/", + "https://www.elastic.co/security-labs/testing-okta-visibility-and-detection-dorothy", +] +risk_score = 47 +rule_id = "6af3e7d2-8fad-11ee-af79-f661ea17fbcd" +severity = "medium" +tags = ["Use Case: Identity and Access Audit", "Data Source: Okta", "Tactic: Initial Access"] +timestamp_override = "event.ingested" +type = "esql" + +query = ''' +from logs-okta* + | where okta.outcome.result == "SUCCESS" and okta.event_type == "user.authentication.sso" and event.dataset == "okta.system" and event.dataset == "okta.system" + | stats count_outcome = count(okta.outcome.result) + | limit 10 +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1078" +name = "Valid Accounts" +reference = "https://attack.mitre.org/techniques/T1078/" + + +[rule.threat.tactic] +id = "TA0001" +name = "Initial Access" +reference = "https://attack.mitre.org/tactics/TA0001/" +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1078" +name = "Valid Accounts" +reference = "https://attack.mitre.org/techniques/T1078/" + + +[rule.threat.tactic] +id = "TA0003" +name = "Persistence" +reference = "https://attack.mitre.org/tactics/TA0003/" +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1078" +name = "Valid Accounts" +reference = "https://attack.mitre.org/techniques/T1078/" + + +[rule.threat.tactic] +id = "TA0004" +name = "Privilege Escalation" +reference = "https://attack.mitre.org/tactics/TA0004/" +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1078" +name = "Valid Accounts" +reference = "https://attack.mitre.org/techniques/T1078/" + + +[rule.threat.tactic] +id = "TA0005" +name = "Defense Evasion" +reference = "https://attack.mitre.org/tactics/TA0005/" + + + diff --git a/rules/linux/credential_access_credential_dumping_via_unshadow.toml b/rules/linux/credential_access_credential_dumping_via_unshadow.toml new file mode 100644 index 00000000000..2f7b57bf3e3 --- /dev/null +++ b/rules/linux/credential_access_credential_dumping_via_unshadow.toml @@ -0,0 +1,56 @@ +[metadata] +creation_date = "2023/02/27" +integration = ["endpoint"] +maturity = "production" +min_stack_comments = "New fields added: required_fields, related_integrations, setup" +min_stack_version = "8.11.0" +updated_date = "2023/06/22" + +[rule] +author = ["Elastic"] +description = """ +Identifies the execution of the unshadow utility which is part of John the Ripper, +a password-cracking tool on the host machine. Malicious actors can use the utility to retrieve +the combined contents of the '/etc/shadow' and '/etc/password' files. +Using the combined file generated from the utility, the malicious threat actors can use them as input +for password-cracking utilities or prepare themselves for future operations by gathering +credential information of the victim. +""" +from = "now-9m" +language = "esql" +license = "Elastic License v2" +name = "ESQL Potential Linux Credential Dumping via Unshadow" +references = [ + "https://www.cyberciti.biz/faq/unix-linux-password-cracking-john-the-ripper/", +] +risk_score = 47 +rule_id = "77af47d0-5bd4-11ee-8f6d-f661ea17fbce" +severity = "medium" +tags = ["Data Source: Elastic Endgame", "Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Credential Access", "Data Source: Elastic Defend"] +timestamp_override = "event.ingested" +type = "esql" +query = ''' +from logs-endpoint.events.*, logs-endpoint.events.process* + | where host.os.type == "linux" and process.name == "unshadow" and event.type == "start" and event.action in ("exec", "exec_event") + | keep host.os.type, process.name, process.working_directory, event.type, event.action + | stats process_count = AVG(process.name) +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1003" +name = "OS Credential Dumping" +reference = "https://attack.mitre.org/techniques/T1003/" +[[rule.threat.technique.subtechnique]] +id = "T1003.008" +name = "/etc/passwd and /etc/shadow" +reference = "https://attack.mitre.org/techniques/T1003/008/" + + + +[rule.threat.tactic] +id = "TA0006" +name = "Credential Access" +reference = "https://attack.mitre.org/tactics/TA0006/" diff --git a/tests/data/__init__.py b/tests/data/__init__.py new file mode 100644 index 00000000000..72ea1f6e244 --- /dev/null +++ b/tests/data/__init__.py @@ -0,0 +1,4 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. diff --git a/tests/data/command_control_dummy_production_rule.toml b/tests/data/command_control_dummy_production_rule.toml new file mode 100644 index 00000000000..591b733e643 --- /dev/null +++ b/tests/data/command_control_dummy_production_rule.toml @@ -0,0 +1,36 @@ +[metadata] +creation_date = "2023/11/20" +integration = ["endpoint"] +maturity = "production" +min_stack_comments = "ES|QL Rule" +min_stack_version = "8.11.0" +updated_date = "2023/11/20" + +[rule] +author = ["Elastic"] +description = """ +Sample ES|QL rule for unit tests. +""" +from = "now-9m" +language = "esql" +license = "Elastic License v2" +name = "Sample ES|QL rule for unit tests" +risk_score = 47 +rule_id = "24220495-cffe-45a1-996c-37b599ba0e43" +severity = "medium" +tags = ["Data Source: Elastic Endpoint", "Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Command and Control", "Data Source: Elastic Defend"] +timestamp_override = "event.ingested" +type = "esql" +query = ''' +from .ds-logs-endpoint.events.process-default-* [metadata _id, _version, _index] + | where event.action == "start" and process.code_signature.subject_name like "Microsoft*" and process.parent.name in ("winword.exe", "WINWORD.EXE", "EXCEL.EXE", "excel.exe") +''' + +[[rule.threat]] +framework = "MITRE ATT&CK" + +[rule.threat.tactic] +id = "TA0011" +name = "Command and Control" +reference = "https://attack.mitre.org/tactics/TA0011/" + diff --git a/tests/test_esql_rules.py b/tests/test_esql_rules.py new file mode 100644 index 00000000000..c5fa5efa94d --- /dev/null +++ b/tests/test_esql_rules.py @@ -0,0 +1,71 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0; you may not use this file except in compliance with the Elastic License +# 2.0. + +from contextlib import nullcontext as does_not_raise +from copy import deepcopy +from pathlib import Path + +import pytest + +from esql.errors import ESQLSyntaxError, ESQLSemanticError +from detection_rules.rule_loader import RuleCollection +from detection_rules.utils import get_path, load_rule_contents + +from .base import BaseRuleTest + + +class TestESQLRules(BaseRuleTest): + """Test ESQL Rules.""" + + def run_esql_test(self, esql_query, expectation, message): + """Test that the query validation is working correctly.""" + rc = RuleCollection() + file_path = Path(get_path("tests", "data", "command_control_dummy_production_rule.toml")) + original_production_rule = load_rule_contents(file_path) + # Test that a ValidationError is raised if the query doesn't match the schema + production_rule = deepcopy(original_production_rule)[0] + if esql_query: + production_rule["rule"]["query"] = esql_query + expectation.match_expr = message + with expectation: + rc.load_dict(production_rule) + + def test_esql_queries(self): + """Test ESQL queries.""" + test_cases = [ + # invalid queries + # `wheres` should be `where` + ('from .ds-logs-endpoint.events.process-default-* | wheres process.name like "Microsoft*"', + pytest.raises(ESQLSyntaxError), r"ESQL syntax error"), + + # `process.names` should be `process.name` + ('from .ds-logs-endpoint.events.process-default-* [metadata _id, _version, _index] | where process.names like "Microsoft*"', # noqa: E501 + pytest.raises(ESQLSemanticError), r"ESQL semantic error: Invalid field: process.names"), + + # Missing `[metadata _id, _version, _index]` without stats + ('from .ds-logs-endpoint.events.process-default-* | where process.name like "Microsoft*"', + pytest.raises(ESQLSemanticError), r"ESQL semantic error: Missing metadata for ES|QL query with no stats command"), # noqa: E501 + + # returns 0 because count on non-forwarded field process.parent.name + # ('from .ds-logs-endpoint.events.process-default-* | where process.name like "Microsoft*" | keep host.os.type | STATS process_count = COUNT(process.parent.name)', # noqa: E501 + # pytest.raises(ESQLSemanticError), r"ESQL semantic error"), + + # aggregation function AVG on text\keyword field type + # ('from .ds-logs-endpoint.events.process-default-* | where process.name like "Microsoft*" | keep host.os.type | STATS process_count = AVG(host.os.type)', # noqa: E501 + # pytest.raises(ESQLSemanticError), r"ESQL semantic error"), + + # Overwriting text/keyword ECS/integration field with different type from function or aggregation operator + # ('from .ds-logs-endpoint.events.process-default-* | where process.name like "Microsoft*" | keep host.os.type | STATS process.name = COUNT(process.name), # noqa: E501 + # pytest.raises(ESQLSemanticError), r"ESQL semantic error"), + + # valid queries + # base query within test rule + ('', does_not_raise(), None), + + # author defined field supported + # | eval process_path = replace(process.executable, """[cC]:\\[uU][sS][eE][rR][sS]\\[a-zA-Z0-9\.\-\_\$]+\\""", "C:\\\\users\\\\user\\\\") # noqa: E501 + ] + for esql_query, expectation, message in test_cases: + self.run_esql_test(esql_query, expectation, message)