func (mset methodSet) add(m *Func) {
	old := mset[m.Name]
	if old == nil || m.Level < old.Level {
		mset[m.Name] = m
		return
	}
	if old != nil && m.Level == old.Level {
		mset[m.Name] = &Func{
			Name:  m.Name,
			Level: m.Level,
		}
	}
}
add adds method m to the method set; m is ignored if the method set
already contains a method with the same name at the same or a higher
level than m.
package doc
import (
	"regexp"
	"sort"
	"strconv"
	"github.com/tcard/sgo/sgo/ast"
	"github.com/tcard/sgo/sgo/token"
)
type methodSet map[string]*Func
func recvString(recv ast.Expr) string {
	switch t := recv.(type) {
	case *ast.Ident:
		return t.Name
	case *ast.StarExpr:
		return "*" + recvString(t.X)
	}
	return "BADRECV"
}
func (mset methodSet) set(f *ast.FuncDecl) {
	name := f.Name.Name
	if g := mset[name]; g != nil && g.Doc != "" {
		return
	}
	recv := ""
	if f.Recv != nil {
		var typ ast.Expr
		if list := f.Recv.List; len(list) == 1 {
			typ = list[0].Type
		}
		recv = recvString(typ)
	}
	mset[name] = &Func{
		Doc:  f.Doc.Text(),
		Name: name,
		Decl: f,
		Recv: recv,
		Orig: recv,
	}
	f.Doc = nil  
}