Documentation ¶
Index ¶
- Constants
- type Scanner
- func (r *Scanner) Current() rune
- func (r *Scanner) Decr() rune
- func (r *Scanner) Empty() bool
- func (r *Scanner) FindFunc(fn func(r rune) bool) (char rune, at int)
- func (r *Scanner) HasLengthRemaining(length int) bool
- func (r *Scanner) Incr() rune
- func (r *Scanner) Peek() rune
- func (r *Scanner) PeekBy(i int) rune
- func (r *Scanner) Pos() int
- func (r *Scanner) Remainder() string
- func (r *Scanner) Remaining() int
- func (r *Scanner) Runes() []rune
- func (r *Scanner) Seek(i int) bool
- func (r *Scanner) SeekBy(i int) bool
- func (r *Scanner) String() string
Constants ¶
const RuneNotFound rune = -1
RuneNotFound is a marker used either by FindFunc to mark it didn't find anything or returned when there is no relevant rune to find
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner reads out a string rune by rune
func (*Scanner) Decr ¶
Decr is the inverse of Incr, decrements the position and returns the current rune it returns RuneNotFound and doesn't decrement if it hits the start
func (*Scanner) FindFunc ¶
FindFunc works like strings.IndexFunc it searches for the next rune that satisfies the condition function and sets the pointer to that point + 1 so the next call returns the next rune returns RuneNotFound and -1 if it doesn't find anything returns the rune and its position of it if it finds one
func (*Scanner) HasLengthRemaining ¶
HasLengthRemaining returns if r has length more runes remaining
func (*Scanner) Incr ¶
Incr increments the position and returns the current rune it returns RuneNotFound and doesn't increment if it hits the end