rules

package
v2.33.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT, Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Text string

	// accumulator of relative values
	Duration time.Duration

	// Aboslute values
	Year, Month, Weekday, Day, Hour, Minute, Second *int

	Location *time.Location
}

func (*Context) Time

func (c *Context) Time(t time.Time) (time.Time, error)

type F

type F struct {
	RegExp  *regexp.Regexp
	Applier func(*Match, *Context, *Options, time.Time) (bool, error)
}

func (*F) Find

func (f *F) Find(text string) *Match

type Match

type Match struct {
	Left, Right int
	Text        string
	Captures    []string
	Order       float64
	Applier     func(*Match, *Context, *Options, time.Time) (bool, error)
}

func (*Match) Apply

func (m *Match) Apply(c *Context, o *Options, t time.Time) (bool, error)

func (Match) String

func (m Match) String() string

type MatchByIndex

type MatchByIndex []*Match

func (MatchByIndex) Len

func (m MatchByIndex) Len() int

func (MatchByIndex) Less

func (m MatchByIndex) Less(i, j int) bool

func (MatchByIndex) Swap

func (m MatchByIndex) Swap(i, j int)

type MatchByOrder

type MatchByOrder []*Match

func (MatchByOrder) Len

func (m MatchByOrder) Len() int

func (MatchByOrder) Less

func (m MatchByOrder) Less(i, j int) bool

func (MatchByOrder) Swap

func (m MatchByOrder) Swap(i, j int)

type Options

type Options struct {
	Afternoon, Evening, Morning, Noon int

	Distance int

	MatchByOrder bool
}

type Rule

type Rule interface {
	Find(string) *Match
}

type Strategy

type Strategy int
const (
	Skip Strategy = iota
	Merge
	Override
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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