I'm using boost spirit to create a URI parser. I get a syntax error for the following when I use the grammar straight off from RFC 2396. server = [[userinfo >> ch_p('@')] hostport] ; And when I change the rule and compile it, then the syntax error goes away but I get the following error. I've enclosed Grammar.h for reference Thanks, Reena d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/scanner/scanner.hpp(146) : error C2064: term does not evaluate to a function taking 2 arguments d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/scanner/scanner.hpp(161) : see reference to function template instantiation 'void boost::spirit::attributed_action_policy<boost::spirit::nil_t>::call<Acto rT,IteratorT>(const ActorT &,boost::spirit::nil_t,const IteratorT &,const IteratorT &)' being compiled with [ ActorT=boost::spirit::sequence<boost::spirit::chlit<char>,boost::spirit: :rule<scanner_t>>, IteratorT=iterator_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/composite/actions.hpp(109) : see reference to function template instantiation 'void boost::spirit::action_policy::do_action<ActionT,boost::spirit::match<boo st::spirit::nil_t>::return_t,iterator_t>(const ActorT &,AttrT &,const IteratorT &,const IteratorT &) const' being compiled with [ ActionT=boost::spirit::sequence<boost::spirit::chlit<char>,boost::spirit ::rule<scanner_t>>, ActorT=boost::spirit::sequence<boost::spirit::chlit<char>,boost::spirit: :rule<scanner_t>>, AttrT=boost::spirit::match<boost::spirit::nil_t>::return_t, IteratorT=iterator_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/impl/rule.ipp(233) : see reference to function template instantiation 'boost::spirit::match<boost::spirit::nil_t> boost::spirit::action<ParserT,ActionT>::parse<ScannerT>(const ScannerT &) const' being compiled with [ ParserT=boost::spirit::rule<scanner_t>, ActionT=boost::spirit::sequence<boost::spirit::chlit<char>,boost::spirit ::rule<scanner_t>>, ScannerT=boost::spirit::scanner<const char *,boost::spirit::scanner_policies_t> ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/impl/rule.ipp(232) : while compiling class template member function 'boost::spirit::match<boost::spirit::nil_t> boost::spirit::impl::concrete_parser<ParserT,ScannerT,AttrT>::do_parse_v irtual(const ScannerT &) const' with [ ParserT=boost::spirit::action<boost::spirit::rule<scanner_t>,boost::spir it::sequence<boost::spirit::chlit<char>,boost::spirit::rule<scanner_t>>> , ScannerT=boost::spirit::scanner<const char *,boost::spirit::scanner_policies_t>, AttrT=boost::spirit::nil_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/rule.hpp(135) : see reference to class template instantiation 'boost::spirit::impl::concrete_parser<ParserT,ScannerT,AttrT>' being compiled with [ ParserT=boost::spirit::action<boost::spirit::rule<scanner_t>,boost::spir it::sequence<boost::spirit::chlit<char>,boost::spirit::rule<scanner_t>>> , ScannerT=boost::spirit::scanner<const char *,boost::spirit::scanner_policies_t>, AttrT=boost::spirit::nil_t ] d:\work\mainline\generation_3\sources_rdo\urilib\Grammar.h(60) : see reference to function template instantiation 'boost::spirit::rule<T0> &boost::spirit::rule<T0>::operator =<boost::spirit::action<ParserT,ActionT>>(const boost::spirit::action<ParserT,ActionT> &)' being compiled with [ T0=scanner_t, ParserT=boost::spirit::rule<scanner_t>, ActionT=boost::spirit::sequence<boost::spirit::chlit<char>,boost::spirit ::rule<scanner_t>> ] d:\work\mainline\generation_3\sources_rdo\urilib\Grammar.h(29) : while compiling class template member function 'urilib::Grammar::definition<ScannerT>::definition(const urilib::Grammar &)' with [ ScannerT=scanner_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/impl/grammar.ipp(262) : see reference to class template instantiation 'urilib::Grammar::definition<ScannerT>' being compiled with [ ScannerT=scanner_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/impl/grammar.ipp(281) : see reference to function template instantiation 'void boost::spirit::impl::call_helper<0>::do_<result_t,definition_t,ScannerT> (RT &,DefinitionT &,const ScannerT &)' being compiled with [ ScannerT=scanner_t, RT=result_t, DefinitionT=definition_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/grammar.hpp(53) : see reference to function template instantiation 'boost::spirit::match<boost::spirit::nil_t> boost::spirit::impl::grammar_parser_parse<0,urilib::Grammar,boost::spiri t::parser_context<>,ScannerT>(const boost::spirit::grammar<DerivedT> *,const ScannerT &)' being compiled with [ ScannerT=scanner_t, DerivedT=urilib::Grammar ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/grammar.hpp(63) : see reference to function template instantiation 'boost::spirit::match<boost::spirit::nil_t> boost::spirit::grammar<DerivedT>::parse_main<ScannerT>(const ScannerT &) const' being compiled with [ DerivedT=urilib::Grammar, ScannerT=scanner_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/scanner/impl/skipper.ipp(131) : see reference to function template instantiation 'boost::spirit::match<boost::spirit::nil_t> boost::spirit::grammar<DerivedT>::parse<scanner_t>(const ScannerT &) const' being compiled with [ DerivedT=urilib::Grammar, ScannerT=scanner_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/scanner/impl/skipper.ipp(153) : see reference to function template instantiation 'boost::spirit::parse_info<> boost::spirit::impl::phrase_parser<boost::spirit::space_parser>::parse<I teratorT,DerivedT>(const IteratorT &,const IteratorT &,const ParserT &,const boost::spirit::space_parser &)' being compiled with [ IteratorT=const char *, DerivedT=urilib::Grammar, ParserT=urilib::Grammar ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/scanner/impl/skipper.ipp(171) : see reference to function template instantiation 'boost::spirit::parse_info<> boost::spirit::parse<const CharT*,DerivedT,boost::spirit::space_parser>(const IteratorT &,const IteratorT &,const boost::spirit::parser<DerivedT> &,const boost::spirit::parser<boost::spirit::space_parser> &)' being compiled with [ CharT=char, DerivedT=urilib::Grammar, IteratorT=const char * ] .\URI.cpp(23) : see reference to function template instantiation 'boost::spirit::parse_info<> boost::spirit::parse<char,DerivedT,boost::spirit::space_parser>(const CharT *,const boost::spirit::parser<DerivedT> &,const boost::spirit::parser<boost::spirit::space_parser> &)' being compiled with [ DerivedT=urilib::Grammar, CharT=char ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/scanner/scanner.hpp(146) : error C2064: term does not evaluate to a function taking 2 arguments d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/scanner/scanner.hpp(161) : see reference to function template instantiation 'void boost::spirit::attributed_action_policy<boost::spirit::nil_t>::call<Acto rT,IteratorT>(const ActorT &,boost::spirit::nil_t,const IteratorT &,const IteratorT &)' being compiled with [ ActorT=boost::spirit::rule<scanner_t>, IteratorT=iterator_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/composite/actions.hpp(109) : see reference to function template instantiation 'void boost::spirit::action_policy::do_action<ActionT,boost::spirit::match<boo st::spirit::nil_t>::return_t,iterator_t>(const ActorT &,AttrT &,const IteratorT &,const IteratorT &) const' being compiled with [ ActionT=boost::spirit::rule<scanner_t>, ActorT=boost::spirit::rule<scanner_t>, AttrT=boost::spirit::match<boost::spirit::nil_t>::return_t, IteratorT=iterator_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/impl/rule.ipp(233) : see reference to function template instantiation 'boost::spirit::match<boost::spirit::nil_t> boost::spirit::action<ParserT,ActionT>::parse<ScannerT>(const ScannerT &) const' being compiled with [ ParserT=boost::spirit::rule<scanner_t>, ActionT=boost::spirit::rule<scanner_t>, ScannerT=boost::spirit::scanner<const char *,boost::spirit::scanner_policies_t> ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/impl/rule.ipp(232) : while compiling class template member function 'boost::spirit::match<boost::spirit::nil_t> boost::spirit::impl::concrete_parser<ParserT,ScannerT,AttrT>::do_parse_v irtual(const ScannerT &) const' with [ ParserT=boost::spirit::action<boost::spirit::rule<scanner_t>,boost::spir it::rule<scanner_t>>, ScannerT=boost::spirit::scanner<const char *,boost::spirit::scanner_policies_t>, AttrT=boost::spirit::nil_t ] d:\Work\Mainline\Generation_3\root\usr\include\NTx86debug\boost/spirit/c ore/non_terminal/rule.hpp(135) : see reference to class template instantiation 'boost::spirit::impl::concrete_parser<ParserT,ScannerT,AttrT>' being compiled with [ ParserT=boost::spirit::action<boost::spirit::rule<scanner_t>,boost::spir it::rule<scanner_t>>, ScannerT=boost::spirit::scanner<const char *,boost::spirit::scanner_policies_t>, AttrT=boost::spirit::nil_t ] d:\work\mainline\generation_3\sources_rdo\urilib\Grammar.h(68) : see reference to function template instantiation 'boost::spirit::rule<T0> &boost::spirit::rule<T0>::operator =<boost::spirit::action<ParserT,ActionT>>(const boost::spirit::action<ParserT,ActionT> &)' being compiled with [ T0=scanner_t, ParserT=boost::spirit::rule<scanner_t>, ActionT=boost::spirit::rule<scanner_t> ]
On Monday 09 June 2008, Reena Dass wrote:
I'm using boost spirit to create a URI parser.
I get a syntax error for the following when I use the grammar straight off from RFC 2396.
server = [[userinfo >> ch_p('@')] hostport] ;
Use "!" to denote an optional expression as described in http://www.boost.org/doc/libs/1_35_0/libs/spirit/doc/operators.html: server = !(!(userinfo >> '@') >> hostport);
And when I change the rule and compile it, then the syntax error goes away but I get the following error.
Same problem; see line 68 in your grammar, as indicated by the error message. HTH, Chris
participants (2)
-
Chris Hoeppler
-
Reena Dass