Documentation ¶
Index ¶
- Constants
- func DenseBit(ch rune) uint64
- func EqualRunes(a, b []rune) bool
- func IsHex(ch rune) bool
- func IsOct(ch rune) bool
- func IsPunct(ch rune) bool
- func SafeAppendRune(runes []rune, ch rune) []rune
- type AnyMatch
- type Capture
- type ExceptRangeMatch
- type ExceptSetMatch
- type ExplodedString
- type Glob
- type IndexSet
- type IsMatch
- type IsNotMatch
- type LoHi
- type Matcher
- type MemoKey
- type MemoMap
- type MemoValue
- type NoneMatch
- type ParseState
- type Parser
- func (p *Parser) EmitLiteral(ch rune)
- func (p *Parser) EmitSegment(t SegmentType, PatternP, PatternQ uint)
- func (p *Parser) EmitSetHi(ch rune)
- func (p *Parser) EmitSetLo(ch rune)
- func (p *Parser) Fail(format string, args ...interface{})
- func (p *Parser) FlushLiteral()
- func (p *Parser) FlushSet()
- func (p *Parser) MakeError(format string, args ...interface{}) error
- func (p *Parser) ProcessEscape(ch rune, ifOct, ifHex, ifPunct ParseState, emit func(rune))
- func (p *Parser) ProcessHex(ch rune, ifDone ParseState, emit func(rune))
- func (p *Parser) ProcessOct(ch rune, ifDone ParseState, emit func(rune))
- func (p *Parser) Run()
- type RangeMatch
- type RuneMatcher
- type Segment
- type SegmentType
- type SetMatch
- type SortedLoHi
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func EqualRunes ¶
func SafeAppendRune ¶
Types ¶
type AnyMatch ¶
type AnyMatch struct{}
func (*AnyMatch) ForEachRange ¶
func (*AnyMatch) Not ¶
func (*AnyMatch) Not() RuneMatcher
type ExceptRangeMatch ¶
type ExceptRangeMatch struct{ Lo, Hi rune }
func (*ExceptRangeMatch) ForEachRange ¶
func (m *ExceptRangeMatch) ForEachRange(fn func(lo, hi rune))
func (*ExceptRangeMatch) MatchRune ¶
func (m *ExceptRangeMatch) MatchRune(ch rune) bool
func (*ExceptRangeMatch) Not ¶
func (m *ExceptRangeMatch) Not() RuneMatcher
type ExceptSetMatch ¶
type ExceptSetMatch struct { Dense0 uint64 Dense1 uint64 Ranges SortedLoHi }
func (*ExceptSetMatch) ForEachRange ¶
func (m *ExceptSetMatch) ForEachRange(fn func(lo, hi rune))
func (*ExceptSetMatch) MatchRune ¶
func (m *ExceptSetMatch) MatchRune(ch rune) bool
func (*ExceptSetMatch) Not ¶
func (m *ExceptSetMatch) Not() RuneMatcher
type ExplodedString ¶
func Norm ¶
func Norm(in string) ExplodedString
func (ExplodedString) Substring ¶
func (x ExplodedString) Substring(i, j uint) string
type Glob ¶
type Glob struct { Pattern ExplodedString Segments []Segment MinLength uint MaxLength uint }
type IsMatch ¶
type IsMatch struct{ Rune rune }
func (*IsMatch) ForEachRange ¶
func (*IsMatch) Not ¶
func (m *IsMatch) Not() RuneMatcher
type IsNotMatch ¶
type IsNotMatch struct{ Rune rune }
func (*IsNotMatch) ForEachRange ¶
func (m *IsNotMatch) ForEachRange(fn func(lo, hi rune))
func (*IsNotMatch) MatchRune ¶
func (m *IsNotMatch) MatchRune(ch rune) bool
func (*IsNotMatch) Not ¶
func (m *IsNotMatch) Not() RuneMatcher
type Matcher ¶
type NoneMatch ¶
type NoneMatch struct{}
func (*NoneMatch) ForEachRange ¶
func (*NoneMatch) Not ¶
func (*NoneMatch) Not() RuneMatcher
type ParseState ¶
type ParseState byte
const ( RootState ParseState = iota RootEscState RootOctState RootHexState CharsetInitialState CharsetHeadState CharsetHeadEscState CharsetHeadOctState CharsetHeadHexState CharsetMidState CharsetTailState CharsetTailEscState CharsetTailOctState CharsetTailHexState )
func (ParseState) GoString ¶
func (x ParseState) GoString() string
func (ParseState) String ¶
func (x ParseState) String() string
type Parser ¶
type Parser struct { Input ExplodedString Segments []Segment Ranges []LoHi PartialLiteral []rune PartialEscape []rune LastSegment *Segment Err error InputP uint InputQ uint InputI uint InputJ uint MinLength uint MaxLength uint EscapeIntroducer rune State ParseState EscapeLen byte Negate bool WantSet bool }
func (*Parser) EmitLiteral ¶
func (*Parser) EmitSegment ¶
func (p *Parser) EmitSegment(t SegmentType, PatternP, PatternQ uint)
func (*Parser) FlushLiteral ¶
func (p *Parser) FlushLiteral()
func (*Parser) ProcessEscape ¶
func (p *Parser) ProcessEscape(ch rune, ifOct, ifHex, ifPunct ParseState, emit func(rune))
func (*Parser) ProcessHex ¶
func (p *Parser) ProcessHex(ch rune, ifDone ParseState, emit func(rune))
func (*Parser) ProcessOct ¶
func (p *Parser) ProcessOct(ch rune, ifDone ParseState, emit func(rune))
type RangeMatch ¶
type RangeMatch struct{ Lo, Hi rune }
func (*RangeMatch) ForEachRange ¶
func (m *RangeMatch) ForEachRange(fn func(lo, hi rune))
func (*RangeMatch) MatchRune ¶
func (m *RangeMatch) MatchRune(ch rune) bool
func (*RangeMatch) Not ¶
func (m *RangeMatch) Not() RuneMatcher
type RuneMatcher ¶
type RuneMatcher interface { MatchRune(rune) bool ForEachRange(func(lo, hi rune)) Not() RuneMatcher }
var ( AnyValue RuneMatcher = &AnyMatch{} NoneValue RuneMatcher = &NoneMatch{} )
func Any ¶
func Any() RuneMatcher
func BuildSet ¶
func BuildSet(ranges []LoHi) RuneMatcher
func CompileRuneMatcher ¶
func CompileRuneMatcher(input string) (RuneMatcher, error)
func Is ¶
func Is(ch rune) RuneMatcher
func None ¶
func None() RuneMatcher
func Range ¶
func Range(lo, hi rune) RuneMatcher
func Set ¶
func Set(matchers ...RuneMatcher) RuneMatcher
type Segment ¶
type Segment struct { Type SegmentType Literal ExplodedString Matcher RuneMatcher PatternP uint PatternQ uint MinLength uint MaxLength uint }
type SegmentType ¶
type SegmentType byte
const ( LiteralSegment SegmentType = iota RuneMatchSegment QuestionSegment StarSegment DoubleStarSegment DoubleStarSlashSegment )
func (SegmentType) GoString ¶
func (x SegmentType) GoString() string
func (SegmentType) String ¶
func (x SegmentType) String() string
type SetMatch ¶
type SetMatch struct { Dense0 uint64 Dense1 uint64 Ranges SortedLoHi }
func (*SetMatch) ForEachRange ¶
func (*SetMatch) Not ¶
func (m *SetMatch) Not() RuneMatcher
type SortedLoHi ¶
type SortedLoHi []LoHi
func (SortedLoHi) Len ¶
func (x SortedLoHi) Len() int
func (SortedLoHi) Less ¶
func (x SortedLoHi) Less(i, j int) bool
func (SortedLoHi) Swap ¶
func (x SortedLoHi) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.