Boost logo

Boost Users :

From: Stefan Slapeta (stefan_at_[hidden])
Date: 2005-08-23 09:35:55


Stephen Henry wrote:

> Hi all,
>
> I am having a problem with the following snippet of code. What I want to
> do is parse a line of alpha numeric characters from a file_iterator and
> then use the read characters to construct a new object which takes a
> std::string and integer argument for it's constructor. To do this I am
> using the statement below:
>
> p >> (+alpha_p)[ create_dfa( self.m_dfa, construct_<DFA>(
> construct_<std::string>( arg1 ), var(500) ) ) ];
>

First of all, please post questions about spirit to
gmane.comp.parsers.spirit.general!

You forgot to make self.m_dfa lazy:

p >> (+alpha_p)
      [
         create_dfa( var(self.m_dfa), // <---
                     construct_<DFA>(
                         construct_<std::string>( arg1 ), var(500)
                   ))
      ];

> This is the code I've got:

[...]

> Script_parser p(vDFA);
> parser_info<iterator_t> info = parse( first, last, p );

This must be parse_info!

> This doesn't even compile, and I have absolutely no idea why. All the
> compiler shows is pages and pages of garbage that means absolutely
> nothing. Please help!
>

I guess you have never really seen a compiler printing pages and pages...

Cheers,

Stefan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net