Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLineTooLong = errors.New("line too long")
ErrLineTooLong means there was a line encountered that exceeded max_line_size for the space.
Functions ¶
This section is empty.
Types ¶
type Scanner ¶
type Scanner struct { Stats // contains filtered or unexported fields }
Scanner is like bufio.Scanner but it it understands how to skip over and report lines that are too long.
func (*Scanner) Scan ¶
Scan returns the next line of input as a byte slice or nil and an error indicating the state of things. A terminal "\r\n" sequence is first replaced with a newline, and then the terminal newline is returned in the slice, except in the case of a final line without a newline. When a line is encountered that is larger than the max line size, then the partial line is returned along with ErrLineTooLong. In this case, Scan can be subsequently called for the rest of the line, possibly with another line too long error, and so on. Skip can also be called to easily skip over the rest of the line. At EOF, nil is returned. XXX If Scan is called directly instead of ScanLine, then Stats are not properly tracked. for the slice and io.EOF for the error.
func (*Scanner) ScanLine ¶
Scan returns the next line skipping blank lines and too-long lines and accumulating statistics.