Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
e7c4a6df
Commit
e7c4a6df
authored
Apr 08, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: fix weird error message
Fixes #1670. R=ken2 CC=golang-dev
https://golang.org/cl/4386045
parent
8dc0ba7a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
src/cmd/gc/subr.c
src/cmd/gc/subr.c
+11
-0
No files found.
src/cmd/gc/subr.c
View file @
e7c4a6df
...
@@ -135,6 +135,7 @@ yyerror(char *fmt, ...)
...
@@ -135,6 +135,7 @@ yyerror(char *fmt, ...)
int
i
;
int
i
;
static
int
lastsyntax
;
static
int
lastsyntax
;
va_list
arg
;
va_list
arg
;
char
buf
[
512
],
*
p
;
if
(
strncmp
(
fmt
,
"syntax error"
,
12
)
==
0
)
{
if
(
strncmp
(
fmt
,
"syntax error"
,
12
)
==
0
)
{
nsyntaxerrors
++
;
nsyntaxerrors
++
;
...
@@ -147,6 +148,16 @@ yyerror(char *fmt, ...)
...
@@ -147,6 +148,16 @@ yyerror(char *fmt, ...)
return
;
return
;
lastsyntax
=
lexlineno
;
lastsyntax
=
lexlineno
;
if
(
strstr
(
fmt
,
"{ or {"
))
{
// The grammar has { and LBRACE but both show up as {.
// Rewrite syntax error referring to "{ or {" to say just "{".
strecpy
(
buf
,
buf
+
sizeof
buf
,
fmt
);
p
=
strstr
(
buf
,
"{ or {"
);
if
(
p
)
memmove
(
p
+
1
,
p
+
6
,
strlen
(
p
+
6
)
+
1
);
fmt
=
buf
;
}
// look for parse state-specific errors in list (see go.errors).
// look for parse state-specific errors in list (see go.errors).
for
(
i
=
0
;
i
<
nelem
(
yymsg
);
i
++
)
{
for
(
i
=
0
;
i
<
nelem
(
yymsg
);
i
++
)
{
if
(
yymsg
[
i
].
yystate
==
yystate
&&
yymsg
[
i
].
yychar
==
yychar
)
{
if
(
yymsg
[
i
].
yystate
==
yystate
&&
yymsg
[
i
].
yychar
==
yychar
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment