Hej, another question:
I have written a number of very similar parsers which use a number of common rules. Can I store these rule<> objects in a place where they can be acessed by multiple parsers? It looks somehow like this:
rule<> nmeaStart = ch_p('$');
rule<> nmeaAddress = alnum_p() >> alnum_p() >> !alnum_p() >> !alnum_p();
rule<> nmeaDelim = ch_p(',');
rule<> nmeaHead = nmeaStart >> nmeaAddress >> nmeaDelim;
...
/* other rules. Different for each parser*/
...
rule<> nmeaChkSumStart = ch_p('*');
rule<> nmeaChkSum = int_parser<unsigned int,16,2,2>();
rule<> nmeaTail = nmeaChkSumStart >> nmeaChkSum >> eol_p;
I would like to put all rules named nmea... into a common place, preferably into a protected static variable of some class. I guess the thing called Grammar in the Spirit-documentation is the key but honestly I don't understand much about it yet.
Many thanks! Cheers!