matcher

package
v0.0.0-...-4ed146b Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package matcher implements matchers that efficiently let you determine whether a rune is part of a previously defined rune set.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

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

M is the definition of a character class, which can tell whether a rune is part of that character definition or not.

func Diff

func Diff(shouldMatch M, butNot M) M

Diff returns a matcher that matches runes, that are matched by shouldMatch, but are not matched by butNot.

Diff(A, B).Matches(r) => r element (A \ B)

func Merge

func Merge(ms ...M) M

Merge creates a new matcher, that accepts runes that are matched by one or more of the given matchers.

func New

func New(desc string, rt *unicode.RangeTable) M

New creates a new matcher from a given match function.

func RangeTable

func RangeTable(desc string, rt *unicode.RangeTable) M

RangeTable creates a matcher that matches runes that are contained in the given range table.

func RuneWithDesc

func RuneWithDesc(desc string, exp rune) M

RuneWithDesc creates a matcher that matches only the given rune. The description is the string representation of this matcher. This is useful when dealing with whitespace characters.

func String

func String(s string) M

String creates a matcher that checks whether a rune is part of the given string.

func (M) Matches

func (m M) Matches(r rune) bool

Matches describes, whether the given rune is contained in this matcher's range table.

func (M) String

func (m M) String() string

String returns a human readable string description of the runes that this matcher matches.

Jump to

Keyboard shortcuts

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