go/parser: better error synchronization
gofmt reports now a single, accurate error for
the test case of issue 3106.
Also: Added test harness for general error
checking and two test cases for now.
Fixes issue 3106.
LGTM on tests especially. not very familiar with parser code, but seems sane. http://codereview.appspot.com/5755062/diff/10001/src/pkg/go/parser/error_test.go File ...
13 years, 2 months ago
(2012-03-07 20:04:52 UTC)
#5
PTAL http://codereview.appspot.com/5755062/diff/10001/src/pkg/go/parser/error_test.go File src/pkg/go/parser/error_test.go (right): http://codereview.appspot.com/5755062/diff/10001/src/pkg/go/parser/error_test.go#newcode58 src/pkg/go/parser/error_test.go:58: var errRx = regexp.MustCompile(`^/\* *ERROR *"([^"]*)" *\*/$`) On ...
13 years, 2 months ago
(2012-03-07 20:14:15 UTC)
#7
PTAL
http://codereview.appspot.com/5755062/diff/10001/src/pkg/go/parser/error_test.go
File src/pkg/go/parser/error_test.go (right):
http://codereview.appspot.com/5755062/diff/10001/src/pkg/go/parser/error_test...
src/pkg/go/parser/error_test.go:58: var errRx = regexp.MustCompile(`^/\* *ERROR
*"([^"]*)" *\*/$`)
On 2012/03/07 20:04:52, bradfitz wrote:
> the * in " *" probably isn't necessary. you document the format as a single
> space.
left alone - no harm done
http://codereview.appspot.com/5755062/diff/10001/src/pkg/go/parser/error_test...
src/pkg/go/parser/error_test.go:91: func eliminate(t *testing.T, expected
map[token.Pos]string, found scanner.ErrorList) {
On 2012/03/07 20:06:41, rsc wrote:
> doc comment here would help
> make clear that eliminate edits expected,
> complains about unexpected errors in found,
> but leaves the complaining about missing errors
> to the caller.
Added comment and reorganized so that all complaining happens in this function.
*** Submitted as http://code.google.com/p/go/source/detail?r=097e02a1815a *** go/parser: better error synchronization gofmt reports now a single, accurate ...
13 years, 2 months ago
(2012-03-07 20:24:23 UTC)
#9
Issue 5755062: code review 5755062: go/parser: better error synchronization
(Closed)
Created 13 years, 2 months ago by gri
Modified 13 years, 2 months ago
Reviewers:
Base URL:
Comments: 5