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
63985b48
Commit
63985b48
authored
Mar 05, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug085 bug129
R=ken OCL=25787 CL=25791
parent
bf983477
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
22 deletions
+47
-22
go.y
src/cmd/gc/go.y
+43
-11
lex.c
src/cmd/gc/lex.c
+3
-0
bug085.go
test/fixedbugs/bug085.go
+0
-0
bug129.go
test/fixedbugs/bug129.go
+0
-0
golden.out
test/golden.out
+1
-11
No files found.
src/cmd/gc/go.y
View file @
63985b48
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
%
type
<
node
>
simple_stmt
osimple_stmt
range_stmt
semi_stmt
%
type
<
node
>
simple_stmt
osimple_stmt
range_stmt
semi_stmt
%
type
<
node
>
expr
uexpr
pexpr
expr_list
oexpr
oexpr_list
expr_list_r
%
type
<
node
>
expr
uexpr
pexpr
expr_list
oexpr
oexpr_list
expr_list_r
%
type
<
node
>
exprsym3_list_r
exprsym3
%
type
<
node
>
exprsym3_list_r
exprsym3
%
type
<
node
>
name
onew_name
new_name
new_name_list_r
new_field
%
type
<
node
>
name
labelname
onew_name
new_name
new_name_list_r
new_field
%
type
<
node
>
vardcl_list_r
vardcl
Avardcl
Bvardcl
%
type
<
node
>
vardcl_list_r
vardcl
Avardcl
Bvardcl
%
type
<
node
>
interfacedcl_list_r
interfacedcl
interfacedcl1
%
type
<
node
>
interfacedcl_list_r
interfacedcl
interfacedcl1
%
type
<
node
>
structdcl_list_r
structdcl
embed
%
type
<
node
>
structdcl_list_r
structdcl
embed
...
@@ -95,6 +95,23 @@
...
@@ -95,6 +95,23 @@
%
left
'{'
%
left
'{'
%
left
Condition
%
left
Condition
/*
*
resolve
LPACKAGE
vs
not
in
favor
of
LPACKAGE
*/
%
left
NotPackage
%
left
LPACKAGE
/*
*
resolve
'.'
vs
not
in
favor
of
'.'
*/
%
left
NotDot
%
left
'.'
/*
*
resolve
'('
vs
not
in
favor
of
'('
*/
%
left
NotParen
%
left
'('
%%
%%
file
:
file
:
...
@@ -107,6 +124,7 @@ file:
...
@@ -107,6 +124,7 @@ file:
}
}
package
:
package
:
%
prec
NotPackage
{
{
yyerror
(
"package statement must be first"
);
yyerror
(
"package statement must be first"
);
mkpackage
(
"main"
);
mkpackage
(
"main"
);
...
@@ -776,6 +794,8 @@ pexpr:
...
@@ -776,6 +794,8 @@ pexpr:
{
{
$$
=
nod
(
OLITERAL
,
N
,
N
);
$$
=
nod
(
OLITERAL
,
N
,
N
);
$$->
val
=
$
1
;
$$->
val
=
$
1
;
if
($
1.
ctype
==
CTSTR
)
$$->
type
=
types
[
TSTRING
];
}
}
|
laconst
|
laconst
{
{
...
@@ -999,6 +1019,25 @@ name:
...
@@ -999,6 +1019,25 @@ name:
{
{
$$
=
oldname
($
1
);
$$
=
oldname
($
1
);
}
}
/*
*
this
rule
introduces
1
reduce
/
reduce
conflict
*
with
the
rule
lpack
:
LPACK
above
.
*
the
reduce
/
reduce
conflict
is
only
with
*
lookahead
'.'
,
in
which
case
the
correct
*
resolution
is
the
lpack
rule
.
(
and
it
wins
*
because
it
is
above
.)
*/
|
LPACK
%
prec
NotDot
{
$$
=
oldname
($
1
);
}
labelname
:
name
|
keyword
{
$$
=
oldname
($
1
);
}
convtype
:
convtype
:
latype
latype
...
@@ -1311,6 +1350,7 @@ Afnres:
...
@@ -1311,6 +1350,7 @@ Afnres:
}
}
Bfnres
:
Bfnres
:
%
prec
NotParen
{
{
$$
=
N
;
$$
=
N
;
}
}
...
@@ -1515,7 +1555,7 @@ Astmt:
...
@@ -1515,7 +1555,7 @@ Astmt:
{
{
$$ = N;
$$ = N;
}
}
|
new_
name '
:
'
|
label
name '
:
'
{
{
$$ = nod(OLABEL, $1, N);
$$ = nod(OLABEL, $1, N);
}
}
...
@@ -1961,15 +2001,7 @@ lpack:
...
@@ -1961,15 +2001,7 @@ lpack:
}
}
laconst
:
laconst
:
LPACK
LATYPE
{
//
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
(
"%s is type, not var"
,
$
1
->
name
);
YYERROR
;
YYERROR
;
...
...
src/cmd/gc/lex.c
View file @
63985b48
...
@@ -1341,6 +1341,9 @@ mkpackage(char* pkg)
...
@@ -1341,6 +1341,9 @@ mkpackage(char* pkg)
s
->
opackage
=
package
;
s
->
opackage
=
package
;
}
}
// declare this name as a package
lookup
(
package
)
->
lexical
=
LPACK
;
if
(
outfile
==
nil
)
{
if
(
outfile
==
nil
)
{
// BOTCH need to get .6 from backend
// BOTCH need to get .6 from backend
p
=
strrchr
(
infile
,
'/'
);
p
=
strrchr
(
infile
,
'/'
);
...
...
test/bugs/bug085.go
→
test/
fixed
bugs/bug085.go
View file @
63985b48
File moved
test/bugs/bug129.go
→
test/
fixed
bugs/bug129.go
View file @
63985b48
File moved
test/golden.out
View file @
63985b48
...
@@ -42,9 +42,7 @@ errchk: ./convlit.go: unmatched error messages:
...
@@ -42,9 +42,7 @@ errchk: ./convlit.go: unmatched error messages:
./convlit.go:11: overflow converting constant to int
./convlit.go:11: overflow converting constant to int
./convlit.go:12: overflow converting constant to float
./convlit.go:12: overflow converting constant to float
./convlit.go:8: cannot convert non-integer constant to int
./convlit.go:8: cannot convert non-integer constant to int
./convlit.go:9: cannot convert non-integer constant to int
./convlit.go:8: fatal error: too many errors
./convlit.go:11: overflow converting constant to int
./convlit.go:11: fatal error: too many errors
==================================================
==================================================
=========== ./helloworld.go
=========== ./helloworld.go
...
@@ -117,10 +115,6 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
...
@@ -117,10 +115,6 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
=========== chan/nonblock.go
=========== chan/nonblock.go
PASS
PASS
=========== bugs/bug085.go
bugs/bug085.go:8: P: undefined
BUG: fails incorrectly
=========== bugs/bug087.go
=========== bugs/bug087.go
bugs/bug087.go:8: illegal combination of literals LEN 9
bugs/bug087.go:8: illegal combination of literals LEN 9
bugs/bug087.go:8: illegal combination of literals LEN 9
bugs/bug087.go:8: illegal combination of literals LEN 9
...
@@ -146,10 +140,6 @@ BUG: compilation succeeds incorrectly
...
@@ -146,10 +140,6 @@ BUG: compilation succeeds incorrectly
=========== bugs/bug125.go
=========== bugs/bug125.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug125.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug125.go
=========== bugs/bug129.go
bugs/bug129.go:6: syscall is package, not var
BUG129
=========== bugs/bug131.go
=========== bugs/bug131.go
BUG: should not compile
BUG: should not compile
...
...
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