]> Cypherpunks repositories - gostls13.git/commitdiff
- fixed Makefile, added more tests
authorRobert Griesemer <gri@golang.org>
Wed, 1 Oct 2008 21:31:44 +0000 (14:31 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 1 Oct 2008 21:31:44 +0000 (14:31 -0700)
- fixed parsing of parameter lists (sigh)

R=r
DELTA=48  (22 added, 7 deleted, 19 changed)
OCL=16319
CL=16321

usr/gri/pretty/Makefile
usr/gri/pretty/parser.go

index 41a3fa0c0dea48ddb7fd36d78901aaaa6bf37ad8..c739bd6fe4f1e531abc9ce018c674b61bfe6f84a 100644 (file)
@@ -11,6 +11,10 @@ pretty: pretty.6
 test: pretty
        pretty -s *.go
        pretty -s ../gosrc/*.go
+       pretty -s $(GOROOT)/test/235.go
+       pretty -s $(GOROOT)/test/args.go
+       pretty -s $(GOROOT)/test/bufiolib.go
+       pretty -s $(GOROOT)/test/char_lit.go
        pretty -s $(GOROOT)/test/sieve.go
        pretty -s $(GOROOT)/src/pkg/*.go
        pretty -s $(GOROOT)/src/lib/flag.go
@@ -18,7 +22,24 @@ test: pretty
        pretty -s $(GOROOT)/src/lib/rand.go
        pretty -s $(GOROOT)/src/lib/math/*.go
        pretty -s $(GOROOT)/src/lib/container/*.go
-       pretty -s $(GOROOT)/src/syscall/*.go
+       pretty -s $(GOROOT)/src/lib/syscall/*.go
+       echo "DONE"
+
+testnoisy: pretty
+       pretty *.go
+       pretty ../gosrc/*.go
+       pretty $(GOROOT)/test/235.go
+       pretty $(GOROOT)/test/args.go
+       pretty $(GOROOT)/test/bufiolib.go
+       pretty $(GOROOT)/test/char_lit.go
+       pretty $(GOROOT)/test/sieve.go
+       pretty $(GOROOT)/src/pkg/*.go
+       pretty $(GOROOT)/src/lib/flag.go
+       pretty $(GOROOT)/src/lib/fmt.go
+       pretty $(GOROOT)/src/lib/rand.go
+       pretty $(GOROOT)/src/lib/math/*.go
+       pretty $(GOROOT)/src/lib/container/*.go
+       pretty $(GOROOT)/src/lib/syscall/*.go
        echo "DONE"
 
 install: pretty
index d9a3d31da2e3585322a0116eb1808384548ae9d0..449e63fcfa62056b22e3f2275dc17ac1b9b1713c 100644 (file)
@@ -152,13 +152,12 @@ func (P *Parser) ParseIdentList() *AST.List {
 }
 
 
-func (P *Parser) ParseQualifiedIdent(ident *AST.Ident) AST.Expr {
+func (P *Parser) ParseQualifiedIdent() AST.Expr {
        P.Trace("QualifiedIdent");
 
-       if ident == nil {
-               ident = P.ParseIdent();
-       }
+       ident := P.ParseIdent();
        var qident AST.Expr = ident;
+
        for P.tok == Scanner.PERIOD {
                pos := P.pos;
                P.Next();
@@ -203,7 +202,7 @@ func (P *Parser) ParseVarType() AST.Type {
 func (P *Parser) ParseTypeName() AST.Type {
        P.Trace("TypeName");
        
-       typ := P.ParseQualifiedIdent(nil);
+       typ := P.ParseQualifiedIdent();
 
        P.Ecart();
        return typ;
@@ -257,27 +256,22 @@ func (P *Parser) ParseChannelType() *AST.ChannelType {
 
 func (P *Parser) ParseVarDeclList() *AST.VarDeclList {
        P.Trace("VarDeclList");
-       
+
        vars := new(AST.VarDeclList);
-       if P.tok == Scanner.IDENT {
-               vars.idents = P.ParseIdentList();
-               typ, ok := P.TryType();
-               if ok {
-                       vars.typ = typ;
-               } else {
-                       // we had an anonymous var, and the ident may be it's typename
-                       // or the package name of a qualified identifier representing
-                       // the typename
-                       if vars.idents.len() == 1 {
-                               vars.typ = P.ParseQualifiedIdent(vars.idents.at(0));
-                               vars.idents = nil;
-                       } else {
-                               P.Error(P.pos, "type expected");
-                               vars.typ = AST.NIL;
-                       }
-               }
-       } else {
-               vars.typ = P.ParseVarType();
+       vars.idents = AST.NewList();
+       vars.typ = AST.NIL;
+       
+       vars.idents.Add(P.ParseType());
+       for P.tok == Scanner.COMMA {
+               P.Next();
+               vars.idents.Add(P.ParseType());
+       }
+       
+       var ok bool;
+       vars.typ, ok = P.TryType();
+
+       if !ok {
+               // we must have a list of types
        }
        
        P.Ecart();
@@ -285,7 +279,7 @@ func (P *Parser) ParseVarDeclList() *AST.VarDeclList {
 }
 
 
-// Returns a list of AST.VarDeclList
+// Returns a list of *AST.VarDeclList or Type
 func (P *Parser) ParseParameterList() *AST.List {
        P.Trace("ParameterList");