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
3ec46752
Commit
3ec46752
authored
Jan 28, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up range grammar
R=ken OCL=23712 CL=23714
parent
9f726c2c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
17 deletions
+10
-17
go.y
src/cmd/gc/go.y
+10
-17
No files found.
src/cmd/gc/go.y
View file @
3ec46752
...
...
@@ -52,7 +52,7 @@
%
type
<
node
>
Astmt
Bstmt
%
type
<
node
>
for_stmt
for_body
for_header
%
type
<
node
>
if_stmt
if_body
if_header
select_stmt
%
type
<
node
>
simple_stmt
osimple_stmt
o
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
>
exprsym3_list_r
exprsym3
%
type
<
node
>
name
onew_name
new_name
new_name_list_r
new_field
...
...
@@ -536,9 +536,8 @@ compound_stmt:
popdcl
();
}
orange_stmt
:
osimple_stmt
|
exprsym3_list_r
'='
LRANGE
expr
range_stmt
:
exprsym3_list_r
'='
LRANGE
expr
{
$$
=
nod
(
ORANGE
,
$
1
,
$
4
);
$$->
etype
=
0
;
//
:=
flag
...
...
@@ -550,14 +549,8 @@ orange_stmt:
}
for_header
:
osimple_stmt
';'
o
rang
e_stmt
';'
osimple_stmt
osimple_stmt
';'
o
simpl
e_stmt
';'
osimple_stmt
{
if
($
3
!= N && $3->op == ORANGE) {
$$
=
dorange
($
3
);
$$->
ninit
=
list
($$->
ninit
,
$
1
);
$$->
nincr
=
list
($$->
nincr
,
$
5
);
break
;
}
//
init
;
test
;
incr
if
($
5
!= N && $5->colas != 0)
yyerror
(
"cannot declare in the for-increment"
);
...
...
@@ -566,19 +559,19 @@ for_header:
$$->
ntest
=
$
3
;
$$->
nincr
=
$
5
;
}
|
o
rang
e_stmt
|
o
simpl
e_stmt
{
//
range
if
($
1
!= N && $1->op == ORANGE) {
$$
=
dorange
($
1
);
break
;
}
//
normal
test
$$
=
nod
(
OFOR
,
N
,
N
);
$$->
ninit
=
N
;
$$->
ntest
=
$
1
;
$$->
nincr
=
N
;
}
|
range_stmt
{
$$
=
dorange
($
1
);
addtotop
($$);
}
for_body
:
for_header
compound_stmt
...
...
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