Documentation
¶
Overview ¶
Package filter holds the shared parser for the explicit PRE:/SUF:/REG: filter grammar and the "^" exclusion prefix.
It only parses: it does not decide what is being matched (release tag, asset name, file name or search keyword), does not build matchers and does not take over the glob or substring defaults of its callers. Callers keep their own trimming, error wording and matching semantics — see docs/plans/2026-10-17-rule-consolidation-plan.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPattern ¶
IsPattern reports whether raw uses an explicit PRE:/SUF:/REG: filter. It does not trim and does not treat "^PRE:" as a pattern.
func ParseRegex ¶
ParseRegex compiles a REG: expression and wraps failures in *RegexError.
Types ¶
type RegexError ¶
RegexError reports an invalid REG: expression. Callers take Expr to keep their own error wording (e.g. `invalid tag regex %q`).
func RegexErrorOf ¶
func RegexErrorOf(err error) (*RegexError, bool)
RegexErrorOf extracts the *RegexError from err, if any.
func (*RegexError) Error ¶
func (e *RegexError) Error() string
func (*RegexError) Unwrap ¶
func (e *RegexError) Unwrap() error
type Spec ¶
Spec is the parsed form of a filter expression.
Raw is the input as passed in (not trimmed, "^" not stripped); Expr is the expression without its syntax prefix (for KindPlain it equals Raw); Anti is set by the caller through StripAnti, never by Parse. Regex is filled for KindPrefix/KindSuffix/KindRegex and is nil for KindPlain, whose meaning (substring or anchored prefix) belongs to the caller.
func Parse ¶
Parse parses a PRE:/SUF:/REG: expression (a plain value stays KindPlain).
It deliberately does not TrimSpace and does not strip "^": the tag callers trim before calling and treat "^" as literal content, while the asset/search callers strip "^" through StripAnti first.
func (Spec) PrefixRegex ¶
PrefixRegex returns the case-insensitive, anchored-prefix matcher for the expression — the regex the tag and asset filters built before.
func (Spec) SuffixRegex ¶
SuffixRegex returns the case-insensitive suffix matcher for the expression.