|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55973 - trunk/boost/spirit/home/lex/lexer/lexertl
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-02 05:57:03
Author: hkaiser
Date: 2009-09-02 05:57:03 EDT (Wed, 02 Sep 2009)
New Revision: 55973
URL: http://svn.boost.org/trac/boost/changeset/55973
Log:
Spirit: allow for mpl::vector<> instead of mpl::vector0<>
Text files modified:
trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp 2009-09-02 05:57:03 EDT (Wed, 02 Sep 2009)
@@ -274,7 +274,9 @@
template <typename IteratorPair, typename AttributeTypes>
struct token_value_type
: mpl::eval_if<
- is_same<AttributeTypes, mpl::vector0<> >
+ mpl::or_<
+ is_same<AttributeTypes, mpl::vector0<> >
+ , is_same<AttributeTypes, mpl::vector<> > >
, mpl::identity<IteratorPair>
, token_value_typesequence<IteratorPair, AttributeTypes> >
{};
@@ -423,7 +425,7 @@
}
}
- // This is called from the parse function of token_def if the token type
+ // These are called from the parse function of token_def if the token type
// has no special attribute type assigned
template <typename Attribute, typename Iterator, typename HasState>
inline void construct(Attribute& attr,
@@ -436,6 +438,18 @@
qi::detail::assign_to(t.value().begin(), t.value().end(), attr);
}
+ // same as above but using mpl::vector<> instead of mpl::vector0<>
+ template <typename Attribute, typename Iterator, typename HasState>
+ inline void construct(Attribute& attr,
+ token<Iterator, mpl::vector<>, HasState>& t)
+ {
+ // The default type returned by the token_def parser component (if it
+ // has no token value type assigned) is the pair of iterators to the
+ // matched character sequence.
+
+ qi::detail::assign_to(t.value().begin(), t.value().end(), attr);
+ }
+
// This is called from the parse function of token_def if the token type
// has been explicitly omitted (i.e. no attribute value is used), which
// essentially means that every attribute gets initialized using default
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk