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
3599e3fc
Commit
3599e3fc
authored
May 02, 2011
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/printer: make tests follow syntactic restrictions
R=rsc CC=golang-dev
https://golang.org/cl/4439087
parent
16381b14
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
174 additions
and
117 deletions
+174
-117
src/pkg/go/printer/testdata/expressions.golden
src/pkg/go/printer/testdata/expressions.golden
+58
-39
src/pkg/go/printer/testdata/expressions.input
src/pkg/go/printer/testdata/expressions.input
+58
-39
src/pkg/go/printer/testdata/expressions.raw
src/pkg/go/printer/testdata/expressions.raw
+58
-39
No files found.
src/pkg/go/printer/testdata/expressions.golden
View file @
3599e3fc
...
...
@@ -94,30 +94,49 @@ func _() {
_
=
under_bar
-
1
_
=
Open
(
dpath
+
"/file"
,
O_WRONLY
|
O_CREAT
,
0666
)
_
=
int
(
c0
&
_Mask4
)<<
18
|
int
(
c1
&
_Maskx
)<<
12
|
int
(
c2
&
_Maskx
)<<
6
|
int
(
c3
&
_Maskx
)
}
func
_
()
{
//
the
parser
does
not
restrict
expressions
that
may
appear
as
statements
true
42
"foo"
x
(
x
)
a
+
b
a
+
b
+
c
a
+
b
*
c
a
+
(
b
*
c
)
(
a
+
b
)
*
c
a
+
(
b
*
c
*
d
)
a
+
(
b
*
c
+
d
)
a
+
(
b
/
c
)
1
+
a
a
+
1
s
[
a
]
x
<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a
|^
b
]
x
[
a
/
*
b
]
a
&
^
b
a
+
+
b
a
-
-
b
x
[
a
*-
b
]
x
[
a
+
+
b
]
x
^
y
^
z
b
[
a
>>
24
]
^
b
[(
a
>>
16
)&
0xFF
]
^
b
[(
a
>>
8
)&
0xFF
]
^
b
[
a
&
0xFF
]
len
(
longVariableName
)
*
2
token
(
matchType
+
xlength
<<
lengthShift
+
xoffset
)
_
=
a
*
b
+
c
_
=
a
-
b
-
c
_
=
a
-
(
b
-
c
)
_
=
a
-
b
*
c
_
=
a
-
(
b
*
c
)
_
=
a
*
b
/
c
_
=
a
/
*
b
_
=
x
[
a
|^
b
]
_
=
x
[
a
/
*
b
]
_
=
a
&
^
b
_
=
a
+
+
b
_
=
a
-
-
b
_
=
x
[
a
*-
b
]
_
=
x
[
a
+
+
b
]
_
=
x
^
y
^
z
_
=
b
[
a
>>
24
]
^
b
[(
a
>>
16
)&
0xFF
]
^
b
[(
a
>>
8
)&
0xFF
]
^
b
[
a
&
0xFF
]
_
=
len
(
longVariableName
)
*
2
_
=
token
(
matchType
+
xlength
<<
lengthShift
+
xoffset
)
}
...
...
src/pkg/go/printer/testdata/expressions.input
View file @
3599e3fc
...
...
@@ -94,30 +94,49 @@ func _() {
_
=
under_bar
-
1
_
=
Open
(
dpath
+
"/file"
,
O_WRONLY
|
O_CREAT
,
0666
)
_
=
int
(
c0
&
_Mask4
)<<
18
|
int
(
c1
&
_Maskx
)<<
12
|
int
(
c2
&
_Maskx
)<<
6
|
int
(
c3
&
_Maskx
)
}
func
_
()
{
//
the
parser
does
not
restrict
expressions
that
may
appear
as
statements
true
42
"foo"
x
(
x
)
a
+
b
a
+
b
+
c
a
+
b
*
c
a
+(
b
*
c
)
(
a
+
b
)*
c
a
+(
b
*
c
*
d
)
a
+(
b
*
c
+
d
)
a
+(
b
/
c
)
1
+
a
a
+
1
s
[
a
]
x
<<
1
(
s
[
0
]<<
1
)&
0xf
"foo"
+
s
x
==
y
x
<
y
||
z
>
42
}
1
<<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
x
^
y
^
z
b
[
a
>>
24
]
^
b
[(
a
>>
16
)&
0xFF
]
^
b
[(
a
>>
8
)&
0xFF
]
^
b
[
a
&
0xFF
]
len
(
longVariableName
)*
2
token
(
matchType
+
xlength
<<
lengthShift
+
xoffset
)
_
=
a
*
b
+
c
_
=
a
-
b
-
c
_
=
a
-(
b
-
c
)
_
=
a
-
b
*
c
_
=
a
-(
b
*
c
)
_
=
a
*
b
/
c
_
=
a
/
*
b
_
=
x
[
a
|^
b
]
_
=
x
[
a
/
*
b
]
_
=
a
&
^
b
_
=
a
+
+
b
_
=
a
-
-
b
_
=
x
[
a
*-
b
]
_
=
x
[
a
+
+
b
]
_
=
x
^
y
^
z
_
=
b
[
a
>>
24
]
^
b
[(
a
>>
16
)&
0xFF
]
^
b
[(
a
>>
8
)&
0xFF
]
^
b
[
a
&
0xFF
]
_
=
len
(
longVariableName
)*
2
_
=
token
(
matchType
+
xlength
<<
lengthShift
+
xoffset
)
}
...
...
src/pkg/go/printer/testdata/expressions.raw
View file @
3599e3fc
...
...
@@ -94,30 +94,49 @@ func _() {
_
=
under_bar
-
1
_
=
Open
(
dpath
+
"/file"
,
O_WRONLY
|
O_CREAT
,
0666
)
_
=
int
(
c0
&
_Mask4
)<<
18
|
int
(
c1
&
_Maskx
)<<
12
|
int
(
c2
&
_Maskx
)<<
6
|
int
(
c3
&
_Maskx
)
}
func
_
()
{
//
the
parser
does
not
restrict
expressions
that
may
appear
as
statements
true
42
"foo"
x
(
x
)
a
+
b
a
+
b
+
c
a
+
b
*
c
a
+
(
b
*
c
)
(
a
+
b
)
*
c
a
+
(
b
*
c
*
d
)
a
+
(
b
*
c
+
d
)
a
+
(
b
/
c
)
1
+
a
a
+
1
s
[
a
]
x
<<
1
(
s
[
0
]
<<
1
)
&
0xf
"foo"
+
s
x
==
y
x
<
y
||
z
>
42
}
func
_
()
{
_
=
a
+
b
_
=
a
+
b
+
c
_
=
a
+
b
*
c
_
=
a
+
(
b
*
c
)
_
=
(
a
+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>
8
)&
0xFF
]
^
b
[
a
&
0xFF
]
len
(
longVariableName
)
*
2
token
(
matchType
+
xlength
<<
lengthShift
+
xoffset
)
_
=
a
*
b
+
c
_
=
a
-
b
-
c
_
=
a
-
(
b
-
c
)
_
=
a
-
b
*
c
_
=
a
-
(
b
*
c
)
_
=
a
*
b
/
c
_
=
a
/
*
b
_
=
x
[
a
|^
b
]
_
=
x
[
a
/
*
b
]
_
=
a
&
^
b
_
=
a
+
+
b
_
=
a
-
-
b
_
=
x
[
a
*-
b
]
_
=
x
[
a
+
+
b
]
_
=
x
^
y
^
z
_
=
b
[
a
>>
24
]
^
b
[(
a
>>
16
)&
0xFF
]
^
b
[(
a
>>
8
)&
0xFF
]
^
b
[
a
&
0xFF
]
_
=
len
(
longVariableName
)
*
2
_
=
token
(
matchType
+
xlength
<<
lengthShift
+
xoffset
)
}
...
...
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