- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for atEOF (0.04 sec)
-
src/bufio/example_test.go
scanner := bufio.NewScanner(strings.NewReader(input)) // Create a custom split function by wrapping the existing ScanWords function. split := func(data []byte, atEOF bool) (advance int, token []byte, err error) { advance, token, err = bufio.ScanWords(data, atEOF) if err == nil && token != nil { _, err = strconv.ParseInt(string(token), 10, 32) } return } // Set the split function for the scanning operation.
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Nov 01 21:52:12 UTC 2024 - 5.5K bytes - Viewed (0) -
src/bufio/scan.go
// longer slice starting at the same point in the input. // // The function is never called with an empty data slice unless atEOF // is true. If atEOF is true, however, data may be non-empty and, // as always, holds unprocessed text. type SplitFunc func(data []byte, atEOF bool) (advance int, token []byte, err error) // Errors returned by Scanner. var ( ErrTooLong = errors.New("bufio.Scanner: token too long")
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Mon Oct 23 09:06:30 UTC 2023 - 14.2K bytes - Viewed (0) -
src/cmd/asm/internal/asm/expr_test.go
if result != test.output { t.Errorf("%d: %q evaluated to %d; expected %d", i, test.input, result, test.output) } tok := p.next() if test.atEOF && tok.ScanToken != scanner.EOF { t.Errorf("%d: %q: at EOF got %s", i, test.input, tok) } else if !test.atEOF && tok.ScanToken == scanner.EOF { t.Errorf("%d: %q: expected not EOF but at EOF", i, test.input) } } } type badExprTest struct { input string
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Tue Aug 29 07:48:38 UTC 2023 - 3.2K bytes - Viewed (0) -
src/bufio/scan_test.go
func TestSplitError(t *testing.T) { // Create a split function that delivers a little data, then a predictable error. numSplits := 0 const okCount = 7 errorSplit := func(data []byte, atEOF bool) (advance int, token []byte, err error) { if atEOF { panic("didn't get enough data") } if numSplits >= okCount { return 0, nil, testError } numSplits++ return 1, data[0:1], nil } // Read the data.
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Sep 22 16:22:42 UTC 2023 - 14.3K bytes - Viewed (0) -
cmd/metacache-set.go
var current metaCacheEntry var atEOF, fnf, vnf, hasErr, agree int for i := range topEntries { topEntries[i] = metaCacheEntry{} } if contextCanceled(ctx) { return ctx.Err() } for i, r := range readers { if errs[i] != nil { hasErr++ continue } entry, err := r.peek() switch err { case io.EOF: atEOF++ continue case nil:
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Jul 12 16:23:16 UTC 2024 - 30.7K bytes - Viewed (0)