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
5ae4012b
Commit
5ae4012b
authored
Mar 20, 2013
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/parser: use method values
R=golang-dev, r CC=golang-dev
https://golang.org/cl/7858045
parent
db53d97a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/pkg/go/parser/parser.go
src/pkg/go/parser/parser.go
+6
-6
No files found.
src/pkg/go/parser/parser.go
View file @
5ae4012b
...
...
@@ -2118,7 +2118,7 @@ func (p *parser) parseStmt() (s ast.Stmt) {
// ----------------------------------------------------------------------------
// Declarations
type
parseSpecFunction
func
(
p
*
parser
,
doc
*
ast
.
CommentGroup
,
keyword
token
.
Token
,
iota
int
)
ast
.
Spec
type
parseSpecFunction
func
(
doc
*
ast
.
CommentGroup
,
keyword
token
.
Token
,
iota
int
)
ast
.
Spec
func
isValidImport
(
lit
string
)
bool
{
const
illegalChars
=
`!"#$%&'()*,:;<=>?[\]^{|}`
+
"`
\uFFFD
"
...
...
@@ -2237,12 +2237,12 @@ func (p *parser) parseGenDecl(keyword token.Token, f parseSpecFunction) *ast.Gen
lparen
=
p
.
pos
p
.
next
()
for
iota
:=
0
;
p
.
tok
!=
token
.
RPAREN
&&
p
.
tok
!=
token
.
EOF
;
iota
++
{
list
=
append
(
list
,
f
(
p
,
p
.
leadComment
,
keyword
,
iota
))
list
=
append
(
list
,
f
(
p
.
leadComment
,
keyword
,
iota
))
}
rparen
=
p
.
expect
(
token
.
RPAREN
)
p
.
expectSemi
()
}
else
{
list
=
append
(
list
,
f
(
p
,
nil
,
keyword
,
0
))
list
=
append
(
list
,
f
(
nil
,
keyword
,
0
))
}
return
&
ast
.
GenDecl
{
...
...
@@ -2343,10 +2343,10 @@ func (p *parser) parseDecl(sync func(*parser)) ast.Decl {
var
f
parseSpecFunction
switch
p
.
tok
{
case
token
.
CONST
,
token
.
VAR
:
f
=
(
*
parser
)
.
parseValueSpec
f
=
p
.
parseValueSpec
case
token
.
TYPE
:
f
=
(
*
parser
)
.
parseTypeSpec
f
=
p
.
parseTypeSpec
case
token
.
FUNC
:
return
p
.
parseFuncDecl
()
...
...
@@ -2398,7 +2398,7 @@ func (p *parser) parseFile() *ast.File {
if
p
.
mode
&
PackageClauseOnly
==
0
{
// import decls
for
p
.
tok
==
token
.
IMPORT
{
decls
=
append
(
decls
,
p
.
parseGenDecl
(
token
.
IMPORT
,
(
*
parser
)
.
parseImportSpec
))
decls
=
append
(
decls
,
p
.
parseGenDecl
(
token
.
IMPORT
,
p
.
parseImportSpec
))
}
if
p
.
mode
&
ImportsOnly
==
0
{
...
...
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