1// Copyright 2013 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package bufio 6 7// Exported for testing only. 8import ( 9 "unicode/utf8" 10) 11 12var IsSpace = isSpace 13 14func (s *Scanner) MaxTokenSize(n int) { 15 if n < utf8.UTFMax || n > 1e9 { 16 panic("bad max token size") 17 } 18 if n < len(s.buf) { 19 s.buf = make([]byte, n) 20 } 21 s.maxTokenSize = n 22} 23 24// ErrOrEOF is like Err, but returns EOF. Used to test a corner case. 25func (s *Scanner) ErrOrEOF() error { 26 return s.err 27} 28