Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-05-05 10:43:49


Joel de Guzman wrote:

>Arkadiy Vertleyb wrote:
>>"Joel de Guzman" wrote
>>>I'd like
>>>to start a new CVS branch for typeof/auto experimentations. This would
>>>involve not only Spirit but Phoenix as well. I have a feeling that this
>>>will take more than a week or two. Yet, I'm sure that the results would
>>>be gratifying, at the very least.
>>
>>
>>Actually, I do think that this should be done fast, since it is intended
>>to
>>close the gap (maybe a year or two) until the real typeof becomes
>>available.
>
>Agreed. Let's do it!

I would also like to help, as I think that Spirit is an awesome library/tool
and would benefit greatly with auto/typeof support.

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 >
      {
         public:
            typedef sequence_t
            <
               alternative< alpha_parser, chlit<> >,
               kleene_alternative_t< alnum_parser, chlit<> >::type
>::type
start_t;
         public:
            start_t start;
         public:
            inline identifier_parser():
               start
               (
                  ( 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 with
the typeof/auto hack (since it could then be implemented as a grammar).

Regards,
Reece

_________________________________________________________________
Tired of 56k? Get a FREE BT Broadband connection
http://www.msn.co.uk/specials/btbroadband


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk