123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114(* Yoann Padioleau
*
* Copyright (C) 2010 Facebook
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation, with the
* special exception on linking described in file license.txt.
*
* This library 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.
*)openParse_infotypedumper_precision={full_info:bool;token_info:bool;type_info:bool;}letdefault_dumper_precision={full_info=false;token_info=false;type_info=false;}letvof_filenamev=Ocaml.vof_stringvletvof_token_location{str=v_str;charpos=v_charpos;line=v_line;column=v_column;file=v_file}=letbnds=[]inletarg=vof_filenamev_fileinletbnd=("file",arg)inletbnds=bnd::bndsinletarg=Ocaml.vof_intv_columninletbnd=("column",arg)inletbnds=bnd::bndsinletarg=Ocaml.vof_intv_lineinletbnd=("line",arg)inletbnds=bnd::bndsinletarg=Ocaml.vof_intv_charposinletbnd=("charpos",arg)inletbnds=bnd::bndsinletarg=Ocaml.vof_stringv_strinletbnd=("str",arg)inletbnds=bnd::bndsinOcaml.VDictbndsletvof_token_origin=function|OriginTokv1->letv1=vof_token_locationv1inOcaml.VSum(("OriginTok",[v1]))|FakeTokStr(v1,opt)->letv1=Ocaml.vof_stringv1inletopt=Ocaml.vof_option(fun(p1,i)->Ocaml.VTuple[vof_token_locationp1;Ocaml.vof_inti])optinOcaml.VSum(("FakeTokStr",[v1;opt]))|Ab->Ocaml.VSum(("Ab",[]))|ExpandedTok(v1,v2,v3)->letv1=vof_token_locationv1inletv2=vof_token_locationv2inletv3=Ocaml.vof_intv3inOcaml.VSum(("ExpandedTok",[v1;v2;v3]))letrecvof_transformation=function|NoTransfo->Ocaml.VSum(("NoTransfo",[]))|Remove->Ocaml.VSum(("Remove",[]))|AddBeforev1->letv1=vof_addv1inOcaml.VSum(("AddBefore",[v1]))|AddAfterv1->letv1=vof_addv1inOcaml.VSum(("AddAfter",[v1]))|Replacev1->letv1=vof_addv1inOcaml.VSum(("Replace",[v1]))|AddArgsBeforev1->letv1=Ocaml.vof_listOcaml.vof_stringv1inOcaml.VSum(("AddArgsBefore",[v1]))andvof_add=function|AddStrv1->letv1=Ocaml.vof_stringv1inOcaml.VSum(("AddStr",[v1]))|AddNewlineAndIdent->Ocaml.VSum(("AddNewlineAndIdent",[]))letvof_info{token=v_token;transfo=v_transfo}=letbnds=[]inletarg=vof_transformationv_transfoinletbnd=("transfo",arg)inletbnds=bnd::bndsinletarg=vof_token_originv_tokeninletbnd=("token",arg)inletbnds=bnd::bndsinOcaml.VDictbnds(* todo? could also do via a post processing phase with a OCaml.map_v ? *)let_current_precision=refdefault_dumper_precisionletvof_info_adjustable_precisionx=if!_current_precision.full_infothenvof_infoxelseif!_current_precision.token_infothenOcaml.VDict["line",Ocaml.VInt(line_of_infox);"col",Ocaml.VInt(col_of_infox);]elseOcaml.VUnit