src/main/java/com/basistech/tclre/Compiler.java
private Subre parsebranch(int stopper, int type, State left, State right, boolean partial) throws RegexException {
        State lp;   /* left end of current construct */
        boolean seencontent = false;    /* is there anything in this branch yet? */
        Subre t;

        lp = left;

        t = new Subre('=', 0, left, right); /* op '=' is tentative */
        while (!see('|') && !see(stopper) && !see(EOS)) {
            if (seencontent) {  /* implicit concat operator */
                lp = nfa.newstate();
                moveins(nfa, right, lp);
            }
            seencontent = true;

        /* NB, recursion in parseqatom() may swallow rest of branch */
            parseqatom(stopper, type, lp, right, t);
        }

        if (!seencontent) {     /* empty branch */
            if (!partial) {
                note(Flags.REG_UUNSPEC);
            }

            nfa.emptyarc(left, right);
        }

        return t;
    }
private Subre parsebranch(int stopper, int type, State left, State right, boolean partial) throws RegexException {
        State lp;   /* left end of current construct */
        boolean seencontent = false;    /* is there anything in this branch yet? */
        Subre t;

        lp = left;

        t = new Subre('=', 0, left, right); /* op '=' is tentative */
        while (!see('|') && !see(stopper) && !see(EOS)) {
            if (seencontent) {  /* implicit concat operator */
                lp = nfa.newstate();
                moveins(nfa, right, lp);
            }
            seencontent = true;

        /* NB, recursion in parseqatom() may swallow rest of branch */
            parseqatom(stopper, type, lp, right, t);
        }

        if (!seencontent) {     /* empty branch */
            if (!partial) {
                note(Flags.REG_UUNSPEC);
            }

            nfa.emptyarc(left, right);
        }

        return t;
    }
parsebranch - parse one branch of an RE
This mostly manages concatenation, working closely with parseqatom().
Concatenated things are bundled up as much as possible, with separate
',' nodes introduced only when necessary due to substructure.