splitpattern

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2020 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capture

type Capture struct {
	Offsets strutils.ByteOffsets
	IsMatch bool
}

Capture is a single pattern capture of text within the input string, which provides offset positions and a flag reporting whether this is a match or not.

type FuncSplitPattern

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

func FromFunc

func FromFunc(f func(rune) bool) *FuncSplitPattern

func (*FuncSplitPattern) FindMatches

func (sp *FuncSplitPattern) FindMatches(s string) ([]Capture, error)

type InvertedPattern

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

func Invert

func Invert(sp SplitPattern) *InvertedPattern

func (*InvertedPattern) FindMatches

func (ip *InvertedPattern) FindMatches(s string) ([]Capture, error)

type Regexp2SplitPattern

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

func FromRegexp2

func FromRegexp2(r *regexp2.Regexp) *Regexp2SplitPattern

func (*Regexp2SplitPattern) FindMatches

func (sp *Regexp2SplitPattern) FindMatches(s string) ([]Capture, error)

type RegexpSplitPattern

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

func FromRegexp

func FromRegexp(r *regexp.Regexp) *RegexpSplitPattern

func (*RegexpSplitPattern) FindMatches

func (sp *RegexpSplitPattern) FindMatches(s string) ([]Capture, error)

type RuneSplitPattern

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

func FromRune

func FromRune(r rune) *RuneSplitPattern

func (*RuneSplitPattern) FindMatches

func (sp *RuneSplitPattern) FindMatches(s string) ([]Capture, error)

type SplitPattern

type SplitPattern interface {
	// FindMatches slices the given string in a list of Capture values.
	//
	// This method MUST cover the whole string in its outputs, with
	// contiguous ordered slices.
	FindMatches(string) ([]Capture, error)
}

SplitPattern is implemented by any value which represents a pattern for splitting a string.

type StringSplitPattern

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

func FromString

func FromString(s string) *StringSplitPattern

func (*StringSplitPattern) FindMatches

func (sp *StringSplitPattern) FindMatches(s string) ([]Capture, error)

Jump to

Keyboard shortcuts

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