REuint8 *emitREBytecode(REState *pState, REuint8 *pc, RENode *t)
static REuint8 *emitREBytecode(REState *pState, REuint8 *pc, RENode *t)
REuint8 *emitREBytecode(REState *pState, REuint8 *pc, RENode *t){    RENode *nextAlt;    REuint8 *nextAltFixup, *nextTermFixup;    while (t) {        *pc++ = t->kind;        switch (t->kind) {        case REOP_EMPTY:            --pc;            break;        case REOP_ALT:            nextAlt = (RENode *)(t->data.child2);            nextAltFixup = pc;            EMIT_BRANCH(pc);    /* address of next alternate */            pc = emitREBytecode(pState, pc, (RENode *)(t->child));            *pc++ = REOP_ENDALT;            nextTermFixup = pc;            EMIT_BRANCH(pc);    /* address of following term */            CHECK_RANGE(nextAltFixup, pc);            EMIT_FIXUP(nextAltFixup, pc);            pc = emitREBytecode(pState, pc, nextAlt);            *pc++ = REOP_ENDALT;            nextAltFixup = pc;            EMIT_BRANCH(pc);            CHECK_RANGE(nextTermFixup, pc);            EMIT_FIXUP(nextTermFixup, pc);            CHECK_RANGE(nextAltFixup, pc);            EMIT_FIXUP(nextAltFixup, pc);            break;        case REOP_FLAT:            if (t->child && (t->data.flat.length > 1)) {                if (pState->flags & RE_IGNORECASE)                    pc[-1] = REOP_FLATNi;                else                    pc[-1] = REOP_FLATN;                EMIT_ARG(pc, (REchar *)(t->child) - pState->srcStart);                EMIT_ARG(pc, t->data.flat.length);            }            else {  /* XXX original Monkey code separated ASCII and Unicode cases to save extra byte */                if (pState->flags & RE_IGNORECASE)                    pc[-1] = REOP_FLAT1i;                else                    pc[-1] = REOP_FLAT1;                EMIT_ARG(pc, t->data.flat.ch);            }            break;        case REOP_PAREN:            EMIT_ARG(pc, t->parenIndex);            pc = emitREBytecode(pState, pc, (RENode *)(t->child));            *pc++ = REOP_CLOSEPAREN;            EMIT_ARG(pc, t->parenIndex);            break;        case REOP_BACKREF:            EMIT_ARG(pc, t->parenIndex);            break;        case REOP_ASSERT:            nextTermFixup = pc;            EMIT_BRANCH(pc);            pc = emitREBytecode(pState, pc, (RENode *)(t->child));            *pc++ = REOP_ASSERTTEST;            CHECK_RANGE(nextTermFixup, pc);            EMIT_FIXUP(nextTermFixup, pc);            break;        case REOP_ASSERTNOT:            nextTermFixup = pc;            EMIT_BRANCH(pc);            pc = emitREBytecode(pState, pc, (RENode *)(t->child));            *pc++ = REOP_ASSERTNOTTEST;            CHECK_RANGE(nextTermFixup, pc);            EMIT_FIXUP(nextTermFixup, pc);            break;        case REOP_QUANT:            if ((t->data.quantifier.min == 0) && (t->data.quantifier.max == -1))                pc[-1] = (t->data.quantifier.greedy)                                         ? REOP_STAR : REOP_MINIMALSTAR;            else            if ((t->data.quantifier.min == 0) && (t->data.quantifier.max == 1))                pc[-1] = (t->data.quantifier.greedy)                                         ? REOP_OPT : REOP_MINIMALOPT;            else            if ((t->data.quantifier.min == 1) && (t->data.quantifier.max == -1))                pc[-1] = (t->data.quantifier.greedy)                                         ? REOP_PLUS : REOP_MINIMALPLUS;            else {                if (!t->data.quantifier.greedy) pc[-1] = REOP_MINIMALQUANT;                EMIT_ARG(pc, t->data.quantifier.min);                EMIT_ARG(pc, t->data.quantifier.max);            }            EMIT_ARG(pc, t->data.quantifier.parenCount);            EMIT_ARG(pc, t->parenIndex);            nextTermFixup = pc;            EMIT_BRANCH(pc);            pc = emitREBytecode(pState, pc, (RENode *)(t->child));            *pc++ = REOP_ENDCHILD;            CHECK_RANGE(nextTermFixup, pc);            EMIT_FIXUP(nextTermFixup, pc);            break;        case REOP_CLASS:            EMIT_ARG(pc, t->data.chclass.classIndex);            processCharSet(pState, t);            break;        }        t = t->next;    }    return pc;}