Qt 4.8
Public Functions | Public Variables | List of all members
QRegExpMatchState Struct Reference

Public Functions

void drain ()
 
void match (const QChar *str, int len, int pos, bool minimal, bool oneTest, int caretIndex)
 
bool matchHere ()
 
void prepareForMatch (QRegExpEngine *eng)
 
 QRegExpMatchState ()
 
bool testAnchor (int i, int a, const int *capBegin)
 
 ~QRegExpMatchState ()
 

Public Variables

int * bigArray
 
int * capBegin
 
int * capEnd
 
int * captured
 
int capturedSize
 
int caretPos
 
int * curCapBegin
 
int * curCapEnd
 
int * curStack
 
const QRegExpEngineeng
 
const QCharin
 
int * inNextStack
 
int len
 
int matchLen
 
bool minimal
 
int * nextCapBegin
 
int * nextCapEnd
 
int * nextStack
 
int oneTestMatchedLen
 
int pos
 
QList< QVector< int > > sleeping
 
int * slideTab
 
int slideTabSize
 
int * tempCapBegin
 
int * tempCapEnd
 

Detailed Description

Definition at line 902 of file qregexp.cpp.

Constructors and Destructors

◆ QRegExpMatchState()

QRegExpMatchState::QRegExpMatchState ( )
inline

Definition at line 933 of file qregexp.cpp.

933 : bigArray(0), captured(0) {}

◆ ~QRegExpMatchState()

QRegExpMatchState::~QRegExpMatchState ( )
inline

Definition at line 934 of file qregexp.cpp.

934 { free(bigArray); }

Functions

◆ drain()

void QRegExpMatchState::drain ( )
inline

Definition at line 936 of file qregexp.cpp.

Referenced by invalidateEngine().

936 { free(bigArray); bigArray = 0; captured = 0; } // to save memory

◆ match()

void QRegExpMatchState::match ( const QChar str,
int  len,
int  pos,
bool  minimal,
bool  oneTest,
int  caretIndex 
)

Definition at line 1414 of file qregexp.cpp.

Referenced by testAnchor().

1416 {
1417  bool matched = false;
1418  QChar char_null;
1419 
1420 #ifndef QT_NO_REGEXP_OPTIM
1421  if (eng->trivial && !oneTest) {
1422  pos = qFindString(str0, len0, pos0, eng->goodStr.unicode(), eng->goodStr.length(), eng->cs);
1423  matchLen = eng->goodStr.length();
1424  matched = (pos != -1);
1425  } else
1426 #endif
1427  {
1428  in = str0;
1429  if (in == 0)
1430  in = &char_null;
1431  pos = pos0;
1432  caretPos = caretIndex;
1433  len = len0;
1434  minimal = minimal0;
1435  matchLen = 0;
1436  oneTestMatchedLen = 0;
1437 
1438  if (eng->valid && pos >= 0 && pos <= len) {
1439 #ifndef QT_NO_REGEXP_OPTIM
1440  if (oneTest) {
1441  matched = matchHere();
1442  } else {
1443  if (pos <= len - eng->minl) {
1444  if (eng->caretAnchored) {
1445  matched = matchHere();
1446  } else if (eng->useGoodStringHeuristic) {
1447  matched = eng->goodStringMatch(*this);
1448  } else {
1449  matched = eng->badCharMatch(*this);
1450  }
1451  }
1452  }
1453 #else
1454  matched = oneTest ? matchHere() : eng->bruteMatch(*this);
1455 #endif
1456  }
1457  }
1458 
1459  if (matched) {
1460  int *c = captured;
1461  *c++ = pos;
1462  *c++ = matchLen;
1463 
1464  int numCaptures = (capturedSize - 2) >> 1;
1465 #ifndef QT_NO_REGEXP_CAPTURE
1466  for (int i = 0; i < numCaptures; ++i) {
1467  int j = eng->captureForOfficialCapture.at(i);
1468  if (capBegin[j] != EmptyCapture) {
1469  int len = capEnd[j] - capBegin[j];
1470  *c++ = (len > 0) ? pos + capBegin[j] : 0;
1471  *c++ = len;
1472  } else {
1473  *c++ = -1;
1474  *c++ = -1;
1475  }
1476  }
1477 #endif
1478  } else {
1479  // we rely on 2's complement here
1480  memset(captured, -1, capturedSize * sizeof(int));
1481  }
1482 }
QString goodStr
Definition: qregexp.cpp:1188
unsigned char c[8]
Definition: qnumeric_p.h:62
bool goodStringMatch(QRegExpMatchState &matchState) const
Definition: qregexp.cpp:1872
Qt::CaseSensitivity cs
Definition: qregexp.cpp:1176
bool caretAnchored
Definition: qregexp.cpp:1172
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QVector< int > captureForOfficialCapture
Definition: qregexp.cpp:1158
bool badCharMatch(QRegExpMatchState &matchState) const
Definition: qregexp.cpp:1892
static int caretIndex(int offset, QRegExp::CaretMode caretMode)
Definition: qregexp.cpp:858
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
const QRegExpEngine * eng
Definition: qregexp.cpp:931
const QChar * unicode() const
Returns a &#39;\0&#39;-terminated Unicode representation of the string.
Definition: qstring.h:706
int qFindString(const QChar *haystack, int haystackLen, int from, const QChar *needle, int needleLen, Qt::CaseSensitivity cs)
Definition: qstring.cpp:2753
const int EmptyCapture
Definition: qregexp.cpp:702
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
bool useGoodStringHeuristic
Definition: qregexp.cpp:1184
const QChar * in
Definition: qregexp.cpp:904

