summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2008-09-18 23:30:32 -0700
committerRobert Griesemer <gri@golang.org>2008-09-18 23:30:32 -0700
commitbb4828b68b8d5230f6ad4b5157923db56669f081 (patch)
tree7821f5252d689dd5f4376ace4b953fd7d33d7784
parentdc9e4d29ecd30e5453ffa1987d7890b47c571a33 (diff)
downloadgolang-bb4828b68b8d5230f6ad4b5157923db56669f081.tar.gz
- fixed another parser bug, now correctly parse more tests
R=r OCL=15518 CL=15518
-rw-r--r--usr/gri/pretty/parser.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr/gri/pretty/parser.go b/usr/gri/pretty/parser.go
index d1a0b6230..01f1609ed 100644
--- a/usr/gri/pretty/parser.go
+++ b/usr/gri/pretty/parser.go
@@ -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 {