def eat_descriptor(descr):
 array_dim = 0
 while (descr[0] == '['):
  array_dim += 1
  descr = descr[1:]
 if (descr[0] == 'L'):
  try:
   end = descr.find(';')
  except:
   raise ParserError(('Not a valid descriptor string: ' + descr))
  type = descr[1:end]
  descr = descr[end:]
 else:
  global code_to_type_name
  try:
   type = code_to_type_name[descr[0]]
  except KeyError:
   raise ParserError(('Not a valid descriptor string: %s' % descr))
 return ((type.replace('/', '.') + (array_dim * '[]')), descr[1:])

def eat_descriptor ( descr ) : array_dim = 0 while ( descr [ 0 ] == '[' ) : array_dim += 1 descr = descr [ 1 : ] if ( descr [ 0 ] == 'L' ) : try : end = descr . find ( ';' ) except : raise ParserError ( ( 'Not a valid descriptor string: ' + descr ) ) type = descr [ 1 : end ] descr = descr [ end : ] else : global code_to_type_name try : type = code_to_type_name [ descr [ 0 ] ] except KeyError : raise ParserError ( ( 'Not a valid descriptor string: %s' % descr ) ) return ( ( type . replace ( '/' , '.' ) + ( array_dim * '[]' ) ) , descr [ 1 : ] )
read head of a field/method descriptor .