src/main/java/com/basistech/tclre/ColorMap.java
private short newsub(short co) throws RegexException {
        short sco; // new subcolor.

        ColorDesc cd = colorDescs.get(co);

        sco = colorDescs.get(co).sub;
        if (sco == Constants.NOSUB) {       /* color has no open subcolor */
            if (cd.getNChars() == 1) { /* optimization */
                return co;
            }
            sco = newcolor();   /* must create subcolor */
            if (sco == Constants.COLORLESS) {
                throw new RegexException("Invalid color allocation");
            }

            ColorDesc subcd = colorDescs.get(sco);
            cd.sub = sco;
            subcd.sub = sco;    /* open subcolor points to self */
        }

        return sco;
    }
private short newsub(short co) throws RegexException {
        short sco; // new subcolor.

        ColorDesc cd = colorDescs.get(co);

        sco = colorDescs.get(co).sub;
        if (sco == Constants.NOSUB) {       /* color has no open subcolor */
            if (cd.getNChars() == 1) { /* optimization */
                return co;
            }
            sco = newcolor();   /* must create subcolor */
            if (sco == Constants.COLORLESS) {
                throw new RegexException("Invalid color allocation");
            }

            ColorDesc subcd = colorDescs.get(sco);
            cd.sub = sco;
            subcd.sub = sco;    /* open subcolor points to self */
        }

        return sco;
    }
private short newsub ( short co ) throws RegexException { short sco ; // new subcolor. ColorDesc cd = colorDescs . get ( co ) ; sco = colorDescs . get ( co ) . sub ; if ( sco == Constants . NOSUB ) { /* color has no open subcolor */ if ( cd . getNChars ( ) == 1 ) { /* optimization */ return co ; } sco = newcolor ( ) ; /* must create subcolor */ if ( sco == Constants . COLORLESS ) { throw new RegexException ( "Invalid color allocation" ) ; } ColorDesc subcd = colorDescs . get ( sco ) ; cd . sub = sco ; subcd . sub = sco ; /* open subcolor points to self */ } return sco ; }
newsub - allocate a new subcolor (if necessary) for a color
newsub - allocate a new subcolor ( if necessary ) for a color