def p_field_req(p):
 if (len(p) == 2):
  p[0] = (p[1] == 'required')
 elif (len(p) == 1):
  p[0] = False

def p_field_req ( p ) : if ( len ( p ) == 2 ) : p [ 0 ] = ( p [ 1 ] == 'required' ) elif ( len ( p ) == 1 ) : p [ 0 ] = False
field_req : required | optional .