[dev.inline] cmd/compile/internal/syntax: remove gcCompat uses in scanner

- make the scanner unconditionally gc compatible
- consistently use "invalid" instead "illegal" in errors

Reviewed in and cherry-picked from https://go-review.googlesource.com/#/c/33896/.

Change-Id: I4c4253e7392f3311b0d838bbe503576c9469b203
Reviewed-on: https://go-review.googlesource.com/34237
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2016-12-02 16:22:45 -08:00
parent 3d5df64b3f
commit 4b8895e2dd
4 changed files with 26 additions and 33 deletions

View file

@ -22,7 +22,7 @@ func TestScanner(t *testing.T) {
defer src.Close()
var s scanner
s.init(src, nil, nil, false)
s.init(src, nil, nil)
for {
s.next()
if s.tok == _EOF {
@ -51,7 +51,7 @@ func TestTokens(t *testing.T) {
// scan source
var got scanner
got.init(&bytesReader{buf}, nil, nil, false)
got.init(&bytesReader{buf}, nil, nil)
got.next()
for i, want := range sampleTokens {
nlsemi := false
@ -269,7 +269,7 @@ func TestScanErrors(t *testing.T) {
// token-level errors
{"x + ~y", "bitwise complement operator is ^", 1, 5},
{"foo$bar = 0", "illegal character U+0024 '$'", 1, 4},
{"foo$bar = 0", "invalid character U+0024 '$'", 1, 4},
{"const x = 0xyz", "malformed hex constant", 1, 13},
{"0123456789", "malformed octal constant", 1, 11},
{"0123456789. /* foobar", "comment not terminated", 1, 13}, // valid float constant
@ -348,7 +348,7 @@ func TestScanErrors(t *testing.T) {
// TODO(gri) make this use position info
t.Errorf("%q: got unexpected %q at line = %d", test.src, msg, line)
}
}, nil, true)
}, nil)
for {
s.next()