Repository navigation
Fix PromQL quoted and raw string highlighting - #1496
Merged
Merged
Conversation
Added expected output for PromQL string tests to validate lexer behavior.
alecthomas
added a commit
that referenced
this pull request
Nov 21, 2026
GitHub reports a fork PR run held for maintainer approval with status "completed" and conclusion "action_required", but auto-merge matched on status. It never approved a held run, so first-time contributors' PRs (#1496, #1522) sat until CI was approved by hand. Returning contributors were unaffected because their runs are never held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PromQL allows single-quoted, double-quoted, and raw backtick strings. The quoted forms use backslash escapes, while raw strings can contain newlines.
The lexer currently ends a string on either quote type and does not account for escapes. That splits valid strings into incorrect tokens, including Error tokens. Raw backtick strings are not recognized either. In a label value, an escaped quote followed by a brace can also end the label state too early.
Use a shared string state for expressions and label values. Keep the existing Punctuation delimiters and LiteralString contents. Add golden coverage for escaped and opposite quotes, raw and multiline strings, braces inside label values, escaped trailing backslashes, and ordinary strings/selectors.
Validation on base and candidate:
Candidate-only checks:
Full race runs are not uniformly green: TestLongTokensMatch hits its existing regex timeout on both trees under Go 1.26.6, and also on the candidate in one pinned Go run. Bounded runs also hit an existing OpenEdge_ABL test timeout on both trees; default-order runs stalled at TestGet/ViaGoooFilename on both. Plain vet returns identical existing unkeyed Rule warnings on both trees.
This extends the PromQL support in #422 and #474 while retaining the metric-colon behavior from #1495.
The lexer XML has a trailing newline versus the original draft. The complete diff is three files, +166/-8.