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
e8278bcb
Commit
e8278bcb
authored
Oct 26, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow len := 0
R=r OCL=17869 CL=17869
parent
c4af3e7c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
14 deletions
+39
-14
go.y
src/cmd/gc/go.y
+39
-14
No files found.
src/cmd/gc/go.y
View file @
e8278bcb
...
...
@@ -42,7 +42,7 @@
* names like Bstmt, Bvardcl, etc. can'
t
.
*/
%
type
<
sym
>
sym
sym1
sym2
keyword
laconst
lname
latype
lpackatype
%
type
<
sym
>
sym
sym1
sym2
sym3
keyword
laconst
lname
latype
lpackatype
%
type
<
node
>
xdcl
xdcl_list_r
oxdcl_list
%
type
<
node
>
common_dcl
Acommon_dcl
Bcommon_dcl
%
type
<
node
>
oarg_type_list
arg_type_list_r
arg_chunk
arg_chunk_list_r
arg_type_list
...
...
@@ -55,6 +55,7 @@
%
type
<
node
>
range_header
range_body
range_stmt
select_stmt
%
type
<
node
>
simple_stmt
osimple_stmt
semi_stmt
%
type
<
node
>
expr
uexpr
pexpr
expr_list
oexpr
oexpr_list
expr_list_r
%
type
<
node
>
exprsym3_list_r
exprsym3
%
type
<
node
>
name
onew_name
new_name
new_name_list_r
%
type
<
node
>
vardcl_list_r
vardcl
Avardcl
Bvardcl
%
type
<
node
>
interfacedcl_list_r
interfacedcl
...
...
@@ -414,13 +415,16 @@ simple_stmt:
$$
=
nod
(
OASOP
,
$
1
,
$
3
);
$$->
etype
=
$
2
;
//
rathole
to
pass
opcode
}
|
expr
_list
'='
expr_list
|
expr
sym3_list_r
'='
expr_list
{
$$
=
nod
(
OAS
,
$
1
,
$
3
);
$$
=
rev
($
1
);
$$
=
nod
(
OAS
,
$$,
$
3
);
}
|
expr
_list
LCOLAS
expr_list
|
expr
sym3_list_r
LCOLAS
expr_list
{
$$
=
nod
(
OAS
,
colas
($
1
,
$
3
),
$
3
);
$$
=
rev
($
1
);
$$
=
colas
($$,
$
3
);
$$
=
nod
(
OAS
,
$$,
$
3
);
addtotop
($$);
}
|
LPRINT
'('
oexpr_list
')'
...
...
@@ -961,15 +965,11 @@ sym2:
sym1
/*
*
keywords
that
we
can
*
use
as
variable
/
type
name
s
*
keywords
that
can
be
variables
*
but
are
not
already
legal
expression
s
*/
keyword
:
LNIL
|
LTRUE
|
LFALSE
|
LIOTA
|
LLEN
sym3
:
LLEN
|
LCAP
|
LPANIC
|
LPANICN
...
...
@@ -980,6 +980,17 @@ keyword:
|
LTYPEOF
|
LCONVERT
/*
*
keywords
that
we
can
*
use
as
variable
/
type
names
*/
keyword
:
sym3
|
LNIL
|
LTRUE
|
LFALSE
|
LIOTA
name
:
lname
{
...
...
@@ -1544,6 +1555,20 @@ new_name_list_r:
$$
=
nod
(
OLIST
,
$
1
,
$
3
);
}
exprsym3
:
expr
|
sym3
{
$$
=
newname
($
1
);
}
exprsym3_list_r
:
exprsym3
|
exprsym3_list_r
','
exprsym3
{
$$
=
nod
(
OLIST
,
$
1
,
$
3
);
}
export_list_r
:
export
|
export_list_r
ocomma
export
...
...
@@ -1924,7 +1949,7 @@ hidden_importsym:
* 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
{
...
...
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