Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DiffCrossConfidence = 3 BufferSize = runebuffer.DefaultBufferSize )
DiffCrossConfidence determines how many tokens the cross comparison phase will look ahead before giving up. This can be tuned according to the length of the incoming data set to emit more or less verbose diffs.
var SplitSpaces = SplitterFunc(func(tr *TokenReader) []string { var tokens []string for { token, found := tr.Until(" ") if !found { return tokens } tokens = append(tokens, token) for { space, found := tr.AcceptToken(" ") if !found { break } tokens = append(tokens, space) } } })
Functions ¶
This section is empty.
Types ¶
type DiffSet ¶
type DiffSet struct {
// contains filtered or unexported fields
}
func (*DiffSet) AddAddition ¶
func (*DiffSet) AddRemoval ¶
func (*DiffSet) AddSimilarity ¶
func (*DiffSet) Iterator ¶
func (s *DiffSet) Iterator() *DiffSetIterator
type DiffSetIterator ¶
type DiffSetIterator struct {
// contains filtered or unexported fields
}
type Splitter ¶
type Splitter interface {
Split(tr *TokenReader) []string
}
type SplitterFunc ¶
type SplitterFunc func(tr *TokenReader) []string
func (SplitterFunc) Split ¶
func (f SplitterFunc) Split(tr *TokenReader) []string
type TokenReader ¶
type TokenReader struct {
*runebuffer.RuneBuffer
}
func NewStringTokenReader ¶
func NewStringTokenReader(s string) *TokenReader
func NewStringTokenReaderWithSize ¶
func NewStringTokenReaderWithSize(s string, size int) *TokenReader
func NewTokenReader ¶
func NewTokenReader(r io.Reader) *TokenReader
func NewTokenReaderWithSize ¶
func NewTokenReaderWithSize(r io.Reader, size int) *TokenReader
func (*TokenReader) Accept ¶
func (tr *TokenReader) Accept(list string) (string, bool)
Accept reads runes matching the accept list, returning the read token if any runes were read. The list is split to runes, and all unique runes are included in a match set.
func (*TokenReader) AcceptToken ¶
func (tr *TokenReader) AcceptToken(token string) (string, bool)
AcceptToken returns exactly the token from the input if it exists. Otherwise, "" and false are returned, and all read runes are unread.
func (*TokenReader) Until ¶
func (tr *TokenReader) Until(list string) (string, bool)
Until reads until a rune in the list string matches, returning the read token if any runes were read. The list is split to runes, and all unique runes are included in a match set. This can read the entire input into memory if the runes do not exist past the current read point.
func (*TokenReader) UntilToken ¶
func (tr *TokenReader) UntilToken(token string) (string, bool)
UntilToken returns all from the input runes up to the token if it exists. If the token is not found or the end of the stream is reached, then "" and false are returned, and all read runes are unread. This will return "" and true if the token is the very next set of runes in the stream. This can read the entire input into memory before unreading if the token doesn't exist past the current read point.
