]> Cypherpunks repositories - gostls13.git/commitdiff
- fixed another parser bug, now correctly parse more tests
authorRobert Griesemer <gri@golang.org>
Fri, 19 Sep 2008 06:30:32 +0000 (23:30 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 19 Sep 2008 06:30:32 +0000 (23:30 -0700)
R=r
OCL=15518
CL=15518

usr/gri/pretty/parser.go

index d1a0b6230501696bc23d1e9cfdde8cad74fdf2ba..01f1609ed37fca325fc2000b2272731eac5fcfda 100644 (file)
@@ -680,7 +680,9 @@ func (P *Parser) ParseCall(x AST.Expr) AST.Expr {
        P.Expect(Scanner.LPAREN);
        if P.tok != Scanner.RPAREN {
                // first arguments could be a type if the call is to "new"
-               if P.tok != Scanner.IDENT && P.TryType() {
+               // - exclude type names because they could be expression starts
+               // - exclude "("'s because function types are not allowed and they indicate an expression
+               if P.tok != Scanner.IDENT && P.tok != Scanner.LPAREN && P.TryType() {
                        if P.tok == Scanner.COMMA {
                                 P.Next();
                                 if P.tok != Scanner.RPAREN {