mirror of
https://github.com/golang/go
synced 2024-11-08 18:16:10 -07:00
bfb903f252
This is one of several changes that were part of a larger rewrite which I made in early 2019 after switching to the new number literal syntax implementation. The purpose of the rewrite was to simplify reading of source code (Unicode character by character) and speed up the scanner but was never submitted for review due to other priorities. Part 2 of 3: This change contains improvements to the scanner error messages: - Use "rune literal" rather than "character literal" to match the spec nomenclature. - Shorter, more to the point error messages. (For instance, "more than one character in rune literal" rather than "invalid character literal (more than one character)", etc.) Change-Id: I1aaf79003374a68dbb05926437ed305cf2a8ec96 Reviewed-on: https://go-review.googlesource.com/c/go/+/221602 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
20 lines
685 B
Go
20 lines
685 B
Go
// errorcheck
|
|
|
|
// Copyright 2017 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package p
|
|
|
|
// These error messages are for the invalid literals on lines 19 and 20:
|
|
|
|
// ERROR "newline in character literal|newline in rune literal"
|
|
// ERROR "invalid character literal \(missing closing '\)|rune literal not terminated"
|
|
|
|
const (
|
|
_ = '' // ERROR "empty character literal or unescaped ' in character literal|empty rune literal"
|
|
_ = 'f'
|
|
_ = 'foo' // ERROR "invalid character literal \(more than one character\)|more than one character in rune literal"
|
|
//line issue15611.go:11
|
|
_ = '
|
|
_ = ' |