Documentation
¶
Overview ¶
Package edit provides edit scripts. Edit scripts are a core notion for diffs. They represent a way to go from A to B by a sequence of insertions, deletions, and equal elements.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Range ¶
A Range is a pair of clopen index ranges. It represents the elements A[LowA:HighA] and B[LowB:HighB].
func (*Range) IsDelete ¶
IsDelete reports whether r represents a deletion in a Script. If so, the deleted elements are A[LowA:HighA].
func (*Range) IsEqual ¶
IsEqual reports whether r represents a series of equal elements in a Script. If so, the elements A[LowA:HighA] are equal to the elements B[LowB:HighB].
func (*Range) IsInsert ¶
IsInsert reports whether r represents an insertion in a Script. If so, the inserted elements are B[LowB:HighB].
type Script ¶
type Script struct {
Ranges []Range
}
A Script is an edit script to alter A into B.
func NewScript ¶
NewScript returns a Script containing the ranges r. It is only a convenience wrapper used to reduce line noise.
func (*Script) IsIdentity ¶
IsIdentity reports whether s is the identity edit script, that is, whether A and B are identical.