Fixed some bugs in the ecma bracket epression regarding escaped characters, and got the awk grammar going.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109599 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2010-07-28 17:35:27 +00:00
parent e9de5ff443
commit 15476f345d
3 changed files with 1845 additions and 24 deletions

View File

@@ -788,6 +788,21 @@ int main()
assert(m.position(0) == 6);
assert(m.str(0) == "Jeff");
}
{
std::cmatch m;
const char s[] = "5%k";
assert(std::regex_search(s, m, std::regex("\\d[\\W]k")));
assert(m.size() == 1);
assert(!m.prefix().matched);
assert(m.prefix().first == s);
assert(m.prefix().second == m[0].first);
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<char>::length(s));
assert(m.length(0) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
{
std::wcmatch m;
@@ -1552,4 +1567,19 @@ int main()
assert(m.position(0) == 6);
assert(m.str(0) == L"Jeff");
}
{
std::wcmatch m;
const wchar_t s[] = L"5%k";
assert(std::regex_search(s, m, std::wregex(L"\\d[\\W]k")));
assert(m.size() == 1);
assert(!m.prefix().matched);
assert(m.prefix().first == s);
assert(m.prefix().second == m[0].first);
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<wchar_t>::length(s));
assert(m.length(0) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
}