diff

package
v0.0.0-...-a996405 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const FOUR_BYTE_BITS = 21
View Source
const ONE_BYTE_BITS = 7

These constants define the number of bits representable in 1,2,3,4 byte utf8 sequences, respectively.

View Source
const THREE_BYTE_BITS = 16
View Source
const TWO_BYTE_BITS = 11
View Source
const UNICODE_INVALID_RANGE_DELTA = UNICODE_INVALID_RANGE_END - UNICODE_INVALID_RANGE_START + 1
View Source
const UNICODE_INVALID_RANGE_END = 0xDFFF
View Source
const UNICODE_INVALID_RANGE_START = 0xD800
View Source
const UNICODE_RANGE_MAX = 0x10FFFF

Variables

This section is empty.

Functions

func DiffPrettyHtml

func DiffPrettyHtml(diffs []Diff) string

* diff_prettyHtml Convert a diff array into a pretty HTML report.

Types

type Diff

type Diff struct {
	Type Operation
	Text string
}

type DiffMatchPatch

type DiffMatchPatch struct {

	// Number of seconds to map a diff before giving up (0 for infinity).
	Diff_Timeout time.Duration
	// Cost of an empty edit operation in terms of edit characters.
	Diff_EditCost uint16
	// At what point is no match declared (0.0 = perfection, 1.0 = very loose).
	Match_Threshold float32
	// How far to search for a match (0 = exact location, 1000+ = broad match).
	// A match this many characters away from the expected location will add
	// 1.0 to the score (0.0 is a perfect match).
	Match_Distance int32
	// When deleting a large block of text (over ~64 characters), how close does
	// the contents have to match the expected contents. (0.0 = perfection,
	// 1.0 = very loose).  Note that Match_Threshold controls how closely the
	// end points of a delete need to match.
	Patch_DeleteThreshold float32
	// Chunk size for context length.
	Patch_Margin uint16

	// The number of bits in an int.
	Match_MaxBits uint16
}

func New

func New() *DiffMatchPatch

func (*DiffMatchPatch) DiffBisectSplit

func (dmp *DiffMatchPatch) DiffBisectSplit(textA, textB []rune, x, y int, deadline time.Time) []Diff

* diffBisectSplit

func (*DiffMatchPatch) DiffBisect_

func (dmp *DiffMatchPatch) DiffBisect_(textA, textB string, deadline time.Time) []Diff

* diffBisect_

func (*DiffMatchPatch) DiffCharsToLines

func (dmp *DiffMatchPatch) DiffCharsToLines(diffs []Diff, lineArray []string) []Diff

* diffCharsToLines

func (*DiffMatchPatch) DiffCleanupEfficiency

func (dmp *DiffMatchPatch) DiffCleanupEfficiency(diffs []Diff) []Diff

* diffCleanupEfficiency - used by patch, skip

func (*DiffMatchPatch) DiffCleanupMerge

func (dmp *DiffMatchPatch) DiffCleanupMerge(diffs []Diff) (error, []Diff)

* diff_xIndex - used by patch, skip * diffCleanupMerge

func (*DiffMatchPatch) DiffCleanupSemantic

func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff

* diffCleanupSemantic

func (*DiffMatchPatch) DiffCleanupSemanticLossless

func (dmp *DiffMatchPatch) DiffCleanupSemanticLossless(diffs []Diff) []Diff

* diffCleanupSemanticLossless

func (*DiffMatchPatch) DiffCleanupSemanticScore

func (dmp *DiffMatchPatch) DiffCleanupSemanticScore(one, two string) int

* diffCleanupSemanticScore

func (*DiffMatchPatch) DiffCommonOverlap

func (dmp *DiffMatchPatch) DiffCommonOverlap(textA, textB string) int

* diffCommonOverlap

func (*DiffMatchPatch) DiffCommonPrefix

func (dmp *DiffMatchPatch) DiffCommonPrefix(textA, textB []rune) int

* diffCommonPrefix

func (*DiffMatchPatch) DiffCommonSuffix

func (dmp *DiffMatchPatch) DiffCommonSuffix(textA, textB []rune) int

* diffCommonSuffix

func (*DiffMatchPatch) DiffCommonSuffixString

func (dmp *DiffMatchPatch) DiffCommonSuffixString(textA, textB string) int

func (*DiffMatchPatch) DiffCompute

func (dmp *DiffMatchPatch) DiffCompute(textA, textB []rune, checklines bool, deadline time.Time) []Diff

* diffCompute_

func (*DiffMatchPatch) DiffHalfMatch

func (dmp *DiffMatchPatch) DiffHalfMatch(textA, textB []rune) ([]rune, []rune, []rune, []rune, []rune)

* diffHalfMatch

func (*DiffMatchPatch) DiffHalfMatchI

func (dmp *DiffMatchPatch) DiffHalfMatchI(longtext, shorttext []rune, i int) ([]rune, []rune, []rune, []rune, []rune)

* diffHalfMatchI

func (*DiffMatchPatch) DiffLineMode

func (dmp *DiffMatchPatch) DiffLineMode(textA, textB []rune, deadline time.Time) []Diff

* diffLineMode_

func (*DiffMatchPatch) DiffLinesToChars

func (dmp *DiffMatchPatch) DiffLinesToChars(textA, textB string) ([]rune, []rune, []string)

* diffLinesToChars - ********* @todo: fix this!! ********

func (*DiffMatchPatch) DiffLinesToCharsMunge

func (dmp *DiffMatchPatch) DiffLinesToCharsMunge(text string, lineArray []string, lineHash map[string]int) []rune

* diffLinestoCharsMunge

func (*DiffMatchPatch) DiffLinesToRunes

func (dmp *DiffMatchPatch) DiffLinesToRunes(text1, text2 string) ([]rune, []rune, []string)

func (*DiffMatchPatch) DiffLinesToStrings

func (dmp *DiffMatchPatch) DiffLinesToStrings(text1, text2 string) (string, string, []string)

func (*DiffMatchPatch) DiffLinesToStringsMunge

func (dmp *DiffMatchPatch) DiffLinesToStringsMunge(text string, lineArray *[]string, lineHash map[string]int) []uint32

func (*DiffMatchPatch) DiffMain

func (dmp *DiffMatchPatch) DiffMain(inputA, inputB []rune, checklines bool) (error, []Diff)

Recursive diff method setting a deadline

func (*DiffMatchPatch) DiffMainDeadline

func (dmp *DiffMatchPatch) DiffMainDeadline(inputA, inputB []rune, checklines bool, deadline time.Time) (error, []Diff)

Diff method with deadline

func (*DiffMatchPatch) DiffRecurse

func (dmp *DiffMatchPatch) DiffRecurse(inputA, inputB string) (error, []Diff)

The default diff entry method, sets checklines to true and continues

func (*DiffMatchPatch) DiffTextResult

func (dmp *DiffMatchPatch) DiffTextResult(diffs []Diff) string

func (*DiffMatchPatch) DiffTextSource

func (dmp *DiffMatchPatch) DiffTextSource(diffs []Diff) string

type Operation

type Operation int
const (
	DELETE Operation = iota + 1
	INSERT
	EQUAL
)

func (Operation) EnumIndex

func (op Operation) EnumIndex() int

func (Operation) String

func (op Operation) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL