Help us shape the future of Go! Take the 2026 Go Developer Survey

input

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const EndOfText rune = -1
View Source
const StartOfText rune = -2

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input interface {
	// Step returns the rune starting at pos and its width. Unless
	// CanCheckPrefix is true, Step should always be called with
	// with the current position in the string, which is the sum
	// of the previous pos Step was called with, and the width
	// returned by that call.
	Step(pos int) (r rune, width int)

	// CanCheckInput reports whether we can look ahead without losing info.
	CanCheckPrefix() bool

	// HasPrefix reports whether the input has the prefix reported
	// by the Prefixer.
	HasPrefix(p Prefixer) bool

	// Index returns the index of the first occurence of the
	// prefix following pos, or -1 if it can't be found.
	Index(p Prefixer, pos int) int

	// Context returns the EmptyOp flags satisfied by the context at pos.
	Context(pos int) syntax.EmptyOp
}

Input abstracts different representations of the input text. It provides one-character lookahead.

type InputBytes

type InputBytes struct {
	// contains filtered or unexported fields
}

InputBytes scans a byte slice.

func (*InputBytes) CanCheckPrefix

func (i *InputBytes) CanCheckPrefix() bool

func (*InputBytes) Context

func (i *InputBytes) Context(pos int) syntax.EmptyOp

func (*InputBytes) HasPrefix

func (i *InputBytes) HasPrefix(p Prefixer) bool

func (*InputBytes) Index

func (i *InputBytes) Index(p Prefixer, pos int) int

func (*InputBytes) Reset

func (i *InputBytes) Reset(str []byte)

Reset resets the InputBytes with the given byte slice.

func (*InputBytes) Rstep

func (i *InputBytes) Rstep(pos int) (rune, int)

func (*InputBytes) Step

func (i *InputBytes) Step(pos int) (rune, int)

type InputReader

type InputReader struct {
	// contains filtered or unexported fields
}

InputReader scans a RuneReader.

func (*InputReader) CanCheckPrefix

func (i *InputReader) CanCheckPrefix() bool

func (*InputReader) Context

func (i *InputReader) Context(pos int) syntax.EmptyOp

func (*InputReader) HasPrefix

func (i *InputReader) HasPrefix(p Prefixer) bool

func (*InputReader) Index

func (i *InputReader) Index(p Prefixer, pos int) int

func (*InputReader) Reset

func (i *InputReader) Reset(r io.RuneReader)

Reset resets the InputReader with the given RuneReader.

func (*InputReader) Step

func (i *InputReader) Step(pos int) (rune, int)

type InputString

type InputString struct {
	// contains filtered or unexported fields
}

InputString scans a string.

func (*InputString) CanCheckPrefix

func (i *InputString) CanCheckPrefix() bool

func (*InputString) Context

func (i *InputString) Context(pos int) syntax.EmptyOp

func (*InputString) HasPrefix

func (i *InputString) HasPrefix(p Prefixer) bool

func (*InputString) Index

func (i *InputString) Index(p Prefixer, pos int) int

func (*InputString) Reset

func (i *InputString) Reset(str string)

Reset resets the InputString with the given string.

func (*InputString) Rstep

func (i *InputString) Rstep(pos int) (rune, int)

func (*InputString) Step

func (i *InputString) Step(pos int) (rune, int)

type Prefixer

type Prefixer interface {
	Prefix() string
	PrefixBytes() []byte
}

type Rinput

type Rinput interface {
	Input

	Rstep(pos int) (r rune, width int)
}

Jump to

Keyboard shortcuts

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