View Source Dmp.DebugUtils (diff_match_patch v0.2.0)
Utilities for debugging bitarrays.
Link to this section Summary
Functions
Returns a list of "codepoints" (single-character strings)
showing the base-2 value of value
.
Formats an alphabet bitarray into a list of lines, showing binary values.
Formats the rd
bitarray into a list of lines, showing binary values.
Link to this section Functions
@spec bitmap_to_list(non_neg_integer(), non_neg_integer()) :: [String.t()]
Returns a list of "codepoints" (single-character strings)
showing the base-2 value of value
.
A minimum of padding
elements are returned.
@spec debug_alphabet(Dmp.Match.alpha(), String.t()) :: [String.t()]
Formats an alphabet bitarray into a list of lines, showing binary values.
s
- The alphabet as returned byDmp.Match.alphabet/1
.pattern
- The pattern that is associated with the alphabet.
examples
Examples
iex> DebugUtils.debug_alphabet(%{?a => 5, ?b => 2}, "aba")
[
"alphabet: a b a",
" a 5: 1 0 1",
" b 2: 0 1 0"
]
@spec debug_rd( Dmp.Match.bitap_array(), String.t(), String.t(), non_neg_integer(), non_neg_integer(), integer() ) :: [String.t()]
Formats the rd
bitarray into a list of lines, showing binary values.
rd
- The bitarrary.text
- The text associated withrd
.pattern
- The pattern associated withrd
.d
- The error level.start
- The lowest index that has been calculated. Lines below this index will be marked with an asterisk.best_loc
- The index in the text where the best match has been found. The line at this index will be marked with an "@"-sign.
examples
Examples
iex> DebugUtils.debug_rd(%{1 => 5, 2 => 7, -1 => 3}, "abc", "add", 0, 1, 2)
[
" rd_j^0: a d d",
" 0* _ 0: 0 0 0",
" 1 a 5: 1 0 1",
" 2 b 7: 1 1 1",
" 3@ c 0: 0 0 0",
" 4 _ 0: 0 0 0"
]