Incremental editing (language.md, section 7): merges a patch, the changed statements a model answers with in edit mode, into the current program.
Both texts are read with the parser's own rules for fences, comments and
statement boundaries, so a multi-line ternary is one statement in both. A
patch statement replaces the one with its name in place; a new name is
appended; name = null deletes the statement. After merging, statements
root cannot reach are removed, unless there is no root statement.
State declarations are always kept. Merge only once the patch has finished
streaming: a half-written root would remove statements it reaches later.
Summary
Functions
Merges patch into the current program text and returns the merged text.