123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263typecategory=|EndOfLine|SingleLine|Regularletstring_of_category=function|Regular->"Regular"|EndOfLine->"End of Line"|SingleLine->"SingleLine"typet={location:Location.t;category:category;text:string}letcategoryt=t.categoryletlocationt=t.locationletdumpppft=Format.fprintfppf"%d (%d:%d)-%d (%d:%d) -- %s:||%s||"t.location.loc_start.pos_cnumt.location.loc_start.pos_lnum(t.location.loc_start.pos_cnum-t.location.loc_start.pos_bol)t.location.loc_end.pos_cnumt.location.loc_end.pos_lnum(t.location.loc_end.pos_cnum-t.location.loc_end.pos_bol)(string_of_categoryt.category)t.textletdump_listppflist=List.iter(Format.fprintfppf"%a\n"dump)listletwrapt=matcht.textwith|""|"*"->"/***/"|txtwhenReason_syntax_util.isLineCommenttxt->"//"(* single line comments of the form `// comment` have a `\n` at the end *)^String.subtxt0(String.lengthtxt-1)^Reason_syntax_util.EOLMarker.string|txtwhentxt.[0]='*'&&txt.[1]<>'*'->(* CHECK: this comment printing seems fishy.
* It apply to invalid docstrings.
* In this case, it will add a spurious '*'.
* E.g. /**
* * bla */
* In an invalid context is turned into
* /***
* * bla */
* I think this case should be removed.
*)"/**"^txt^"*/"|txt->"/*"^txt^"*/"letis_doct=String.lengtht.text>0&&t.text.[0]=='*'letmake~locationcategorytext={text;category;location}letisLineComment{category;text;_}=matchcategorywith|SingleLine->Reason_syntax_util.isLineCommenttext|EndOfLine|Regular->false