◆ matchHere()

bool QRegExpMatchState::matchHere ( )

Definition at line 1971 of file qregexp.cpp.

Referenced by QRegExpEngine::badCharMatch(), and QRegExpEngine::goodStringMatch().

1972 {
1973  int ncur = 1, nnext = 0;
1974  int i = 0, j, k, m;
1975  bool stop = false;
1976 
1977  matchLen = -1;
1978  oneTestMatchedLen = -1;
1980 
1981  int ncap = eng->ncap;
1982 #ifndef QT_NO_REGEXP_CAPTURE
1983  if (ncap > 0) {
1984  for (j = 0; j < ncap; j++) {
1986  curCapEnd[j] = EmptyCapture;
1987  }
1988  }
1989 #endif
1990 
1991 #ifndef QT_NO_REGEXP_BACKREF
1992  while ((ncur > 0 || !sleeping.isEmpty()) && i <= len - pos && !stop)
1993 #else
1994  while (ncur > 0 && i <= len - pos && !stop)
1995 #endif
1996  {
1997  int ch = (i < len - pos) ? in[pos + i].unicode() : 0;
1998  for (j = 0; j < ncur; j++) {
1999  int cur = curStack[j];
2000  const QRegExpAutomatonState &scur = eng->s.at(cur);
2001  const QVector<int> &outs = scur.outs;
2002  for (k = 0; k < outs.size(); k++) {
2003  int next = outs.at(k);
2004  const QRegExpAutomatonState &snext = eng->s.at(next);
2005  bool inside = true;
2006 #if !defined(QT_NO_REGEXP_BACKREF) && !defined(QT_NO_REGEXP_CAPTURE)
2007  int needSomeSleep = 0;
2008 #endif
2009 
2010  /*
2011  First, check if the anchors are anchored properly.
2012  */
2013  int a = scur.anchors.value(next);
2014  if (a != 0 && !testAnchor(i, a, curCapBegin + j * ncap))
2015  inside = false;
2016 
2017  /*
2018  If indeed they are, check if the input character is
2019  correct for this transition.
2020  */
2021  if (inside) {
2022  m = snext.match;
2024  if (eng->cs)
2025  inside = (m == ch);
2026  else
2027  inside = (QChar(m).toLower() == QChar(ch).toLower());
2028  } else if (next == QRegExpEngine::FinalState) {
2029  matchLen = i;
2030  stop = minimal;
2031  inside = true;
2032  } else if ((m & QRegExpEngine::CharClassBit) != 0) {
2033 #ifndef QT_NO_REGEXP_CCLASS
2034  const QRegExpCharClass &cc = eng->cl.at(m ^ QRegExpEngine::CharClassBit);
2035  if (eng->cs)
2036  inside = cc.in(ch);
2037  else if (cc.negative())
2038  inside = cc.in(QChar(ch).toLower()) &&
2039  cc.in(QChar(ch).toUpper());
2040  else
2041  inside = cc.in(QChar(ch).toLower()) ||
2042  cc.in(QChar(ch).toUpper());
2043 #endif
2044 #if !defined(QT_NO_REGEXP_BACKREF) && !defined(QT_NO_REGEXP_CAPTURE)
2045  } else { /* ((m & QRegExpEngine::BackRefBit) != 0) */
2046  int bref = m ^ QRegExpEngine::BackRefBit;
2047  int ell = j * ncap + eng->captureForOfficialCapture.at(bref - 1);
2048 
2049  inside = bref <= ncap && curCapBegin[ell] != EmptyCapture;
2050  if (inside) {
2051  if (eng->cs)
2052  inside = (in[pos + curCapBegin[ell]] == QChar(ch));
2053  else
2054  inside = (in[pos + curCapBegin[ell]].toLower()
2055  == QChar(ch).toLower());
2056  }
2057 
2058  if (inside) {
2059  int delta;
2060  if (curCapEnd[ell] == EmptyCapture)
2061  delta = i - curCapBegin[ell];
2062  else
2063  delta = curCapEnd[ell] - curCapBegin[ell];
2064 
2065  inside = (delta <= len - (pos + i));
2066  if (inside && delta > 1) {
2067  int n = 1;
2068  if (eng->cs) {
2069  while (n < delta) {
2070  if (in[pos + curCapBegin[ell] + n]
2071  != in[pos + i + n])
2072  break;
2073  ++n;
2074  }
2075  } else {
2076  while (n < delta) {
2077  QChar a = in[pos + curCapBegin[ell] + n];
2078  QChar b = in[pos + i + n];
2079  if (a.toLower() != b.toLower())
2080  break;
2081  ++n;
2082  }
2083  }
2084  inside = (n == delta);
2085  if (inside)
2086  needSomeSleep = delta - 1;
2087  }
2088  }
2089 #endif
2090  }
2091  }
2092 
2093  /*
2094  We must now update our data structures.
2095  */
2096  if (inside) {
2097 #ifndef QT_NO_REGEXP_CAPTURE
2098  int *capBegin, *capEnd;
2099 #endif
2100  /*
2101  If the next state was not encountered yet, all
2102  is fine.
2103  */
2104  if ((m = inNextStack[next]) == -1) {
2105  m = nnext++;
2106  nextStack[m] = next;
2107  inNextStack[next] = m;
2108 #ifndef QT_NO_REGEXP_CAPTURE
2109  capBegin = nextCapBegin + m * ncap;
2110  capEnd = nextCapEnd + m * ncap;
2111 
2112  /*
2113  Otherwise, we'll first maintain captures in
2114  temporary arrays, and decide at the end whether
2115  it's best to keep the previous capture zones or
2116  the new ones.
2117  */
2118  } else {
2119  capBegin = tempCapBegin;
2120  capEnd = tempCapEnd;
2121 #endif
2122  }
2123 
2124 #ifndef QT_NO_REGEXP_CAPTURE
2125  /*
2126  Updating the capture zones is much of a task.
2127  */
2128  if (ncap > 0) {
2129  memcpy(capBegin, curCapBegin + j * ncap, ncap * sizeof(int));
2130  memcpy(capEnd, curCapEnd + j * ncap, ncap * sizeof(int));
2131  int c = scur.atom, n = snext.atom;
2132  int p = -1, q = -1;
2133  int cap;
2134 
2135  /*
2136  Lemma 1. For any x in the range [0..nf), we
2137  have f[x].parent < x.
2138 
2139  Proof. By looking at startAtom(), it is
2140  clear that cf < nf holds all the time, and
2141  thus that f[nf].parent < nf.
2142  */
2143 
2144  /*
2145  If we are reentering an atom, we empty all
2146  capture zones inside it.
2147  */
2148  if ((q = scur.reenter.value(next)) != 0) {
2149  QBitArray b(eng->nf, false);
2150  b.setBit(q, true);
2151  for (int ell = q + 1; ell < eng->nf; ell++) {
2152  if (b.testBit(eng->f.at(ell).parent)) {
2153  b.setBit(ell, true);
2154  cap = eng->f.at(ell).capture;
2155  if (cap >= 0) {
2156  capBegin[cap] = EmptyCapture;
2157  capEnd[cap] = EmptyCapture;
2158  }
2159  }
2160  }
2161  p = eng->f.at(q).parent;
2162 
2163  /*
2164  Otherwise, close the capture zones we are
2165  leaving. We are leaving f[c].capture,
2166  f[f[c].parent].capture,
2167  f[f[f[c].parent].parent].capture, ...,
2168  until f[x].capture, with x such that
2169  f[x].parent is the youngest common ancestor
2170  for c and n.
2171 
2172  We go up along c's and n's ancestry until
2173  we find x.
2174  */
2175  } else {
2176  p = c;
2177  q = n;
2178  while (p != q) {
2179  if (p > q) {
2180  cap = eng->f.at(p).capture;
2181  if (cap >= 0) {
2182  if (capBegin[cap] == i) {
2183  capBegin[cap] = EmptyCapture;
2184  capEnd[cap] = EmptyCapture;
2185  } else {
2186  capEnd[cap] = i;
2187  }
2188  }
2189  p = eng->f.at(p).parent;
2190  } else {
2191  q = eng->f.at(q).parent;
2192  }
2193  }
2194  }
2195 
2196  /*
2197  In any case, we now open the capture zones
2198  we are entering. We work upwards from n
2199  until we reach p (the parent of the atom we
2200  reenter or the youngest common ancestor).
2201  */
2202  while (n > p) {
2203  cap = eng->f.at(n).capture;
2204  if (cap >= 0) {
2205  capBegin[cap] = i;
2206  capEnd[cap] = EmptyCapture;
2207  }
2208  n = eng->f.at(n).parent;
2209  }
2210  /*
2211  If the next state was already in
2212  nextStack, we must choose carefully which
2213  capture zones we want to keep.
2214  */
2215  if (capBegin == tempCapBegin &&
2216  isBetterCapture(ncap, capBegin, capEnd, nextCapBegin + m * ncap,
2217  nextCapEnd + m * ncap)) {
2218  memcpy(nextCapBegin + m * ncap, capBegin, ncap * sizeof(int));
2219  memcpy(nextCapEnd + m * ncap, capEnd, ncap * sizeof(int));
2220  }
2221  }
2222 #ifndef QT_NO_REGEXP_BACKREF
2223  /*
2224  We are done with updating the capture zones.
2225  It's now time to put the next state to sleep,
2226  if it needs to, and to remove it from
2227  nextStack.
2228  */
2229  if (needSomeSleep > 0) {
2230  QVector<int> zzZ(2 + 2 * ncap);
2231  zzZ[0] = i + needSomeSleep;
2232  zzZ[1] = next;
2233  if (ncap > 0) {
2234  memcpy(zzZ.data() + 2, capBegin, ncap * sizeof(int));
2235  memcpy(zzZ.data() + 2 + ncap, capEnd, ncap * sizeof(int));
2236  }
2237  inNextStack[nextStack[--nnext]] = -1;
2238  sleeping.append(zzZ);
2239  }
2240 #endif
2241 #endif
2242  }
2243  }
2244  }
2245 #ifndef QT_NO_REGEXP_CAPTURE
2246  /*
2247  If we reached the final state, hurray! Copy the captured
2248  zone.
2249  */
2250  if (ncap > 0 && (m = inNextStack[QRegExpEngine::FinalState]) != -1) {
2251  memcpy(capBegin, nextCapBegin + m * ncap, ncap * sizeof(int));
2252  memcpy(capEnd, nextCapEnd + m * ncap, ncap * sizeof(int));
2253  }
2254 #ifndef QT_NO_REGEXP_BACKREF
2255  /*
2256  It's time to wake up the sleepers.
2257  */
2258  j = 0;
2259  while (j < sleeping.count()) {
2260  if (sleeping.at(j)[0] == i) {
2261  const QVector<int> &zzZ = sleeping.at(j);
2262  int next = zzZ[1];
2263  const int *capBegin = zzZ.data() + 2;
2264  const int *capEnd = zzZ.data() + 2 + ncap;
2265  bool copyOver = true;
2266 
2267  if ((m = inNextStack[next]) == -1) {
2268  m = nnext++;
2269  nextStack[m] = next;
2270  inNextStack[next] = m;
2271  } else {
2272  copyOver = isBetterCapture(ncap, nextCapBegin + m * ncap, nextCapEnd + m * ncap,
2273  capBegin, capEnd);
2274  }
2275  if (copyOver) {
2276  memcpy(nextCapBegin + m * ncap, capBegin, ncap * sizeof(int));
2277  memcpy(nextCapEnd + m * ncap, capEnd, ncap * sizeof(int));
2278  }
2279 
2280  sleeping.removeAt(j);
2281  } else {
2282  ++j;
2283  }
2284  }
2285 #endif
2286 #endif
2287  for (j = 0; j < nnext; j++)
2288  inNextStack[nextStack[j]] = -1;
2289 
2290  // avoid needless iteration that confuses oneTestMatchedLen
2291  if (nnext == 1 && nextStack[0] == QRegExpEngine::FinalState
2292 #ifndef QT_NO_REGEXP_BACKREF
2293  && sleeping.isEmpty()
2294 #endif
2295  )
2296  stop = true;
2297 
2299 #ifndef QT_NO_REGEXP_CAPTURE
2300  qSwap(curCapBegin, nextCapBegin);
2302 #endif
2303  ncur = nnext;
2304  nnext = 0;
2305  ++i;
2306  }
2307 
2308 #ifndef QT_NO_REGEXP_BACKREF
2309  /*
2310  If minimal matching is enabled, we might have some sleepers
2311  left.
2312  */
2313  if (!sleeping.isEmpty())
2314  sleeping.clear();
2315 #endif
2316 
2317  oneTestMatchedLen = i - 1;
2318  return (matchLen >= 0);
2319 }
QMap< int, int > anchors
Definition: qregexp.cpp:958
unsigned char c[8]
Definition: qnumeric_p.h:62
QVector< int > outs
Definition: qregexp.cpp:956
Qt::CaseSensitivity cs
Definition: qregexp.cpp:1176
QVector< int > captureForOfficialCapture
Definition: qregexp.cpp:1158
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
const QRegExpEngine * eng
Definition: qregexp.cpp:931
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
bool negative() const
Definition: qregexp.cpp:1031
bool in(QChar ch) const
Definition: qregexp.cpp:2393
const int EmptyCapture
Definition: qregexp.cpp:702
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
static bool isBetterCapture(int ncap, const int *begin1, const int *end1, const int *begin2, const int *end2)
Definition: qregexp.cpp:1785
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void clear()
Removes all items from the list.
Definition: qlist.h:764
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
The QBitArray class provides an array of bits.
Definition: qbitarray.h:54
QVector< QRegExpCharClass > cl
Definition: qregexp.cpp:1163
QList< QVector< int > > sleeping
Definition: qregexp.cpp:926
QVector< QRegExpAtom > f
Definition: qregexp.cpp:1155
const QChar * in
Definition: qregexp.cpp:904
T * data()
Returns a pointer to the data stored in the vector.
Definition: qvector.h:152
bool testAnchor(int i, int a, const int *capBegin)
Definition: qregexp.cpp:1804
QVector< QRegExpAutomatonState > s
Definition: qregexp.cpp:1153
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
QMap< int, int > reenter
Definition: qregexp.cpp:957
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ prepareForMatch()

