@@ -1674,7 +1674,10 @@ public:
16741674 }
16751675};
16761676
1677- enum class _Rx_unwind_ops { _After_assert = _N_end + 1 };
1677+ enum class _Rx_unwind_ops {
1678+ _After_assert = _N_end + 1,
1679+ _After_neg_assert,
1680+ };
16781681
16791682template <class _BidIt>
16801683class _Rx_state_frame_t {
@@ -1807,7 +1810,6 @@ private:
18071810 void _Increase_stack_usage_count();
18081811 void _Decrease_stack_usage_count();
18091812
1810- bool _Do_neg_assert(_Node_assert*);
18111813 bool _Do_if(_Node_if*);
18121814 bool _Do_rep0(_Node_rep*, bool);
18131815 bool _Do_rep(_Node_rep*, bool, int);
@@ -3400,19 +3402,6 @@ void _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Decrease_stack_usage_cou
34003402 }
34013403}
34023404
3403- template <class _BidIt, class _Elem, class _RxTraits, class _It, class _Alloc>
3404- bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_neg_assert(_Node_assert* _Node) {
3405- // apply negative assert node
3406- const size_t _Frame_idx = _Push_frame();
3407- bool _Succeeded = !_Match_pat(_Node->_Child);
3408- if (_Succeeded) {
3409- const _Bt_state_t<_It>& _St = _Frames[_Frame_idx]._Match_state;
3410- _Tgt_state = _St;
3411- }
3412- _Pop_frame(_Frame_idx);
3413- return _Succeeded;
3414- }
3415-
34163405template <class _BidIt, class _Elem, class _RxTraits, class _It, class _Alloc>
34173406bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Do_if(_Node_if* _Node) { // apply if node
34183407 const size_t _Frame_idx = _Push_frame();
@@ -4130,7 +4119,11 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Match_pat(_Node_base* _N
41304119
41314120 case _N_neg_assert:
41324121 { // check negative assert
4133- _Failed = !_Do_neg_assert(static_cast<_Node_assert*>(_Nx));
4122+ auto _Node = static_cast<_Node_assert*>(_Nx);
4123+ _Push_frame(_Rx_unwind_ops::_After_neg_assert, _Node);
4124+ _Next = _Node->_Child;
4125+
4126+ _Increase_stack_usage_count();
41344127 break;
41354128 }
41364129
@@ -4256,6 +4249,18 @@ bool _Matcher3<_BidIt, _Elem, _RxTraits, _It, _Alloc>::_Match_pat(_Node_base* _N
42564249 break;
42574250 }
42584251
4252+ case _Rx_unwind_ops::_After_neg_assert:
4253+ { // negative assert completed
4254+ _Decrease_stack_usage_count();
4255+ if (_Failed) {
4256+ const _Bt_state_t<_It>& _St = _Frame._Match_state;
4257+ _Tgt_state = _St;
4258+ _Nx = _Frame._Node->_Next;
4259+ }
4260+ _Failed = !_Failed;
4261+ break;
4262+ }
4263+
42594264 default:
42604265#if _ITERATOR_DEBUG_LEVEL != 0
42614266 _STL_REPORT_ERROR("internal stack of regex matcher corrupted");
0 commit comments