Tagging in X3

Kent Hauser <[email protected]> Thu, 7 Jun 2018 23:25:17 -0700
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <CADp_x2kMe593-+=C_FoJcGeXfZYCc3X1bPr1_E7HMzT1=Cr=1A@mail.gmail.com>
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general