MCPcopy Create free account

hub / github.com/sergi/go-diff / functions

Functions144 in github.com/sergi/go-diff

↓ 59 callersFunctionNew
New creates a new DiffMatchPatch object with default parameters.
diffmatchpatch/diffmatchpatch.go:36
↓ 17 callersMethodDiffMain
DiffMain finds the differences between two texts. The checklines flag is a speedup: if false, don't run a line-level diff first to identify the change
diffmatchpatch/diff.go:85
↓ 15 callersMethodPatchMake
PatchMake computes a list of patches.
diffmatchpatch/patch.go:158
↓ 11 callersMethodString
String emulates GNU diff's format. Header: @@ -382,8 +481,9 @@ Indices are printed as 1-based, not 0-based.
diffmatchpatch/patch.go:68
↓ 9 callersMethodPatchApply
PatchApply merges a set of patches onto the text. Returns a patched text, as well as an array of true/false values indicating which patches were appl
diffmatchpatch/patch.go:285
↓ 8 callersFunctionspeedtestTexts
()
diffmatchpatch/benchutil_test.go:17
↓ 7 callersMethodDiffCharsToLines
DiffCharsToLines rehydrates the text in a diff from a string of line hashes to real lines of text.
diffmatchpatch/diff.go:408
↓ 7 callersMethodDiffText1
DiffText1 computes and returns the source text (all equalities and deletions).
diffmatchpatch/diff.go:1197
↓ 6 callersMethodPatchFromText
PatchFromText parses a textual representation of patches and returns a List of Patch objects.
diffmatchpatch/patch.go:592
↓ 6 callersMethodPatchToText
PatchToText takes a list of patches and returns a textual representation.
diffmatchpatch/patch.go:581
↓ 6 callersFunctioncommonPrefixLength
commonPrefixLength returns the length of the common prefix of two rune slices.
diffmatchpatch/diff.go:437
↓ 6 callersFunctioncommonSuffixLength
commonSuffixLength returns the length of the common suffix of two rune slices.
diffmatchpatch/diff.go:449
↓ 5 callersMethodDiffCleanupSemantic
DiffCleanupSemantic reduces the number of edits by eliminating semantically trivial equalities.
diffmatchpatch/diff.go:623
↓ 5 callersMethodDiffText2
DiffText2 computes and returns the destination text (all equalities and insertions).
diffmatchpatch/diff.go:1210
↓ 5 callersFunctionalignRuneStart
alignRuneStart backs up byte index idx to the nearest UTF-8 rune start byte. idx <= 0 or idx >= len(s) is returned unchanged. Motivation: Google's re
diffmatchpatch/patch.go:37
↓ 5 callersFunctionsplice
splice removes amount elements from slice at index index, replacing them with elements.
diffmatchpatch/diff.go:46
↓ 4 callersMethodDiffCleanupMerge
DiffCleanupMerge reorders and merges like edit sections. Merge equalities. Any edit section can move as long as it doesn't cross an equality.
diffmatchpatch/diff.go:975
↓ 4 callersMethodDiffLinesToChars
DiffLinesToChars splits two texts into a list of strings, and educes the texts to a string of hashes where each Unicode character represents one line.
diffmatchpatch/diff.go:395
↓ 4 callersMethodPatchSplitMax
PatchSplitMax looks through the patches and breaks up any which are longer than the maximum limit of the match algorithm. Intended to be called only f
diffmatchpatch/patch.go:452
↓ 4 callersMethoddiffMainRunes
(text1, text2 []rune, checklines bool, deadline time.Time)
diffmatchpatch/diff.go:100
↓ 4 callersFunctionmax
(x, y int)
diffmatchpatch/mathutil.go:18
↓ 4 callersFunctionmin
(x, y int)
diffmatchpatch/mathutil.go:11
↓ 3 callersMethodDiffCleanupSemanticLossless
DiffCleanupSemanticLossless looks for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word bo
diffmatchpatch/diff.go:791
↓ 3 callersMethodDiffLinesToRunes
DiffLinesToRunes splits two texts into a list of runes. At most 1,112,060 unique lines can be encoded across both texts; if the texts contain more uni
diffmatchpatch/diff.go:402
↓ 3 callersMethodDiffMainRunes
DiffMainRunes finds the differences between two rune sequences. The checklines flag is a speedup: if false, don't run a line-level diff first to ident
diffmatchpatch/diff.go:92
↓ 3 callersMethodMatchBitap
MatchBitap locates the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm. Returns -1 if no match was found.
diffmatchpatch/match.go:37
↓ 3 callersMethodMatchMain
MatchMain locates the best instance of 'pattern' in 'text' near 'loc'. Returns -1 if no match found.
diffmatchpatch/match.go:17
↓ 3 callersFunctionalignRuneEnd
alignRuneEnd moves byte index idx forward to the next UTF-8 rune start. idx <= 0 or idx >= len(s) is returned unchanged.
diffmatchpatch/patch.go:49
↓ 3 callersFunctionindexOf
indexOf returns the first index of pattern in str, starting at str[i].
diffmatchpatch/stringutil.go:32
↓ 3 callersFunctionindexesToString
(indexes []index)
diffmatchpatch/index.go:22
↓ 3 callersFunctionintToRune
Converts an integer in the range 0~1112060 into a rune. Based on the ranges table in https://en.wikipedia.org/wiki/UTF-8
diffmatchpatch/stringutil.go:122
↓ 2 callersMethodDiffCleanupEfficiency
DiffCleanupEfficiency reduces the number of edits by eliminating operationally trivial equalities.
diffmatchpatch/diff.go:864
↓ 2 callersMethodDiffCommonOverlap
DiffCommonOverlap determines if the suffix of one string is the prefix of another.
diffmatchpatch/diff.go:477
↓ 2 callersMethodDiffCommonPrefix
DiffCommonPrefix determines the common prefix length of two strings.
diffmatchpatch/diff.go:425
↓ 2 callersMethodDiffCommonSuffix
DiffCommonSuffix determines the common suffix length of two strings.
diffmatchpatch/diff.go:431
↓ 2 callersMethodDiffHalfMatch
DiffHalfMatch checks whether the two texts share a substring which is at least half the length of the longer text. This speedup can produce non-minima
diffmatchpatch/diff.go:517
↓ 2 callersMethodDiffLevenshtein
DiffLevenshtein computes the Levenshtein distance that is the number of inserted, deleted or substituted characters.
diffmatchpatch/diff.go:1222
↓ 2 callersMethodDiffXIndex
DiffXIndex returns the equivalent location in s2.
diffmatchpatch/diff.go:1102
↓ 2 callersMethodPatchAddContext
PatchAddContext increases the context until it is unique, but doesn't let the pattern expand beyond MatchMaxBits.
diffmatchpatch/patch.go:109
↓ 2 callersMethodPatchAddPadding
PatchAddPadding adds some padding on text start and end so that edges can match something. Intended to be called only from within patchApply.
diffmatchpatch/patch.go:400
↓ 2 callersMethodPatchDeepCopy
PatchDeepCopy returns an array that is identical to a given an array of patches.
diffmatchpatch/patch.go:265
↓ 2 callersMethoddiffBisect
diffBisect finds the 'middle snake' of a diff, splits the problem in two and returns the recursively constructed diff. See Myers's 1986 paper: An O(ND
diffmatchpatch/diff.go:263
↓ 2 callersMethoddiffBisectSplit
(runes1, runes2 []rune, x, y int, deadline time.Time)
diffmatchpatch/diff.go:378
↓ 2 callersFunctiondiffCleanupSemanticScore
diffCleanupSemanticScore computes a score representing whether the internal boundary falls on logical boundaries. Scores range from 6 (best) to 0 (wor
diffmatchpatch/diff.go:749
↓ 2 callersMethoddiffHalfMatch
(text1, text2 []rune)
diffmatchpatch/diff.go:531
↓ 2 callersMethoddiffLinesToStrings
diffLinesToStrings splits two texts into a list of strings. Each string represents one line.
diffmatchpatch/diff.go:1339
↓ 2 callersFunctiondiffText1Prefix
diffText1Prefix returns the first n bytes of DiffText1(diffs) without building the whole text. If byte n falls inside a multi-byte rune, the prefix st
diffmatchpatch/patch.go:557
↓ 2 callersFunctionlastIndexOf
lastIndexOf returns the last index of pattern in str, starting at str[i].
diffmatchpatch/stringutil.go:47
↓ 2 callersFunctionruneToInt
Converts a rune generated by intToRune back to an integer
diffmatchpatch/stringutil.go:161
↓ 2 callersFunctionrunesEqual
(r1, r2 []rune)
diffmatchpatch/stringutil.go:73
↓ 2 callersFunctionrunesIndex
runesIndex is the equivalent of strings.Index for rune slices.
diffmatchpatch/stringutil.go:86
↓ 2 callersFunctionrunesIndexOf
runesIndexOf returns the index of pattern in target, starting at target[i].
diffmatchpatch/stringutil.go:59
↓ 1 callersMethodDiffBisect
DiffBisect finds the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. If an invalid UTF-8 sequence is e
diffmatchpatch/diff.go:256
↓ 1 callersMethodDiffFromDelta
DiffFromDelta given the original text1, and an encoded string which describes the operations required to transform text1 into text2, comAdde the full
diffmatchpatch/diff.go:1278
↓ 1 callersMethodDiffPrettyHtml
DiffPrettyHtml converts a []Diff into a pretty HTML report. It is intended as an example from which to write one's own display functions.
diffmatchpatch/diff.go:1136
↓ 1 callersMethodDiffPrettyText
DiffPrettyText converts a []Diff into a colored text report.
diffmatchpatch/diff.go:1159
↓ 1 callersMethodDiffToDelta
DiffToDelta crushes the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3\t-2\t+ing -> Keep
diffmatchpatch/diff.go:1247
↓ 1 callersMethodMatchAlphabet
MatchAlphabet initialises the alphabet for the Bitap algorithm.
diffmatchpatch/match.go:143
↓ 1 callersFunctioncommonSuffixBytes
commonSuffixBytes returns the length in bytes of the common suffix of two strings, never splitting a rune.
diffmatchpatch/diff.go:464
↓ 1 callersMethoddiffCompute
diffCompute finds the differences between two rune slices. Assumes that the texts do not have any common prefix or suffix.
diffmatchpatch/diff.go:135
↓ 1 callersMethoddiffHalfMatchI
diffHalfMatchI checks if a substring of shorttext exist within longtext such that the substring is at least half the length of longtext? Returns a sli
diffmatchpatch/diff.go:582
↓ 1 callersMethoddiffLineMode
diffLineMode does a quick line-level diff on both []runes, then rediff the parts for greater accuracy. This speedup can produce non-minimal diffs.
diffmatchpatch/diff.go:196
↓ 1 callersMethoddiffLinesToStringsMunge
diffLinesToStringsMunge splits a text into an array of strings, and reduces the texts to a []index.
diffmatchpatch/diff.go:1354
↓ 1 callersFunctiondiffRebuildTexts
(diffs []Diff)
diffmatchpatch/diff_test.go:48
↓ 1 callersFunctiongetBits
Helper for getting a sequence of bits from an integer.
diffmatchpatch/stringutil.go:116
↓ 1 callersFunctionintArrayToString
(ns []index)
diffmatchpatch/stringutil.go:96
↓ 1 callersMethodmatchBitapScore
matchBitapScore computes and returns the score for a match with e errors and x location.
diffmatchpatch/match.go:128
↓ 1 callersMethodpatchMake2
patchMake2 computes a list of patches to turn text1 into text2. text2 is not provided, diffs are the delta between text1 and text2.
diffmatchpatch/patch.go:184
↓ 1 callersFunctionstringToIndex
next invalid code point
diffmatchpatch/index.go:9
FunctionBenchmarkCommonLength
(b *testing.B)
diffmatchpatch/diff_test.go:149
FunctionBenchmarkDiffCleanupSemantic
(b *testing.B)
diffmatchpatch/diff_test.go:896
FunctionBenchmarkDiffCommonPrefix
(b *testing.B)
diffmatchpatch/diff_test.go:85
FunctionBenchmarkDiffCommonSuffix
exported sink var to avoid compiler optimizations in benchmarks
diffmatchpatch/diff_test.go:137
FunctionBenchmarkDiffHalfMatch
(b *testing.B)
diffmatchpatch/diff_test.go:270
FunctionBenchmarkDiffMain
(bench *testing.B)
diffmatchpatch/diff_test.go:1542
FunctionBenchmarkDiffMainLarge
(b *testing.B)
diffmatchpatch/diff_test.go:1562
FunctionBenchmarkDiffMainRunesLargeDiffLines
(b *testing.B)
diffmatchpatch/diff_test.go:1589
FunctionBenchmarkDiffMainRunesLargeLines
(b *testing.B)
diffmatchpatch/diff_test.go:1574
FunctionBenchmarkMatchBitap
(b *testing.B)
diffmatchpatch/match_test.go:176
FunctionBenchmarkPatchApply
(b *testing.B)
diffmatchpatch/patch_test.go:407
FunctionBenchmarkPatchFromText
(b *testing.B)
diffmatchpatch/patch_test.go:394
FunctionBenchmarkPatchSplitMax
(b *testing.B)
diffmatchpatch/patch_test.go:422
FunctionExampleDiffMatchPatch_DiffCleanupSemantic
Cleanup shifts edits to word boundaries: the raw diff on the left splits words, the cleaned up diff on the right edits whole words.
diffmatchpatch/example_test.go:121
FunctionExampleDiffMatchPatch_DiffLinesToChars
Diff two texts line by line by reducing each line to a character, diffing the reduced texts and expanding the result back to lines.
diffmatchpatch/example_test.go:55
FunctionExampleDiffMatchPatch_DiffMain
Compare two texts and print the differences.
diffmatchpatch/example_test.go:19
FunctionExampleDiffMatchPatch_DiffText1
The diffs are plain data; the source and target texts can be reconstructed from them without any pretty printing.
diffmatchpatch/example_test.go:40
FunctionExampleDiffMatchPatch_MatchMain
Locate a pattern in the text, exactly or fuzzily.
diffmatchpatch/example_test.go:106
FunctionExampleDiffMatchPatch_PatchMake
Make a patch, convert it to text, and apply that text to the original later, possibly elsewhere.
diffmatchpatch/example_test.go:78
MethodString
()
diffmatchpatch/operation_string.go:11
FunctionTestAlignRuneEnd
alignRuneEnd should move any byte index inside a multi-byte UTF-8 character forward to the start of the next character.
diffmatchpatch/patch_rune_safety_test.go:42
FunctionTestAlignRuneStart
alignRuneStart should back any byte index inside a multi-byte UTF-8 character back to that character's first byte.
diffmatchpatch/patch_rune_safety_test.go:13
FunctionTestCommonPrefixLength
(t *testing.T)
diffmatchpatch/diff_test.go:95
FunctionTestCommonSuffixLength
(t *testing.T)
diffmatchpatch/diff_test.go:181
FunctionTestDiffBisect
(t *testing.T)
diffmatchpatch/diff_test.go:1242
FunctionTestDiffBisectSplit
(t *testing.T)
diffmatchpatch/diff_test.go:282
FunctionTestDiffCharsToLines
(t *testing.T)
diffmatchpatch/diff_test.go:350
FunctionTestDiffCleanupEfficiency
(t *testing.T)
diffmatchpatch/diff_test.go:910
FunctionTestDiffCleanupMerge
(t *testing.T)
diffmatchpatch/diff_test.go:395
FunctionTestDiffCleanupSemantic
(t *testing.T)
diffmatchpatch/diff_test.go:640
FunctionTestDiffCleanupSemanticLossless
(t *testing.T)
diffmatchpatch/diff_test.go:490
next →1–100 of 144, ranked by callers