|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61320 - trunk/boost/spirit/home/karma/char
From: hartmut.kaiser_at_[hidden]
Date: 2010-04-16 14:00:34
Author: hkaiser
Date: 2010-04-16 14:00:33 EDT (Fri, 16 Apr 2010)
New Revision: 61320
URL: http://svn.boost.org/trac/boost/changeset/61320
Log:
Spirit: added single character syntax for character ranges for Karma as well
Text files modified:
trunk/boost/spirit/home/karma/char/char.hpp | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
Modified: trunk/boost/spirit/home/karma/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/char.hpp (original)
+++ trunk/boost/spirit/home/karma/char/char.hpp 2010-04-16 14:00:33 EDT (Fri, 16 Apr 2010)
@@ -478,6 +478,32 @@
}
};
+ template <typename CharEncoding, typename Modifiers, typename Char>
+ struct make_primitive<
+ terminal_ex<
+ tag::char_code<tag::char_, CharEncoding>
+ , fusion::vector2<Char(&)[2], Char(&)[2]> // For single char strings
+ >
+ , Modifiers>
+ {
+ static bool const lower =
+ has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+ static bool const upper =
+ has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+ typedef char_range<
+ typename spirit::detail::get_encoding_with_case<
+ Modifiers, CharEncoding, lower || upper>::type
+ , typename detail::get_casetag<Modifiers, lower || upper>::type
+ > result_type;
+
+ template <typename Terminal>
+ result_type operator()(Terminal const& term, unused_type) const
+ {
+ return result_type(fusion::at_c<0>(term.args)[0]
+ , fusion::at_c<1>(term.args)[0]);
+ }
+ };
}}} // namespace boost::spirit::karma
#endif
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