diff options
author | Robert Griesemer <gri@golang.org> | 2019-08-28 21:56:47 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2019-08-29 23:37:01 +0000 |
commit | 117400ec095335f24e5363f61d60f8baad6be3ce (patch) | |
tree | ffa7bafc79f21110766afc3bb8f96d3dad1974bd /src/cmd/compile/internal/syntax/nodes.go | |
parent | bf36219cdd1d354d58107ed8903679f538948154 (diff) | |
download | go-117400ec095335f24e5363f61d60f8baad6be3ce.tar.gz go-117400ec095335f24e5363f61d60f8baad6be3ce.zip |
cmd/compile/internal/syntax: add BasicLit.Bad field for lexical errors
The new (internal) field scanner.bad indicates whether a syntax error
occurred while scanning a literal; the corresponding scanner.lit
string may be syntactically incorrect in that case. Store the value
of scanner.bad together with the scanner.lit in BasicLit.
Clean up error handling so that all syntactic errors use one of the
scanner's error reporting methods which also set scanner.bad. Make
use of the new field in a few places where we used to track a prior
error separately.
Preliminary step towards fixing #32133 in a comprehensive manner.
Change-Id: I4d79ad6e3b50632dd5fb3fc32ca3df0598ee77b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/192278
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax/nodes.go')
-rw-r--r-- | src/cmd/compile/internal/syntax/nodes.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/nodes.go b/src/cmd/compile/internal/syntax/nodes.go index 6d468ed80e..9a74c0250b 100644 --- a/src/cmd/compile/internal/syntax/nodes.go +++ b/src/cmd/compile/internal/syntax/nodes.go @@ -139,6 +139,7 @@ type ( BasicLit struct { Value string Kind LitKind + Bad bool // true means the literal Value has syntax errors expr } |