func (p ErrorList) Err() error {
	if len(p) == 0 {
		return nil
	}
	return p
}
Err returns an error equivalent to this error list.
If the list is empty, Err returns nil.
package scanner
import (
	"fmt"
	"io"
	"sort"
)
import (
	"github.com/src-d/gcfg/token"
)
type Error struct {
	Pos token.Position
	Msg string
}
func (e Error) Error() string {
	if e.Pos.Filename != "" || e.Pos.IsValid() {
		return e.Pos.String() + ": " + e.Msg
	}
	return e.Msg
}
type ErrorList []*Error
func (p *ErrorList) Add(pos token.Position, msg string) {
	*p = append(*p, &Error{pos, msg})
}
func (p *ErrorList) Reset() { *p = (*p)[0:0] }
func (p ErrorList) Len() int      { return len(p) }
func (p ErrorList) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p ErrorList) Less(i, j int) bool {
	e := &p[i].Pos
	f := &p[j].Pos
	if e.Filename < f.Filename {
		return true
	}
	if e.Filename == f.Filename {
		return e.Offset < f.Offset
	}
	return false
}
func (p ErrorList) Sort() {
	sort.Sort(p)
}
func (p *ErrorList) RemoveMultiples() {
	sort.Sort(p)
	var last token.Position  
	i := 0
	for _, e := range *p {
		if e.Pos.Filename != last.Filename || e.Pos.Line != last.Line {
			last = e.Pos
			(*p)[i] = e
			i++
		}
	}
	(*p) = (*p)[0:i]
}
func (p ErrorList) Error() string {
	switch len(p) {
	case 0:
		return "no errors"
	case 1:
		return p[0].Error()
	}
	return fmt.Sprintf("%s (and %d more errors)", p[0], len(p)-1)
}