update as requested

This commit is contained in:
Zxilly 2024-02-22 18:15:23 +08:00
parent f7a348e75a
commit 5747309aea
6 changed files with 9 additions and 9 deletions

View File

@ -268,7 +268,7 @@ func (p *parser) syntaxErrorAt(pos Pos, msg string) {
var tok string
switch p.tok {
case _Name:
tok = "\"" + p.lit + "\""
tok = "`" + p.lit + "'"
case _Semi:
tok = p.lit
case _Literal:

View File

@ -6,4 +6,4 @@
// Line 9 must end in EOF for this test (no newline).
package e
func([<-chan<-[func /* ERROR unexpected u */ u){go
func([<-chan<-[func /* ERROR unexpected `u' */ u){go

View File

@ -7,7 +7,7 @@ package p
func _() {
_ = m[] // ERROR expected operand
_ = m[x,]
_ = m[x /* ERROR unexpected a */ a b c d]
_ = m[x /* ERROR unexpected `a' */ a b c d]
}
// test case from the issue

View File

@ -7,7 +7,7 @@ package p
// test case from issue
type _ interface{
m /* ERROR unexpected int in interface type; possibly missing semicolon or newline or } */ int
m /* ERROR unexpected `int' in interface type; possibly missing semicolon or newline or } */ int
}
// other cases where the fix for this issue affects the error message
@ -16,12 +16,12 @@ const (
x int = 10 /* ERROR unexpected literal "foo" in grouped declaration; possibly missing semicolon or newline or \) */ "foo"
)
var _ = []int{1, 2, 3 /* ERROR unexpected int in composite literal; possibly missing comma or } */ int }
var _ = []int{1, 2, 3 /* ERROR unexpected `int' in composite literal; possibly missing comma or } */ int }
type _ struct {
x y /* ERROR syntax error: unexpected comma in struct type; possibly missing semicolon or newline or } */ ,
}
func f(a, b c /* ERROR unexpected d in parameter list; possibly missing comma or \) */ d) {
f(a, b, c /* ERROR unexpected d in argument list; possibly missing comma or \) */ d)
func f(a, b c /* ERROR unexpected `d' in parameter list; possibly missing comma or \) */ d) {
f(a, b, c /* ERROR unexpected `d' in argument list; possibly missing comma or \) */ d)
}

View File

@ -13,5 +13,5 @@ type _ interface {
(int) | (string)
(int) | ~(string)
(/* ERROR unexpected ~ */ ~int)
(int /* ERROR unexpected \| */ | /* ERROR unexpected string */ string /* ERROR unexpected \) */ )
(int /* ERROR unexpected \| */ | /* ERROR unexpected `string' */ string /* ERROR unexpected \) */ )
}

View File

@ -9,6 +9,6 @@ import (
)
func f() {
int status // ERROR syntax error: unexpected "status" at end of statement
int status // ERROR syntax error: unexpected `status' at end of statement
fmt.Println(status)
}