# @elastic/esql-promql-grammar

> **Do not edit any file in this package by hand.** All TypeScript files are auto-generated by
> the grammar sync CI job from `elastic/elasticsearch`. Edit the source grammar there.

Auto-generated ANTLR4 TypeScript lexer and parser artifacts for the PromQL grammar used
inside ES|QL queries. This is an internal workspace package — it is not published to npm.

## Contents

| File | Description |
|------|-------------|
| `src/promql_lexer.g4` | PromQL lexer grammar |
| `src/promql_parser.g4` | PromQL parser grammar |
| `src/promql_lexer.ts` | Generated ANTLR4 lexer |
| `src/promql_parser.ts` | Generated ANTLR4 parser |
| `src/promql_parser_listener.ts` | Generated parse-tree listener |

## Grammar sync

The PromQL grammar originates from the Prometheus project / Grafana tooling and is mirrored
in `elastic/elasticsearch`. The CI sync job updates these files and opens a PR touching only
this package. Follow-up changes to the PromQL parser logic belong in `@elastic/esql`.

## Regenerate manually

```sh
pnpm --filter @elastic/esql-promql-grammar build:antlr4
```

Requires `antlr` CLI. Install on macOS with:

```sh
pnpm --filter @elastic/esql-promql-grammar antlr4:deps
```
