Files
ottyl/tickets/005-filterbar-pest-parser.md
T
2026-09-05 12:46:45 +01:00

1.5 KiB

005 — FilterBar query language (pest grammar)

Summary

Build the syntax-aware search language described in the README's FilterBar section, using pest, supporting regex searches and metric comparisons combined with boolean operators.

Scope

  • Add pest + pest_derive dependencies.
  • Grammar covering:
    • regex("...") — raw-text regex search over log lines.
    • metric_name[param] <op> value comparisons (<, >, <=, >=, ==, !=) — metric_name[param]<5 per the README example.
    • sequence and timestamp as reserved metric names usable the same way (sequence<5, timestamp>12:00).
    • Boolean combinators and / or with standard precedence, e.g. regex("error") and sequence<5 or timestamp>12:00.
  • Parse into an AST (not directly into engine queries — that's 007).
  • Surface parse errors with position info suitable for showing under the FilterBar input.

Acceptance criteria

  • Grammar test cases cover: bare regex, single metric comparison, reserved-metric comparison, and/or combinations with correct precedence, and at least one malformed-input case producing a located error rather than a panic.
  • Parser is a standalone module with no dependency on the engine/index types, so it can be unit tested in isolation.

Depends on

None directly, but the metric-comparison side of the grammar is only meaningful once 002 exists — build/test this ticket against metric names as opaque strings.