The parser has been (mostly) strictly written with Spec:Packet in mind, but the specification has changed somewhat since.
How the parser works
- First the parser tries to read in a complete header, that is done by looking for the sequences ".\n" or "\n\n" which delimit the end of a routing header. In case ".\n" is found the packet will not contain any further data. In case "\n\n" was found the header is stripped from the input buffer (along with the second "\n") and the routing modifiers are parsed.
- If the routing modifiers contained a "_length" setting the parser tries to read that count of bytes and subsequently the packet end delimiter "\n.\n".
- If however the routing modifiers didn't contain any "_length" setting the parser looks for the packet end, which is delimited by "\n.\n". If found, the packet is stripped from the input buffer and parsed (along with "\n.\n").
- goto 1.