|
Subject: How use a grammar with multiple entries inside another grammar Newsgroups: gmane.comp.parsers.spirit.general Date: 2005-04-05 18:51:58 GMT (3 years, 19 weeks, 3 days, 19 hours and 40 minutes ago)
I tried the following :
#include <boost/spirit/core.hpp>
#include <boost/spirit/utility/grammar_def.hpp>
namespace spirit = boost::spirit;
struct Test : public spirit::grammar<Test>
{
template <typename ScannerT>
struct definition : public spirit::grammar_def<spirit::rule<ScannerT>,
spirit::same>
{
definition(Test const& self)
{
a = spirit::ch_p('a');
b = spirit::ch_p('b');
this->start_parsers(a, b);
}
spirit::rule<ScannerT> a, b;
};
};
struct TestWrap : public spirit::grammar<TestWrap>
{
template <typename ScannerT>
struct definition
{
definition(TestWrap const& self)
{
b = test.use_parser<1>();
}
spirit::rule<ScannerT> const& start() const { return b; }
Test test;
spirit::rule<ScannerT> b;
};
};
int __cdecl main()
{
TestWrap testWrap;
parse( "a", testWrap, spirit::blank_p );
}
and I get the following error
K:\Work\boost_1_32_0\boost\spirit\core\non_terminal\impl\rule.ipp(227):
error C2440: 'initializing' :
cannot convert from 'const boost::spirit::impl::entry_grammar<Test, 1,
boost::spirit::parser_context<> >'
to 'boost::spirit::impl::entry_grammar<Test, 1,
boost::spirit::parser_context<> >::embed_t'
Is that a bug ?
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
|
|
|