module salix::Diff
rascal-0.41.2
org.rascalmpl.salix-core-0.2.9
Usage
import salix::Diff;
Dependencies
import salix::Node;
import salix::util::LCS;
import List;
import util::Math;
import IO;
import vis::Text;
data Patch
data Patch
= patch(int pos, list[Patch] patches = [], list[Edit] edits = [])
;
Patch are positioned at pos in the parent element where they originate. This allows sparse/shallow traversal during patching: not all kids of an element will have changes, so patches for those kids will not end up in the patch at all. At each level a list of edits can be applied. A root patch will have pos = - 1.
data EditType
data EditType
= setText()
| replace()
| removeNode()
| appendNode()
| insertNode()
| setAttr()
| setProp()
| setEvent()
| setExtra()
| removeAttr()
| removeProp()
| removeEvent()
| removeExtra()
;
data Node
data Node
= none()
;
data Hnd
data Hnd
= null()
;
data Edit
data Edit
= edit(EditType \type, str contents="", Node html=none(), Hnd handler=null(),
str name="", str val="", int pos=-1, value extra=())
;
function diff
Patch diff(Node old, Node new)
function nodeEq
bool nodeEq(Node x, Node y)
function diff
Patch diff(Node old, Node new, int idx)
function isAlien
bool isAlien(Node nk)
function getId
str getId(Node n)
function diffKids
Patch diffKids(list[Node] oldKids, list[Node] newKids, Patch myPatch)
function diffEventMap
list[Edit] diffEventMap(map[str, Hnd] old, map[str, Hnd] new)
function diffMap
list[Edit] diffMap(map[str, str] old, map[str, str] new, EditType upd, EditType del)
function diffExtra
list[Edit] diffExtra(map[str, value] old, map[str, value] new)