MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ApplyFold

Function ApplyFold

extern/re2/re2/parse.cc:300–323  ·  view source on GitHub ↗

Returns the result of applying the fold f to the rune r.

Source from the content-addressed store, hash-verified

298
299// Returns the result of applying the fold f to the rune r.
300Rune ApplyFold(const CaseFold *f, Rune r) {
301 switch (f->delta) {
302 default:
303 return r + f->delta;
304
305 case EvenOddSkip: // even <-> odd but only applies to every other
306 if ((r - f->lo) % 2)
307 return r;
308 FALLTHROUGH_INTENDED;
309 case EvenOdd: // even <-> odd
310 if (r%2 == 0)
311 return r + 1;
312 return r - 1;
313
314 case OddEvenSkip: // odd <-> even but only applies to every other
315 if ((r - f->lo) % 2)
316 return r;
317 FALLTHROUGH_INTENDED;
318 case OddEven: // odd <-> even
319 if (r%2 == 1)
320 return r + 1;
321 return r - 1;
322 }
323}
324
325// Returns the next Rune in r's folding cycle (see unicode_casefold.h).
326// Examples:

Callers 2

CycleFoldRuneFunction · 0.85
ToLowerRuneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected