1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798(* This file is free software, part of dolmen. See file "LICENSE" formore information *)moduleMake(Loc:ParseLocation.S)(Ty:sigtypetokentypestatementvalenv:stringlistend)(Lex:Dolmen_intf.Lex.Swithtypetoken:=Ty.token)(Parse:Dolmen_intf.Parse.Swithtypetoken:=Ty.tokenandtypestatement:=Ty.statement)=structincludeTymoduleLexer=LexmoduleParser=Parseletrecfind_envfile=function|[]->None|var::r->beginmatchSys.getenvvarwith|dir->letf=Filename.concatdirfileinifSys.file_existsfthenSomefelsefind_envfiler|exceptionNot_found->find_envfilerendletfind?(dir="")file=ifFilename.is_relativefilethenbeginletf=Filename.concatdirfileinifSys.file_existsfthenSomefelsefind_envfileTy.envendelseifSys.file_existsfilethenSomefileelseNoneletparse_filefile=letlexbuf,cleanup=ParseLocation.mk_lexbuf(`Filefile)intryletres=Parser.fileLexer.tokenlexbufincleanup();reswith|((Loc.Syntax_error_)ase)|((Loc.Lexing_error_)ase)->let()=cleanup()inraisee|Parser.Error->letpos=Loc.of_lexbuflexbufinlet()=cleanup()inraise(Loc.Syntax_error(pos,""))|Lexer.Error->letpos=Loc.of_lexbuflexbufinlet()=cleanup()inraise(Loc.Lexing_error(pos,Lexing.lexemelexbuf))|_ase->letpos=Loc.of_lexbuflexbufinlet()=cleanup()inraise(Loc.Uncaught(pos,e))letparse_inputi=letlexbuf,cleanup=ParseLocation.mk_lexbufiinletsupplier=Parser.MenhirInterpreter.lexer_lexbuf_to_supplierLexer.tokenlexbufinletloop=Parse.MenhirInterpreter.loopsupplierinletaux()=beginmatchloop(Parse.Incremental.inputLexing.(lexbuf.lex_curr_p))with|res->res|exception((Loc.Syntax_error_)ase)->raisee|exception((Loc.Lexing_error_)ase)->raisee|exceptionLexer.Error->letpos=Loc.of_lexbuflexbufinleterr=Lexing.lexemelexbufinDolmen_line.consumelexbuf;raise(Loc.Lexing_error(pos,err))|exceptionParser.Error->letpos=Loc.of_lexbuflexbufinDolmen_line.consumelexbuf;raise(Loc.Syntax_error(pos,""))|exceptione->letpos=Loc.of_lexbuflexbufinDolmen_line.consumelexbuf;raise(Loc.Uncaught(pos,e))endinaux,cleanupend