Re: boost and stl problem - std::string
Philipp Schwaha <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Jens,
On 07/10/2016 10:07 PM, Jens Kallup wrote:
> Hello,
>
> I want to use ExprNode to store AST informations.
> But I fail.
> How can I overgive parameters to class ExprNode?
>
> Here are the code sippets:
>
> template <typename TN>
> class ExprNode
> {
> public:
> struct ExprNode *operand1;
> struct ExprNode *operand2;
>
> char opr;
> int num;
>
> ExprNode(char op, struct ExprNode *e1, struct ExprNode *e2)
> {
> opr = op;
> operand1 = e1;
> operand2 = e2;
> }
>
> ExprNode(int n)
> {
> num = n;
> operand1 = operand2 = nullptr;
> }
>
> ExprNode() { }
>
> template<TN>
> ExprNode(TN t, std::string *p1, std::string *p2)
> {
> if (t == 2)
> {
> std::cout << "classler" << endl;
> }
> }
> };
>
> class_definition
> = (tok.kw_class >> *comments
> >> tok.identifier >> *comments
> >> tok.kw_of >> *comments
> >> tok.identifier >> *comments >> class_body
> >> tok.kw_endclass)
> /* line: 181 */ [
> ExprNode<int>(
> 2,
> phx::construct<std::string>(_1),
> phx::construct<std::string>(_2))
>
> //expnode->add(2,"val(_1)","val(_2)")
> //phx::construct<std::string>(_1),
> //phx::construct<std::string>(_2))
> ]
> ;
>
> /home/bak/src/ui/dbase/dBase/src/compiler/source/parser/yymain.cc:181:
> Fehler: no matching function for call to 'ExprNode<int>::ExprNode(int,
> boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::detail::construct_eval<std::__cxx11::basic_string<char>
> >, boost::fusion::vector<boost::spirit::argument<0>,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> > >,
> boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::detail::construct_eval<std::__cxx11::basic_string<char>
> >, boost::fusion::vector<boost::spirit::argument<1>,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> > >)'
> [
> ^
have you tried wrapping the ExprNode<int> constructor in a
phx::construct call?
From to code you provided I wonder what you want to do with the
constructed object? If this is an attributed grammar, you could also try
to provide a customization point to facilitate the construction of the
attribute.
If you could provide a self contained compilable example it would be
easier to judge.
Cheers
Philipp
> Thanks for helping
>
> Jens
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> Spirit-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/spirit-general
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev