golang/src/go/token
Robert Griesemer a5fb65601e go/token: correct out-of-bounds token offsets and positions
Per the discussion on the issue, make methods that depend on
incoming offsets or positions tolerant in the presence of
out-of-bounds values by adjusting the values as needed.

Add an internal flag debug that can be set to enable the old
(not fault-tolerant) behavior.

Fixes #57490.

Change-Id: I8a7d422b9fd1d6f0980fd4e64da2f0489056d71e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559436
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-01-31 20:26:14 +00:00
..
example_test.go go/token: use "// Output:" instead of "//Output:" in examples 2023-10-09 22:09:31 +00:00
position.go go/token: correct out-of-bounds token offsets and positions 2024-01-31 20:26:14 +00:00
position_bench_test.go all: faster midpoint computation in binary search 2021-02-23 01:37:31 +00:00
position_test.go go/token: correct out-of-bounds token offsets and positions 2024-01-31 20:26:14 +00:00
serialize.go go/token: use atomics not Mutex for last file cache 2022-06-29 22:19:48 +00:00
serialize_test.go go/token: delete unused File.set field 2022-06-17 15:02:55 +00:00
token.go go: add available godoc link 2023-10-19 12:02:03 +00:00
token_test.go go/token: add IsIdentifier, IsKeyword, and IsExported 2019-04-15 04:12:52 +00:00