mirror of https://github.com/golang/go.git
cmd/compile: use quotes to wrap user-supplied token
This commit is contained in:
parent
d4112310a4
commit
f7a348e75a
|
|
@ -267,7 +267,9 @@ func (p *parser) syntaxErrorAt(pos Pos, msg string) {
|
|||
// determine token string
|
||||
var tok string
|
||||
switch p.tok {
|
||||
case _Name, _Semi:
|
||||
case _Name:
|
||||
tok = "\"" + p.lit + "\""
|
||||
case _Semi:
|
||||
tok = p.lit
|
||||
case _Literal:
|
||||
tok = "literal " + p.lit
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2023 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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func f() {
|
||||
int status // ERROR syntax error: unexpected "status" at end of statement
|
||||
fmt.Println(status)
|
||||
}
|
||||
Loading…
Reference in New Issue