From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-05-05 11:08:29
"Reece Dunn" <msclrhd_at_[hidden]> 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):
> using namespace boost::spirit;
> struct identifier_parser: public sub_grammar< identifier_parser >
> typedef sequence_t
> alternative< alpha_parser, chlit<> >,
> kleene_alternative_t< alnum_parser, chlit<> >::type
> start_t start;
> inline identifier_parser():
> ( alpha_p | '_' ) >> *( alnum_p | '_' )
> } identifier;
> NOTE: This is using various type construction helpers.
> 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
> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk