Re: x3 semantic action and attribute transformation
Seth <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 08-03-17 10:35, Olaf Peter wrote:
> auto combine_to_uint = [](auto &ctx) {
> auto const &v = x3::_val(ctx);
> std::ostringstream ss;
> std::copy(v.begin(), v.end(), std::ostream_iterator<int>(ss, ""));
> uint int_ { 0 };
> x3::_pass(ctx) = x3::parse(ss.str().begin(), ss.str().end(),
> x3::uint_, int_);
> std::cout << int_ << '\n';
> x3::_attr(ctx) = int_;
> };
Here it seems you mainly confused `_attr` and `_val`. Avoid confusing
names like `int_`.
Here's your own sample "fixed" (I still think it's too complicated):
http://coliru.stacked-crooked.com/a/a6e053b5f552f766
------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford