v0.3.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 4 Imported by: 0



Package runes helps us work with runes



View Source
const (
	// ReadBufferSize indicates the initial buffer size
	ReadBufferSize = 1 << 7 // 128B

	// DoublingBufferSizeLimit indicates when we stop doubling
	// and just add instead
	DoublingBufferSizeLimit = 1 << 17 // 128KiB


This section is empty.


This section is empty.


type Reader added in v0.3.0

type Reader struct {
	// contains filtered or unexported fields

Reader is a RuneReader aimed at implementing text parsers

func NewReader added in v0.3.0

func NewReader(r io.Reader) *Reader

NewReader creates a new runes Reader using the given io.Reader

func NewReaderBytes added in v0.3.0

func NewReaderBytes(b []byte) *Reader

NewReaderBytes creates a new runes Reader using the given bytes

func NewReaderString added in v0.3.0

func NewReaderString(s string) *Reader

NewReaderString creates a new runes Reader using the given string

func (*Reader) Discard added in v0.3.0

func (b *Reader) Discard()

Discard removes from the buffer everything that has been Read

func (*Reader) Emit added in v0.3.0

func (b *Reader) Emit() string

Emit returns what's already being Read and discards it afterwards

func (*Reader) ReadRune added in v0.3.0

func (b *Reader) ReadRune() (rune, int, error)

ReadRune reads the next rune

func (*Reader) String added in v0.3.0

func (b *Reader) String() string

String returns what's already Read but not yet emitted or discarded

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL