def p_idlist(p):
 if (len(p) == 2):
  p[0] = [p[1]]
 else:
  p[0] = p[1]
  p[1].append(p[3])

def p_idlist ( p ) : if ( len ( p ) == 2 ) : p [ 0 ] = [ p [ 1 ] ] else : p [ 0 ] = p [ 1 ] p [ 1 ] . append ( p [ 3 ] )
idlist : idlist optcomma tokenid | tokenid .