1234567891011121314151617181920212223242526272829open!Ppxlibletexpand(e:Parsetree.expression)=matche.pexp_descwith|Pexp_apply(_,[(Nolabel,x);(Nolabel,y)])->Some(matchywith|{pexp_desc=Pexp_construct(id,None);_}->{ywithpexp_desc=Pexp_construct(id,Somex)}|{pexp_desc=Pexp_apply(f,args);pexp_attributes=[];_}when(matchf.pexp_descwith(* Do not inline |> as this would create applications with too many
arguments *)|Pexp_ident{txt=Lident"|>";_}->false|_->true)->{ewithpexp_desc=Pexp_apply(f,args@[(Nolabel,x)])}|_->{ewithpexp_desc=Pexp_apply(y,[(Nolabel,x)])})|Pexp_ident{txt=Lidents;_}|Pexp_apply({pexp_desc=Pexp_ident{txt=Lidents;_};_},_)->Location.raise_errorf~loc:e.pexp_loc"%s must be applied to two arguments"s|_->None;;let()=Driver.register_transformation"pipebang"~rules:[Context_free.Rule.special_function"|>"expand];;