Currently when parsing basic and extended POSIX regular expressions
libc++ silently skips invalid escaped characters and trailing escapes.
This patch changes the behavior, so that a std::regex_error with code
set to error_escape is thrown in these cases.
The patch also extends the bad_escape test case to document the
expected behavior for commonly used escape sequences.
Details
- Reviewers
EricWF mclow.lists
Diff Detail
Event Timeline
include/regex | ||
---|---|---|
3465 | FWIW, I don't understand what's going on in this switch. | |
test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp | ||
60 | I would think about adding test cases here to document the intended behavior of
If these are already covered elsewhere in the suite, then never mind me. |
include/regex | ||
---|---|---|
3465 | Yes. As far as I understand, only extended POSIX regular expressions support alternation: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html, so "\\|" should be treated as error_escape |
include/regex | ||
---|---|---|
3492–3493 | Probably not, but we should throw an exception here as well. |
FWIW, I don't understand what's going on in this switch.
Is it intentional that '(' and '|' now take different paths here?