123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172(*
* Copyright (c) 2014 Leo White <lpw25@cl.cam.ac.uk>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)openResulttypelookup_result_found=Component_table.lookup_result_found={root:Odoc_model.Root.t;hidden:bool}typelookup_result=Component_table.lookup_unit_result=|Forward_reference|Foundoflookup_result_found|Not_foundtypemsg=[`Msgofstring](** Internal. Used to handled errors from [fetch_unit] and [fetch_page] *)exceptionFetch_failedofmsgletcore_types=Odoc_model.Predefined.core_typesletcore_exceptions=Odoc_model.Predefined.core_exceptionstyperesolver=Resolve.resolverletbuild_resolver?equal?hashlookup_unitfetch_unitlookup_pagefetch_page=letfetch_unitroot=matchfetch_unitrootwith|Okunit->unit|Errore->raise(Fetch_failede)andfetch_pageroot=matchfetch_pagerootwith|Okpage->page|Errore->raise(Fetch_failede)inResolve.build_resolver?equal?hashlookup_unitfetch_unitlookup_pagefetch_pageletresolveresolverunit=tryOk(Resolve.resolveresolverunit)withFetch_failed(`Msg_ase)->Erroreletresolve_pageresolverpage=tryOk(Resolve.resolve_pageresolverpage)withFetch_failed(`Msg_ase)->Erroretypeexpander=Expand.tletbuild_expander?equal?hashlookupfetch=letfetch~rootroot'=matchfetch~rootroot'with|Okunit->unit|Errore->raise(Fetch_failede)inExpand.build_expander?equal?hashlookupfetchletexpandexpanderunit=tryOk(Expand.expandexpanderunit)withFetch_failed(`Msg_ase)->ErroremoduleLookup=Lookup