summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2008-10-07 18:30:08 -0700
committerRobert Griesemer <gri@golang.org>2008-10-07 18:30:08 -0700
commita4d7067b3ab0686d787dbfe5199df4c510dd9a85 (patch)
treee1b5b9040ab282a76cf3529fa105635f84806972
parentc637fa75ea9770b841cdd9dc682a4712a507d466 (diff)
downloadgolang-a4d7067b3ab0686d787dbfe5199df4c510dd9a85.tar.gz
- don't allow empty decl lists (e.g. const ())
R=r OCL=16698 CL=16698
-rw-r--r--usr/gri/pretty/parser.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/usr/gri/pretty/parser.go b/usr/gri/pretty/parser.go
index b0ce43c94..fde763595 100644
--- a/usr/gri/pretty/parser.go
+++ b/usr/gri/pretty/parser.go
@@ -373,16 +373,10 @@ func (P *Parser) ParseResult() *AST.List {
func (P *Parser) ParseFunctionType() *AST.FunctionType {
P.Trace("FunctionType");
- P.OpenScope();
- P.level--;
-
typ := new(AST.FunctionType);
typ.pos = P.pos;
typ.params = P.ParseParameters();
typ.result = P.ParseResult();
-
- P.level++;
- P.CloseScope();
P.Ecart();
return typ;
@@ -1341,6 +1335,8 @@ func (P *Parser) ParseDecl(exported bool, keyword int) *AST.Declaration {
P.Expect(keyword);
if P.tok == Scanner.LPAREN {
P.Next();
+ decl.decls.Add(P.ParseSpec(exported, keyword));
+ P.OptSemicolon(Scanner.RPAREN);
for P.tok != Scanner.RPAREN {
decl.decls.Add(P.ParseSpec(exported, keyword));
P.OptSemicolon(Scanner.RPAREN);
@@ -1418,7 +1414,9 @@ func (P *Parser) ParseExportDecl() {
}
for P.tok == Scanner.IDENT {
ident := P.ParseIdent();
- P.Optional(Scanner.COMMA); // TODO this seems wrong
+ if P.tok == Scanner.COMMA {
+ P.Next(); // TODO this seems wrong
+ }
}
if has_paren {
P.Expect(Scanner.RPAREN)