[ragel-users] Conditional parsing
Iñaki Baz Castillo
ibc at aliax.net
Thu Apr 10 20:08:04 UTC 2014
Hi,
I'm building a parser for a protocol message similar to HTTP (let's
say: a main header and N key: value separated by CRLF until a final
double CRLF). My concern is:
- I parse the messages in a "Dispatcher" module that just needs to
parse a few fields in each message.
- Then the Dispatcher passes the message to a Worker thread via UNIX Socket.
- And the Worker must parse it again, but in this case I need all the
fields parsed.
Note that during the Worker's parsing, a C++ complex object is build
with all the parsed fields mapped into member variables, so I don't
want to play with those complex objects in the Dispatcher module.
How could I reuse the same Ragel machine for both cases? Of course I
would like something like:
%%{
machine Parser;
[...]
if (dispatcher) {
main := xxxxxxx
}
else {
main := yyyyyyy
}
}%%
Thanks a lot.
--
Iñaki Baz Castillo
<ibc at aliax.net>
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
More information about the ragel-users
mailing list