tokenizer

package
v0.0.0-...-1751d81 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEqual

func IsEqual(a rune) matchFn

func IsNumeric

func IsNumeric(i rune) bool

func IsOneOf

func IsOneOf(a ...rune) matchFn

Types

type StateFn

type StateFn[Token any] func(t *Tokenizer[Token]) (*Token, StateFn[Token])

type Tokenizer

type Tokenizer[Token any] struct {
	// contains filtered or unexported fields
}

func NewTokenizer

func NewTokenizer[Token any](input io.RuneScanner, initialState StateFn[Token]) *Tokenizer[Token]

func (*Tokenizer[Token]) Done

func (t *Tokenizer[Token]) Done() bool

func (*Tokenizer[Token]) Ignore

func (t *Tokenizer[Token]) Ignore()

func (*Tokenizer[Token]) IgnoreUntil

func (t *Tokenizer[Token]) IgnoreUntil(fn matchFn)

func (*Tokenizer[Token]) IgnoreWhile

func (t *Tokenizer[Token]) IgnoreWhile(fn matchFn)

func (*Tokenizer[Token]) NextRune

func (t *Tokenizer[Token]) NextRune() rune

func (*Tokenizer[Token]) Peek

func (t *Tokenizer[Token]) Peek() rune

func (*Tokenizer[Token]) PeekMatch

func (t *Tokenizer[Token]) PeekMatch(fn matchFn) bool

func (*Tokenizer[Token]) ReadUntil

func (t *Tokenizer[Token]) ReadUntil(fn matchFn) []rune

func (*Tokenizer[Token]) Tokens

func (t *Tokenizer[Token]) Tokens() iter.Seq[Token]

Jump to

Keyboard shortcuts

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