def gettags(comment):
 tags = []
 tag = None
 datatype = None
 name = None
 tag_lineno = lineno = 0
 tag_text = []
 for line in comment.split('\n'):
  line = line.strip()
  if line.startswith('@'):
   tags.append((tag_lineno, tag, datatype, name, '\n'.join(tag_text)))
   parts = line.split(None, 3)
   if (len(parts) == 1):
    datatype = ''
    name = ''
    tag_text = []
   elif (len(parts) == 2):
    datatype = parts[1]
    name = ''
    tag_text = []
   elif (len(parts) == 3):
    datatype = parts[1]
    name = parts[2]
    tag_text = []
   elif (len(parts) == 4):
    datatype = parts[1]
    name = parts[2]
    tag_text = [parts[3].lstrip()]
   tag = parts[0][1:]
   tag_lineno = lineno
  elif line:
   tag_text.append(line)
  lineno += 1
 tags.append((tag_lineno, tag, datatype, name, '\n'.join(tag_text)))
 return tags

def gettags ( comment ) : tags = [ ] tag = None datatype = None name = None tag_lineno = lineno = 0 tag_text = [ ] for line in comment . split ( '\n' ) : line = line . strip ( ) if line . startswith ( '@' ) : tags . append ( ( tag_lineno , tag , datatype , name , '\n' . join ( tag_text ) ) ) parts = line . split ( None , 3 ) if ( len ( parts ) == 1 ) : datatype = '' name = '' tag_text = [ ] elif ( len ( parts ) == 2 ) : datatype = parts [ 1 ] name = '' tag_text = [ ] elif ( len ( parts ) == 3 ) : datatype = parts [ 1 ] name = parts [ 2 ] tag_text = [ ] elif ( len ( parts ) == 4 ) : datatype = parts [ 1 ] name = parts [ 2 ] tag_text = [ parts [ 3 ] . lstrip ( ) ] tag = parts [ 0 ] [ 1 : ] tag_lineno = lineno elif line : tag_text . append ( line ) lineno += 1 tags . append ( ( tag_lineno , tag , datatype , name , '\n' . join ( tag_text ) ) ) return tags
parse documentation strings into javadoc-like tokens .