Elmex's prototypical C++ implementation of PSYC according to Spec:Packet. The package also contains parsers in C and perl.


The Parser

psycpp comes with a C++ parser that uses the spirit library from boost, but recent changes in the packet made such a complicated parser unnecessary.

The parser has been (mostly) strictly written with Spec:Packet in mind, but the specification has changed somewhat since.

How the parser works

  1. 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.
    1. 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".
    2. 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").
  2. goto 1.

See also