This is the diff-match-patch Reference Manual, version 0.2.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:02:53 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
diff-match-patch
A Common Lisp port of Neil Fraser’s library of the same name
Boris Smilga <boris.smilga@gmail.com>
Neil Fraser; ported by Boris Smilga
Apache 2.0
0.2.1
iterate
(system).
cl-ppcre
(system).
src
(module).
Modules are listed depth-first from the system components tree.
diff-match-patch/src
diff-match-patch
(system).
package.lisp
(file).
lib.lisp
(file).
diff.lisp
(file).
cleanup.lisp
(file).
match.lisp
(file).
patch.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
diff-match-patch/diff-match-patch.asd
diff-match-patch/src/package.lisp
diff-match-patch/src/lib.lisp
diff-match-patch/src/diff.lisp
diff-match-patch/src/cleanup.lisp
diff-match-patch/src/match.lisp
diff-match-patch/src/patch.lisp
diff-match-patch/diff-match-patch.asd
diff-match-patch
(system).
diff-match-patch/src/package.lisp
src
(module).
*diff-check-lines-length*
(special variable).
*diff-edit-cost*
(special variable).
*diff-timeout*
(special variable).
*match-distance*
(special variable).
*match-threshold*
(special variable).
*max-bits*
(special variable).
*patch-delete-threshold*
(special variable).
*patch-margin*
(special variable).
diff-match-patch/src/lib.lisp
package.lisp
(file).
src
(module).
dlet*
(macro).
empty
(function).
fn-to-hash-table-test
(function).
get-internal-seconds
(function).
index
(function).
join
(function).
join*
(function).
long-short
(function).
make-adjustable-vector
(function).
mapcall
(function).
narrow
(function).
newline-char-p
(function).
overlap
(function).
prefixp
(function).
read-char-urldecode
(function).
read-line-urldecode
(function).
revappend*
(function).
seq-type
(function).
split-at
(function).
split-lines
(function).
suffixp
(function).
whitespace-char-p
(function).
write-char-urlencode
(function).
write-line-urlencode
(function).
diff-match-patch/src/diff.lisp
lib.lisp
(file).
src
(module).
diff
(function).
diff-destination
(function).
diff-origin
(function).
index-abbreviator
(function).
levenshtein
(function).
mapdiff
(function).
translate-position
(function).
%diff-deadline%
(special variable).
affix-match
(function).
diff-bisect
(function).
diff-coerce
(function).
diff-compute
(function).
diff-line-mode
(function).
diff-seq-type
(function).
half-match
(function).
next-diffs
(function).
past-diff-deadline
(function).
with-diff-deadline
(macro).
diff-match-patch/src/cleanup.lisp
diff.lisp
(file).
src
(module).
cleanup-for-efficiency
(function).
cleanup-merge
(function).
cleanup-merge.join-differences
(function).
cleanup-merge.shift-differences
(function).
cleanup-semantic
(function).
cleanup-semantic.boundary-score
(function).
cleanup-semantic.eliminate-overlaps
(function).
cleanup-semantic.eliminate-short-equalities
(function).
cleanup-semantic.next-short-equality
(function).
cleanup-semantic.shift-lossless
(function).
edits-xor
(function).
filter-diffs
(function).
diff-match-patch/src/match.lisp
cleanup.lisp
(file).
src
(module).
match
(function).
match-bitap
(function).
match-bitap.alphabet
(function).
diff-match-patch/src/patch.lisp
match.lisp
(file).
src
(module).
apply-patch
(function).
hunk
(class).
hunk-diffs
(reader method).
(setf hunk-diffs)
(writer method).
hunk-length-a
(reader method).
(setf hunk-length-a)
(writer method).
hunk-length-b
(reader method).
(setf hunk-length-b)
(writer method).
hunk-start-a
(reader method).
(setf hunk-start-a)
(writer method).
hunk-start-b
(reader method).
(setf hunk-start-b)
(writer method).
make-patch
(function).
read-chars-patch
(function).
read-lines-patch
(function).
write-chars-patch
(function).
write-lines-patch
(function).
add-padding
(function).
apply-hunk
(function).
copy-hunk
(function).
format-hunk-header
(function).
make-hunk
(function).
make-patch.cleanup
(function).
make-patch.next-hunk
(function).
parse-hunk-header
(function).
split-big-hunk
(function).
split-big-hunks
(function).
trivial-padding
(function).
Packages are listed by definition order.
diff-match-patch
dmp
common-lisp
.
iterate
.
*diff-check-lines-length*
(special variable).
*diff-edit-cost*
(special variable).
*diff-timeout*
(special variable).
*match-distance*
(special variable).
*match-threshold*
(special variable).
*max-bits*
(special variable).
*patch-delete-threshold*
(special variable).
*patch-margin*
(special variable).
apply-patch
(function).
diff
(function).
diff-destination
(function).
diff-origin
(function).
hunk
(class).
hunk-diffs
(generic reader).
(setf hunk-diffs)
(generic writer).
hunk-length-a
(generic reader).
(setf hunk-length-a)
(generic writer).
hunk-length-b
(generic reader).
(setf hunk-length-b)
(generic writer).
hunk-start-a
(generic reader).
(setf hunk-start-a)
(generic writer).
hunk-start-b
(generic reader).
(setf hunk-start-b)
(generic writer).
index-abbreviator
(function).
levenshtein
(function).
make-patch
(function).
mapdiff
(function).
match
(function).
read-chars-patch
(function).
read-lines-patch
(function).
translate-position
(function).
write-chars-patch
(function).
write-lines-patch
(function).
%diff-deadline%
(special variable).
add-padding
(function).
affix-match
(function).
apply-hunk
(function).
cleanup-for-efficiency
(function).
cleanup-merge
(function).
cleanup-merge.join-differences
(function).
cleanup-merge.shift-differences
(function).
cleanup-semantic
(function).
cleanup-semantic.boundary-score
(function).
cleanup-semantic.eliminate-overlaps
(function).
cleanup-semantic.eliminate-short-equalities
(function).
cleanup-semantic.next-short-equality
(function).
cleanup-semantic.shift-lossless
(function).
copy-hunk
(function).
diff-bisect
(function).
diff-coerce
(function).
diff-compute
(function).
diff-line-mode
(function).
diff-seq-type
(function).
dlet*
(macro).
edits-xor
(function).
empty
(function).
filter-diffs
(function).
fn-to-hash-table-test
(function).
format-hunk-header
(function).
get-internal-seconds
(function).
half-match
(function).
index
(function).
join
(function).
join*
(function).
long-short
(function).
make-adjustable-vector
(function).
make-hunk
(function).
make-patch.cleanup
(function).
make-patch.next-hunk
(function).
mapcall
(function).
match-bitap
(function).
match-bitap.alphabet
(function).
narrow
(function).
newline-char-p
(function).
next-diffs
(function).
overlap
(function).
parse-hunk-header
(function).
past-diff-deadline
(function).
prefixp
(function).
read-char-urldecode
(function).
read-line-urldecode
(function).
revappend*
(function).
seq-type
(function).
split-at
(function).
split-big-hunk
(function).
split-big-hunks
(function).
split-lines
(function).
suffixp
(function).
trivial-padding
(function).
whitespace-char-p
(function).
with-diff-deadline
(macro).
write-char-urlencode
(function).
write-line-urlencode
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
When a diff is computed between strings, how long should they be to to qualify for line-level-diff optimization. On strings whose length is greater than this value, a line-level diff is run first to identify the changed areas. NIL = don’t optimize.
Cost of an empty edit operation in terms of edit characters. Used to detect operationally trivial equalities when cleaning up diff lists.
Number of seconds to refine a diff before giving up (NIL for infinity).
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).
At what point is no match declared (0.0 = perfection, 1.0 = very loose).
The number of bits in an int, used to limit the width of match patterns when applying an inexact patch. Common Lisp having bigints allows to set this value to NIL (meaning unlimited width), but keeping it as it is optimizes performance by using fixints only.
When deleting a large block of text (over ~64 characters), how close do the contents have to be 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.
Chunk size for context length.
Apply PATCH (a list of hunks) to the sequence SEQ. Return two values: (1) SEQ, or its modified copy; and (2) a list of booleans, of the same length as PATCH, indicating for every hunk if it could be applied.
Find the differences between two sequences A and B of elements comparable under the function TEST. Return a list of edit operations of the form (OP X), where OP is one of the keywords :+ :- :=, and X is a subsequence of A or B.
Given a difference list, rebuild the second of the compared sequences.
Given a difference list, rebuild the first of the compared sequences.
Return two unary functions: one to abbreviate things to integers, the other to restore them from integer abbreviations.
Given the difference list DIFFS between two sequences, return the corresponding Levenshtein distance.
When called with two seuqences A and B, compute the diff between them and convert it into a list of hunk objects. Alternatively, the diff can be passed explicitly by keyword argument, and sequences reconstructed from it.
Return a copy of edit operation list DIFFS in which the content of every operation has been replaced by its image under FN.
Locate a subsequence most closely resembling PATTERN in SPACE near POSITION.
Read a formatted representation of patch encoding a difference of character strings from the stream IN and return it as a list of hunks.
Read a formatted representation of patch encoding a difference of line sequences from the stream IN and return it as a list of hunks.
Given the difference list DIFFS between two sequences and a POSITION in the first sequence, return the equivalent position in the second sequence.
Write the formatted representation of the given PATCH (a hunk or list of hunks, encoding a difference of character strings) to the stream OUT.
Write the formatted representation of the given PATCH (a hunk or list of hunks, encoding a difference of line sequences) to the stream OUT.
A wrapper for an edit or group of adjacent edits.
list
:diffs
(integer 0)
:start-a
(integer 0)
:start-b
(integer 0)
:length-a
(integer 0)
:length-b
Return a copy of PATCH with PADDING added to its first and last hunk.
If A and B are elementwise equal, return either of them. Otherwise, return four values: (1) the common prefix of A and B; (2, 3) the middle parts of A and B between the common prefix and the common suffix; and (4) the common suffix.
Apply one HUNK to the sequence SEQ with an offset DELTA between expected and actual position. Return three values: (1) a boolean indicating if the hunk could be applied; (2) SEQ, or its modified copy; and (3) DELTA, possibly modified.
Reduce the number of edits by eliminating operationally trivial equalities.
Reorder and merge like edit sections in the list DIFFS. Merge equalities. Any edit section can move as long as it doesn’t cross an equality.
For every run of differences in the list DIFFS (separated by equalities), concatenate additions with additions and deletions with deletions to get two sequences, and factor out their common affixes, joining them unto the surrounding equalities.
For every unpaired edit in the list DIFFS which is surrounded by equalities on both sides, try to eliminate either the left or the right equality by “shifting through” the edit. E. g. =A -BA =C is equivalent to -AB =AC, =A -BC =B is equivalent to =AB -CB.
Reduce the number of edits by eliminating semantically trivial equalities.
Compute a score from 6 to 0 determining to which extent the position POS in the portion of STR between START and END is a logical boundary.
Find overlaps between adjacent deletions and insertions in DIFFS and extract them by inserting equalities, provided the overlap is as big as the remainder of the edits. E. g. -ABCXXX +XXXDEF is the same as -ABC =XXX +DEF; -XXXABC +DEFXXX is the same as +DEF =XXX -ABC.
Eliminate every equality in DIFFS which is no longer than either all the deletions or all the insertions on its left side, and ditto for those on its right side, by replacing it with a delete-add pair.
Find the first equality in DIFFS which is no longer than either all the deletions or all the insertions on its left side, and ditto for those on its right side. Return two values: (1) a three-element list, with (1a) differences on the left of the equality in reverse order, (1b) the content of the equality, and (1c) differences on the right in direct order; and (2) the list PREV-EQUALITIES unto which have been consed similar three-element lists representing equalities in DIFF before the one we’d found.
For every unpaired edit in the list DIFFS which is surrounded by equalities on both sides, try to realign the edit by “shifting it through” to a logical boundary.
Return a copy of HUNK with zero or more slot values replaced by arguments.
Use E. Myers’ (1986) algorithm to find the “middle snake” (equality) of an optimal diff of A and B, split the sequences just beyond the snake, and return four values: the two parts of A and the two parts of B. If the timeout is hit, or if the two sequences have no common elements, return NIL.
Coerce the sequences in the elements of DIFFS to TYPE.
Find the differences between two sequences A and B of elements comparable under TEST, assuming that they don’t share a common preffix or suffix and that neither is empty.
Find the differences between the multiline texts A and B by comparing them as sequences of lines, then recursively comparing just the non-matching line runs by the general method.
Return the type of sequences in the elements of DIFFS.
If the sequences A and B share a common infix which is at least half the length of the longer sequence, return five values: (1, 2) the prefixes of A and B up to (3) the common middle, and (4, 5) the suffixes of A and B after it. Otherwise, return NIL.
Create a hunk instance, ensuring that it includes a unique context.
Cleanup DIFFS based on their size and type of elements.
Extract the next patch hunk from DIFFS.
Use the Bitap algorithm to locate the best instance of PATTERN in SPACE near POSITION.
Compute the alphabet for the Bitap algorithm, as a hash table mapping elements of PATTERN to integer hashes.
Extract all differences from the beginning of the list DIFFS, up to the first equality or the end of the list, whichever comes first. Return four values: (1) the concatenation of all deleted sequences, (2) the concatenation of all added sequences, (3) the equal sequence (or NIL if the end of DIFFS was reached), and (4) the rest of DIFFS after the equality.
Split HUNK into pieces not exceeding SIZE and return them as a list of hunks.
Return a copy of PATCH with all big hunks split. (Big hunks are hunks whose length exceeds the maximum limit of the match algorithm.)
Return a padding sequence for PATCH, of the given LENGTH.
Jump to: | (
A C D E F G H I J L M N O P R S T W |
---|
Jump to: | (
A C D E F G H I J L M N O P R S T W |
---|
Jump to: | %
*
D L S |
---|
Jump to: | %
*
D L S |
---|
Jump to: | C D F H L M P S |
---|
Jump to: | C D F H L M P S |
---|