From: Robert Griesemer Date: Wed, 1 Oct 2008 21:31:44 +0000 (-0700) Subject: - fixed Makefile, added more tests X-Git-Tag: weekly.2009-11-06~3062 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4fb6064c1131f71b85a3d2aa1aea4f579884110d;p=gostls13.git - fixed Makefile, added more tests - fixed parsing of parameter lists (sigh) R=r DELTA=48 (22 added, 7 deleted, 19 changed) OCL=16319 CL=16321 --- diff --git a/usr/gri/pretty/Makefile b/usr/gri/pretty/Makefile index 41a3fa0c0d..c739bd6fe4 100644 --- a/usr/gri/pretty/Makefile +++ b/usr/gri/pretty/Makefile @@ -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 diff --git a/usr/gri/pretty/parser.go b/usr/gri/pretty/parser.go index d9a3d31da2..449e63fcfa 100644 --- a/usr/gri/pretty/parser.go +++ b/usr/gri/pretty/parser.go @@ -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");