James W. Walker wrote:

> Thanks, that helps, but I still have a question or two.  The FAQ says 
> "it is best to avoid rules as arguments to the parse functions", but 
> then what are rules good for?  How else am I going to do any 
> nontrivial parsing?

Use grammars (see here:
http://www.boost.org/libs/spirit/doc/grammar.html). This is the best way
to implement non-trivial parsers with Spirit.

> I've been looking at the Spirit article in the C/C++ Users 
> Journal.  It 
> contains a code example that defines rule<> expression, and 
> later says 
> if (parse( str, expression, space ).full)...  I supposed that "space" 
> was a typo for "space_p".  How do you reconcile that code sample with 
> the FAQ?

The article describes Spirit V1.2 (it was written nearly two years ago).

Spirit has undergone some minor interface changes since then (all
predefined parser objects have a '_p' appended).
Another change was a slight change of the scanner<> idiom, which lead to
the subtleties you've encountered. Generally the CUJ article is a good
starting point, but nevertheless you should have a look at the current
doc's and, may be, at the samples contained with Spirit.

HTH
Regrads Hartmut


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to