diff_match_patch library
Copyright 2011 Google Inc. Copyright 2014 Boris Kaul localvoid@gmail.com http://github.com/localvoid/diff-match-patch
Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Classes
Constants
- DIFF_DELETE → const int
- The data structure representing a diff is a List of Diff objects:
- DIFF_EQUAL → const int
- DIFF_INSERT → const int
Functions
-
cleanupEfficiency(
List< Diff> diffs, int diffEditCost) → void - Reduce the number of edits by eliminating operationally trivial equalities.
-
cleanupSemantic(
List< Diff> diffs) → void - Reduce the number of edits by eliminating semantically trivial equalities.
-
diff(
String text1, String text2, {double timeout = 1.0, bool checklines = true, DateTime? deadline}) → List< Diff> - Find the differences between two texts. Simplifies the problem by stripping any common prefix or suffix off the texts before diffing.
-
levenshtein(
List< Diff> diffs) → int - Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.
-
match(
String text, String pattern, int loc, {double threshold = 0.5, int distance = 1000}) → int -
Locate the best instance of
pattern
intext
nearloc
. Returns -1 if no match found. -
patchApply(
List< Patch> patches, String text, {double deleteThreshold = 0.5, double diffTimeout = 1.0, DateTime? diffDeadline, double matchThreshold = 0.5, int matchDistance = 1000, int margin = 4}) → List - Merge a set of patches onto the text.
-
patchFromText(
String textline) → List< Patch> - Parse a textual representation of patches and return a List of Patch objects.
-
patchMake(
Object? a, {Object? b, Object? c, double diffTimeout = 1.0, DateTime? diffDeadline, int diffEditCost = 4, double deleteThreshold = 0.5, int margin = 4}) → List< Patch> -
Compute a List of Patches to turn
text1
intotext2
. -
patchToText(
List< Patch> patches) → String - Take a list of patches and return a textual representation.