src/main/java/com/basistech/tclre/Lex.java
private int lexdigits(int base, int minlen, int maxlen) throws RegexException {
        int n;          /* unsigned to avoid overflow misbehavior */
        int len;
        int c;
        int d;
        final char ub = (char)base;

        n = 0;
        for (len = 0; len < maxlen && !ateos(); len++) {
            c = charAtNowAdvance();
            switch (c) {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                d = digitval((char)c);
                break;
            case 'a':
            case 'A':
                d = 10;
                break;
            case 'b':
            case 'B':
                d = 11;
                break;
            case 'c':
            case 'C':
                d = 12;
                break;
            case 'd':
            case 'D':
                d = 13;
                break;
            case 'e':
            case 'E':
                d = 14;
                break;
            case 'f':
            case 'F':
                d = 15;
                break;
            default:
                v.now--;    /* oops, not a digit at all */
                d = -1;
                break;
            }

            if (d >= base) {    /* not a plausible digit */
                v.now--;
                d = -1;
            }
            if (d < 0) {
                break;      /* NOTE BREAK OUT */
            }
            n = n * ub + d;
        }
        if (len < minlen) {
            throw new RegexException("Not enough digits.");
        }

        return n;
    }
private int lexdigits(int base, int minlen, int maxlen) throws RegexException {
        int n;          /* unsigned to avoid overflow misbehavior */
        int len;
        int c;
        int d;
        final char ub = (char)base;

        n = 0;
        for (len = 0; len < maxlen && !ateos(); len++) {
            c = charAtNowAdvance();
            switch (c) {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                d = digitval((char)c);
                break;
            case 'a':
            case 'A':
                d = 10;
                break;
            case 'b':
            case 'B':
                d = 11;
                break;
            case 'c':
            case 'C':
                d = 12;
                break;
            case 'd':
            case 'D':
                d = 13;
                break;
            case 'e':
            case 'E':
                d = 14;
                break;
            case 'f':
            case 'F':
                d = 15;
                break;
            default:
                v.now--;    /* oops, not a digit at all */
                d = -1;
                break;
            }

            if (d >= base) {    /* not a plausible digit */
                v.now--;
                d = -1;
            }
            if (d < 0) {
                break;      /* NOTE BREAK OUT */
            }
            n = n * ub + d;
        }
        if (len < minlen) {
            throw new RegexException("Not enough digits.");
        }

        return n;
    }
private int lexdigits ( int base , int minlen , int maxlen ) throws RegexException { int n ; /* unsigned to avoid overflow misbehavior */ int len ; int c ; int d ; final char ub = ( char ) base ; n = 0 ; for ( len = 0 ; len < maxlen && ! ateos ( ) ; len ++ ) { c = charAtNowAdvance ( ) ; switch ( c ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : d = digitval ( ( char ) c ) ; break ; case ' ' : case ' ' : d = 10 ; break ; case ' ' : case ' ' : d = 11 ; break ; case ' ' : case ' ' : d = 12 ; break ; case ' ' : case ' ' : d = 13 ; break ; case ' ' : case ' ' : d = 14 ; break ; case ' ' : case ' ' : d = 15 ; break ; default : v . now -- ; /* oops, not a digit at all */ d = - 1 ; break ; } if ( d >= base ) { /* not a plausible digit */ v . now -- ; d = - 1 ; } if ( d < 0 ) { break ; /* NOTE BREAK OUT */ } n = n * ub + d ; } if ( len < minlen ) { throw new RegexException ( "Not enough digits." ) ; } return n ; }
/* chr value; errors signalled via ERR
/ * chr value ; errors signalled via ERR