STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
_Matcher< _BidIt, _Elem, _RxTraits, _It > Class Template Reference

Public Member Functions

 _Matcher (_It _Pfirst, _It _Plast, const _RxTraits &_Tr, _Root_node *_Re, unsigned int _Nx, regex_constants::syntax_option_type _Sf, regex_constants::match_flag_type _Mf)
 
void _Setf (regex_constants::match_flag_type _Mf)
 
void _Clearf (regex_constants::match_flag_type _Mf)
 
template<class _Alloc >
bool _Match (_It _Pfirst, match_results< _BidIt, _Alloc > *_Matches, bool _Full_match)
 
template<class _Alloc >
bool _Match (match_results< _BidIt, _Alloc > *_Matches, bool _Full_match)
 
_BidIt _Skip (_BidIt, _BidIt, _Node_base *=0)
 

Private Member Functions

bool _Do_if (_Node_if *)
 
bool _Do_rep0 (_Node_rep *, bool)
 
bool _Do_rep (_Node_rep *, bool, int)
 
bool _Is_wc (_It, int)
 
bool _Do_class (_Node_base *)
 
bool _Match_pat (_Node_base *)
 
bool _Better_match ()
 
unsigned int _Get_ncap () const
 
_Matcheroperator= (const _Matcher &)
 

Private Attributes

_Tgt_state_t< _It > _Tgt_state
 
_Tgt_state_t< _It > _Res
 
vector< _Loop_vals_t_Loop_vals
 
_It _Begin
 
_It _End
 
_It _First
 
_Node_base_Rep
 
regex_constants::syntax_option_type _Sflags
 
regex_constants::match_flag_type _Mflags
 
bool _Matched
 
bool _Cap
 
int _Ncap
 
bool _Longest
 
const _RxTraits & _Traits
 
bool _Full
 
long _Max_complexity_count
 
long _Max_stack_count
 

Constructor & Destructor Documentation

template<class _BidIt , class _Elem , class _RxTraits , class _It >
_Matcher< _BidIt, _Elem, _RxTraits, _It >::_Matcher ( _It  _Pfirst,
_It  _Plast,
const _RxTraits &  _Tr,
_Root_node _Re,
unsigned int  _Nx,
regex_constants::syntax_option_type  _Sf,
regex_constants::match_flag_type  _Mf 
)
inline
2007  : _First(_Pfirst), _End(_Plast), _Traits(_Tr), _Rep(_Re),
2008  _Sflags(_Sf), _Mflags(_Mf), _Matched(false),
2009  _Ncap(static_cast<int>(_Nx)),
2010  _Longest((_Re->_Flags & _Fl_longest)
2011  && !(_Mf & regex_constants::match_any))
2012  { // construct
2013  _Loop_vals.resize(_Re->_Loops);
2015  }
void resize(size_type _Newsize)
Definition: vector:1132
_Node_base * _Rep
Definition: regex:2115
_RanIt _Plast
Definition: algorithm:2577
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
const _RxTraits & _Traits
Definition: regex:2122
regex_constants::match_flag_type _Mflags
Definition: regex:2117
_It _End
Definition: regex:2113
Definition: regex:1493
bool _Longest
Definition: regex:2121
regex_constants::syntax_option_type _Sflags
Definition: regex:2116
Definition: regex:123
_RanIt _Pfirst
Definition: algorithm:2576
bool _Matched
Definition: regex:2118
vector< _Loop_vals_t > _Loop_vals
Definition: regex:2100
int _Ncap
Definition: regex:2120
_Node_flags _Flags
Definition: regex:1660
_It _First
Definition: regex:2114
unsigned int _Loops
Definition: regex:1695

Member Function Documentation

