private String rdNumber ( int base ) throws LexException { StringBuilder v = new StringBuilder ( ) ; int n = value ( ch ) ; // long v = n; v . append ( ch ) ; if ( n < 0 || n >= base ) { throwMessage ( 1001 , "Invalid char [" + ch + "] in base " + base + " number" ) ; } while ( true ) { rdCh ( ) ; n = value ( ch ) ; if ( n < 0 || n >= base ) { return v . toString ( ) ; } // v = (v * base) + n; v . append ( ch ) ; } }
Read a number of the given base . Parsing terminates when a character not within the number base is read .