rules

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 2 Imported by: 26

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