template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Better_match ( )
inlineprivate
4487  { // check for better match under UNIX rules
4488  for (unsigned int _Ix = 0; _Ix < _Get_ncap(); ++_Ix)
4489  { // check each capture group
4490  if (!_Res._Grp_valid[_Ix] || !_Tgt_state._Grp_valid[_Ix])
4491  ;
4492  else if (_Res._Grps[_Ix]._Begin
4493  != _Tgt_state._Grps[_Ix]._Begin)
4494  return (_STD distance(_Begin, _Res._Grps[_Ix]._Begin)
4495  < _STD distance(_Begin, _Tgt_state._Grps[_Ix]._Begin));
4496  else if (_Res._Grps[_Ix]._End
4497  != _Tgt_state._Grps[_Ix]._End)
4498  return (_STD distance(_Begin, _Res._Grps[_Ix]._End)
4499  < _STD distance(_Begin, _Tgt_state._Grps[_Ix]._End));
4500  }
4501  return (false);
4502  }
_It _Begin
Definition: regex:2112
vector< bool > _Grp_valid
Definition: regex:1972
vector< _Grp_t > _Grps
Definition: regex:1987
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2098
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
unsigned int _Get_ncap() const
Definition: regex:4508
_Tgt_state_t< _It > _Res
Definition: regex:2099
template<class _BidIt , class _Elem , class _RxTraits , class _It >
void _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Clearf ( regex_constants::match_flag_type  _Mf)
inline
2023  { // clear specified flags
2024  _Mflags &= ~_Mf;
2025  }
regex_constants::match_flag_type _Mflags
Definition: regex:2117
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Do_class ( _Node_base _Nx)
inlineprivate
4437  { // apply bracket expression
4438  bool _Found;
4439  typename _RxTraits::_Uelem _Ch = *_Tgt_state._Cur;
4441  _Ch = _Traits.translate_nocase(_Ch);
4442  _It _Res0 = _Tgt_state._Cur;
4443  ++_Res0;
4444  _It _Resx;
4447  if (_Node->_Coll
4448  && (_Resx = _Lookup_coll(_Tgt_state._Cur, _End, _Node->_Coll))
4449  != _Tgt_state._Cur)
4450  { // check for collation element
4451  _Res0 = _Resx;
4452  _Found = true;
4453  }
4454  else if (_Node->_Ranges
4455  && (_Lookup_range((typename _RxTraits::_Uelem)
4457  ? _Traits.translate(_Ch)
4458  : _Ch), _Node->_Ranges)))
4459  _Found = true;
4460  else if (_Ch < _Bmp_max)
4461  _Found = _Node->_Small && _Node->_Small->_Find(_Ch);
4462  else if (_Node->_Large
4463  && _STD find(_Node->_Large->_Str(),
4464  _Node->_Large->_Str() + _Node->_Large->_Size(), _Ch)
4465  != _Node->_Large->_Str() + _Node->_Large->_Size())
4466  _Found = true;
4467  else if (_Node->_Classes != 0 && _Traits.isctype(_Ch, _Node->_Classes))
4468  _Found = true;
4469  else if (_Node->_Equiv && _Lookup_equiv(_Ch, _Node->_Equiv, _Traits))
4470  _Found = true;
4471  else
4472  _Found = false;
4473  if (_Found == (_Node->_Flags & _Fl_negate))
4474  return (false);
4475  else
4476  { // record result
4477  _Tgt_state._Cur = _Res0;
4478  return (true);
4479  }
4480  }
_BidIt _Cur
Definition: regex:1971
Definition: regex:1774
bool _Lookup_equiv(typename _RxTraits::_Uelem _Ch, const _Sequence< _Elem > *_Eq, const _RxTraits &_Traits)
Definition: regex:4387
const _RxTraits & _Traits
Definition: regex:2122
_It _End
Definition: regex:2113
Definition: regex:1490
_Sequence< _Elem > * _Equiv
Definition: regex:1808
regex_constants::syntax_option_type _Sflags
Definition: regex:2116
_Sequence< _Elem > * _Coll
Definition: regex:1803
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2098
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_Buf< _Elem > * _Ranges
Definition: regex:1806
bool _Find(_Elem _Ch) const
Definition: regex:1625
_BidIt _Lookup_coll(_BidIt _First, _BidIt _Last, const _Sequence< _Elem > *_Eq)
Definition: regex:4410
_Bitmap * _Small
Definition: regex:1804
Definition: regex:108
_RxTraits::char_class_type _Classes
Definition: regex:1807
_Node_flags _Flags
Definition: regex:1660
Definition: regex:111
_Buf< _Elem > * _Large
Definition: regex:1805
const unsigned int _Bmp_max
Definition: regex:1478
bool _Lookup_range(unsigned int _Ch, const _Buf< _Elem > *_Bufptr)
Definition: regex:4373
_InIt find(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3282
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Do_if ( _Node_if _Node)
inlineprivate
4139  { // apply if node
4141 
4142  // look for the first match
4143  for (; _Node; _Node = _Node->_Child)
4144  { // process one branch of if
4145  _Tgt_state = _St; // rewind to where the alternation starts in input
4146  if (_Match_pat(_Node->_Next)) // try to match this branch
4147  break;
4148  }
4149 
4150  // if none of the if branches matched, fail to match
4151  if (!_Node)
4152  return (false);
4153 
4154  // if we aren't looking for the longest match, that's it
4155  if (!_Longest)
4156  return (true);
4157 
4158  // see if there is a longer match
4159  _Tgt_state_t<_It> _Final = _Tgt_state;
4160  size_t _Final_len = _STD distance(_St._Cur, _Tgt_state._Cur);
4161  for (;;)
4162  { // process one branch of if
4163  _Node = _Node->_Child;
4164  if (!_Node)
4165  break;
4166 
4167  _Tgt_state = _St;
4168  if (_Match_pat(_Node->_Next))
4169  { // record match if it is longer
4170  size_t _Len = _STD distance(_St._Cur, _Tgt_state._Cur);
4171  if (_Final_len < _Len)
4172  { // memorize longest so far
4173  _Final = _Tgt_state;
4174  _Final_len = _Len;
4175  }
4176  }
4177  }
4178 
4179  // set the input end to the longest match
4180  _Tgt_state = _Final;
4181  return (true);
4182  }
_BidIt _Cur
Definition: regex:1971
_Node_base * _Next
Definition: regex:1661
bool _Longest
Definition: regex:2121
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2098
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
bool _Match_pat(_Node_base *)
Definition: regex:4517
_Node_if * _Child
Definition: regex:1845
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Do_rep ( _Node_rep _Node,
bool  _Greedy,
int  _Init_idx 
)
inlineprivate
4253  { // apply repetition
4254  if (_Node->_Simple_loop == 1)
4255  return (_Do_rep0(_Node, _Greedy));
4256 
4257  bool _Matched0 = false;
4259  _Loop_vals_t *_Psav = &_Loop_vals[_Node->_Loop_number];
4260  int _Loop_idx_sav = _Psav->_Loop_idx;
4261  _It *_Loop_iter_sav = (_It *)_Psav->_Loop_iter;
4262  _It _Cur_iter = _Tgt_state._Cur;
4263 
4264  bool _Progress = _Init_idx == 0 || *_Loop_iter_sav != _Cur_iter;
4265 
4266  if (0 <= _Node->_Max && _Node->_Max <= _Init_idx)
4267  _Matched0 = _Match_pat(_Node->_End_rep->_Next); // reps done, try tail
4268  else if (_Init_idx < _Node->_Min)
4269  { // try a required rep
4270  if (!_Progress)
4271  _Matched0 = _Match_pat(_Node->_End_rep->_Next); // empty, try tail
4272  else
4273  { // try another required match
4274  _Psav->_Loop_idx = _Init_idx + 1;
4275  _Psav->_Loop_iter = &_Cur_iter;
4276  _Matched0 = _Match_pat(_Node->_Next);
4277  }
4278  }
4279  else if (!_Greedy)
4280  { // not greedy, favor minimum number of reps
4281  _Matched0 = _Match_pat(_Node->_End_rep->_Next);
4282  if (!_Matched0 && _Progress)
4283  { // tail failed, try another rep
4284  _Tgt_state = _St;
4285  _Psav->_Loop_idx = _Init_idx + 1;
4286  _Psav->_Loop_iter = &_Cur_iter;
4287  _Matched0 = _Match_pat(_Node->_Next);
4288  }
4289  }
4290  else
4291  { // greedy, favor maximum number of reps
4292  if (_Progress)
4293  { // try another rep
4294  _Psav->_Loop_idx = _Init_idx + 1;
4295  _Psav->_Loop_iter = &_Cur_iter;
4296  _Matched0 = _Match_pat(_Node->_Next);
4297  }
4298  if (!_Progress && 1 < _Init_idx)
4299  ;
4300  else if (!_Matched0)
4301  { // rep failed, try tail
4302  _Psav->_Loop_idx = _Loop_idx_sav;
4303  _Psav->_Loop_iter = _Loop_iter_sav;
4304  _Tgt_state = _St;
4305  _Matched0 = _Match_pat(_Node->_End_rep->_Next);
4306  }
4307  }
4308 
4309  if (!_Matched0)
4310  _Tgt_state = _St;
4311  _Psav->_Loop_idx = _Loop_idx_sav;
4312  _Psav->_Loop_iter = _Loop_iter_sav;
4313  return (_Matched0);
4314  }
_BidIt _Cur
Definition: regex:1971
_Node_base * _Next
Definition: regex:1661
const int _Max
Definition: regex:1891
unsigned int _Loop_number
Definition: regex:1893
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2098
int _Loop_idx
Definition: regex:1870
vector< _Loop_vals_t > _Loop_vals
Definition: regex:2100
bool _Match_pat(_Node_base *)
Definition: regex:4517
int _Simple_loop
Definition: regex:1894
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:399
Definition: regex:1868
void * _Loop_iter
Definition: regex:1871
bool _Do_rep0(_Node_rep *, bool)
Definition: regex:4188
_Node_end_rep * _End_rep
Definition: regex:1892
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Do_rep0 ( _Node_rep _Node,
bool  _Greedy 
)
inlineprivate
4190  { // apply repetition to loop with no nested if/do
4191  int _Ix = 0;
4193 
4194  for (; _Ix < _Node->_Min; ++_Ix)
4195  { // do minimum number of reps
4196  _It _Cur = _Tgt_state._Cur;
4197  if (!_Match_pat(_Node->_Next))
4198  { // didn't match minimum number of reps, fail
4199  _Tgt_state = _St;
4200  return (false);
4201  }
4202  else if (_Cur == _Tgt_state._Cur)
4203  _Ix = _Node->_Min - 1; // skip matches that don't change state
4204  }
4205 
4206  _Tgt_state_t<_It> _Final = _Tgt_state;
4207  bool _Matched0 = false;
4208  _It _Saved_pos = _Tgt_state._Cur;
4209 
4210  if (!_Match_pat(_Node->_End_rep->_Next))
4211  ; // no full match yet
4212  else if (!_Greedy)
4213  return (true); // go with current match
4214  else
4215  { // record an acceptable match and continue
4216  _Final = _Tgt_state;
4217  _Matched0 = true;
4218  }
4219 
4220  while (_Node->_Max == -1 || _Ix++ < _Node->_Max)
4221  { // try another rep/tail match
4222  _Tgt_state._Cur = _Saved_pos;
4224  if (!_Match_pat(_Node->_Next))
4225  break; // rep match failed, quit loop
4226 
4227  _It _Mid = _Tgt_state._Cur;
4228  if (!_Match_pat(_Node->_End_rep->_Next))
4229  ; // tail match failed, continue
4230  else if (!_Greedy)
4231  return (true); // go with current match
4232  else
4233  { // record match and continue
4234  _Final = _Tgt_state;
4235  _Matched0 = true;
4236  }
4237 
4238  if (_Saved_pos == _Mid)
4239  break; // rep match ate no additional elements, quit loop
4240  _Saved_pos = _Mid;
4241  }
4242 
4243  _Tgt_state = _Matched0 ? _Final : _St;
4244  return (_Matched0);
4245  }
_BidIt _Cur
Definition: regex:1971
_Node_base * _Next
Definition: regex:1661
const int _Max
Definition: regex:1891
vector< bool > _Grp_valid
Definition: regex:1972
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2098
const int _Min
Definition: regex:1890
bool _Match_pat(_Node_base *)
Definition: regex:4517
_Node_end_rep * _End_rep
Definition: regex:1892
template<class _BidIt , class _Elem , class _RxTraits , class _It >
unsigned int _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Get_ncap ( ) const
inlineprivate
4509  {
4510  return (static_cast<unsigned int>(_Ncap));
4511  }
int _Ncap
Definition: regex:2120
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Is_wc ( _It  _Ch0,
int  _Offset 
)
inlineprivate
4322  { // check for word boundary
4323  if ((_Offset == -1
4324  && _Ch0 == _Begin
4326  || (_Offset == 0 && _Ch0 == _End))
4327  return (false);
4328  else
4329  { // test for word char
4330  _Elem _Ch = (_Offset ? *--_Ch0 : *_Ch0);
4331 
4332  return (_Ch == (char)_Ch // assume L'x' == 'x'
4333  && _CSTD strchr("abcdefghijklmnopqrstuvwxyz"
4334  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
4335  "0123456789_", _Ch) != 0);
4336  }
4337  }
regex_constants::match_flag_type _Mflags
Definition: regex:2117
_It _End
Definition: regex:2113
_It _Begin
Definition: regex:2112
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_Check_return_ _VCRTIMP char _CONST_RETURN *__cdecl strchr(_In_z_ char const *_Str, _In_ int _Val)
#define _CSTD
Definition: yvals.h:570
template<class _BidIt , class _Elem , class _RxTraits , class _It >
template<class _Alloc >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Match ( _It  _Pfirst,
match_results< _BidIt, _Alloc > *  _Matches,
bool  _Full_match 
)
inline
2031  { // try to match
2032  _First = _Pfirst;
2033  return (_Match(_Matches, _Full_match));
2034  }
_RanIt _Pfirst
Definition: algorithm:2576
_It _First
Definition: regex:2114
bool _Match(_It _Pfirst, match_results< _BidIt, _Alloc > *_Matches, bool _Full_match)
Definition: regex:2028
template<class _BidIt , class _Elem , class _RxTraits , class _It >
template<class _Alloc >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Match ( match_results< _BidIt, _Alloc > *  _Matches,
bool  _Full_match 
)
inline
2039  { // try to match
2040  if (_Matches)
2041  { // clear _Matches before doing work
2042  _Matches->_Ready = true;
2043  _Matches->_Resize(0);
2044  }
2045 
2046  _Begin = _First;
2049  _Tgt_state._Grps.resize(_Get_ncap());
2050  _Cap = _Matches != 0;
2051  _Full = _Full_match;
2054 
2055  _Matched = false;
2056 
2057  if (!_Match_pat(_Rep))
2058  return (false);
2059 
2060  if (_Matches)
2061  { // copy results to _Matches
2062  _Matches->_Resize(_Get_ncap());
2063  for (unsigned int _Idx = 0; _Idx < _Get_ncap(); ++_Idx)
2064  { // copy submatch _Idx
2065  if (_Res._Grp_valid[_Idx])
2066  { // copy successful match
2067  _Matches->_At(_Idx).matched = true;
2068  _Matches->_At(_Idx).first = _Res._Grps[_Idx]._Begin;
2069  _Matches->_At(_Idx).second = _Res._Grps[_Idx]._End;
2070  }
2071  else
2072  { // copy failed match
2073  _Matches->_At(_Idx).matched = false;
2074  _Matches->_At(_Idx).first = _End;
2075  _Matches->_At(_Idx).second = _End;
2076  }
2077  }
2078  _Matches->_Org = _Begin;
2079  _Matches->_Pfx().first = _Begin;
2080  _Matches->_Pfx().second = _Matches->_At(0).first;
2081  _Matches->_Pfx().matched =
2082  _Matches->_Pfx().first != _Matches->_Pfx().second;
2083 
2084  _Matches->_Sfx().first = _Matches->_At(0).second;
2085  _Matches->_Sfx().second = _End;
2086  _Matches->_Sfx().matched =
2087  _Matches->_Sfx().first != _Matches->_Sfx().second;
2088 
2089  _Matches->_Null().first = _End;
2090  _Matches->_Null().second = _End;
2091  }
2092  return (true);
2093  }
void resize(size_type _Newsize)
Definition: vector:1132
_Ty2 second
Definition: utility:243
_Node_base * _Rep
Definition: regex:2115
bool _Cap
Definition: regex:2119
_BidIt _Org
Definition: regex:1436
_BidIt _Cur
Definition: regex:1971
_It _End
Definition: regex:2113
bool matched
Definition: regex:643
_It _Begin
Definition: regex:2112
vector< bool > _Grp_valid
Definition: regex:1972
vector< _Grp_t > _Grps
Definition: regex:1987
_Elem & _Null()
Definition: regex:1421
bool _Full
Definition: regex:2123
bool _Matched
Definition: regex:2118
#define _REGEX_MAX_STACK_COUNT
Definition: regex:36
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2098
_Ty1 first
Definition: utility:242
_Elem & _At(unsigned int _Sub)
Definition: regex:1426
unsigned int _Get_ncap() const
Definition: regex:4508
#define _REGEX_MAX_COMPLEXITY_COUNT
Definition: regex:29
_Tgt_state_t< _It > _Res
Definition: regex:2099
bool _Match_pat(_Node_base *)
Definition: regex:4517
_Elem & _Pfx()
Definition: regex:1411
void _Resize(unsigned int _Nx)
Definition: regex:1406
_It _First
Definition: regex:2114
long _Max_stack_count
Definition: regex:2125
bool _Ready
Definition: regex:1437
_Elem & _Sfx()
Definition: regex:1416
long _Max_complexity_count
Definition: regex:2124
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Match_pat ( _Node_base _Nx)
inlineprivate
4519  { // check for match
4520  if (0 < _Max_stack_count && --_Max_stack_count <= 0)
4522  if (0 < _Max_complexity_count && --_Max_complexity_count <= 0)
4524 
4525  bool _Failed = false;
4526  while (_Nx != 0)
4527  { // match current node
4528  switch (_Nx->_Kind)
4529  { // handle current node's type
4530  case _N_nop:
4531  break;
4532 
4533  case _N_bol:
4537  _Failed = true;
4539  || _Tgt_state._Cur != _Begin)
4540  { // check for preceding newline
4541  _It _Tmp = _Tgt_state._Cur;
4542  _Failed = *--_Tmp != _Meta_nl;
4543  }
4544  break;
4545 
4546  case _N_eol:
4548  || (_Tgt_state._Cur != _End
4549  && *_Tgt_state._Cur != _Meta_nl))
4550  _Failed = true;
4551  break;
4552 
4553  case _N_wbound:
4554  { // check for word boundary
4555  bool _Is_bound;
4557  && _Tgt_state._Cur == _Begin)
4559  && _Tgt_state._Cur == _End))
4560  _Is_bound = false;
4561  else
4562  _Is_bound = _Is_wc(_Tgt_state._Cur, -1)
4563  != _Is_wc(_Tgt_state._Cur, 0);
4564  bool _Neg = (_Nx->_Flags & _Fl_negate) != 0;
4565  if (_Is_bound == _Neg)
4566  _Failed = true;
4567  break;
4568  }
4569 
4570  case _N_dot:
4571  if (_Tgt_state._Cur == _End
4572  || *_Tgt_state._Cur == _Meta_nl
4573  || *_Tgt_state._Cur == _Meta_cr)
4574  _Failed = true;
4575  else
4576  ++_Tgt_state._Cur;
4577  break;
4578 
4579  case _N_str:
4580  { // check for string match
4581  _Node_str<_Elem> *_Node = (_Node_str<_Elem> *)_Nx;
4582  _It _Res0;
4583  if ((_Res0 = _Compare(_Tgt_state._Cur, _End,
4584  _Node->_Data._Str(),
4585  _Node->_Data._Str() + _Node->_Data._Size(),
4586  _Traits, _Sflags))
4587  != _Tgt_state._Cur)
4588  _Tgt_state._Cur = _Res0;
4589  else
4590  _Failed = true;
4591  break;
4592  }
4593 
4594  case _N_class:
4595  { // check for bracket expression match
4596  _Failed = _Tgt_state._Cur == _End
4597  || !_Do_class(_Nx);
4598  break;
4599  }
4600 
4601  case _N_group:
4602  break;
4603 
4604  case _N_end_group:
4605  break;
4606 
4607  case _N_neg_assert:
4608  case _N_assert:
4609  { // check assert
4610  _It _Ch = _Tgt_state._Cur;
4611  bool _Neg = _Nx->_Kind == _N_neg_assert;
4613  if (_Match_pat(((_Node_assert *)_Nx)->_Child) == _Neg)
4614  { // restore initial state and indicate failure
4615  _Tgt_state = _St;
4616  _Failed = true;
4617  }
4618  else
4619  _Tgt_state._Cur = _Ch;
4620  break;
4621  }
4622 
4623  case _N_end_assert:
4624  _Nx = 0;
4625  break;
4626 
4627  case _N_capture:
4628  { // record current position
4629  _Node_capture *_Node = (_Node_capture *)_Nx;
4630  _Tgt_state._Grps[_Node->_Idx]._Begin = _Tgt_state._Cur;
4631  for (size_t _Idx = _Tgt_state._Grp_valid.size();
4632  _Node->_Idx < _Idx; )
4633  _Tgt_state._Grp_valid[--_Idx] = false;
4634  break;
4635  }
4636 
4637  case _N_end_capture:
4638  { // record successful capture
4639  _Node_end_group *_Node = (_Node_end_group *)_Nx;
4640  _Node_capture *_Node0 = (_Node_capture *)_Node->_Back;
4641  if (_Cap || _Node0->_Idx != 0)
4642  { // update capture data
4643  _Tgt_state._Grp_valid[_Node0->_Idx] = true;
4644  _Tgt_state._Grps[_Node0->_Idx]._End = _Tgt_state._Cur;
4645  }
4646  break;
4647  }
4648 
4649  case _N_back:
4650  { // check back reference
4651  _Node_back *_Node = (_Node_back *)_Nx;
4652  if (_Tgt_state._Grp_valid[_Node->_Idx])
4653  { // check for match
4654  _It _Res0 = _Tgt_state._Cur;
4655  _It _Bx = _Tgt_state._Grps[_Node->_Idx]._Begin;
4656  _It _Ex = _Tgt_state._Grps[_Node->_Idx]._End;
4657  if (_Bx != _Ex // _Bx == _Ex for zero-length match
4658  && (_Res0 = _Compare(_Tgt_state._Cur, _End,
4659  _Bx, _Ex, _Traits, _Sflags))
4660  == _Tgt_state._Cur)
4661  _Failed = true;
4662  else
4663  _Tgt_state._Cur = _Res0;
4664  }
4665  break;
4666  }
4667 
4668  case _N_if:
4669  if (!_Do_if((_Node_if *)_Nx))
4670  _Failed = true;
4671  _Nx = 0;
4672  break;
4673 
4674  case _N_endif:
4675  break;
4676 
4677  case _N_rep:
4678  if (!_Do_rep((_Node_rep *)_Nx,
4679  (_Nx->_Flags & _Fl_greedy) != 0, 0))
4680  _Failed = true;
4681  _Nx = 0;
4682  break;
4683 
4684  case _N_end_rep:
4685  { // return at end of loop
4686  _Node_rep *_Nr = ((_Node_end_rep *)_Nx)->_Begin_rep;
4687  _Loop_vals_t *_Psav = &_Loop_vals[_Nr->_Loop_number];
4688 
4689  if (_Nr->_Simple_loop == 0 && !_Do_rep(_Nr,
4690  (_Nr->_Flags & _Fl_greedy) != 0, _Psav->_Loop_idx))
4691  _Failed = true; // recurse only if loop contains if/do
4692  _Nx = 0;
4693  break;
4694  }
4695 
4696  case _N_begin:
4697  break;
4698 
4699  case _N_end:
4702  && _Begin == _Tgt_state._Cur)
4703  || (_Full && _Tgt_state._Cur != _End))
4704  _Failed = true;
4705  else if (!_Matched || _Better_match())
4706  { // record successful match
4707  _Res = _Tgt_state;
4708  _Matched = true;
4709  }
4710  _Nx = 0;
4711  break;
4712 
4713  default:
4715  }
4716 
4717  if (_Failed)
4718  _Nx = 0;
4719  else if (_Nx)
4720  _Nx = _Nx->_Next;
4721  }
4722 
4723  if (0 < _Max_stack_count)
4724  ++_Max_stack_count;
4725  return (!_Failed);
4726  }
Definition: regex:119
Definition: regex:150
bool _Cap
Definition: regex:2119
Definition: regex:1491
Definition: regex:151
_BidIt _Cur
Definition: regex:1971
Definition: regex:1519
Definition: regex:1517
Definition: regex:1518
Definition: regex:1525
_Node_base * _Next
Definition: regex:1661
Definition: regex:1532
_Buf< _Elem > _Data
Definition: regex:1768
Definition: regex:1759
const _RxTraits & _Traits
Definition: regex:2122
regex_constants::match_flag_type _Mflags
Definition: regex:2117
Definition: regex:1521
_It _End
Definition: regex:2113
Definition: regex:1732
_It _Begin
Definition: regex:2112
Definition: regex:124
Definition: regex:1823
Definition: regex:1490
Definition: regex:1529
Definition: regex:1524
vector< bool > _Grp_valid
Definition: regex:1972
regex_constants::syntax_option_type _Sflags
Definition: regex:2116
unsigned int _Loop_number
Definition: regex:1893
vector< _Grp_t > _Grps
Definition: regex:1987
_Node_base * _Back
Definition: regex:1710
Definition: regex:1534
bool _Full
Definition: regex:2123
bool _Matched
Definition: regex:2118
Definition: regex:1523
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2098
Definition: regex:1522
int _Loop_idx
Definition: regex:1870
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_BidIt1 _Compare(_BidIt1 _Begin1, _BidIt1 _End1, _BidIt2 _Begin2, _BidIt2 _End2, const _RxTraits &_Traits, regex_constants::syntax_option_type _Sflags)
Definition: regex:4355
Definition: regex:1516
bool _Is_wc(_It, int)
Definition: regex:4320
vector< _Loop_vals_t > _Loop_vals
Definition: regex:2100
size_type size() const _NOEXCEPT
Definition: vector:1178
_Tgt_state_t< _It > _Res
Definition: regex:2099
bool _Match_pat(_Node_base *)
Definition: regex:4517
int _Simple_loop
Definition: regex:1894
bool _Better_match()
Definition: regex:4486
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xregex_error(regex_constants::error_type _Code)
Definition: regex:1531
unsigned int _Idx
Definition: regex:1741
Definition: regex:75
Definition: regex:1701
_Node_flags _Flags
Definition: regex:1660
Definition: regex:1745
long _Max_stack_count
Definition: regex:2125
bool _Do_rep(_Node_rep *, bool, int)
Definition: regex:4251
Definition: regex:1533
_Node_type _Kind
Definition: regex:1659
unsigned int _Idx
Definition: regex:1754
Definition: regex:1527
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:399
Definition: regex:1868
Definition: regex:1528
Definition: regex:1520
Definition: regex:1530
Definition: regex:1851
Definition: regex:76
Definition: regex:1875
bool _Do_class(_Node_base *)
Definition: regex:4435
bool _Do_if(_Node_if *)
Definition: regex:4137
Definition: regex:1514
Definition: regex:121
Definition: regex:1515
Definition: regex:1714
Definition: regex:122
long _Max_complexity_count
Definition: regex:2124
Definition: regex:1526
Definition: regex:120
template<class _BidIt , class _Elem , class _RxTraits , class _It >
void _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Setf ( regex_constants::match_flag_type  _Mf)
inline
2018  { // set specified flags
2019  _Mflags |= _Mf;
2020  }
regex_constants::match_flag_type _Mflags
Definition: regex:2117
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_BidIt _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Skip ( _BidIt  _First_arg,
_BidIt  _Last,
_Node_base _Node_arg = 0 
)
inline
4734  { // skip until possible match
4735  _Node_base *_Nx = _Node_arg != 0 ? _Node_arg : _Rep;
4736 
4737  while (_First_arg != _Last && _Nx != 0)
4738  { // check current node
4739  switch (_Nx->_Kind)
4740  { // handle current node's type
4741  case _N_nop:
4742  break;
4743 
4744  case _N_bol:
4745  { // check for embedded newline
4747  return (_Last);
4748  for (; _First_arg != _Last; ++_First_arg)
4749  { // look for character following meta newline
4750  _It _Prev = _First_arg;
4751  if (*--_Prev == _Meta_nl)
4752  break;
4753  }
4754  return (_First_arg);
4755  }
4756 
4757  case _N_eol:
4759  return (_Last);
4760  for (; _First_arg != _Last; ++_First_arg)
4761  if (*_First_arg == _Meta_nl)
4762  break;
4763  return (_First_arg);
4764 
4765 // case _N_wbound:
4766 // case _N_dot:
4767 
4768  case _N_str:
4769  { // check for string match
4770  _Node_str<_Elem> *_Node = (_Node_str<_Elem> *)_Nx;
4771  for (; _First_arg != _Last; ++_First_arg)
4772  { // look for starting match
4773  _BidIt _Next = _First_arg;
4774  if (_Compare(_First_arg, ++_Next,
4775  _Node->_Data._Str(),
4776  _Node->_Data._Str() + 1,
4777  _Traits, _Sflags)
4778  != _First_arg)
4779  break;
4780  }
4781  return (_First_arg);
4782  }
4783 
4784  case _N_class:
4785  { // check for string match
4786  for (; _First_arg != _Last; ++_First_arg)
4787  { // look for starting match
4788  bool _Found;
4789  typename _RxTraits::_Uelem _Ch = *_First_arg;
4792  _It _Next = _First_arg;
4793  ++_Next;
4794 
4795  if (_Node->_Coll
4796  && _Lookup_coll(_First_arg, _Next, _Node->_Coll)
4797  != _First_arg)
4798  _Found = true;
4799  else if (_Node->_Ranges
4800  && (_Lookup_range((typename _RxTraits::_Uelem)
4802  ? _Traits.translate(_Ch)
4803  : _Ch), _Node->_Ranges)))
4804  _Found = true;
4805  else if (_Ch < _Bmp_max)
4806  _Found = _Node->_Small && _Node->_Small->_Find(_Ch);
4807  else if (_Node->_Large
4808  && _STD find(_Node->_Large->_Str(),
4809  _Node->_Large->_Str() + _Node->_Large->_Size(),
4810  _Ch)
4811  != _Node->_Large->_Str() + _Node->_Large->_Size())
4812  _Found = true;
4813  else if (_Node->_Classes
4814  && _Traits.isctype(_Ch, _Node->_Classes))
4815  _Found = true;
4816  else if (_Node->_Equiv
4817  && _Lookup_equiv(_Ch, _Node->_Equiv, _Traits))
4818  _Found = true;
4819  else
4820  _Found = false;
4821 
4822  if (_Found != (_Node->_Flags & _Fl_negate))
4823  return (_First_arg);
4824  }
4825  }
4826  return (_First_arg);
4827 
4828  case _N_group:
4829  break;
4830 
4831  case _N_end_group:
4832  break;
4833 
4834 // case _N_neg_assert:
4835 // case _N_assert:
4836 
4837  case _N_end_assert:
4838  _Nx = 0;
4839  break;
4840 
4841  case _N_capture:
4842  break;
4843 
4844  case _N_end_capture:
4845  break;
4846 
4847 // case _N_back:
4848 
4849  case _N_if:
4850  { // check for soonest string match
4851  _Node_if *_Node = (_Node_if *)_Nx;
4852 
4853  for (; _First_arg != _Last && _Node != 0;
4854  _Node = _Node->_Child)
4855  _Last = _Skip(_First_arg, _Last, _Node->_Next);
4856  return (_Last);
4857  }
4858 
4859 // case _N_endif:
4860 // case _N_rep:
4861 // case _N_end_rep:
4862 
4863  case _N_begin:
4864  break;
4865 
4866  case _N_end:
4867  _Nx = 0;
4868  break;
4869 
4870  default:
4871  return (_First_arg);
4872  }
4873  if (_Nx)
4874  _Nx = _Nx->_Next;
4875  }
4876  return (_First_arg);
4877  }
Definition: regex:119
_Node_base * _Rep
Definition: regex:2115
_BidIt _Skip(_BidIt, _BidIt, _Node_base *=0)
Definition: regex:4732
Definition: regex:1519
Definition: regex:1774
Definition: regex:1525
_Node_base * _Next
Definition: regex:1661
_Buf< _Elem > _Data
Definition: regex:1768
bool _Lookup_equiv(typename _RxTraits::_Uelem _Ch, const _Sequence< _Elem > *_Eq, const _RxTraits &_Traits)
Definition: regex:4387
Definition: regex:1759
const _RxTraits & _Traits
Definition: regex:2122
regex_constants::match_flag_type _Mflags
Definition: regex:2117
Definition: regex:1521
Definition: regex:1823
Definition: regex:1490
Definition: regex:1529
_Sequence< _Elem > * _Equiv
Definition: regex:1808
regex_constants::syntax_option_type _Sflags
Definition: regex:2116
_Sequence< _Elem > * _Coll
Definition: regex:1803
Definition: regex:1534
Definition: regex:1522
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_BidIt1 _Compare(_BidIt1 _Begin1, _BidIt1 _End1, _BidIt2 _Begin2, _BidIt2 _End2, const _RxTraits &_Traits, regex_constants::syntax_option_type _Sflags)
Definition: regex:4355
Definition: regex:1516
_Buf< _Elem > * _Ranges
Definition: regex:1806
bool _Find(_Elem _Ch) const
Definition: regex:1625
_BidIt _Lookup_coll(_BidIt _First, _BidIt _Last, const _Sequence< _Elem > *_Eq)
Definition: regex:4410
_Bitmap * _Small
Definition: regex:1804
Definition: regex:75
_RxTraits::char_class_type _Classes
Definition: regex:1807
_Node_flags _Flags
Definition: regex:1660
Definition: regex:1533
_Node_type _Kind
Definition: regex:1659
Definition: regex:1527
Definition: regex:1520
_Node_if * _Child
Definition: regex:1845
Definition: regex:111
_Buf< _Elem > * _Large
Definition: regex:1805
const unsigned int _Bmp_max
Definition: regex:1478
Definition: regex:1514
Definition: regex:1515
_FwdIt _Last
Definition: algorithm:1936
Definition: regex:1526
bool _Lookup_range(unsigned int _Ch, const _Buf< _Elem > *_Bufptr)
Definition: regex:4373
_InIt find(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3282
Definition: regex:120
Definition: regex:1651
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_Matcher& _Matcher< _BidIt, _Elem, _RxTraits, _It >::operator= ( const _Matcher< _BidIt, _Elem, _RxTraits, _It > &  )
private

Member Data Documentation

template<class _BidIt , class _Elem , class _RxTraits , class _It >
_It _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Begin
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Cap
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_It _Matcher< _BidIt, _Elem, _RxTraits, _It >::_End
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_It _Matcher< _BidIt, _Elem, _RxTraits, _It >::_First
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Full
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Longest
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
vector<_Loop_vals_t> _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Loop_vals
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Matched
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
long _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Max_complexity_count
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
long _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Max_stack_count
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
regex_constants::match_flag_type _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Mflags
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
int _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Ncap
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_Node_base* _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Rep
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_Tgt_state_t<_It> _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Res
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
regex_constants::syntax_option_type _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Sflags
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_Tgt_state_t<_It> _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Tgt_state
private
template<class _BidIt , class _Elem , class _RxTraits , class _It >
const _RxTraits& _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Traits
private

The documentation for this class was generated from the following file: