
Hi, Is there a way using Phoenix to do quoting? I would like to do something like this: quote x("x"); string s = (x < 3 and x > 0)(); //s = "x < 3 and x > 0" Is there some kind of quote class in Phoenix or a way to create a quote class? Thanks, Paul

On 12/08/2011 08:52 PM, paul Fultz wrote:
Hi, Is there a way using Phoenix to do quoting? I would like to do something like this:
quote x("x"); string s = (x< 3 and x> 0)(); //s = "x< 3 and x> 0"
Is there some kind of quote class in Phoenix or a way to create a quote class?
What you want is a Proto transform that converts a tree to a string.

Thanks, for the response, but wouldnt I use an actor? I want to be able to quote several variables like this: quote x("x"); quote y("y"); string s = x+ y;// s = "x + y" I would assume that the quote class would be an actor, but can I transform the tree with an actor? Or would I need to write an actor that outputs a string for every operator? Is there a easy way to do this? ----- Original Message ----- From: Mathias Gaunard <mathias.gaunard@ens-lyon.org> To: boost@lists.boost.org Cc: Sent: Thursday, December 8, 2011 3:09 PM Subject: Re: [boost] Phoenix Quoting On 12/08/2011 08:52 PM, paul Fultz wrote:
Hi, Is there a way using Phoenix to do quoting? I would like to do something like this:
quote x("x"); string s = (x< 3 and x> 0)(); //s = "x< 3 and x> 0"
Is there some kind of quote class in Phoenix or a way to create a quote class?
What you want is a Proto transform that converts a tree to a string. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On 12/09/2011 09:54 PM, paul Fultz wrote:
Thanks, for the response, but wouldnt I use an actor? I want to be able to quote several variables like this: quote x("x"); quote y("y"); string s = x+ y;// s = "x + y"
I would assume that the quote class would be an actor, but can I transform the tree with an actor? Or would I need to write an actor that outputs a string for every operator? Is there a easy way to do this?
Read the Proto documentation. You don't need Phoenix at all (and probably can't use it to do this)

AMDG On 12/08/2011 11:52 AM, paul Fultz wrote:
Hi, Is there a way using Phoenix to do quoting? I would like to do something like this:
quote x("x"); string s = (x < 3 and x > 0)(); //s = "x < 3 and x > 0"
Is there some kind of quote class in Phoenix or a way to create a quote class?
I suspect that you'd do better with raw Proto, since the evaluation has nothing to do with normal C++ semantics. In Christ, Steven Watanabe

On 12/09/2011 06:50 PM, Steven Watanabe wrote:
AMDG
On 12/08/2011 11:52 AM, paul Fultz wrote:
Hi, Is there a way using Phoenix to do quoting? I would like to do something like this:
quote x("x"); string s = (x< 3 and x> 0)(); //s = "x< 3 and x> 0"
Is there some kind of quote class in Phoenix or a way to create a quote class?
I suspect that you'd do better with raw Proto, since the evaluation has nothing to do with normal C++ semantics.
I suppose you could also want to generate code for Phoenix-specific nodes.
participants (3)
-
Mathias Gaunard
-
paul Fultz
-
Steven Watanabe