pub fn parse_patch(text: &str) -> Result<Patch, PatchError>Expand description
Parses the *** Begin Patch envelope (spec 3.1 §7.26).
A shell heredoc around the envelope (<<'EOF' … EOF) is tolerated, since models
trained on a shell-run apply_patch sometimes keep it. A @@ -1,3 +1,4 @@ range header
is read as an @@ line without an anchor: the format has no line numbers.
§Errors
Returns a PatchError naming the line that does not fit the format.
§Example
use adk_devtools::patch::parse_patch;
let error = parse_patch("*** Update File: a.rs\n").unwrap_err();
assert!(error.to_string().contains("*** Begin Patch"));