[lex][boost 1.44] 2 oddities
Zach Laine <[email protected]> Wed, 17 Nov 2010 11:57:55 -0600
| Newsgroups | gmane.comp.parsers.spirit.devel |
|---|---|
| Message-ID | <[email protected]> |
I couldn't find anything about these on either Spirit list, but
apologies if I just missed it.
Oddity #1: There is a specialization of
assign_to_attribute_from_iterators<> for bool, in
home/qi/detail/construct.hpp:
template <typename Iterator>
struct assign_to_attribute_from_iterators<bool, Iterator>
{
static void
call(Iterator const& first, Iterator const& last, char& attr)
{ ... }
};
Notice that attr is a char&, not a bool&. Is this a cut-and-paste
error, or is it intentional? It has forced me to provide my own
specialization to get lex to automatically create a token_def<bool>:
template <>
struct assign_to_attribute_from_iterators<bool, my_iterator_type, void>
{
static void call(const GG::text_iterator& first, const
my_iterator_type& last, bool& attr)
{ ... }
};
Notice that I was forced to supply an iterator type so that my
specialization is a better fit. This means that I can't currently
define a lexer template that takes an Iterator parameter that "just
works" -- when my users change their choice of iterator, they have to
add a new full specialization of assign_to_attribute_from_iterators<>.
I've verified that this code is still in place on the release branch,
so presumably it will go out in 1.45.
Oddity #2: It seems that I have to define
assign_to_attribute_from_iterators<> for new types, even if I define a
semantic action that does the assignment. This further means that any
semantic action [_val = ...] is useless, because the conversion will
happen later and overwrite the token's value anyway, right?
Thanks,
Zach Laine
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev