diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2010-07-27 01:25:38 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2010-07-27 01:25:38 +0000 |
| commit | 5c679861560d1ac5323997d016ecfc89f3b33a8b (patch) | |
| tree | df6c5d566de2e23af5bc08c29a4fba0296acbfd9 /libcxx/src/regex.cpp | |
| parent | 86ac5d85a43a317710e888ee870cbeabca56d0c1 (diff) | |
A good start on ecma regex's. Maybe even feature complete, not sure yet. Also an unrelated fix to is_constructible thanks to Daniel Krugler.
llvm-svn: 109479
Diffstat (limited to 'libcxx/src/regex.cpp')
| -rw-r--r-- | libcxx/src/regex.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/libcxx/src/regex.cpp b/libcxx/src/regex.cpp index 9cc6eb543b2a..59591e037234 100644 --- a/libcxx/src/regex.cpp +++ b/libcxx/src/regex.cpp @@ -252,4 +252,62 @@ __get_classname(const char* s, bool __icase) return r; } +template <> +void +__match_any_but_newline<char>::__exec(__state& __s) const +{ + if (__s.__current_ != __s.__last_) + { + switch (*__s.__current_) + { + case '\r': + case '\n': + __s.__do_ = __state::__reject; + __s.__node_ = nullptr; + break; + default: + __s.__do_ = __state::__accept_and_consume; + ++__s.__current_; + __s.__node_ = this->first(); + break; + } + } + else + { + __s.__do_ = __state::__reject; + __s.__node_ = nullptr; + } +} + +template <> +void +__match_any_but_newline<wchar_t>::__exec(__state& __s) const +{ + if (__s.__current_ != __s.__last_) + { + switch (*__s.__current_) + { + case '\r': + case '\n': + case 0x2028: + case 0x2029: + __s.__do_ = __state::__reject; + __s.__node_ = nullptr; + break; + default: + __s.__do_ = __state::__accept_and_consume; + ++__s.__current_; + __s.__node_ = this->first(); + break; + } + } + else + { + __s.__do_ = __state::__reject; + __s.__node_ = nullptr; + } +} + + + _LIBCPP_END_NAMESPACE_STD |