void QRegExpMatchState::prepareForMatch ( QRegExpEngine eng)

Definition at line 1367 of file qregexp.cpp.

Referenced by prepareEngine_helper(), prepareEngineForMatch(), and testAnchor().

1368 {
1369  /*
1370  We use one QVector<int> for all the big data used a lot in
1371  matchHere() and friends.
1372  */
1373  int ns = eng->s.size(); // number of states
1374  int ncap = eng->ncap;
1375 #ifndef QT_NO_REGEXP_OPTIM
1376  int newSlideTabSize = qMax(eng->minl + 1, 16);
1377 #else
1378  int newSlideTabSize = 0;
1379 #endif
1380  int numCaptures = eng->captureCount();
1381  int newCapturedSize = 2 + 2 * numCaptures;
1382  bigArray = q_check_ptr((int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int)));
1383 
1384  // set all internal variables only _after_ bigArray is realloc'ed
1385  // to prevent a broken regexp in oom case
1386 
1387  slideTabSize = newSlideTabSize;
1388  capturedSize = newCapturedSize;
1390  memset(inNextStack, -1, ns * sizeof(int));
1391  curStack = inNextStack + ns;
1392  nextStack = inNextStack + 2 * ns;
1393 
1394  curCapBegin = inNextStack + 3 * ns;
1395  nextCapBegin = curCapBegin + ncap * ns;
1396  curCapEnd = curCapBegin + 2 * ncap * ns;
1397  nextCapEnd = curCapBegin + 3 * ncap * ns;
1398 
1399  tempCapBegin = curCapBegin + 4 * ncap * ns;
1400  tempCapEnd = tempCapBegin + ncap;
1401  capBegin = tempCapBegin + 2 * ncap;
1402  capEnd = tempCapBegin + 3 * ncap;
1403 
1404  slideTab = tempCapBegin + 4 * ncap;
1406  memset(captured, -1, capturedSize*sizeof(int));
1407  this->eng = eng;
1408 }
T * q_check_ptr(T *p)
Definition: qglobal.h:1857
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
const QRegExpEngine * eng
Definition: qregexp.cpp:931
int captureCount() const
Definition: qregexp.cpp:1085
QVector< QRegExpAutomatonState > s
Definition: qregexp.cpp:1153
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ testAnchor()

