Re: inconsistent parser behaviour

Seth <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 05-07-17 11:13, Philipp Schwaha wrote:
> Hi Guys,
>
> I encountered inconsistent behaviour when refactoring a parser.
> The extraction of the code is in the attachment and should be self
> contained.
>
> The essence is that I have a simple parser consisting of:
>  byte_(0xFF) >> byte_
> It behaves differently depending on if this is passed into the parse
> function inline or if it is returned via a function.
>
> such as:
> auto generate() -> decltype(byte_(0xFF) >> byte_) {
>   return (byte_(0xFF) >> byte_) ;
> }
This usage is not supported. You can probably "fix" it by mandating a
deep-copy of the proto expression:

     boost::proto::deep_copy(byte_(0xFF) >> byte_);

Be sure to alter the trailing return type accordingly.

See also:

 -
https://stackoverflow.com/questions/22023779/assigning-parsers-to-auto-variables/22027181
 -
https://stackoverflow.com/questions/31293443/inconsistent-behavior-of-boost-spirit-grammar?noredirect=1&lq=1

Regards

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.