]> Cypherpunks repositories - gostls13.git/commit
go/scanner: give specific error for curvy “abc” quotes
authorAlan Donovan <adonovan@google.com>
Tue, 25 Jul 2023 11:47:05 +0000 (12:47 +0100)
committerAlan Donovan <adonovan@google.com>
Mon, 28 Aug 2023 15:38:31 +0000 (15:38 +0000)
commitfaf564644d9948e001db7c4f61a0ac9a61283003
tree7a3e0a7c30b2fc7c4ff9e2231cb8b3b322a574e4
parent7e7dd4dcd9a73ed9e832cd873b8fad7b87ddf029
go/scanner: give specific error for curvy “abc” quotes

Code examples sometimes mistakenly use curvy quotes,
leading to hard-to-spot invalid token errors.
This change makes the error message explicit.

(An alternative change would be to accept them in place
of "abc" and emit an error, but the extra check would
likely add an unacceptable dynamic cost to string scanning.)

Fixes #61450

Change-Id: Ie2b18c958c6f8f71a56ac193a94a8d16eea839db
Reviewed-on: https://go-review.googlesource.com/c/go/+/512855
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/go/scanner/scanner.go
src/go/scanner/scanner_test.go