Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file meta_parse_info.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128(* 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_precisionletcmdline_flags_precision()=[("-full_token_info",Arg.Unit(fun()->_current_precision:={default_dumper_precisionwithfull_info=true};Parse_info.pp_full_token_info:=true)," print also token information in dumper");]letvof_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