mirror of
https://github.com/golang/go
synced 2024-11-02 08:01:26 +00:00
- 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
This commit is contained in:
parent
970d6a14c4
commit
4fb6064c11
2 changed files with 42 additions and 27 deletions
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue