src/main/java/com/basistech/tclre/Compiler.java
private int scannum() throws RegexException {
        int n = 0;

        while (see(DIGIT) && n < DUPMAX) {
            n = n * 10 + nextvalue;
            lex.next();
        }

        if (see(DIGIT) || n > DUPMAX) {
            throw new RegexException("Unvalid reference number.");
        }
        return n;
    }
private int scannum() throws RegexException {
        int n = 0;

        while (see(DIGIT) && n < DUPMAX) {
            n = n * 10 + nextvalue;
            lex.next();
        }

        if (see(DIGIT) || n > DUPMAX) {
            throw new RegexException("Unvalid reference number.");
        }
        return n;
    }
scannum - scan a number

@return value <= DUPMAX