]> Cypherpunks repositories - gostls13.git/commitdiff
bufio: make it a little clearer how the default Scanner splits lines.
authorRob Pike <r@golang.org>
Wed, 3 Apr 2013 17:40:04 +0000 (10:40 -0700)
committerRob Pike <r@golang.org>
Wed, 3 Apr 2013 17:40:04 +0000 (10:40 -0700)
Just commentary, no semantic change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8329043

src/pkg/bufio/scan.go

index d94f7f9adc177856f0a88576214cd4ea72d7aea0..486853e6bc06fc3bd25e6f1a1dba50572703ba5b 100644 (file)
@@ -16,7 +16,7 @@ import (
 // the Scan method will step through the 'tokens' of a file, skipping
 // the bytes between the tokens. The specification of a token is
 // defined by a split function of type SplitFunc; the default split
-// function breaks the input into lines with newlines stripped. Split
+// function breaks the input into lines with line termination stripped. Split
 // functions are defined in this package for scanning a file into
 // lines, bytes, UTF-8-encoded runes, and space-delimited words. The
 // client may instead provide a custom split function.
@@ -70,6 +70,7 @@ const (
 )
 
 // NewScanner returns a new Scanner to read from r.
+// The split function defaults to ScanLines.
 func NewScanner(r io.Reader) *Scanner {
        return &Scanner{
                r:            r,
@@ -257,7 +258,7 @@ func dropCR(data []byte) []byte {
 // ScanLines is a split function for a Scanner that returns each line of
 // text, stripped of any trailing end-of-line marker. The returned line may
 // be empty. The end-of-line marker is one optional carriage return followed
-// by one mandatory newline. In regular expression notation, it is `\r?\n'.
+// by one mandatory newline. In regular expression notation, it is `\r?\n`.
 // The last non-empty line of input will be returned even if it has no
 // newline.
 func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {