pattern

package
v0.0.0-...-28ad961 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CharGroup

type CharGroup struct {
	CharSet     CharSet
	Count       int
	CountStrict bool
	// contains filtered or unexported fields
}

func (CharGroup) ValidatePartial

func (cg CharGroup) ValidatePartial(input string, currLine int) (string, error)

type CharSet

type CharSet func(r rune) bool

type LinePattern

type LinePattern struct {
	InRange func(line int) bool
	Pattern ValidatesPartially
}

func (LinePattern) ValidatePartial

func (lp LinePattern) ValidatePartial(input string, currLine int) (string, error)

type Literal

type Literal struct {
	Chars string
}

func (Literal) ValidatePartial

func (l Literal) ValidatePartial(input string, currLine int) (string, error)

type Optional

type Optional struct {
	Pattern ValidatesPartially
}

func (Optional) ValidatePartial

func (o Optional) ValidatePartial(input string, currLine int) (string, error)

type OrPattern

type OrPattern struct {
	Left  ValidatesPartially
	Right ValidatesPartially
}

func (OrPattern) ValidatePartial

func (op OrPattern) ValidatePartial(input string, currLine int) (string, error)

type Pattern

type Pattern []ValidatesPartially

func Parse

func Parse(input string) (Pattern, error)

TODO - Support escaping of reserved characters for use as literals

func (Pattern) Validate

func (p Pattern) Validate(input string) error

func (Pattern) ValidatePartial

func (p Pattern) ValidatePartial(input string, currLine int) (string, error)

type ValidatesPartially

type ValidatesPartially interface {
	ValidatePartial(input string, currLine int) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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