def p_function(p):
 if (p[1] == 'oneway'):
  oneway = True
  base = 1
 else:
  oneway = False
  base = 0
 if (p[(len(p) - 1)] == ')'):
  throws = []
 else:
  throws = p[(len(p) - 1)]
 p[0] = [oneway, p[(base + 1)], p[(base + 2)], p[(base + 4)], throws]

def p_function ( p ) : if ( p [ 1 ] == 'oneway' ) : oneway = True base = 1 else : oneway = False base = 0 if ( p [ ( len ( p ) - 1 ) ] == ')' ) : throws = [ ] else : throws = p [ ( len ( p ) - 1 ) ] p [ 0 ] = [ oneway , p [ ( base + 1 ) ] , p [ ( base + 2 ) ] , p [ ( base + 4 ) ] , throws ]
function : oneway function_type identifier throws | oneway function_type identifier | function_type identifier throws | function_type identifier .