offset64 const #
const offset64 uint64 = 14695981039346656037
const offset64 uint64 = 14695981039346656037
const prime64 uint64 = 1099511628211
A Matcher is the parsed, compiled form of a PATTERN string. The nil *Matcher is valid: it has all changes enabled but none reported.
type Matcher struct {
verbose bool
enable bool
list []cond
}
A cond is a single condition in the matcher. Given an input id, if id&mask == bits, return the result.
type cond struct {
mask uint64
bits uint64
result bool
}
type parseError struct {
text string
}
AppendMarker is like [Marker] but appends the marker to dst.
func AppendMarker(dst []byte, id uint64) []byte
CutMarker finds the first match marker in line and removes it, returning the shortened line (with the marker removed), the ID from the match marker, and whether a marker was found at all. If there is no marker, CutMarker returns line, 0, false.
func CutMarker(line string) (short string, id uint64, ok bool)
func (e *parseError) Error() string
Hash computes a hash of the data arguments, each of which must be of type string, byte, int, uint, int32, uint32, int64, uint64, uintptr, or a slice of one of those types.
func Hash(data ...any) uint64
Marker returns the match marker text to use on any line reporting details about a match of the given ID. It always returns the hexadecimal format.
func Marker(id uint64) string
New creates and returns a new Matcher implementing the given pattern. The pattern syntax is defined in the package doc comment. In addition to the pattern syntax syntax, New("") returns nil, nil. The nil *Matcher is valid for use: it returns true from ShouldEnable and false from ShouldReport for all changes. Callers can avoid calling [Hash], [Matcher.ShouldEnable], and [Matcher.ShouldPrint] entirely when they recognize the nil Matcher.
func New(pattern string) (*Matcher, error)
ShouldEnable reports whether the change with the given id should be enabled.
func (m *Matcher) ShouldEnable(id uint64) bool
ShouldReport reports whether the change with the given id should be reported.
func (m *Matcher) ShouldReport(id uint64) bool
Verbose reports whether the reports will be shown to users and need to include a human-readable change description. If not, the target can print just the Marker on a line by itself and perhaps save some computation.
func (m *Matcher) Verbose() bool
func fnv(h uint64, x byte) uint64
func fnvString(h uint64, x string) uint64
func fnvUint32(h uint64, x uint32) uint64
func fnvUint64(h uint64, x uint64) uint64
Generated with Arrow