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

Function fxMatchRegExp

xs/sources/xsre.c:2758–3221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2756#endif
2757
2758txBoolean fxMatchRegExp(void* the, txInteger* code, txInteger* data, txString subject, txInteger start)
2759{
2760#if defined(__GNUC__)
2761 static void *const gxSteps[] = {
2762 &&cxMatchStep,
2763 &&cxAssertionStep,
2764 &&cxAssertionCompletion,
2765 &&cxAssertionNotStep,
2766 &&cxAssertionNotCompletion,
2767 &&cxCaptureForwardStep,
2768 &&cxCaptureForwardCompletion,
2769 &&cxCaptureBackwardStep,
2770 &&cxCaptureBackwardCompletion,
2771 &&cxCaptureReferenceForwardStep,
2772 &&cxCaptureReferenceBackwardStep,
2773 &&cxCharSetForwardStep,
2774 &&cxCharSetBackwardStep,
2775 &&cxDisjunctionStep,
2776 &&cxEmptyStep,
2777 &&cxLineBeginStep,
2778 &&cxLineEndStep,
2779 &&cxQuantifierStep,
2780 &&cxQuantifierGreedyLoop,
2781 &&cxQuantifierLazyLoop,
2782 &&cxQuantifierCompletion,
2783 &&cxWordBreakStep,
2784 &&cxWordContinueStep,
2785 &&cxModifiersStep,
2786 };
2787 register void * const *steps = gxSteps;
2788#endif
2789 txInteger stop = (the) ? fxCacheUTF8Length(the, subject) : mxStringLength(subject);
2790 txInteger flags = code[0];
2791 txInteger captureCount = code[1];
2792 txInteger nameCount = code[2];
2793 txInteger assertionCount = code[3];
2794 txCaptureData* captures = (txCaptureData*)data;
2795 txInteger* names = (txInteger*)(captures + captureCount);
2796 txAssertionData* assertions = (txAssertionData*)(names + nameCount);
2797 txQuantifierData* quantifiers = (txQuantifierData*)(assertions + assertionCount);
2798 txCaptureData* capture;
2799 txAssertionData* assertion;
2800 txQuantifierData* quantifier;
2801 txStateData* firstState = C_NULL;
2802 txInteger from, to, e, f, g;
2803 txBoolean result = 0;
2804 if ((0 <= start) && (start <= stop)) {
2805 for (;;) {
2806 txInteger step = (5 + nameCount) * sizeof(txInteger), sequel;
2807 txInteger offset = start;
2808 #ifdef mxMetering
2809 txInteger former = step;
2810 #endif
2811 c_memset(captures, -1, captureCount * sizeof(txCaptureData));
2812 c_memset(names, -1, nameCount * sizeof(txInteger));
2813 while (step) {
2814 txInteger* pointer = (txInteger*)(((txByte*)code) + step);
2815 txInteger which = *pointer++;

Callers 4

PiuCodeSearchDataFunction · 0.85
PiuCodeSearchFunction · 0.85
mainFunction · 0.85
fx_RegExp_prototype_execFunction · 0.85

Calls 7

fxCacheUTF8LengthFunction · 0.85
fxCheckMeteringFunction · 0.85
fxPopStatesFunction · 0.85
fxPushStateFunction · 0.85
fxGetCharacterFunction · 0.85
fxFindCharacterFunction · 0.85
fxMatchCharacterFunction · 0.85

Tested by

no test coverage detected