MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxMatchCharacter

Function fxMatchCharacter

xs/sources/xsre.c:2671–2702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2669}
2670
2671txBoolean fxMatchCharacter(txInteger* characters, txInteger character)
2672{
2673 txInteger min = 0;
2674 txInteger max = characters[0] >> 1;
2675 txInteger* base = characters + 1;
2676 while (min < max) {
2677 txInteger mid = (min + max) >> 1;
2678 txInteger begin = *(base + (mid << 1));
2679 txInteger end = *(base + (mid << 1) + 1);
2680 #ifdef mxTrace
2681 fprintf(stderr, " ");
2682 if ((32 <= begin) && (begin < 128))
2683 fprintf(stderr, "%c", begin);
2684 else
2685 fprintf(stderr, "%4.4X", begin);
2686 if (begin != (end - 1)) {
2687 fprintf(stderr, "-");
2688 if ((32 <= (end - 1)) && ((end - 1) < 128))
2689 fprintf(stderr, "%c", (end - 1));
2690 else
2691 fprintf(stderr, "%4.4X", (end - 1));
2692 }
2693 #endif
2694 if (character < begin)
2695 max = mid;
2696 else if (character >= end)
2697 min = mid + 1;
2698 else
2699 return 1;
2700 }
2701 return 0;
2702}
2703
2704txStateData* fxPopStates(txMachine* the, txStateData* fromState, txStateData* toState)
2705{

Callers 1

fxMatchRegExpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected