func (s *Scanner) Done() bool {
	return s.done
}
Done returns true if the scanner has reached the end of the underlying
stream.
package stack
import (
	"bufio"
	"errors"
	"io"
	"regexp"
	"strconv"
)
var (
	reBlank     = regexp.MustCompile(`^\s*$`)
	reGoroutine = regexp.MustCompile(`^\s*goroutine (\d+) \[([^\]]*)\]:\s*$`)
	reCall      = regexp.MustCompile(`^\s*` +
		`(created by )?` +  
		`(([\w/.]+/)?[\w]+)\.` +  
		`(\(([^:.)]*)\)\.)?` +  
		`([\w\.]+)` +  
		`(\(.*\))?` +  
		`\s*$`)
	rePos = regexp.MustCompile(`^\s*(.*):(\d+)( .*)?$`)
	errBreakParse = errors.New("break parse")
)
type Scanner struct {
	lines *bufio.Scanner
	done  bool
}
func NewScanner(r io.Reader) *Scanner {
	s := &Scanner{
		lines: bufio.NewScanner(r),
	}
	s.Skip()  
	return s
}
func (s *Scanner) Peek() string {
	if s.done {
		return ""
	}
	return s.lines.Text()
}
func (s *Scanner) Skip() {
	if !s.lines.Scan() {
		s.done = true
	}
}
func (s *Scanner) Next() string {
	line := s.Peek()
	s.Skip()
	return line
}