private final int fetchNameForNoNamedGroup(int startCode, boolean ref) {
        int src = p;
        value = 0;
        int sign = 1;

        int endCode = nameEndCodePoint(startCode);
        int pnumHead = p;
        int nameEnd = stop;

        String err = null;
        if (!left()) {
            newValueException(EMPTY_GROUP_NAME);
        } else {
            fetch();
            if (c == endCode) newValueException(EMPTY_GROUP_NAME);

            if (enc.isDigit(c)) {
            } else if (c == '-') {
                sign = -1;
                pnumHead = p;
            } else {
                err = INVALID_CHAR_IN_GROUP_NAME;
            }
        }

        while(left()) {
            nameEnd = p;

            fetch();
            if (c == endCode || c == ')') break;
            if (!enc.isDigit(c)) err = INVALID_CHAR_IN_GROUP_NAME;
        }

        if (err == null && c != endCode) {
            err = INVALID_GROUP_NAME;
            nameEnd = stop;
        }

        if (err == null) {
            mark();
            p = pnumHead;
            int backNum = scanUnsignedNumber();
            restore();
            if (backNum < 0) {
                newValueException(TOO_BIG_NUMBER);
            } else if (backNum == 0){
                newValueException(INVALID_GROUP_NAME, src, nameEnd);
            }
            backNum *= sign;

            value = nameEnd;
            return backNum;
        } else {
            newValueException(err, src, nameEnd);
            return 0; // not reached
        }
    }
private final int fetchNameForNoNamedGroup ( int startCode , boolean ref ) { int src = p ; value = 0 ; int sign = 1 ; int endCode = nameEndCodePoint ( startCode ) ; int pnumHead = p ; int nameEnd = stop ; String err = null ; if ( ! left ( ) ) { newValueException ( EMPTY_GROUP_NAME ) ; } else { fetch ( ) ; if ( c == endCode ) newValueException ( EMPTY_GROUP_NAME ) ; if ( enc . isDigit ( c ) ) { } else if ( c == '-' ) { sign = - 1 ; pnumHead = p ; } else { err = INVALID_CHAR_IN_GROUP_NAME ; } } while ( left ( ) ) { nameEnd = p ; fetch ( ) ; if ( c == endCode || c == ')' ) break ; if ( ! enc . isDigit ( c ) ) err = INVALID_CHAR_IN_GROUP_NAME ; } if ( err == null && c != endCode ) { err = INVALID_GROUP_NAME ; nameEnd = stop ; } if ( err == null ) { mark ( ) ; p = pnumHead ; int backNum = scanUnsignedNumber ( ) ; restore ( ) ; if ( backNum < 0 ) { newValueException ( TOO_BIG_NUMBER ) ; } else if ( backNum == 0 ) { newValueException ( INVALID_GROUP_NAME , src , nameEnd ) ; } backNum *= sign ; value = nameEnd ; return backNum ; } else { newValueException ( err , src , nameEnd ) ; return 0 ; } }
make it return nameEnd!