Preserve exact token locations in proto aggregate option values by computing coordinate gaps.
When complex aggregate options e.g. `[(my_opt) = { a: 1 /* comment */ b: 2 }]` are parsed into uninterpreted option blocks, Tokenizer skips whitespace and comments. Simply appending consecutive tokens causes downstream location mapping (TextFormat) to incorrectly shift tokens to the left or upwards when comments or multiline gaps are present.
This CL updates ParseUninterpretedBlock() to compute exact line and column coordinate gaps between consecutive tokens (`cur_token` vs `last_token`) and automatically inserts precisely matching spaces and newlines into `aggregate_value`. This guarantees character-for-character location preservation for every token without requiring any changes to Tokenizer.
PiperOrigin-RevId: 918944204 M
Mikita Belahlazau committed
fc1cf1cda9786c5974af5fb70636c55c6334d58d
Parent: 382f6a7
Committed by Copybara-Service <copybara-worker@google.com>
on 5/21/2026, 10:21:45 AM