Clive, 2nd ed. User's manual. Section 2

import "clive/cmd/look"

var Debug bool ...
func ParseRules(txt string) (Rules, error)
type Rule struct { ... }
type Rules []*Rule
    func ParseRules(txt string) (Rules, error)


Return commands to run when the user looks for strings.

Programs rely on this package to "plumb" user looks. By convention, $look,
or $home/lib/look, or $home/.look are used to keep the rules. A rule is a
pair of lines, the first line is a regular expression as provided by sre(2)
and the second is the command to execute for the rule. The special command
"not" can be used to prevent further rules to match. Back-references may be
used to build a command from parts of the matching text.



type Rule struct {
	Rexp string
	Cmd  string

	// contains filtered or unexported fields
    If the user looks for something matching Rexp, then Cmd leads to a result
    string. Backquoting to refer to \0...\9 is ok in Cmd.

func (r *Rule) CmdFor(s string) (string, error)
    Return the command to run if s matches the rule. ErrNoMatch is returned if
    there's no match.

type Rules []*Rule

func ParseRules(txt string) (Rules, error)

func (rs Rules) CmdFor(s string) (string, error)
    Return the command for a user look, if any. ErrNoMatch is returned if no
    rule matches. If there's an error in any of the rules, no further rules are

func (rs Rules) String() string
    Return a string that can be parsed later on by ParseRules to make a set of



var (
	Debug bool

	ErrNoMatch = errors.New("no match")

User's manual, 2nd ed. Section 2