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, 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 ()
 
_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,
int  _Nx,
regex_constants::syntax_option_type  _Sf,
regex_constants::match_flag_type  _Mf 
)
inline
1975  : _First(_Pfirst), _End(_Plast), _Traits(_Tr), _Rep(_Re),
1976  _Sflags(_Sf), _Mflags(_Mf), _Matched(false),
1977  _Ncap(_Nx),
1978  _Longest((_Re->_Flags & _Fl_longest)
1979  && !(_Mf & regex_constants::match_any))
1980  { // construct
1981  _Loop_vals.resize(_Re->_Loops);
1983  }
void resize(size_type _Newsize)
Definition: vector:1099
_Node_base * _Rep
Definition: regex:2082
_RanIt _Plast
Definition: algorithm:2577
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
const _RxTraits & _Traits
Definition: regex:2089
regex_constants::match_flag_type _Mflags
Definition: regex:2084
_It _End
Definition: regex:2080
Definition: regex:1474
bool _Longest
Definition: regex:2088
regex_constants::syntax_option_type _Sflags
Definition: regex:2083
Definition: regex:159
_RanIt _Pfirst
Definition: algorithm:2576
bool _Matched
Definition: regex:2085
vector< _Loop_vals_t > _Loop_vals
Definition: regex:2069
int _Ncap
Definition: regex:2087
_Node_flags _Flags
Definition: regex:1635
_It _First
Definition: regex:2081
unsigned int _Loops
Definition: regex:1668

Member Function Documentation

