Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
13f3149a
Commit
13f3149a
authored
Sep 18, 2008
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more helpful messages for name-related syntax errors.
R=ken OCL=15477 CL=15479
parent
9f35e8b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
go.y
src/cmd/gc/go.y
+55
-0
walk.c
src/cmd/gc/walk.c
+1
-1
No files found.
src/cmd/gc/go.y
View file @
13f3149a
...
...
@@ -1644,3 +1644,58 @@ hidden_importfield:
$$
=
$
2
;
$$->
fsym
=
$
1
;
}
/*
*
helpful
error
messages
.
*
THIS
SECTION
MUST
BE
AT
THE
END
OF
THE
FILE
.
*
*
these
rules
trigger
reduce
/
reduce
conflicts
in
the
grammar
.
*
they
are
safe
because
reduce
/
reduce
conflicts
are
resolved
*
in
favor
of
rules
appearing
earlier
in
the
grammar
,
and
these
*
are
at
the
end
of
the
file
.
*
*
to
check
whether
the
rest
of
the
grammar
is
free
of
*
reduce
/
reduce
conflicts
,
comment
this
section
out
by
*
removing
the
slash
on
the
next
line
.
*/
lpack
:
LATYPE
{
yyerror
(
"%s is type, not package"
,
$
1
->
name
);
YYERROR
;
}
laconst
:
LPACK
{
//
for
LALR
(
1
)
reasons
,
using
laconst
works
here
//
but
lname
does
not
.
even
so
,
the
messages
make
//
more
sense
saying
"var"
instead
of
"const"
.
yyerror
(
"%s is package, not var"
,
$
1
->
name
);
YYERROR
;
}
|
LATYPE
{
yyerror
(
"%s is type, not var"
,
$
1
->
name
);
YYERROR
;
}
latype
:
LACONST
{
yyerror
(
"%s is const, not type"
,
$
1
->
name
);
YYERROR
;
}
|
LPACK
{
yyerror
(
"%s is package, not type"
,
$
1
->
name
);
YYERROR
;
}
|
LNAME
{
yyerror
(
"%s is var, not type"
,
$
1
->
name
);
YYERROR
;
}
/**/
src/cmd/gc/walk.c
View file @
13f3149a
...
...
@@ -1420,7 +1420,7 @@ walkdot(Node *n)
f
=
lookdot
(
n
->
right
,
t
->
method
);
if
(
f
==
T
)
{
yyerror
(
"undefined DOT
reference %N"
,
n
->
right
);
yyerror
(
"undefined DOT
%s"
,
n
->
right
->
sym
->
name
);
return
;
}
...
...
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