Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow ascii symbols_parser to be matched against unicode chars #655

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/boost/spirit/home/x3/support/no_case.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace boost { namespace spirit { namespace x3
return set.test(ch);
}

template <typename Char>
int32_t operator()(Char lc, Char rc) const
template <typename Char, typename Char2>
int32_t operator()(Char lc, Char2 rc) const
{
return lc - rc;
}
Expand All @@ -50,8 +50,8 @@ namespace boost { namespace spirit { namespace x3
? Encoding::toupper(ch) : Encoding::tolower(ch));
}

template <typename Char>
int32_t operator()(Char lc_, Char const rc_) const
template <typename Char, typename Char2>
int32_t operator()(Char lc_, Char2 const rc_) const
{
using char_type = typename Encoding::classify_type;
auto lc = char_type(lc_);
Expand Down
10 changes: 10 additions & 0 deletions test/x3/symbols3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,15 @@ main()
BOOST_TEST(r == 3);
}

{ // unicode input | ascii symbols
using namespace boost::spirit;
symbols<int> foo = {{"a1", 1}, {"a2", 2}, {"a3", 3}};

int r;
BOOST_TEST((test_attr(U"a3", foo, r)));
std::cout << "r = " <<r << std::endl;
BOOST_TEST(r == 3);
}

return boost::report_errors();
}