def p_include(p):
 thrift = thrift_stack[(-1)]
 if (thrift.__thrift_file__ is None):
  raise ThriftParserError('Unexcepted include statement while loadingfrom file like object.')
 replace_include_dirs = ([os.path.dirname(thrift.__thrift_file__)] + include_dirs_)
 for include_dir in replace_include_dirs:
  path = os.path.join(include_dir, p[2])
  if os.path.exists(path):
   child = parse(path)
   setattr(thrift, child.__name__, child)
   _add_thrift_meta('includes', child)
   return
 raise ThriftParserError(("Couldn't include thrift %s in any directories provided" % p[2]))

def p_include ( p ) : thrift = thrift_stack [ ( - 1 ) ] if ( thrift . __thrift_file__ is None ) : raise ThriftParserError ( 'Unexcepted include statement while loadingfrom file like object.' ) replace_include_dirs = ( [ os . path . dirname ( thrift . __thrift_file__ ) ] + include_dirs_ ) for include_dir in replace_include_dirs : path = os . path . join ( include_dir , p [ 2 ] ) if os . path . exists ( path ) : child = parse ( path ) setattr ( thrift , child . __name__ , child ) _add_thrift_meta ( 'includes' , child ) return raise ThriftParserError ( ( "Couldn't include thrift %s in any directories provided" % p [ 2 ] ) )
include : include literal .