bool QRegExpMatchState::testAnchor ( int  i,
int  a,
const int *  capBegin 
)

Definition at line 1804 of file qregexp.cpp.

1805 {
1806  int j;
1807 
1808 #ifndef QT_NO_REGEXP_ANCHOR_ALT
1809  if ((a & QRegExpEngine::Anchor_Alternation) != 0)
1810  return testAnchor(i, eng->aa.at(a ^ QRegExpEngine::Anchor_Alternation).a, capBegin)
1811  || testAnchor(i, eng->aa.at(a ^ QRegExpEngine::Anchor_Alternation).b, capBegin);
1812 #endif
1813 
1814  if ((a & QRegExpEngine::Anchor_Caret) != 0) {
1815  if (pos + i != caretPos)
1816  return false;
1817  }
1818  if ((a & QRegExpEngine::Anchor_Dollar) != 0) {
1819  if (pos + i != len)
1820  return false;
1821  }
1822 #ifndef QT_NO_REGEXP_ESCAPE
1824  bool before = false;
1825  bool after = false;
1826  if (pos + i != 0)
1827  before = isWord(in[pos + i - 1]);
1828  if (pos + i != len)
1829  after = isWord(in[pos + i]);
1830  if ((a & QRegExpEngine::Anchor_Word) != 0 && (before == after))
1831  return false;
1832  if ((a & QRegExpEngine::Anchor_NonWord) != 0 && (before != after))
1833  return false;
1834  }
1835 #endif
1836 #ifndef QT_NO_REGEXP_LOOKAHEAD
1837  if ((a & QRegExpEngine::Anchor_LookaheadMask) != 0) {
1838  const QVector<QRegExpLookahead *> &ahead = eng->ahead;
1839  for (j = 0; j < ahead.size(); j++) {
1840  if ((a & (QRegExpEngine::Anchor_FirstLookahead << j)) != 0) {
1841  QRegExpMatchState matchState;
1842  matchState.prepareForMatch(ahead[j]->eng);
1843  matchState.match(in + pos + i, len - pos - i, 0,
1844  true, true, caretPos - pos - i);
1845  if ((matchState.captured[0] == 0) == ahead[j]->neg)
1846  return false;
1847  }
1848  }
1849  }
1850 #endif
1851 #ifndef QT_NO_REGEXP_CAPTURE
1852 #ifndef QT_NO_REGEXP_BACKREF
1853  for (j = 0; j < eng->nbrefs; j++) {
1854  if ((a & (QRegExpEngine::Anchor_BackRef1Empty << j)) != 0) {
1855  int i = eng->captureForOfficialCapture.at(j);
1856  if (capBegin[i] != EmptyCapture)
1857  return false;
1858  }
1859  }
1860 #endif
1861 #endif
1862  return true;
1863 }
QVector< int > captureForOfficialCapture
Definition: qregexp.cpp:1158
long ASN1_INTEGER_get ASN1_INTEGER * a
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
static bool isWord(QChar ch)
Definition: qregexp.cpp:707
const QRegExpEngine * eng
Definition: qregexp.cpp:931
const int EmptyCapture
Definition: qregexp.cpp:702
void prepareForMatch(QRegExpEngine *eng)
Definition: qregexp.cpp:1367
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< QRegExpAnchorAlternation > aa
Definition: qregexp.cpp:1169
QVector< QRegExpLookahead * > ahead
Definition: qregexp.cpp:1166
const QChar * in
Definition: qregexp.cpp:904
bool testAnchor(int i, int a, const int *capBegin)
Definition: qregexp.cpp:1804
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
void match(const QChar *str, int len, int pos, bool minimal, bool oneTest, int caretIndex)
Definition: qregexp.cpp:1414

