type Prog … type InstOp … const InstAlt … const InstAltMatch … const InstCapture … const InstEmptyWidth … const InstMatch … const InstFail … const InstNop … const InstRune … const InstRune1 … const InstRuneAny … const InstRuneAnyNotNL … var instOpNames … func (i InstOp) String() string { … } type EmptyOp … const EmptyBeginLine … const EmptyEndLine … const EmptyBeginText … const EmptyEndText … const EmptyWordBoundary … const EmptyNoWordBoundary … // EmptyOpContext returns the zero-width assertions // satisfied at the position between the runes r1 and r2. // Passing r1 == -1 indicates that the position is // at the beginning of the text. // Passing r2 == -1 indicates that the position is // at the end of the text. func EmptyOpContext(r1, r2 rune) EmptyOp { … } // IsWordChar reports whether r is considered a “word character” // during the evaluation of the \b and \B zero-width assertions. // These assertions are ASCII-only: the word characters are [A-Za-z0-9_]. func IsWordChar(r rune) bool { … } type Inst … func (p *Prog) String() string { … } // skipNop follows any no-op or capturing instructions. func (p *Prog) skipNop(pc uint32) *Inst { … } // op returns i.Op but merges all the Rune special cases into InstRune func (i *Inst) op() InstOp { … } // Prefix returns a literal string that all matches for the // regexp must start with. Complete is true if the prefix // is the entire match. func (p *Prog) Prefix() (prefix string, complete bool) { … } // StartCond returns the leading empty-width conditions that must // be true in any match. It returns ^EmptyOp(0) if no matches are possible. func (p *Prog) StartCond() EmptyOp { … } const noMatch … // MatchRune reports whether the instruction matches (and consumes) r. // It should only be called when i.Op == [InstRune]. func (i *Inst) MatchRune(r rune) bool { … } // MatchRunePos checks whether the instruction matches (and consumes) r. // If so, MatchRunePos returns the index of the matching rune pair // (or, when len(i.Rune) == 1, rune singleton). // If not, MatchRunePos returns -1. // MatchRunePos should only be called when i.Op == [InstRune]. func (i *Inst) MatchRunePos(r rune) int { … } // MatchEmptyWidth reports whether the instruction matches // an empty string between the runes before and after. // It should only be called when i.Op == [InstEmptyWidth]. func (i *Inst) MatchEmptyWidth(before rune, after rune) bool { … } func (i *Inst) String() string { … } func bw(b *strings.Builder, args ...string) { … } func dumpProg(b *strings.Builder, p *Prog) { … } func u32(i uint32) string { … } func dumpInst(b *strings.Builder, i *Inst) { … }