Re: Tagging in X3
Larry Evans <[email protected]> Fri, 8 Jun 2018 05:35:05 -0500
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 06/08/2018 01:25 AM, Kent Hauser wrote:
> I am having a problem figuring out how to tag a rule attribute value
> when the parser definition has a different value.
>
> I have modified the `tag` method of the x3 error_handler to display the
> source (first, last) & type-name of the AST when tagging. With this
> modification & the following rules I am getting the following results:
>
> *** source ***
> struct _tag_ident : annotate_on_success {};
>
> auto const ident_p = lexeme[!digit >> +alphanum];
> auto const ident = rule<_tag_ident, ident_ref>{} = ident_p;
>
> *** result ***
>
> error_handler::tag: src = foo
> error_handler::tag: AST = boost::spirit::x3::unused_type
>
> **************
>
> I get identical results if I use the BOOST_SPIRIT_DEFINE macros. I also
> get identical results if I wrap the lexeme parser in x3::raw.
>
> I would have expected the x3::rule to assign parsed value to
> `ident_ref`` & tagged that.
>
> Any advise on how to get my desired result would be appreciated.
>
> Thanks. Kent
>
Could you please provide an attachment to a compilable .cpp file
or link to one?
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot