|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61318 - trunk/boost/spirit/home/qi/char
From: hartmut.kaiser_at_[hidden]
Date: 2010-04-16 13:55:30
Author: hkaiser
Date: 2010-04-16 13:55:29 EDT (Fri, 16 Apr 2010)
New Revision: 61318
URL: http://svn.boost.org/trac/boost/changeset/61318
Log:
Spirit: added single character syntax for character ranges
Text files modified:
trunk/boost/spirit/home/qi/char/char.hpp | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
Modified: trunk/boost/spirit/home/qi/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/char.hpp (original)
+++ trunk/boost/spirit/home/qi/char/char.hpp 2010-04-16 13:55:29 EDT (Fri, 16 Apr 2010)
@@ -534,6 +534,33 @@
);
}
};
+
+ 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 no_case =
+ has_modifier<Modifiers, tag::char_code_base<tag::no_case> >::value;
+
+ typedef typename
+ spirit::detail::get_encoding<Modifiers, CharEncoding>::type
+ char_encoding;
+
+ typedef char_range<char_encoding, no_case> 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]
+ );
+ }
+ };
}}}
#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