MCPcopy Create free account
hub / github.com/Genivia/RE-flex / parse3

Method parse3

lib/pattern.cpp:1160–1323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1158}
1159
1160void Pattern::parse3(
1161 bool begin,
1162 Location& loc,
1163 Positions& firstpos,
1164 Positions& lastpos,
1165 bool& nullable,
1166 Follow& followpos,
1167 Lazy& lazyidx,
1168 Lazypos& lazypos,
1169 Mods modifiers,
1170 Locations& lookahead,
1171 Iter& iter)
1172{
1173 DBGLOG("BEGIN parse3(%u)", loc);
1174 Position b_pos(loc);
1175 parse4(
1176 begin,
1177 loc,
1178 firstpos,
1179 lastpos,
1180 nullable,
1181 followpos,
1182 lazyidx,
1183 lazypos,
1184 modifiers,
1185 lookahead,
1186 iter);
1187 Char c = at(loc);
1188 if (opt_.x)
1189 while (std::isspace(c))
1190 c = at(++loc);
1191 while (true)
1192 {
1193 if (c == '*' || c == '+' || c == '?')
1194 {
1195 if (c == '*' || c == '?')
1196 {
1197 nullable = true;
1198 if (begin)
1199 bol_ = false;
1200 }
1201 if (at(++loc) == '?')
1202 {
1203 if (++lazyidx == 0)
1204 error(regex_error::exceeds_limits, loc); // overflow: exceeds max 255 lazy quantifiers
1205 lazy_add(lazypos, lazyidx, loc);
1206 lazy(lazypos, firstpos);
1207 ++loc;
1208 }
1209 else if (c != '?' && !lazypos.empty())
1210 {
1211 greedy(firstpos);
1212 }
1213 if (c != '?')
1214 for (Positions::const_iterator p = lastpos.begin(); p != lastpos.end(); ++p)
1215 pos_insert(followpos[p->pos()], firstpos);
1216 }
1217 else if (c == '{') // {n,m} repeat min n times to max m

Callers

nothing calls this directly

Calls 11

atFunction · 0.85
locMethod · 0.80
iterMethod · 0.80
swapMethod · 0.80
errorFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
posMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected