SIGN IN SIGN UP

refactor(core): one value spec per flag instead of three predicates

The tokenizer was asking three questions about the same key, `(TokenKind,
flag name)`, through three predicates: `takes_value`, `takes_separate_value`
and `claims_literal_dash_dash`. `search.rs` passed the same function for two
of them and `git.rs` kept `log_takes_separate_value`/`diff_takes_separate_value`
as second tables beside `log_takes_value` -- the two-lists-drift shape this
branch already fixed for `requests_diff_show_raw_shape` and for golangci's
output-flag list, reintroduced at the API level because a `bool` cannot carry
the answer.

`takes_value` now returns `Option<ValueSpec>`. `Attachment` says how the value
attaches (`AttachedOnly` for git's `-M`/`-U`/`-C`/`-B`, which take an optional
attached number and never the next token; `solo_only` for `-n`, which takes a
separate value only when it is the whole argument) and `claims_dash_dash` says
whether a literal `--` may be the value -- a per-tool split, since grep and rg
swallow it where git and cargo reject it. Each is stated once, per flag, in the
one table that already had to exist.

`AttachedOnly` now also applies to long flags, which the old
`takes_separate_value` could not express -- it was consulted only in the
short-cluster arm. Nothing needs it yet; it is tested rather than left as a
silent gap.

git's log and diff grammars become two predicates instead of one shared list
plus two exception tables, which is what the one-grammar-per-subcommand rule
asks for: they share the long flags all three subcommands parse the same way
and each states its own short grammar, where `-l` is log's solo-only limit and
diff's clustering rename limit.

Two entry points, split by whether the caller has a grammar at all rather than
by dialect: `tokenize(args)` for the callers asking only which arguments are
flags and where `--` is, and `tokenize_grammar(args, takes_value, dialect)` for
the rest. The five structural call sites no longer pass a `|_, _| None` closure
to say they have no flags with values, and `TokenizeOptions` is gone with the
predicates that motivated it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
N
Nicolas Le Cam committed
eec9f3398606676aed2dc005f9919cd724ec2191
Parent: 7931993