
Arkadiy Vertleyb wrote:
"Reece Dunn" <msclrhd@hotmail.com> wrote
One question though: I have a parser where I have created several external grammars to help modularize the grammar and employ the trick suggested in the techniques section (c.f. sub-grammar):
[snip] Once you have a (sub-)rule like this, you can use it like:
rule_t<ScannerT> tagName = !( identifier >> ':' ) >> identifier;
I was wondering if this would cause any major problems when implemented with the typeof/auto hack (since it could then be implemented as a grammar).
I think you would just have to register your identifier_parser class. The typeof system then would treat it as an atom and not care what is behind it.
This was what I was thinking. But is there a way of handling the grammar template as a special case, e.g.: template< typename T > class deduce_type { typedef ... type; }; template< typename DerivedT > class deduce_type< boost::spirit::grammar< DerivedT > > { typedef DerivedT::type type; }; I am not saying that this is what it will look like as I am not up to speed with your typeof mechanism, but if something similar could be implemented, it would make custom grammars more powerful (may even reduce the number of types that need explicit registration). Regards, Reece _________________________________________________________________ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband