Skip to main content

Module parser

Module parser 

Source
Expand description

Token-driven state machine that turns a stream of Tokens into a flat list of Edits, plus the top-level envelope splitter that carves an authored patch into PatchSections.

Ported from omp packages/hashline/src/parser.ts (the Executor state machine) and packages/hashline/src/input.ts (splitPatchInput, PatchSection).

Structs§

Patch
A parsed hashline patch — zero or more PatchSections, each rooted at a [PATH#HASH] header.
PatchSection
One section of a parsed patch: a target file plus its eagerly-parsed edits.

Functions§

parse_patch
Parse a single section’s diff body into (edits, warnings). Mirrors omp parsePatch.
parse_patch_streaming
Streaming-tolerant variant of parse_patch. Mirrors omp parsePatchStreaming.
split_patch_input
Parse text into a Patch. Splits the *** Begin Patch … *** End Patch envelope into [PATH#HASH] sections and eagerly parses each section’s edits.