Skip to content
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/ctre/evaluation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre

if (multiline_mode(f)) {
// TODO add support for different line ending and unicode (in a future unicode mode)
if (*current == '\n') return not_matched;
if (const auto c = *current; c == '\n' || c == '\r') return not_matched;
}
return evaluate(begin, ++current, last, consumed_something(f), captures, ctll::list<Tail...>());
}
Expand Down Expand Up @@ -170,7 +170,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (last == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*current == '\n' && std::next(current) == last) {
} else if (const auto c = *current; (c == '\n' || c == '\r') && std::next(current) == last) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand All @@ -188,7 +188,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (begin == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*std::prev(current) == '\n') {
} else if (const auto c = *std::prev(current); c == '\n' || c == '\r') {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand All @@ -206,7 +206,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (last == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*current == '\n') {
} else if (const auto c = *current; c == '\n' || c == '\r') {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand Down
8 changes: 4 additions & 4 deletions single-header/ctre-unicode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4407,7 +4407,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre

if (multiline_mode(f)) {
// TODO add support for different line ending and unicode (in a future unicode mode)
if (*current == '\n') return not_matched;
if (const auto c = *current; c == '\n' || c == '\r') return not_matched;
}
return evaluate(begin, ++current, last, consumed_something(f), captures, ctll::list<Tail...>());
}
Expand Down Expand Up @@ -4480,7 +4480,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (last == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*current == '\n' && std::next(current) == last) {
} else if (const auto c = *current; (c == '\n' || c == '\r') && std::next(current) == last) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand All @@ -4498,7 +4498,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (begin == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*std::prev(current) == '\n') {
} else if (const auto c = *std::prev(current); c == '\n' || c == '\r') {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand All @@ -4516,7 +4516,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (last == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*current == '\n') {
} else if (const auto c = *current; c == '\n' || c == '\r') {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand Down
8 changes: 4 additions & 4 deletions single-header/ctre.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4404,7 +4404,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre

if (multiline_mode(f)) {
// TODO add support for different line ending and unicode (in a future unicode mode)
if (*current == '\n') return not_matched;
if (const auto c = *current; c == '\n' || c == '\r') return not_matched;
}
return evaluate(begin, ++current, last, consumed_something(f), captures, ctll::list<Tail...>());
}
Expand Down Expand Up @@ -4477,7 +4477,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (last == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*current == '\n' && std::next(current) == last) {
} else if (const auto c = *current; (c == '\n' || c == '\r') && std::next(current) == last) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand All @@ -4495,7 +4495,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (begin == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*std::prev(current) == '\n') {
} else if (const auto c = *std::prev(current); c == '\n' || c == '\r') {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand All @@ -4513,7 +4513,7 @@ constexpr CTRE_FORCE_INLINE R evaluate(const BeginIterator begin, Iterator curre
if (multiline_mode(f)) {
if (last == current) {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else if (*current == '\n') {
} else if (const auto c = *current; c == '\n' || c == '\r') {
return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
} else {
return not_matched;
Expand Down