12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879(**************************************************************************)(* *)(* Copyright 2013 OCamlPro *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the Lesser GNU Public License version 3.0. *)(* *)(* This software is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* Lesser GNU General Public License for more details. *)(* *)(**************************************************************************)(* - Main types - *)includeIndexTypes(* - Utility functions - *)moduleMisc=IndexMisc(* - Trie loading and manipulation functions - *)includeIndexBuild(* - Query functions - *)letfilter_visiblevalues=letsame_kindab=matcha.kind,b.kindwith|Fieldi,Fieldj|Varianti,Variantj|Methodi,Methodj->i.name=j.name|a,b->a=binList.fold_left(funaccinfo->ifList.exists(funn->same_kindinfon)accthenaccelseinfo::acc)[]valueslettrie_to_listtrie=Trie.fold0(funacc_pathvalues->List.rev_append(filter_visiblevalues)acc)trie[]letallt=trie_to_listtletfiltertf=Trie.fold0(funacc_pathvalues->List.rev_append(filter_visible(List.filterfvalues))acc)t[]letgettquery=Trie.findt(Misc.string_to_keyquery)letget_alltquery=Trie.find_allt(Misc.string_to_keyquery)letcompletet?filter:(f=fun_->true)query=letcompletions=filter(Trie.filter_keys((<>)Misc.dot)(Trie.subt(Misc.string_to_keyquery)))finletfile=function{file=Cmtf|Cmif|Cmtif}->finList.sort(funij->letc=compare(filei)(filej)inifc<>0thencelseletc=compare(Lazy.forcei.loc_sig)(Lazy.forcej.loc_sig)inifc<>0thencelsecomparei.pathj.path)completions(* - Output functions - *)includeIndexOut