mirror of
https://github.com/golang/go.git
synced 2025-12-07 13:50:04 +00:00
This CL causes the parser to record in a new field, BasicLit.EndPos, the actual end position of each literal token, and to use it in BasicLit.End. Previously, the End was computed heuristically as Pos + len(Value). This heuristic is incorrect for a multiline raw string literal on Windows, since the scanner normalizes \r\n to \n. Unfortunately the actual end position is not returned by the Scanner.Scan method, so the scanner and parser conspire using a global variable in the go/internal/scannerhook package to communicate. + test, api change, relnote Fixes #76031 Change-Id: I57c18a44e85f7403d470ba23d41dcdcc5a9432c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/720060 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 line
60 B
Text
1 line
60 B
Text
pkg go/ast, type BasicLit struct, ValueEnd token.Pos #76031
|