Properties

◆ bigArray

int* QRegExpMatchState::bigArray

Definition at line 909 of file qregexp.cpp.

◆ capBegin

int* QRegExpMatchState::capBegin

Definition at line 919 of file qregexp.cpp.

◆ capEnd

int* QRegExpMatchState::capEnd

Definition at line 920 of file qregexp.cpp.

◆ captured

int* QRegExpMatchState::captured

Definition at line 922 of file qregexp.cpp.

Referenced by QRegExp::operator=(), and testAnchor().

◆ capturedSize

int QRegExpMatchState::capturedSize

Definition at line 924 of file qregexp.cpp.

◆ caretPos

int QRegExpMatchState::caretPos

Definition at line 906 of file qregexp.cpp.

◆ curCapBegin

int* QRegExpMatchState::curCapBegin

Definition at line 913 of file qregexp.cpp.

◆ curCapEnd

int* QRegExpMatchState::curCapEnd

Definition at line 915 of file qregexp.cpp.

◆ curStack

int* QRegExpMatchState::curStack

Definition at line 911 of file qregexp.cpp.

◆ eng

const QRegExpEngine* QRegExpMatchState::eng

Definition at line 931 of file qregexp.cpp.

◆ in

const QChar* QRegExpMatchState::in

Definition at line 904 of file qregexp.cpp.

