MCPcopy Create free account
hub / github.com/Genivia/ugrep / parse4

Method parse4

lib/pattern.cpp:1325–1598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1323}
1324
1325void Pattern::parse4(
1326 bool begin,
1327 Location& loc,
1328 Positions& firstpos,
1329 Positions& lastpos,
1330 bool& nullable,
1331 Follow& followpos,
1332 Lazy& lazyidx,
1333 Lazypos& lazypos,
1334 Mods modifiers,
1335 Locations& lookahead,
1336 Iter& iter)
1337{
1338 DBGLOG("BEGIN parse4(%u)", loc);
1339 firstpos.clear();
1340 lastpos.clear();
1341 nullable = true;
1342 lazypos.clear();
1343 iter = 1;
1344 Char c = at(loc);
1345 if (c == '(')
1346 {
1347 if (at(++loc) == '?')
1348 {
1349 c = at(++loc);
1350 if (c == '#') // (?# comment
1351 {
1352 while ((c = at(++loc)) != '\0' && c != ')')
1353 continue;
1354 if (c == ')')
1355 ++loc;
1356 }
1357 else if (c == '^') // (?^ negative pattern to be ignored (new mode), producing a redo match
1358 {
1359 Positions firstpos1;
1360 ++loc;
1361 parse1(
1362 begin,
1363 loc,
1364 firstpos1,
1365 lastpos,
1366 nullable,
1367 followpos,
1368 lazyidx,
1369 lazypos,
1370 modifiers,
1371 lookahead,
1372 iter);
1373 for (Positions::iterator p = firstpos1.begin(); p != firstpos1.end(); ++p)
1374 pos_add(firstpos, p->negate(true));
1375 }
1376 else if (c == '=') // (?= lookahead
1377 {
1378 Position l_pos(loc++ - 2); // lookahead at (
1379 parse1(
1380 begin,
1381 loc,
1382 firstpos,

Callers

nothing calls this directly

Calls 11

PositionClass · 0.85
negateMethod · 0.80
locMethod · 0.80
tickedMethod · 0.80
errorFunction · 0.50
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
insertMethod · 0.45
posMethod · 0.45

Tested by

no test coverage detected