|
Boost-Commit : |
From: joel_at_[hidden]
Date: 2008-04-20 04:27:25
Author: djowel
Date: 2008-04-20 04:27:25 EDT (Sun, 20 Apr 2008)
New Revision: 44610
URL: http://svn.boost.org/trac/boost/changeset/44610
Log:
various fixes
Text files modified:
trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp | 31 +++++++++++++-----------
trunk/boost/spirit/home/qi/char/char.hpp | 50 ++++++++++++++++++++++++++++------------
2 files changed, 52 insertions(+), 29 deletions(-)
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp 2008-04-20 04:27:25 EDT (Sun, 20 Apr 2008)
@@ -31,30 +31,33 @@
// wrap phoenix actor, make sure first argument is a fusion sequence
template <typename Eval>
- static void phoenix_action(phoenix::actor<Eval> const& f,
+ static void phoenix_action(phoenix::actor<Eval> const& f,
Attribute const& attr, std::size_t id, bool& pass, Context& ctx)
{
f(spirit::detail::pass_value<Attribute const>::call(attr), id, pass, ctx);
}
-
+
template <typename Eval>
static FunctionType call(phoenix::actor<Eval> const& f)
{
-// using phoenix::arg_names::arg1;
-// using phoenix::arg_names::arg2;
-// using phoenix::arg_names::arg3;
-// using phoenix::arg_names::arg4;
-//
-// return phoenix::bind(
-// &wrap_action::phoenix_action<Eval>, f, arg1, arg2, arg3, arg4);
+ using phoenix::arg_names::arg1;
+ using phoenix::arg_names::arg2;
+ using phoenix::arg_names::arg3;
+ using phoenix::arg_names::arg4;
+
+ void (*pf)(phoenix::actor<Eval> const&,
+ Attribute const&, std::size_t, bool&, Context&) =
+ &wrap_action::phoenix_action;
+
+ return phoenix::bind(pf, f, arg1, arg2, arg3, arg4);
- return boost::bind(
- &wrap_action::phoenix_action<Eval>, f, _1, _2, _3, _4);
+ //~ return boost::bind(
+ //~ &wrap_action::phoenix_action<Eval>, f, _1, _2, _3, _4);
}
// semantic actions with 3 arguments
template <typename F>
- static void arg3_action(F* f, Attribute const& attr,
+ static void arg3_action(F* f, Attribute const& attr,
std::size_t id, bool& pass, Context&)
{
f(attr, id, pass);
@@ -73,7 +76,7 @@
// semantic actions with 2 arguments
template <typename F>
- static void arg2_action(F* f, Attribute const& attr,
+ static void arg2_action(F* f, Attribute const& attr,
std::size_t id, bool&, Context&)
{
f(attr, id);
@@ -91,7 +94,7 @@
// semantic actions with 1 argument
template <typename F>
- static void arg1_action(F* f, Attribute const& attr,
+ static void arg1_action(F* f, Attribute const& attr,
std::size_t, bool&, Context&)
{
f(attr);
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 2008-04-20 04:27:25 EDT (Sun, 20 Apr 2008)
@@ -52,24 +52,20 @@
typedef unused_type type; // literal parsers have no attribute
};
- template <typename Char_, typename CharParam>
- static bool test_impl(Char_ ch, CharParam param)
+ static Char get_char(Char ch)
{
- // tests plain chars
- return ch == param;
+ return ch;
}
- template <typename Char_, typename CharParam>
- static bool test_impl(Char_ const* ch, CharParam param)
+ static Char get_char(Char const* str)
{
- // tests single char null terminated strings
- return *ch == param;
+ return *str;
}
template <typename Component, typename CharParam, typename Context>
static bool test(Component const& component, CharParam ch, Context&)
{
- return test_impl(fusion::at_c<0>(component.elements), ch);
+ return get_char(fusion::at_c<0>(component.elements)) == ch;
}
template <typename Component>
@@ -77,7 +73,7 @@
{
return std::string("'")
+ spirit::detail::to_narrow_char(
- fusion::at_c<0>(component.elements))
+ get_char(fusion::at_c<0>(component.elements)))
+ '\'';
}
};
@@ -204,11 +200,21 @@
typedef unused_type type; // literal parsers have no attribute
};
+ static Char get_char(Char ch)
+ {
+ return ch;
+ }
+
+ static Char get_char(Char const* str)
+ {
+ return *str;
+ }
+
template <typename Component, typename CharParam, typename Context>
static bool test(Component const& component, CharParam ch, Context&)
{
- return fusion::at_c<0>(component.elements) == ch
- || fusion::at_c<1>(component.elements) == ch
+ return get_char(fusion::at_c<0>(component.elements)) == ch
+ || get_char(fusion::at_c<1>(component.elements)) == ch
;
}
@@ -216,9 +222,13 @@
static std::string what(Component const& component)
{
std::string result;
- result += std::string("'") + fusion::at_c<0>(component.elements) + '\'';
+ result += std::string("'")
+ + spirit::detail::to_narrow_char(
+ get_char(fusion::at_c<0>(component.elements))) + '\'';
result += " or ";
- result += std::string("'") + fusion::at_c<1>(component.elements) + '\'';
+ result += std::string("'") +
+ spirit::detail::to_narrow_char(
+ get_char(fusion::at_c<1>(component.elements))) + '\'';
return result;
}
};
@@ -321,12 +331,22 @@
component<qi::domain, qi::no_case_literal_char<Char>, vector_type>
type;
+ static Char get_char(Char ch)
+ {
+ return ch;
+ }
+
+ static Char get_char(Char const* str)
+ {
+ return *str;
+ }
+
static type
call(Elements const& elements)
{
typedef typename Modifier::char_set char_set;
- Char ch = fusion::at_c<0>(elements);
+ Char ch = get_char(fusion::at_c<0>(elements));
vector_type v(
char_set::tolower(ch)
, char_set::toupper(ch)
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