Documentation
¶
Overview ¶
Package pattern executes refinement regular expressions with deterministic work accounting. Native schema regex dialects remain a separate concern.
Index ¶
- Constants
- func Fold[R any](mode Mode, cases ModeCases[R]) R
- func ModeEqual(a, b Mode) bool
- func ModeEqualWith(a, b Mode, ov ModeEqOverrides) bool
- func ModeFold[R any](m Mode, cs ModeCases[R]) R
- func OpcodeEqual(a, b Opcode) bool
- func OpcodeEqualWith(a, b Opcode, ov OpcodeEqOverrides) bool
- func OpcodeFold[R any](o Opcode, cs OpcodeCases[R]) R
- func OpcodeName(op Opcode) string
- type Accept
- type Alt
- type AltMatch
- type Capture
- type EmptyWidth
- type Error
- type Fail
- type Full
- type Instruction
- type Mode
- type ModeCases
- type ModeEqOverrides
- type Nop
- type Opcode
- type OpcodeCases
- type OpcodeEqOverrides
- type Program
- type Regex
- type Rune
- type Rune1
- type RuneAny
- type RuneAnyNotNL
- type Search
Constants ¶
const InstructionProfile = "refine.regex.instructions.v1"
InstructionProfile versions the execution semantics, not the source syntax parser or its optimization choices. This development snapshot is not a native schema format or an unversioned cross-toolchain serialization guarantee.
Variables ¶
This section is empty.
Functions ¶
func Fold ¶
Adding a second enum makes GoPlus qualify its generated fold helpers. Retain the original Mode helper API for existing plain-Go consumers.
func ModeEqualWith ¶
func ModeEqualWith(a, b Mode, ov ModeEqOverrides) bool
ModeEqualWith reports structural equality of a and b under ov.
func OpcodeEqual ¶
OpcodeEqual reports structural equality of a and b.
func OpcodeEqualWith ¶
func OpcodeEqualWith(a, b Opcode, ov OpcodeEqOverrides) bool
OpcodeEqualWith reports structural equality of a and b under ov.
func OpcodeFold ¶
func OpcodeFold[R any](o Opcode, cs OpcodeCases[R]) R
OpcodeFold reduces Opcode by one-level case analysis.
func OpcodeName ¶
Types ¶
type EmptyWidth ¶
type EmptyWidth struct{}
type ModeCases ¶
type ModeCases[R any] struct { Full func() R Search func() R }
ModeCases selects one handler per Mode variant for ModeFold.
type ModeEqOverrides ¶
type ModeEqOverrides struct {
Full func(x, y Full) (eq, handled bool)
Search func(x, y Search) (eq, handled bool)
}
ModeEqOverrides carries optional per-variant hooks for ModeEqualWith. A hook returning handled=false falls through to the derived comparison.
type OpcodeCases ¶
type OpcodeCases[R any] struct { Alt func() R AltMatch func() R Capture func() R EmptyWidth func() R Accept func() R Fail func() R Nop func() R Rune func() R Rune1 func() R RuneAny func() R RuneAnyNotNL func() R }
OpcodeCases selects one handler per Opcode variant for OpcodeFold.
type OpcodeEqOverrides ¶
type OpcodeEqOverrides struct {
Alt func(x, y Alt) (eq, handled bool)
AltMatch func(x, y AltMatch) (eq, handled bool)
Capture func(x, y Capture) (eq, handled bool)
EmptyWidth func(x, y EmptyWidth) (eq, handled bool)
Accept func(x, y Accept) (eq, handled bool)
Fail func(x, y Fail) (eq, handled bool)
Nop func(x, y Nop) (eq, handled bool)
Rune func(x, y Rune) (eq, handled bool)
Rune1 func(x, y Rune1) (eq, handled bool)
RuneAny func(x, y RuneAny) (eq, handled bool)
RuneAnyNotNL func(x, y RuneAnyNotNL) (eq, handled bool)
}
OpcodeEqOverrides carries optional per-variant hooks for OpcodeEqualWith. A hook returning handled=false falls through to the derived comparison.
type Program ¶
type Program struct {
Profile string
UnicodeVersion string
Start int
Instructions []Instruction
}
type Regex ¶
type Regex struct {
// contains filtered or unexported fields
}
func Compile ¶
Compile reuses the Go/RE2 syntax parser and program compiler, not its matcher. Invalid/unsupported dialect constructs fail explicitly. Parser diagnostics are sanitized because the pattern itself can originate in a private payload.
type RuneAnyNotNL ¶
type RuneAnyNotNL struct{}