Boost logo

Boost Users :

Subject: [Boost-users] [spirit] need advise for parsing a set of integer alternatives
From: Zhi Tan (rockonedge_at_[hidden])
Date: 2010-02-28 02:48:41


say I am parsing a message in this format:
2-byte message length + 2-byte instruction code + message body, where the
2-byte instruction code is a predefined set of constants, e.g. 0x01, 0x01234
etc.
I could use this parser:
short_>>short_>>*char_. and resort to the attributes of short_in a
post-check to check whether the instruction code is legal or not .
what if I want to embed the legal instruction code set in the parser
itself, and determine whether this is a legal message at one go? .i.e.
short_>>(what to put here)>>*char?

Thanks.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net