matcher

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignOption

func AssignOption(options []Option, assignable interface{}) bool

AssignOption assign option to supplied assignable

func IsDigit added in v0.3.2

func IsDigit(b byte) bool

IsDigit returns true if byte is ASCII digit

func IsLetter

func IsLetter(b byte) bool

IsLetter returns true if byte is ASCII letter

func IsWhiteSpace

func IsWhiteSpace(b byte) bool

IsWhiteSpace returns true if bte is whitespce

func MatchFold

func MatchFold(target, source []byte, targetOffset, sourceOffset int) bool

MatchFold returns true if source is matched with target (case insensitive)

func NewChar

func NewChar(value rune) parsly.Matcher

NewChar creates a rune or a byte matcher

func NewCharset

func NewCharset(set string, options ...Option) parsly.Matcher

NewCharset creates a bytes or runes matcher

func NewFragment

func NewFragment(value string, options ...Option) parsly.Matcher

NewFragments creates FragmentFold matcher

func NewKeyword added in v0.3.1

func NewKeyword(value string, options ...Option) parsly.Matcher

NewKeyword creates Fragment orFragmentFold matcher with non embedded option

func NewNumber

func NewNumber() *number

NewNumber creates a number matcher

func NewQuote

func NewQuote(val, escape rune) parsly.Matcher

NewQuote creates a new RuneQuote matcher

func NewSet

func NewSet(set []string, options ...Option) parsly.Matcher

NewSet creates SetFold matcher

func NewSpacedFragment

func NewSpacedFragment(text string, options ...Option) parsly.Matcher

NewSpaceFragments creates SpaceFragmentFold matcher

func NewSpacedSet

func NewSpacedSet(texts []string, options ...Option) parsly.Matcher

NewSpacedSet create a spaced set

Types

type Block

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

func NewBlock

func NewBlock(begin, end, escape byte) *Block

func (*Block) Match

func (m *Block) Match(cursor *parsly.Cursor) int

TokenMatch matches quoted characters

type Byte

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

func NewByte

func NewByte(value byte) *Byte

NewByte creates a rune matcher

func (*Byte) Match

func (c *Byte) Match(cursor *parsly.Cursor) (matched int)

type ByteQuote

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

func NewByteQuote

func NewByteQuote(value, escape byte) *ByteQuote

NewByteQuote creates a byte quote

func (*ByteQuote) Match

func (m *ByteQuote) Match(cursor *parsly.Cursor) int

TokenMatch matches quoted characters

type Bytes

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

func NewBytes

func NewBytes(values []byte) *Bytes

NewByte creates a rune matcher

func (*Bytes) Match

func (c *Bytes) Match(cursor *parsly.Cursor) (matched int)

type Digit

type Digit struct{}

func NewDigit

func NewDigit() *Digit

NewDigit creates a Digit matcher

func (*Digit) Match

func (d *Digit) Match(cursor *parsly.Cursor) (matched int)

type Digits

type Digits struct{}

func NewDigits

func NewDigits() *Digits

NewDigits creates a Digits matcher

func (*Digits) Match

func (d *Digits) Match(cursor *parsly.Cursor) (matched int)

type Fragment

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

func (*Fragment) Match

func (d *Fragment) Match(cursor *parsly.Cursor) int

type FragmentFold

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

func (*FragmentFold) Match

func (d *FragmentFold) Match(cursor *parsly.Cursor) int

type Fragments

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

func NewFragments

func NewFragments(values ...[]byte) *Fragments

NewFragments returns fragments folds

func (*Fragments) Match

func (d *Fragments) Match(cursor *parsly.Cursor) (matched int)

type FragmentsFold

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

func NewFragmentsFold

func NewFragmentsFold(values ...[]byte) *FragmentsFold

NewFragmentsFold returns fragments folds

func (*FragmentsFold) Match

func (d *FragmentsFold) Match(cursor *parsly.Cursor) (matched int)

type Nop

type Nop struct {
}

func NewNop

func NewNop() *Nop

NewNop never matcher

func (*Nop) Match

func (c *Nop) Match(cursor *parsly.Cursor) (matched int)

type Option

type Option interface{}

Option represents a matcher option

type Rune

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

func NewRune

func NewRune(value rune) *Rune

NewRune creates a rune matcher

func (*Rune) Match

func (c *Rune) Match(cursor *parsly.Cursor) (matched int)

type RuneQuote

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

func NewRuneQuote

func NewRuneQuote(value, escape rune) *RuneQuote

func (*RuneQuote) Match

func (m *RuneQuote) Match(cursor *parsly.Cursor) int

TokenMatch matches quoted characters

type Runes

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

func NewRunes

func NewRunes(values []rune) *Runes

NewRunes creates a runes matcher

func (*Runes) Match

func (c *Runes) Match(cursor *parsly.Cursor) (matched int)

type SeqBlock

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

func NewSeqBlock

func NewSeqBlock(begin, end string) *SeqBlock

func (*SeqBlock) Match

func (m *SeqBlock) Match(cursor *parsly.Cursor) int

TokenMatch matches quoted characters

type Set

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

func (*Set) Match

func (d *Set) Match(cursor *parsly.Cursor) int

type SetFold

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

func (*SetFold) Match

func (d *SetFold) Match(cursor *parsly.Cursor) int

type SpaceFragmentFold

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

func (*SpaceFragmentFold) Match

func (d *SpaceFragmentFold) Match(cursor *parsly.Cursor) int

type SpaceSetFold

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

func (*SpaceSetFold) Match

func (d *SpaceSetFold) Match(cursor *parsly.Cursor) int

type SpacedFragment

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

SpacedFragment represent space fragment

func (*SpacedFragment) Match

func (d *SpacedFragment) Match(cursor *parsly.Cursor) int

type SpacedSet

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

SpacedSet represent space fragment

func (*SpacedSet) Match

func (d *SpacedSet) Match(cursor *parsly.Cursor) int

type Terminator

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

func NewTerminator

func NewTerminator(value byte, inclusive bool) *Terminator

Terminator creates a terminator byte matcher

func (*Terminator) Match

func (t *Terminator) Match(cursor *parsly.Cursor) (matched int)

type Whitespace

type Whitespace struct{}

func NewWhiteSpace

func NewWhiteSpace() *Whitespace

NewWhiteSpace creates a Whitespace matcher

func (*Whitespace) Match

func (w *Whitespace) Match(cursor *parsly.Cursor) (matched int)

TokenMatch matches whitespaces

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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