diff --git a/src/text/scanner/scanner.go b/src/text/scanner/scanner.go
index 6fb0422fe5..4e76664dc0 100644
--- a/src/text/scanner/scanner.go
+++ b/src/text/scanner/scanner.go
@@ -621,7 +621,7 @@ redo:
case '`':
if s.Mode&ScanRawStrings != 0 {
s.scanRawString()
- tok = String
+ tok = RawString
}
ch = s.next()
default:
diff --git a/src/text/scanner/scanner_test.go b/src/text/scanner/scanner_test.go
index 3e92d659ca..9a6b72ef67 100644
--- a/src/text/scanner/scanner_test.go
+++ b/src/text/scanner/scanner_test.go
@@ -209,10 +209,10 @@ var tokenList = []token{
{String, `"` + f100 + `"`},
{Comment, "// raw strings"},
- {String, "``"},
- {String, "`\\`"},
- {String, "`" + "\n\n/* foobar */\n\n" + "`"},
- {String, "`" + f100 + "`"},
+ {RawString, "``"},
+ {RawString, "`\\`"},
+ {RawString, "`" + "\n\n/* foobar */\n\n" + "`"},
+ {RawString, "`" + f100 + "`"},
{Comment, "// individual characters"},
// NUL character is not allowed
@@ -463,9 +463,9 @@ func TestError(t *testing.T) {
testError(t, `"ab`+"\x80", ":1:4", "illegal UTF-8 encoding", String)
testError(t, `"abc`+"\xff", ":1:5", "illegal UTF-8 encoding", String)
- testError(t, "`a"+"\x00", ":1:3", "illegal character NUL", String)
- testError(t, "`ab"+"\x80", ":1:4", "illegal UTF-8 encoding", String)
- testError(t, "`abc"+"\xff", ":1:5", "illegal UTF-8 encoding", String)
+ testError(t, "`a"+"\x00", ":1:3", "illegal character NUL", RawString)
+ testError(t, "`ab"+"\x80", ":1:4", "illegal UTF-8 encoding", RawString)
+ testError(t, "`abc"+"\xff", ":1:5", "illegal UTF-8 encoding", RawString)
testError(t, `'\"'`, ":1:3", "illegal char escape", Char)
testError(t, `"\'"`, ":1:3", "illegal char escape", String)
@@ -480,7 +480,7 @@ func TestError(t *testing.T) {
testError(t, `'`+"\n", ":1:2", "literal not terminated", Char)
testError(t, `"abc`, ":1:5", "literal not terminated", String)
testError(t, `"abc`+"\n", ":1:5", "literal not terminated", String)
- testError(t, "`abc\n", ":2:1", "literal not terminated", String)
+ testError(t, "`abc\n", ":2:1", "literal not terminated", RawString)
testError(t, `/*/`, ":1:4", "comment not terminated", EOF)
}