template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Better_match ( )
inlineprivate
4361  { // check for better match under UNIX rules
4362  int _Ix;
4363 
4364  for (_Ix = 0; _Ix < _Ncap; ++_Ix)
4365  { // check each capture group
4366  if (!_Res._Grp_valid[_Ix] || !_Tgt_state._Grp_valid[_Ix])
4367  ;
4368  else if (_Res._Grps[_Ix]._Begin
4369  != _Tgt_state._Grps[_Ix]._Begin)
4370  return (_STD distance(_Begin, _Res._Grps[_Ix]._Begin)
4371  < _STD distance(_Begin, _Tgt_state._Grps[_Ix]._Begin));
4372  else if (_Res._Grps[_Ix]._End
4373  != _Tgt_state._Grps[_Ix]._End)
4374  return (_STD distance(_Begin, _Res._Grps[_Ix]._End)
4375  < _STD distance(_Begin, _Tgt_state._Grps[_Ix]._End));
4376  }
4377  return (false);
4378  }
_It _Begin
Definition: regex:2079
vector< bool > _Grp_valid
Definition: regex:1940
vector< _Grp_t > _Grps
Definition: regex:1955
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2067
_Tgt_state_t< _It > _Res
Definition: regex:2068
int _Ncap
Definition: regex:2087
template<class _BidIt , class _Elem , class _RxTraits , class _It >
void _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Clearf ( regex_constants::match_flag_type  _Mf)
inline
1991  { // clear specified flags
1992  _Mflags &= ~_Mf;
1993  }
regex_constants::match_flag_type _Mflags
Definition: regex:2084
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Do_class ( _Node_base _Nx)
inlineprivate
4310  { // apply bracket expression
4311  static int _Max = _Bmp_max; // to quiet diagnostics
4312  static int _Min = 0;
4313 
4314  bool _Found;
4315  _Elem _Ch = *_Tgt_state._Cur;
4317  _Ch = _Traits.translate_nocase(_Ch);
4318  _It _Res = _Tgt_state._Cur;
4319  ++_Res;
4320  _It _Resx;
4323  if (_Node->_Coll
4324  && (_Resx = _Lookup_coll(_Tgt_state._Cur, _End, _Node->_Coll))
4325  != _Tgt_state._Cur)
4326  { // check for collation element
4327  _Res = _Resx;
4328  _Found = true;
4329  }
4330  else if (_Node->_Ranges
4332  ? (int)_Traits.translate(_Ch) : (int)_Ch), _Node->_Ranges)))
4333  _Found = true;
4334  else if (_Min <= _Ch && _Ch < _Max)
4335  _Found = _Node->_Small && _Node->_Small->_Find(_Ch);
4336  else if (_Node->_Large
4337  && _STD find(_Node->_Large->_Str(),
4338  _Node->_Large->_Str() + _Node->_Large->_Size(), _Ch)
4339  != _Node->_Large->_Str() + _Node->_Large->_Size())
4340  _Found = true;
4341  else if (_Node->_Classes != 0 && _Traits.isctype(_Ch, _Node->_Classes))
4342  _Found = true;
4343  else if (_Node->_Equiv && _Lookup_equiv(_Ch, _Node->_Equiv, _Traits))
4344  _Found = true;
4345  else
4346  _Found = false;
4347  if (_Found == (_Node->_Flags & _Fl_negate))
4348  return (false);
4349  else
4350  { // record result
4351  _Tgt_state._Cur = _Res;
4352  return (true);
4353  }
4354  }
const int _Bmp_max
Definition: regex:1459
_BidIt _Cur
Definition: regex:1939
Definition: regex:1746
const _RxTraits & _Traits
Definition: regex:2089
_It _End
Definition: regex:2080
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
Definition: regex:1471
bool _Lookup_range(_Elem _Ch, const _Buf< _Elem > *_Bufptr)
Definition: regex:4248
_Sequence< _Elem > * _Equiv
Definition: regex:1780
regex_constants::syntax_option_type _Sflags
Definition: regex:2083
_Sequence< _Elem > * _Coll
Definition: regex:1775
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2067
bool _Lookup_equiv(_Elem _Ch, const _Sequence< _Elem > *_Eq, const _RxTraits &_Traits)
Definition: regex:4261
_Buf< _Elem > * _Ranges
Definition: regex:1778
_Tgt_state_t< _It > _Res
Definition: regex:2068
_BidIt _Lookup_coll(_BidIt _First, _BidIt _Last, const _Sequence< _Elem > *_Eq)
Definition: regex:4283
_Bitmap * _Small
Definition: regex:1776
Definition: regex:144
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
_RxTraits::char_class_type _Classes
Definition: regex:1779
_Node_flags _Flags
Definition: regex:1635
bool _Find(unsigned int _Ch) const
Definition: regex:1602
Definition: regex:147
_Buf< _Elem > * _Large
Definition: regex:1777
_InIt find(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3050
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Do_if ( _Node_if _Node)
inlineprivate
4019  { // apply if node
4021  _Tgt_state_t<_It> _Final = _Tgt_state;
4022  bool _Matched = false;
4023  int _Final_len = -1;
4024 
4025  while (_Node)
4026  { // process one branch of if
4027  _Tgt_state = _St;
4028  if (!_Match_pat(_Node->_Next))
4029  ;
4030  else if (!_Longest)
4031  return (true);
4032  else
4033  { // record match
4034  int _Len = (int)_STD distance(_St._Cur, _Tgt_state._Cur);
4035  if (_Final_len < _Len)
4036  { // memorize longest so far
4037  _Final = _Tgt_state;
4038  _Final_len = _Len;
4039  }
4040  _Matched = true;
4041  }
4042  _Node = _Node->_Child;
4043  }
4044  _Tgt_state = _Matched ? _Final : _St;
4045  return (_Matched);
4046  }
_BidIt _Cur
Definition: regex:1939
_Node_base * _Next
Definition: regex:1636
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
bool _Longest
Definition: regex:2088
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
bool _Matched
Definition: regex:2085
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2067
bool _Match_pat(_Node_base *)
Definition: regex:4384
_Node_if * _Child
Definition: regex:1817
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
4117  { // apply repetition
4118  if (_Node->_Simple_loop < 0)
4119  { // first time, determine if loop is simple
4120  _Node_base *_Nx = _Node->_Next;
4121  for (; _Nx->_Kind != _N_end_rep; _Nx = _Nx->_Next)
4122  if (_Nx->_Kind == _N_if || _Nx->_Kind == _N_rep)
4123  break;
4124  _Node->_Simple_loop = _Nx->_Kind == _N_end_rep ? 1 : 0;
4125  }
4126  if (0 < _Node->_Simple_loop)
4127  return (_Do_rep0(_Node, _Greedy));
4128 
4129  bool _Matched = false;
4131  _Loop_vals_t *_Psav = &_Loop_vals[_Node->_Loop_number];
4132  int _Loop_idx_sav = _Psav->_Loop_idx;
4133  _It *_Loop_iter_sav = (_It *)_Psav->_Loop_iter;
4134  _It _Cur_iter = _Tgt_state._Cur;
4135 
4136  bool _Progress = _Init_idx == 0 || *_Loop_iter_sav != _Cur_iter;
4137 
4138  if (0 <= _Node->_Max && _Node->_Max <= _Init_idx)
4139  _Matched = _Match_pat(_Node->_End_rep->_Next); // reps done, try tail
4140  else if (_Init_idx < _Node->_Min)
4141  { // try a required rep
4142  if (!_Progress)
4143  _Matched = _Match_pat(_Node->_End_rep->_Next); // empty, try tail
4144  else
4145  { // try another required match
4146  _Psav->_Loop_idx = _Init_idx + 1;
4147  _Psav->_Loop_iter = &_Cur_iter;
4148  _Matched = _Match_pat(_Node->_Next);
4149  }
4150  }
4151  else if (!_Greedy)
4152  { // not greedy, favor minimum number of reps
4153  _Matched = _Match_pat(_Node->_End_rep->_Next);
4154  if (!_Matched && _Progress)
4155  { // tail failed, try another rep
4156  _Tgt_state = _St;
4157  _Psav->_Loop_idx = _Init_idx + 1;
4158  _Psav->_Loop_iter = &_Cur_iter;
4159  _Matched = _Match_pat(_Node->_Next);
4160  }
4161  }
4162  else
4163  { // greedy, favor maximum number of reps
4164  if (_Progress)
4165  { // try another rep
4166  _Psav->_Loop_idx = _Init_idx + 1;
4167  _Psav->_Loop_iter = &_Cur_iter;
4168  _Matched = _Match_pat(_Node->_Next);
4169  }
4170  if (!_Progress && 1 < _Init_idx)
4171  ;
4172  else if (!_Matched)
4173  { // rep failed, try tail
4174  _Psav->_Loop_idx = _Loop_idx_sav;
4175  _Psav->_Loop_iter = _Loop_iter_sav;
4176  _Tgt_state = _St;
4177  _Matched = _Match_pat(_Node->_End_rep->_Next);
4178  }
4179  }
4180 
4181  if (!_Matched)
4182  _Tgt_state = _St;
4183  _Psav->_Loop_idx = _Loop_idx_sav;
4184  _Psav->_Loop_iter = _Loop_iter_sav;
4185  return (_Matched);
4186  }
_BidIt _Cur
Definition: regex:1939
_Node_base * _Next
Definition: regex:1636
Definition: regex:1513
const int _Max
Definition: regex:1863
Definition: regex:1510
unsigned int _Loop_number
Definition: regex:1865
bool _Matched
Definition: regex:2085
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2067
int _Loop_idx
Definition: regex:1842
vector< _Loop_vals_t > _Loop_vals
Definition: regex:2069
bool _Match_pat(_Node_base *)
Definition: regex:4384
int _Simple_loop
Definition: regex:1866
Definition: regex:1512
_Node_type _Kind
Definition: regex:1634
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:394
Definition: regex:1840
void * _Loop_iter
Definition: regex:1843
bool _Do_rep0(_Node_rep *, bool)
Definition: regex:4052
_Node_end_rep * _End_rep
Definition: regex:1864
Definition: regex:1626
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Do_rep0 ( _Node_rep _Node,
bool  _Greedy 
)
inlineprivate
4054  { // apply repetition to loop with no nested if/do
4055  int _Ix = 0;
4057 
4058  for (; _Ix < _Node->_Min; ++_Ix)
4059  { // do minimum number of reps
4060  _It _Cur = _Tgt_state._Cur;
4061  if (!_Match_pat(_Node->_Next))
4062  { // didn't match minimum number of reps, fail
4063  _Tgt_state = _St;
4064  return (false);
4065  }
4066  else if (_Cur == _Tgt_state._Cur)
4067  _Ix = _Node->_Min - 1; // skip matches that don't change state
4068  }
4069 
4070  _Tgt_state_t<_It> _Final = _Tgt_state;
4071  bool _Matched = false;
4072  _It _Saved_pos = _Tgt_state._Cur;
4073 
4074  if (!_Match_pat(_Node->_End_rep->_Next))
4075  ; // no full match yet
4076  else if (!_Greedy)
4077  return (true); // go with current match
4078  else
4079  { // record an acceptable match and continue
4080  _Final = _Tgt_state;
4081  _Matched = true;
4082  }
4083 
4084  while (_Node->_Max == -1 || _Ix++ < _Node->_Max)
4085  { // try another rep/tail match
4086  _Tgt_state._Cur = _Saved_pos;
4088  if (!_Match_pat(_Node->_Next))
4089  break; // rep match failed, quit loop
4090 
4091  _It _Mid = _Tgt_state._Cur;
4092  if (!_Match_pat(_Node->_End_rep->_Next))
4093  ; // tail match failed, continue
4094  else if (!_Greedy)
4095  return (true); // go with current match
4096  else
4097  { // record match and continue
4098  _Final = _Tgt_state;
4099  _Matched = true;
4100  }
4101 
4102  if (_Saved_pos == _Mid)
4103  break; // rep match ate no additional elements, quit loop
4104  _Saved_pos = _Mid;
4105  }
4106 
4107  _Tgt_state = _Matched ? _Final : _St;
4108  return (_Matched);
4109  }
_BidIt _Cur
Definition: regex:1939
_Node_base * _Next
Definition: regex:1636
const int _Max
Definition: regex:1863
vector< bool > _Grp_valid
Definition: regex:1940
bool _Matched
Definition: regex:2085
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2067
const int _Min
Definition: regex:1862
bool _Match_pat(_Node_base *)
Definition: regex:4384
_Node_end_rep * _End_rep
Definition: regex:1864
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Is_wc ( _It  _Ch0,
int  _Offset 
)
inlineprivate
4194  { // check for word boundary
4195  if ((_Offset == -1
4196  && _Ch0 == _Begin
4198  || (_Offset == 0 && _Ch0 == _End))
4199  return (false);
4200  else
4201  { // test for word char
4202  _Elem _Ch = (_Offset ? *--_Ch0 : *_Ch0);
4203 
4204  return (_Ch == (char)_Ch // assume L'x' == 'x'
4205  && strchr("abcdefghijklmnopqrstuvwxyz"
4206  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
4207  "0123456789_", _Ch) != 0);
4208  }
4209  }
_Check_return_opt_ _In_ long _Offset
Definition: io.h:334
regex_constants::match_flag_type _Mflags
Definition: regex:2084
_It _End
Definition: regex:2080
_It _Begin
Definition: regex:2079
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strchr(_In_z_ const char *_Str, _In_ int _Val)
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
1999  { // try to match
2000  _First = _Pfirst;
2001  return (_Match(_Matches, _Full_match));
2002  }
_RanIt _Pfirst
Definition: algorithm:2576
_It _First
Definition: regex:2081
bool _Match(_It _Pfirst, match_results< _BidIt, _Alloc > *_Matches, bool _Full_match)
Definition: regex:1996
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
2007  { // try to match
2008  _Begin = _First;
2011  _Tgt_state._Grps.resize(_Ncap);
2012  _Cap = _Matches != 0;
2013  _Full = _Full_match;
2016 
2017  _Matched = false;
2018 
2019  if (_Match_pat(_Rep))
2020  ;
2021  else if ((_Mflags & regex_constants::_Match_partial) != 0
2022  && _Tgt_state._Cur == _End && _First != _End)
2023  { // record successful partial match
2024  _Res = _Tgt_state;
2025  _Matched = true;
2026  }
2027  else
2028  return (false);
2029  if (_Matches)
2030  { // copy results to _Matches
2031  _Matches->_Resize(_Ncap);
2032  for (int _Idx = 0; _Idx < _Ncap; ++_Idx)
2033  { // copy submatch _Idx
2034  if (_Res._Grp_valid[_Idx])
2035  { // copy successful match
2036  _Matches->_At(_Idx).matched = true;
2037  _Matches->_At(_Idx).first = _Res._Grps[_Idx]._Begin;
2038  _Matches->_At(_Idx).second = _Res._Grps[_Idx]._End;
2039  }
2040  else
2041  { // copy failed match
2042  _Matches->_At(_Idx).matched = false;
2043  _Matches->_At(_Idx).first = _End;
2044  _Matches->_At(_Idx).second = _End;
2045  }
2046  }
2047  _Matches->_Org = _Begin;
2048  _Matches->_Pfx().matched = true;
2049  _Matches->_Pfx().first = _Begin;
2050  _Matches->_Pfx().second = _Matches->_At(0).first;
2051 
2052  _Matches->_Sfx().matched = true;
2053  _Matches->_Sfx().first = _Matches->_At(0).second;
2054  _Matches->_Sfx().second = _End;
2055 
2056  _Matches->_Null().first = _End;
2057  _Matches->_Null().second = _End;
2058 
2059  _Matches->_Ready = true;
2060  }
2061  return (true);
2062  }
void resize(size_type _Newsize)
Definition: vector:1099
_Node_base * _Rep
Definition: regex:2082
bool _Cap
Definition: regex:2086
_BidIt _Org
Definition: regex:1417
_BidIt _Cur
Definition: regex:1939
regex_constants::match_flag_type _Mflags
Definition: regex:2084
Definition: regex:162
_It _End
Definition: regex:2080
bool matched
Definition: regex:616
_It _Begin
Definition: regex:2079
vector< bool > _Grp_valid
Definition: regex:1940
vector< _Grp_t > _Grps
Definition: regex:1955
_Elem & _Null()
Definition: regex:1402
bool _Full
Definition: regex:2090
bool _Matched
Definition: regex:2085
#define _REGEX_MAX_STACK_COUNT
Definition: regex:33
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2067
_Ty1 first
Definition: utility:198
_Elem & _At(unsigned int _Sub)
Definition: regex:1407
#define _REGEX_MAX_COMPLEXITY_COUNT
Definition: regex:29
_Tgt_state_t< _It > _Res
Definition: regex:2068
bool _Match_pat(_Node_base *)
Definition: regex:4384
int _Ncap
Definition: regex:2087
_Elem & _Pfx()
Definition: regex:1392
void _Resize(unsigned int _Nx)
Definition: regex:1387
_It _First
Definition: regex:2081
long _Max_stack_count
Definition: regex:2092
bool _Ready
Definition: regex:1418
second
Definition: utility:167
_Elem & _Sfx()
Definition: regex:1397
long _Max_complexity_count
Definition: regex:2091
template<class _BidIt , class _Elem , class _RxTraits , class _It >
bool _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Match_pat ( _Node_base _Nx)
inlineprivate
4386  { // check for match
4387  if (0 < _Max_stack_count && --_Max_stack_count <= 0)
4388  _Xregex_error(regex_constants::error_stack);
4389  if (0 < _Max_complexity_count && --_Max_complexity_count <= 0)
4390  _Xregex_error(regex_constants::error_complexity);
4391 
4392  bool _Failed = false;
4393  while (_Nx != 0)
4394  { // match current node
4395  switch (_Nx->_Kind)
4396  { // handle current node's type
4397  case _N_nop:
4398  break;
4399 
4400  case _N_bol:
4404  _Failed = true;
4406  || _Tgt_state._Cur != _Begin)
4407  { // check for preceding newline
4408  _It _Tmp = _Tgt_state._Cur;
4409  _Failed = *--_Tmp != _Meta_nl;
4410  }
4411  break;
4412 
4413  case _N_eol:
4415  || (_Tgt_state._Cur != _End
4416  && *_Tgt_state._Cur != _Meta_nl))
4417  _Failed = true;
4418  break;
4419 
4420  case _N_wbound:
4421  { // check for word boundary
4422  bool _Is_bound;
4424  && _Tgt_state._Cur == _Begin)
4426  && _Tgt_state._Cur == _End))
4427  _Is_bound = false;
4428  else
4429  _Is_bound = _Is_wc(_Tgt_state._Cur, -1)
4430  != _Is_wc(_Tgt_state._Cur, 0);
4431  bool _Neg = (_Nx->_Flags & _Fl_negate) != 0;
4432  if (_Is_bound == _Neg)
4433  _Failed = true;
4434  break;
4435  }
4436 
4437  case _N_dot:
4438  if (_Tgt_state._Cur == _End
4439  || *_Tgt_state._Cur == _Meta_nl
4440  || *_Tgt_state._Cur == _Meta_cr)
4441  _Failed = true;
4442  else
4443  ++_Tgt_state._Cur;
4444  break;
4445 
4446  case _N_str:
4447  { // check for string match
4448  _Node_str<_Elem> *_Node = (_Node_str<_Elem> *)_Nx;
4449  _It _Res;
4450  if ((_Res = _Compare(_Tgt_state._Cur, _End,
4451  _Node->_Data._Str(),
4452  _Node->_Data._Str() + _Node->_Data._Size(),
4453  _Traits, _Sflags,
4455  != _Tgt_state._Cur)
4456  _Tgt_state._Cur = _Res;
4457  else
4458  _Failed = true;
4459  break;
4460  }
4461 
4462  case _N_class:
4463  { // check for bracket expression match
4464  _Failed = _Tgt_state._Cur == _End
4465  || !_Do_class(_Nx);
4466  break;
4467  }
4468 
4469  case _N_group:
4470  break;
4471 
4472  case _N_end_group:
4473  break;
4474 
4475  case _N_neg_assert:
4476  case _N_assert:
4477  { // check assert
4478  _It _Ch = _Tgt_state._Cur;
4479  bool _Neg = _Nx->_Kind == _N_neg_assert;
4481  if (_Match_pat(((_Node_assert *)_Nx)->_Child) == _Neg)
4482  { // restore initial state and indicate failure
4483  _Tgt_state = _St;
4484  _Failed = true;
4485  }
4486  else
4487  _Tgt_state._Cur = _Ch;
4488  break;
4489  }
4490 
4491  case _N_end_assert:
4492  _Nx = 0;
4493  break;
4494 
4495  case _N_capture:
4496  { // record current position
4497  _Node_capture *_Node = (_Node_capture *)_Nx;
4498  _Tgt_state._Grps[_Node->_Idx]._Begin = _Tgt_state._Cur;
4499  for (size_t _Idx = _Tgt_state._Grp_valid.size();
4500  _Node->_Idx < _Idx; )
4501  _Tgt_state._Grp_valid[--_Idx] = false;
4502  break;
4503  }
4504 
4505  case _N_end_capture:
4506  { // record successful capture
4507  _Node_end_group *_Node = (_Node_end_group *)_Nx;
4508  _Node_capture *_Node0 = (_Node_capture *)_Node->_Back;
4509  if (_Cap || _Node0->_Idx != 0)
4510  { // update capture data
4511  _Tgt_state._Grp_valid[_Node0->_Idx] = true;
4512  _Tgt_state._Grps[_Node0->_Idx]._End = _Tgt_state._Cur;
4513  }
4514  break;
4515  }
4516 
4517  case _N_back:
4518  { // check back reference
4519  _Node_back *_Node = (_Node_back *)_Nx;
4520  if (_Tgt_state._Grp_valid[_Node->_Idx])
4521  { // check for match
4522  _It _Res = _Tgt_state._Cur;
4523  _It _Bx = _Tgt_state._Grps[_Node->_Idx]._Begin;
4524  _It _Ex = _Tgt_state._Grps[_Node->_Idx]._End;
4525  if (_Bx != _Ex // _Bx == _Ex for zero-length match
4526  && (_Res = _Compare(_Tgt_state._Cur, _End,
4527  _Bx, _Ex, _Traits, _Sflags,
4529  == _Tgt_state._Cur)
4530  _Failed = true;
4531  else
4532  _Tgt_state._Cur = _Res;
4533  }
4534  break;
4535  }
4536 
4537  case _N_if:
4538  if (!_Do_if((_Node_if *)_Nx))
4539  _Failed = true;
4540  _Nx = 0;
4541  break;
4542 
4543  case _N_endif:
4544  break;
4545 
4546  case _N_rep:
4547  if (!_Do_rep((_Node_rep *)_Nx,
4548  (_Nx->_Flags & _Fl_greedy) != 0, 0))
4549  _Failed = true;
4550  _Nx = 0;
4551  break;
4552 
4553  case _N_end_rep:
4554  { // return at end of loop
4555  _Node_rep *_Nr = ((_Node_end_rep *)_Nx)->_Begin_rep;
4556  _Loop_vals_t *_Psav = &_Loop_vals[_Nr->_Loop_number];
4557 
4558  if (_Nr->_Simple_loop == 0 && !_Do_rep(_Nr,
4559  (_Nr->_Flags & _Fl_greedy) != 0, _Psav->_Loop_idx))
4560  _Failed = true; // recurse only if loop contains if/do
4561  _Nx = 0;
4562  break;
4563  }
4564 
4565  case _N_begin:
4566  break;
4567 
4568  case _N_end:
4571  && _Begin == _Tgt_state._Cur)
4572  || (_Full && _Tgt_state._Cur != _End))
4573  _Failed = true;
4574  else if (!_Matched || _Better_match())
4575  { // record successful match
4576  _Res = _Tgt_state;
4577  _Matched = true;
4578  }
4579  _Nx = 0;
4580  break;
4581 
4582  default:
4583  _Xregex_error(regex_constants::error_parse);
4584  }
4585 
4586  if (_Failed)
4587  _Nx = 0;
4588  else if (_Nx)
4589  _Nx = _Nx->_Next;
4590  }
4591 
4592  if (0 < _Max_stack_count)
4593  ++_Max_stack_count;
4594  return (!_Failed);
4595  }
Definition: regex:155
Definition: regex:187
bool _Cap
Definition: regex:2086
Definition: regex:1472
Definition: regex:188
_BidIt _Cur
Definition: regex:1939
Definition: regex:1500
Definition: regex:1498
Definition: regex:1499
Definition: regex:1506
_Node_base * _Next
Definition: regex:1636
Definition: regex:1513
_Buf< _Elem > _Data
Definition: regex:1741
Definition: regex:1732
const _RxTraits & _Traits
Definition: regex:2089
regex_constants::match_flag_type _Mflags
Definition: regex:2084
Definition: regex:1502
Definition: regex:162
_It _End
Definition: regex:2080
Definition: regex:1705
_It _Begin
Definition: regex:2079
Definition: regex:160
Definition: regex:1795
Definition: regex:1471
Definition: regex:1510
Definition: regex:1505
vector< bool > _Grp_valid
Definition: regex:1940
_BidIt1 _Compare(_BidIt1 _Begin1, _BidIt1 _End1, _BidIt2 _Begin2, _BidIt2 _End2, const _RxTraits &_Traits, regex_constants::syntax_option_type _Sflags, bool _Partial)
Definition: regex:4229
regex_constants::syntax_option_type _Sflags
Definition: regex:2083
unsigned int _Loop_number
Definition: regex:1865
vector< _Grp_t > _Grps
Definition: regex:1955
_Node_base * _Back
Definition: regex:1683
Definition: regex:1515
bool _Full
Definition: regex:2090
bool _Matched
Definition: regex:2085
Definition: regex:1504
_Tgt_state_t< _It > _Tgt_state
Definition: regex:2067
Definition: regex:1503
int _Loop_idx
Definition: regex:1842
Definition: regex:1497
bool _Is_wc(_It, int)
Definition: regex:4192
vector< _Loop_vals_t > _Loop_vals
Definition: regex:2069
size_type size() const _NOEXCEPT
Definition: vector:1146
_Tgt_state_t< _It > _Res
Definition: regex:2068
bool _Match_pat(_Node_base *)
Definition: regex:4384
int _Simple_loop
Definition: regex:1866
bool _Better_match()
Definition: regex:4360
Definition: regex:1512
unsigned int _Idx
Definition: regex:1714
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
Definition: regex:75
Definition: regex:1674
_Node_flags _Flags
Definition: regex:1635
Definition: regex:1718
long _Max_stack_count
Definition: regex:2092
bool _Do_rep(_Node_rep *, bool, int)
Definition: regex:4115
Definition: regex:1514
_Node_type _Kind
Definition: regex:1634
unsigned int _Idx
Definition: regex:1727
Definition: regex:1508
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:394
Definition: regex:1840
Definition: regex:1509
Definition: regex:1501
Definition: regex:1511
Definition: regex:1823
Definition: regex:76
Definition: regex:1847
bool _Do_class(_Node_base *)
Definition: regex:4308
bool _Do_if(_Node_if *)
Definition: regex:4017
Definition: regex:1495
Definition: regex:157
Definition: regex:1496
Definition: regex:1687
Definition: regex:158
long _Max_complexity_count
Definition: regex:2091
Definition: regex:1507
Definition: regex:156
template<class _BidIt , class _Elem , class _RxTraits , class _It >
void _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Setf ( regex_constants::match_flag_type  _Mf)
inline
1986  { // set specified flags
1987  _Mflags |= _Mf;
1988  }
regex_constants::match_flag_type _Mflags
Definition: regex:2084
template<class _BidIt , class _Elem , class _RxTraits , class _It >
_BidIt _Matcher< _BidIt, _Elem, _RxTraits, _It >::_Skip ( _BidIt  _First,
_BidIt  _Last,
_Node_base _Node_arg = 0 
)
inline
4603  { // skip until possible match
4604  _Node_base *_Nx = _Node_arg != 0 ? _Node_arg : _Rep;
4605 
4606  while (_First != _Last && _Nx != 0)
4607  { // check current node
4608  switch (_Nx->_Kind)
4609  { // handle current node's type
4610  case _N_nop:
4611  break;
4612 
4613  case _N_bol:
4614  { // check for embedded newline
4616  return (_Last);
4617  for (; _First != _Last; ++_First)
4618  { // look for character following meta newline
4619  _It _Prev = _First;
4620  if (*--_Prev == _Meta_nl)
4621  break;
4622  }
4623  return (_First);
4624  }
4625 
4626  case _N_eol:
4628  return (_Last);
4629  for (; _First != _Last; ++_First)
4630  if (*_First == _Meta_nl)
4631  break;
4632  return (_First);
4633 
4634 // case _N_wbound:
4635 // case _N_dot:
4636 
4637  case _N_str:
4638  { // check for string match
4639  _Node_str<_Elem> *_Node = (_Node_str<_Elem> *)_Nx;
4640  for (; _First != _Last; ++_First)
4641  { // look for starting match
4642  _BidIt _Next = _First;
4643  if (_Compare(_First, ++_Next,
4644  _Node->_Data._Str(),
4645  _Node->_Data._Str() + 1,
4646  _Traits, _Sflags,
4648  != _First)
4649  break;
4650  }
4651  return (_First);
4652  }
4653 
4654  case _N_class:
4655  { // check for string match
4656  for (; _First != _Last; ++_First)
4657  { // look for starting match
4658  static int _Max = _Bmp_max; // to quiet diagnostics
4659  static int _Min = 0;
4660 
4661  bool _Found;
4662  _Elem _Ch = *_First;
4665  _It _Next = _First;
4666  ++_Next;
4667 
4668  if (_Node->_Coll
4669  && _Lookup_coll(_First, _Next, _Node->_Coll)
4670  != _First)
4671  _Found = true;
4672  else if (_Node->_Ranges
4673  && (_Lookup_range(
4675  ? (int)_Traits.translate(_Ch)
4676  : (int)_Ch), _Node->_Ranges)))
4677  _Found = true;
4678  else if (_Min <= _Ch && _Ch < _Max)
4679  _Found = _Node->_Small && _Node->_Small->_Find(_Ch);
4680  else if (_Node->_Large
4681  && _STD find(_Node->_Large->_Str(),
4682  _Node->_Large->_Str() + _Node->_Large->_Size(),
4683  _Ch)
4684  != _Node->_Large->_Str() + _Node->_Large->_Size())
4685  _Found = true;
4686  else if (_Node->_Classes
4687  && _Traits.isctype(_Ch, _Node->_Classes))
4688  _Found = true;
4689  else if (_Node->_Equiv
4690  && _Lookup_equiv(_Ch, _Node->_Equiv, _Traits))
4691  _Found = true;
4692  else
4693  _Found = false;
4694 
4695  if (_Found != (_Node->_Flags & _Fl_negate))
4696  return (_First);
4697  }
4698  }
4699  return (_First);
4700 
4701  case _N_group:
4702  break;
4703 
4704  case _N_end_group:
4705  break;
4706 
4707 // case _N_neg_assert:
4708 // case _N_assert:
4709 
4710  case _N_end_assert:
4711  _Nx = 0;
4712  break;
4713 
4714  case _N_capture:
4715  break;
4716 
4717  case _N_end_capture:
4718  break;
4719 
4720 // case _N_back:
4721 
4722  case _N_if:
4723  { // check for soonest string match
4724  _Node_if *_Node = (_Node_if *)_Nx;
4725 
4726  for (; _First != _Last && _Node != 0; _Node = _Node->_Child)
4727  _Last = _Skip(_First, _Last, _Node->_Next);
4728  return (_Last);
4729  }
4730 
4731 // case _N_endif:
4732 // case _N_rep:
4733 // case _N_end_rep:
4734 
4735  case _N_begin:
4736  break;
4737 
4738  case _N_end:
4739  _Nx = 0;
4740  break;
4741 
4742  default:
4743  return (_First);
4744  }
4745  if (_Nx)
4746  _Nx = _Nx->_Next;
4747  }
4748  return (_First);
4749  }
Definition: regex:155
_Node_base * _Rep
Definition: regex:2082
_BidIt _Skip(_BidIt, _BidIt, _Node_base *=0)
Definition: regex:4601
const int _Bmp_max
Definition: regex:1459
Definition: regex:1500
Definition: regex:1746
Definition: regex:1506
_Node_base * _Next
Definition: regex:1636
_Buf< _Elem > _Data
Definition: regex:1741
Definition: regex:1732
const _RxTraits & _Traits
Definition: regex:2089
regex_constants::match_flag_type _Mflags
Definition: regex:2084
Definition: regex:1502
Definition: regex:162
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
Definition: regex:1795
Definition: regex:1471
Definition: regex:1510
bool _Lookup_range(_Elem _Ch, const _Buf< _Elem > *_Bufptr)
Definition: regex:4248
_Sequence< _Elem > * _Equiv
Definition: regex:1780
_BidIt1 _Compare(_BidIt1 _Begin1, _BidIt1 _End1, _BidIt2 _Begin2, _BidIt2 _End2, const _RxTraits &_Traits, regex_constants::syntax_option_type _Sflags, bool _Partial)
Definition: regex:4229
regex_constants::syntax_option_type _Sflags
Definition: regex:2083
_Sequence< _Elem > * _Coll
Definition: regex:1775
Definition: regex:1515
Definition: regex:1503
Definition: regex:1497
bool _Lookup_equiv(_Elem _Ch, const _Sequence< _Elem > *_Eq, const _RxTraits &_Traits)
Definition: regex:4261
_Buf< _Elem > * _Ranges
Definition: regex:1778
_BidIt _Lookup_coll(_BidIt _First, _BidIt _Last, const _Sequence< _Elem > *_Eq)
Definition: regex:4283
_Bitmap * _Small
Definition: regex:1776
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
Definition: regex:75
_RxTraits::char_class_type _Classes
Definition: regex:1779
_Node_flags _Flags
Definition: regex:1635
_It _First
Definition: regex:2081
Definition: regex:1514
_Node_type _Kind
Definition: regex:1634
bool _Find(unsigned int _Ch) const
Definition: regex:1602
Definition: regex:1508
Definition: regex:1501
_Node_if * _Child
Definition: regex:1817
Definition: regex:147
_Buf< _Elem > * _Large
Definition: regex:1777
Definition: regex:1495
Definition: regex:1496
_FwdIt _Last
Definition: algorithm:1936
Definition: regex:1507
_InIt find(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3050
Definition: regex:156
Definition: regex:1626
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: