private void addInteger(){
  int oldPos=pos - 1;
  String literal=scanInteger();
  final String substring;
  final int radix;
  if (literal.startsWith("0x") || literal.startsWith("0X")) {
    radix=16;
    substring=literal.substring(2);
  }
 else   if (literal.startsWith("0") && literal.length() > 1) {
    radix=8;
    substring=literal.substring(1);
  }
 else {
    radix=10;
    substring=literal;
  }
  int value=0;
  try {
    value=Integer.parseInt(substring,radix);
  }
 catch (  NumberFormatException e) {
    error("invalid base-" + radix + " integer constant: "+ literal);
  }
  addToken(TokenKind.INT,oldPos,pos,value);
}

private void addInteger ( ) { int oldPos = pos - 1 ; String literal = scanInteger ( ) ; final String substring ; final int radix ; if ( literal . startsWith ( "0x" ) || literal . startsWith ( "0X" ) ) { radix = 16 ; substring = literal . substring ( 2 ) ; } else if ( literal . startsWith ( "0" ) && literal . length ( ) > 1 ) { radix = 8 ; substring = literal . substring ( 1 ) ; } else { radix = 10 ; substring = literal ; } int value = 0 ; try { value = Integer . parseInt ( substring , radix ) ; } catch ( NumberFormatException e ) { error ( "invalid base-" + radix + " integer constant: " + literal ) ; } addToken ( TokenKind . INT , oldPos , pos , value ) ; }
scans an addinteger literal . < p > on entry : ' pos ' is 1 + the index of the first char in the literal . on exit : ' pos ' is 1 + the index of the last char in the literal .
