boostorg / spirit

Boost.org spirit module
http://boost.org/libs/spirit
393 stars 161 forks source link

X3.Docs: Typo (`error_handler_tag` instead of `position_cache_tag`) #667

Closed Garzet closed 3 years ago

Garzet commented 3 years ago

Hey, new user of spirit here. First, I must say that this is one of the most impressive libraries I've seen in my humble 5 years of programming. I've followed the tutorials, but I'm stuck on trying to implement X3 Program Structure on Annotations - Decorating the ASTs. Last section (Config) briefly mentions how this should be done, but the jump from the context definition:

using context_type = x3::phrase_parse_context<x3::ascii::space_type>::type;

to

using phrase_context_type = x3::phrase_parse_context<x3::ascii::space_type>::type;

typedef x3::context<error_handler_tag,
       std::reference_wrapper<position_cache>,
       phrase_context_type>
context_type;

is not explained. error_handler_tag is not explained and simply declaring a class results in an error where x3::get<position_cache_tag>(context).get() does not compile since the function expects 1 argument. A novice user like myself might get confused here and get stuck unable to resolve the error.

Thank you for any help and keep up the good spirit :)

Kojoley commented 3 years ago

error_handler_tag is not explained

The error_handler_tag is explained later in https://www.boost.org/doc/libs/1_76_0/libs/spirit/doc/x3/html/spirit_x3/tutorials/error_handling.html, but actually I am pretty sure it is a typo in the annotations documentation, it should be position_cache_tag instead.