what about ScanState.GetRune? type ScanState interface { // GetRune reads the next rune (Unicode code ...
14 years, 2 months ago
(2011-03-10 01:19:49 UTC)
#4
what about ScanState.GetRune?
type ScanState interface {
// GetRune reads the next rune (Unicode code point) from the input.
// If invoked during Scanln, Fscanln, or Sscanln, GetRune() will
// return EOF after returning the first '\n'.
GetRune() (rune int, err os.Error)
// UngetRune causes the next call to GetRune to return the same rune.
UngetRune()
// Width returns the value of the width option and whether it has been set.
// The unit is Unicode code points.
Width() (wid int, ok bool)
// Token returns the next space-delimited token from the input. If
// a width has been specified, the returned token will be no longer
// than the width.
Token() (token string, err os.Error)
}
ScanState represents the scanner state passed to custom scanners.
Scanners may do rune-at-a-time scanning or ask the ScanState
to discover the next space-delimited token.
On Mar 9, 2011, at 5:17 PM, Russ Cox wrote: > what about ScanState.GetRune? > ...
14 years, 2 months ago
(2011-03-10 01:21:13 UTC)
#5
On Mar 9, 2011, at 5:17 PM, Russ Cox wrote:
> what about ScanState.GetRune?
>
>
> type ScanState interface {
> // GetRune reads the next rune (Unicode code point) from the input.
> // If invoked during Scanln, Fscanln, or Sscanln, GetRune() will
> // return EOF after returning the first '\n'.
> GetRune() (rune int, err os.Error)
> // UngetRune causes the next call to GetRune to return the same rune.
> UngetRune()
> // Width returns the value of the width option and whether it has been set.
> // The unit is Unicode code points.
> Width() (wid int, ok bool)
> // Token returns the next space-delimited token from the input. If
> // a width has been specified, the returned token will be no longer
> // than the width.
> Token() (token string, err os.Error)
> }
> ScanState represents the scanner state passed to custom scanners.
> Scanners may do rune-at-a-time scanning or ask the ScanState
> to discover the next space-delimited token.
it's been called ReadRune for quite a while, and EOF is an error, not the
returned rune.
-rob
Issue 4248076: code review 4248076: fmt: heaven forfend we export EOF = -1
(Closed)
Created 14 years, 2 months ago by r
Modified 14 years, 2 months ago
Reviewers: rsc1, r2
Base URL:
Comments: 0