Referenced by QRegExpEngine::badCharMatch(), and QRegExpEngine::goodStringMatch().

◆ inNextStack

int* QRegExpMatchState::inNextStack

Definition at line 910 of file qregexp.cpp.

◆ len

int QRegExpMatchState::len

Definition at line 907 of file qregexp.cpp.

Referenced by QRegExpEngine::badCharMatch(), and QRegExpEngine::goodStringMatch().

◆ matchLen

int QRegExpMatchState::matchLen

Definition at line 928 of file qregexp.cpp.

◆ minimal

bool QRegExpMatchState::minimal

Definition at line 908 of file qregexp.cpp.

◆ nextCapBegin

int* QRegExpMatchState::nextCapBegin

Definition at line 914 of file qregexp.cpp.

◆ nextCapEnd

int* QRegExpMatchState::nextCapEnd

Definition at line 916 of file qregexp.cpp.

◆ nextStack

int* QRegExpMatchState::nextStack

Definition at line 912 of file qregexp.cpp.

◆ oneTestMatchedLen

int QRegExpMatchState::oneTestMatchedLen

Definition at line 929 of file qregexp.cpp.

◆ pos

int QRegExpMatchState::pos

Definition at line 905 of file qregexp.cpp.

Referenced by QRegExpEngine::badCharMatch(), and QRegExpEngine::goodStringMatch().

◆ sleeping

QList<QVector<int> > QRegExpMatchState::sleeping

Definition at line 926 of file qregexp.cpp.

◆ slideTab

int* QRegExpMatchState::slideTab

Definition at line 921 of file qregexp.cpp.

Referenced by QRegExpEngine::badCharMatch().

◆ slideTabSize

int QRegExpMatchState::slideTabSize

Definition at line 923 of file qregexp.cpp.

Referenced by QRegExpEngine::badCharMatch().

◆ tempCapBegin

int* QRegExpMatchState::tempCapBegin

Definition at line 917 of file qregexp.cpp.

◆ tempCapEnd

int* QRegExpMatchState::tempCapEnd

Definition at line 918 of file qregexp.cpp.


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