The query lexer unconditionally dispatched digit-led tokens to the
number/duration reader, which only accepts digits followed by an optional
single-character duration suffix. Identifier-shaped values like
"1-alpha" or "42d-sla" tripped the reader at the first non-digit /
non-suffix byte:
$ bd query 'assignee=1-alpha'
Error: parsing query: expected digit at position 11
Every caller that wanted to filter on such a value had to quote it or
fall back to a client-side filter, which is silly given that the
character set is already accepted in the identifier reader. The query
DSL otherwise treats identifiers and values uniformly (cf. existing
"identifier with hyphen" / "unquoted identifier with colon" coverage),
so it is the digit-led case that is the outlier.
Two changes in readNumberOrDuration:
- The duration suffix only fires when the suffix character stands
alone (no further identifier-continuation lookahead). "7d" → still
a duration; "7day" → falls through to identifier.
- After reading the digit run, if an unsigned token butts against
more identifier characters, the lex restarts at the start position
and re-reads the token as an identifier. Signed forms ("-3-foo")
still error so arithmetic-shaped input doesn't silently become an
identifier.
Five lexer cases added covering both directions: digit-led identifiers
parse cleanly, durations still survive when the suffix is terminal.
|
||
|---|---|---|
| .. | ||
| evaluator.go | ||
| lexer.go | ||
| parser.go | ||
| query_test.go | ||