func Scan(name string, src io.ByteReader, handler func(*Record) bool) (err error) {
	l := newLex(src)

	defer func() {
		if e := recover(); e != nil {
			x, ok := e.(error)
			if !ok || !fileutil.IsEOF(x) {
				err = fmt.Errorf("%s:%d:%d %s", name, l.line, l.column, e)
			}
		}
	}()

	for {
		var r *Record
		switch r, err = l.scan(); {
		case err != nil:
			panic(err)
		case r == nil || !handler(r):
			return
		}
	}
	panic("unreachable")
}
// Scan scans a pcat formatted text file from src, assuming file name is
// 'name'. Handler 'handler' is called for every Record found in src. If
// handler returns false the scanning process is aborted and Scan returns err
// == nil.  If there is any error detected while scanning then the scanning is
// aborted as well and the error is returned.
Scan scans a pcat formatted text file from src, assuming file name is
'name'. Handler 'handler' is called for every Record found in src. If
handler returns false the scanning process is aborted and Scan returns err
== nil.  If there is any error detected while scanning then the scanning is
aborted as well and the error is returned.
// Scan scans a pcat formatted text file from src assuming file name is // ' name ' . Handler ' handler ' is called for every Record found in src . If // handler returns false the scanning process is aborted and Scan returns err // == nil . If there is any error detected while scanning then the scanning is // aborted as well and the error is returned .
func Scan(name string, src io.ByteReader, handler func(*Record) bool) (err error) {
	l := newLex(src)
	defer func() {
		if e := recover(); e != nil {
			x, ok := e.(error)
			if !ok || !fileutil.IsEOF(x) {
				err = fmt.Errorf("%s:%d:%d %s", name, l.line, l.column, e)
			}
		}
	}()
	for {
		var r *Record
		switch r, err = l.scan(); {
		case err != nil:
			panic(err)
		case r == nil || !handler(r):
			return
		}
	}
	panic("unreachable")
}
func Scan ( name string , src io . ByteReader , handler func ( * Record ) bool ) ( err error ) { l := newLex ( src ) defer func ( ) { if e := recover ( ) ; e != nil { x , ok := e . ( error ) if ! ok || ! fileutil . IsEOF ( x ) { err = fmt . Errorf ( " " , name , l . line , l . column , e ) } } } ( ) for { var r * Record switch r , err = l . scan ( ) ; { case err != nil : panic ( err ) case r == nil || ! handler ( r ) : return } } panic ( " " ) }
Scan scans a pcat formatted text file from src, assuming file name is
'name'.
Scan scans a pcat formatted text file from src assuming file name is ' name ' .