12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667(* This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/. *)typet=|Regular_expressionofStr.regexp|Exclude_fileofExclude.fileletexcluded=ref[]letfunction_separator=Str.regexp"[ \t]*,[ \t]*"letadds=letpatterns=Str.splitfunction_separatorsinletpatterns=List.map(funx->Regular_expression(Str.regexpx))patternsinexcluded:=patterns@!excludedletadd_filefilename=letch=open_infilenameinletlexbuf=Lexing.from_channelchintryletres=Exclude_parser.fileExclude_lexer.tokenlexbufinletres=List.map(funx->Exclude_filex)resinexcluded:=res@!excluded;close_in_noerrchwith|Exclude.Exception(line,msg)->Printf.eprintf" *** error in file %S at line %d: %s\n"filenamelinemsg;close_in_noerrch;exit1|e->close_in_noerrch;raiseeletmatch_patternpatternname=Str.string_matchpatternname0&&Str.match_end()=String.lengthnameletfile_name_matchesexclusionfile=matchexclusion.Exclude.pathwith|Exclude.Namefile'->file=file'|Exclude.Regexppattern->match_patternpatternfileletcontains_valuefilename=List.exists(function|Regular_expressionpatt->match_patternpattname|Exclude_fileef->letin_value_list()=matchef.Exclude.exclusionswith|None->true|Someexclusions->exclusions|>List.exists(function|Exclude.Nameen->name=en|Exclude.Regexppatt->match_patternpattname)infile_name_matcheseffile&&in_value_list())!excludedletcontains_filefile=!excluded|>List.exists(function|Regular_expression_->false|Exclude_fileexclusion->exclusion.Exclude.exclusions=None&&file_name_matchesexclusionfile)