123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081(* Yoann Padioleau
*
* Copyright (C) 2019 r2c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License (GPL)
* version 2 as published by the Free Software Foundation.
*
* This program 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
* file license.txt for more details.
*)openCommonmoduleFT=File_type(*****************************************************************************)(* Prelude *)(*****************************************************************************)(*****************************************************************************)(* Types *)(*****************************************************************************)typet=|Python|Javascript|Java|C|ML(*****************************************************************************)(* Helpers *)(*****************************************************************************)letlang_of_string_optx=matchString.lowercase_asciixwith|"py"|"python"->SomePython|"js"|"javascript"->SomeJavascript|"c"->SomeC|"ml"|"ocaml"->SomeML|"java"->SomeJava|_->Noneletlang_of_filename_optfilename=lettyp=File_type.file_type_of_filefilenameinmatchtypwith|FT.PL(FT.Web(FT.Js))->SomeJavascript|FT.PL(FT.Python)->SomePython|FT.PL(FT.C("c"|"h"))->SomeC|FT.PL(FT.ML_)->SomeML|FT.PL(FT.Java)->SomeJava|_->None(* copy-paste: very similar to pfff/find_source.ml *)letfinderlang=matchlangwith|Python->Lib_parsing_python.find_source_files_of_dir_or_files|Javascript->Lib_parsing_js.find_source_files_of_dir_or_files~include_scripts:false|C|Java|ML->raiseTodoletfiles_of_dirs_or_fileslangxs=letfinder=finderlanginletxs=List.mapCommon.fullpathxsinfinderxs(* |> Skip_code.filter_files_if_skip_list *)