Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-05-05 12:28:02

Arkadiy Vertleyb wrote:
>"Reece Dunn" <msclrhd_at_[hidden]> wrote
> > One question though: I have a parser where I have created several
> > grammars to help modularize the grammar and employ the trick suggested
> > 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
> > 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

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).


Tired of 56k? Get a FREE BT Broadband connection

Boost list run by bdawes at, gregod at, cpdaniel at, john at