Expand description
The ct-edit --script engine: a batch of edits applied under the
prepare/confirm/write standard.
Phase 1 simulates the whole script in memory over FileBufs — in script
order under cascade (each edit matches the buffer as transformed by
earlier edits), or against pristine content with an overlap check under
--no-cascade. Every edit’s expectation is judged in the simulation;
the caller writes the final buffers only when every edit passed. Nothing
here touches the filesystem.
Structs§
- Edit
Outcome - One edit’s simulated outcome.
- Edit
Spec - One edit from the script, compiled and ready to run.
- FileBuf
- One selected file, held in memory for the whole simulation.
Enums§
- Op
- A compiled edit operation.
Functions§
- compile_
item - Compile one parsed
edititem into anEditSpec. Defaults inside a script:expect "=1"(an anchored structural edit means exactly here, and the stricter default is the safer one inside an atomic batch) andmode literal(promotion is off in scripts; the author states intent). - run_
cascade - Run the script with cascade: edits run in script order, each matching the
buffers as already transformed by earlier edits, exactly as the final
write would have it. Buffers are updated even past a failing edit so the
remaining diagnostics stay meaningful; the caller writes nothing unless
every outcome is
SUCCESS. - run_
no_ cascade - Run the script without cascade: every edit matches pristine content, any two edits touching the same line is a usage error, and the located splices are applied positionally so the result is exactly what was verified.