123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584(**************************************************************************)(* *)(* OCamlFormat *)(* *)(* Copyright (c) Facebook, Inc. and its affiliates. *)(* *)(* This source code is licensed under the MIT license found in *)(* the LICENSE file in the root directory of this source tree. *)(* *)(**************************************************************************)moduleLocation=Migrate_ast.LocationincludeConf_tletprofile_option_names=["p";"profile"]openCmdlinerletwarn_raw,collect_warnings=letdelay_warning=reffalseinletdelayed_warning_list=ref[]inletwarn_s=if!delay_warningthendelayed_warning_list:=s::!delayed_warning_listelseFormat.eprintf"%s%!"sinletcollect_warningsf=letold_flag,old_list=(!delay_warning,!delayed_warning_list)indelay_warning:=true;delayed_warning_list:=[];letres=f()inletcollected=List.rev!delayed_warning_listindelay_warning:=old_flag;delayed_warning_list:=old_list;(res,fun()->List.iter~f:warn_collected)in(warn_,collect_warnings)letwarn~locfmt=Format.kasprintf(funs->warn_raw(Format.asprintf"%!@{<loc>%a@}:@,@{<warning>Warning@}: %s\n%!"Location.print_loclocs))fmtmoduleDecl=Conf_declmoduleStore=Decl.Storeletconventional_profilefrom=leteltcontent=Elt.makecontentfromin{align_symbol_open_paren=elttrue;assignment_operator=elt`End_line;break_before_in=elt`Fit_or_vertical;break_cases=elt`Fit;break_collection_expressions=elt`Fit_or_vertical;break_colon=elt`After;break_infix=elt`Wrap;break_infix_before_func=eltfalse;break_fun_decl=elt`Wrap;break_fun_sig=elt`Wrap;break_separators=elt`After;break_sequences=elttrue;break_string_literals=elt`Auto;break_struct=elttrue;cases_exp_indent=elt4;cases_matching_exp_indent=elt`Normal;disambiguate_non_breaking_match=eltfalse;doc_comments=elt`After_when_possible;doc_comments_padding=elt2;doc_comments_tag_only=elt`Default;dock_collection_brackets=elttrue;exp_grouping=elt`Parens;extension_indent=elt2;field_space=elt`Loose;function_indent=elt2;function_indent_nested=elt`Never;if_then_else=elt`Compact;indent_after_in=elt0;indicate_multiline_delimiters=elt`No;indicate_nested_or_patterns=elt`Unsafe_no;infix_precedence=elt`Indent;leading_nested_match_parens=eltfalse;let_and=elt`Compact;let_binding_indent=elt2;let_binding_deindent_fun=elttrue;let_binding_spacing=elt`Compact;let_module=elt`Compact;line_endings=elt`Lf;margin=elt80;match_indent=elt0;match_indent_nested=elt`Never;max_indent=eltNone;module_item_spacing=elt`Compact;nested_match=elt`Wrap;ocp_indent_compat=eltfalse;parens_ite=eltfalse;parens_tuple=elt`Always;parens_tuple_patterns=elt`Multi_line_only;parse_docstrings=eltfalse;parse_toplevel_phrases=eltfalse;sequence_blank_line=elt`Preserve_one;sequence_style=elt`Terminator;single_case=elt`Compact;space_around_arrays=elttrue;space_around_lists=elttrue;space_around_records=elttrue;space_around_variants=elttrue;stritem_extension_indent=elt0;type_decl=elt`Compact;type_decl_indent=elt2;wrap_comments=eltfalse;wrap_docstrings=elttrue;wrap_fun_args=elttrue}letdefault_profile=conventional_profileletocamlformat_profilefrom=leteltcontent=Elt.makecontentfromin{align_symbol_open_paren=elttrue;assignment_operator=elt`End_line;break_before_in=elt`Fit_or_vertical;break_cases=elt`Nested;break_collection_expressions=elt`Fit_or_vertical;break_colon=elt`After;break_infix=elt`Wrap;break_infix_before_func=elttrue;break_fun_decl=elt`Wrap;break_fun_sig=elt`Wrap;break_separators=elt`Before;break_sequences=eltfalse;break_string_literals=elt`Auto;break_struct=elttrue;cases_exp_indent=elt4;cases_matching_exp_indent=elt`Compact;disambiguate_non_breaking_match=eltfalse;doc_comments=elt`Before_except_val;doc_comments_padding=elt2;doc_comments_tag_only=elt`Default;dock_collection_brackets=eltfalse;exp_grouping=elt`Parens;extension_indent=elt2;field_space=elt`Tight;function_indent=elt2;function_indent_nested=elt`Never;if_then_else=elt`Compact;indent_after_in=elt0;indicate_multiline_delimiters=elt`Space;indicate_nested_or_patterns=elt`Space;infix_precedence=elt`Indent;leading_nested_match_parens=eltfalse;let_and=elt`Compact;let_binding_indent=elt2;let_binding_deindent_fun=elttrue;let_binding_spacing=elt`Compact;let_module=elt`Compact;line_endings=elt`Lf;margin=elt80;match_indent=elt0;match_indent_nested=elt`Never;max_indent=eltNone;module_item_spacing=elt`Sparse;nested_match=elt`Wrap;ocp_indent_compat=eltfalse;parens_ite=eltfalse;parens_tuple=elt`Always;parens_tuple_patterns=elt`Multi_line_only;parse_docstrings=eltfalse;parse_toplevel_phrases=eltfalse;sequence_blank_line=elt`Compact;sequence_style=elt`Separator;single_case=elt`Compact;space_around_arrays=eltfalse;space_around_lists=eltfalse;space_around_records=eltfalse;space_around_variants=eltfalse;stritem_extension_indent=elt0;type_decl=elt`Compact;type_decl_indent=elt2;wrap_comments=eltfalse;wrap_docstrings=elttrue;wrap_fun_args=elttrue}letjanestreet_profilefrom=leteltcontent=Elt.makecontentfromin{align_symbol_open_paren=eltfalse;assignment_operator=elt`Begin_line;break_before_in=elt`Fit_or_vertical;break_cases=elt`Fit_or_vertical;break_collection_expressions=elt(ocamlformat_profilefrom).break_collection_expressions.v;break_colon=elt`Before;break_infix=elt`Fit_or_vertical;break_infix_before_func=elttrue;break_fun_decl=elt`Fit_or_vertical;break_fun_sig=elt`Fit_or_vertical;break_separators=elt`Before;break_sequences=elttrue;break_string_literals=elt`Auto;break_struct=elt(ocamlformat_profilefrom).break_struct.v;cases_exp_indent=elt2;cases_matching_exp_indent=elt`Normal;disambiguate_non_breaking_match=eltfalse;doc_comments=elt`Before;doc_comments_padding=elt1;doc_comments_tag_only=elt`Fit;dock_collection_brackets=eltfalse;exp_grouping=elt`Parens;extension_indent=elt2;field_space=elt`Loose;function_indent=elt2;function_indent_nested=elt`Never;if_then_else=elt`Keyword_first;indent_after_in=elt0;indicate_multiline_delimiters=elt`No;indicate_nested_or_patterns=elt`Unsafe_no;infix_precedence=elt`Parens;leading_nested_match_parens=elttrue;let_and=elt`Sparse;let_binding_indent=elt2;let_binding_deindent_fun=eltfalse;let_binding_spacing=elt`Double_semicolon;let_module=elt`Sparse;line_endings=elt`Lf;margin=elt90;match_indent=elt0;match_indent_nested=elt`Never;max_indent=elt@@Some2;module_item_spacing=elt`Compact;nested_match=elt`Wrap;ocp_indent_compat=elttrue;parens_ite=elttrue;parens_tuple=elt`Multi_line_only;parens_tuple_patterns=elt`Multi_line_only;parse_docstrings=elttrue;parse_toplevel_phrases=eltfalse;sequence_blank_line=elt`Compact;sequence_style=elt`Terminator;single_case=elt`Sparse;space_around_arrays=elttrue;space_around_lists=elttrue;space_around_records=elttrue;space_around_variants=elttrue;stritem_extension_indent=elt2;type_decl=elt`Sparse;type_decl_indent=elt2;wrap_comments=eltfalse;wrap_docstrings=eltfalse;wrap_fun_args=eltfalse}letdefault=leteltcontent=Elt.makecontent`Defaultin{fmt_opts=default_profile`Default;profile=elt`default;opr_opts={comment_check=elttrue;debug=eltfalse;disable=eltfalse;margin_check=eltfalse;max_iters=elt10;ocaml_version=eltOcaml_version.Releases.v4_04_0;quiet=eltfalse;disable_conf_attrs=eltfalse;version_check=elttrue}}moduleV=structletv0_12=Version.make~major:0~minor:12~patch:Noneletv0_14=Version.make~major:0~minor:14~patch:Noneletv0_16=Version.make~major:0~minor:16~patch:Noneletv0_17=Version.make~major:0~minor:17~patch:Noneletv0_22=Version.make~major:0~minor:22~patch:Noneendletdisable_outside_detected_project=letmsg="OCamlFormat is disabled outside of a detected project by default, to \
enable the opposite behavior use `enable-outside-detected-project`."inletnames=["disable-outside-detected-project"]inDecl.removed_option~names~since:V.v0_22~msgletprofile=letdoc="Select a preset profile which sets $(i,all) options, overriding lower \
priority configuration."inletnames=profile_option_namesinletall=[Decl.Value.make~name:"default"`default"$(b,default) is an alias for the $(b,conventional) profile.";Decl.Value.make~name:"conventional"`conventional"The $(b,conventional) profile aims to be as familiar and \
\"conventional\" appearing as the available options allow.";Decl.Value.make~name:"ocamlformat"`ocamlformat"The $(b,ocamlformat) profile aims to take advantage of the \
strengths of a parsetree-based auto-formatter, and to limit the \
consequences of the weaknesses imposed by the current \
implementation. This is a style which optimizes for what the \
formatter can do best, rather than to match the style of any \
existing code. General guidelines that have directed the design \
include: Legibility, in the sense of making it as hard as possible \
for quick visual parsing to give the wrong interpretation, is of \
highest priority; Whenever possible the high-level structure of \
the code should be obvious by looking only at the left margin, in \
particular, it should not be necessary to visually jump from left \
to right hunting for critical keywords, tokens, etc; All else \
equal compact code is preferred as reading without scrolling is \
easier, so indentation or white space is avoided unless it helps \
legibility; Attention has been given to making some syntactic \
gotchas visually obvious.";Decl.Value.make~name:"janestreet"`janestreet"The $(b,janestreet) profile is used at Jane Street."]inDecl.choice~names~all~default~doc~kind:Decl.Formatting~removed_values:[Decl.Value_removed.make~name:"compact"~since:V.v0_22~msg:"";Decl.Value_removed.make~name:"sparse"~since:V.v0_22~msg:""](funconfelt->letp=elt.vandfrom=elt.frominletname=matchpwith|`default->"default"|`conventional->"conventional"|`ocamlformat->"ocamlformat"|`janestreet->"janestreet"inletfrom_p=letufrom=matchfromwith|`Default|`Updated(_,Some_)->assertfalse|`Profile(_,uf)|`Updated(uf,_)->ufin`Profile(name,ufrom)inletp=(matchpwith|`default->default_profile|`conventional->conventional_profile|`ocamlformat->ocamlformat_profile|`janestreet->janestreet_profile)from_pin{confwithprofile=elt;fmt_opts=p})(funconf->conf.profile)letoptions=Store.[eltdisable_outside_detected_project;eltprofile](** Options affecting formatting *)moduleFormatting=structletkind=Decl.Formattingletupdate~fc={cwithfmt_opts=fc.fmt_opts}letalign_cases=letnames=["align-cases"]inDecl.removed_option~names~since:V.v0_22~msg:""letalign_constructors_decl=letnames=["align-constructors-decl"]inDecl.removed_option~names~since:V.v0_22~msg:""letalign_variants_decl=letnames=["align-variants-decl"]inDecl.removed_option~names~since:V.v0_22~msg:""letassignment_operator=letdoc="Position of the assignment operator."inletnames=["assignment-operator"]inletall=[Decl.Value.make~name:"end-line"`End_line"$(b,end-line) positions assignment operators (`:=` and `<-`) at \
the end of the line and breaks after it if the whole assignment \
expression does not fit on a single line.";Decl.Value.make~name:"begin-line"`Begin_line"$(b,begin-line) positions assignment operators (`:=` and `<-`) \
at the beginning of the line and breaks before it if the whole \
assignment expression does not fit on a single line."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithassignment_operator=elt}))(funconf->conf.fmt_opts.assignment_operator)letbreak_before_in=letdoc="Whether the line should break before the $(i,in) keyword of a \
$(i,let) binding."inletnames=["break-before-in"]inletall=[Decl.Value.make~name:"fit-or-vertical"`Fit_or_vertical"$(b,fit-or-vertical) will always break the line before the \
$(i,in) keyword if the whole $(i,let) binding does not fit on a \
single line.";Decl.Value.make~name:"auto"`Auto"$(b,auto) will only break the line if the $(i,in) keyword does \
not fit on the previous line."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_before_in=elt}))(funconf->conf.fmt_opts.break_before_in)letbreak_cases=letdoc="Break pattern match cases."inletnames=["break-cases"]inletall=[Decl.Value.make~name:"fit"`Fit"Specifying $(b,fit) lets pattern matches break at the margin \
naturally.";Decl.Value.make~name:"nested"`Nested"$(b,nested) forces a break after nested or-patterns to highlight \
the case body. Note that with $(b,nested), the \
$(b,indicate-nested-or-patterns) option is not needed, and so \
ignored.";Decl.Value.make~name:"toplevel"`Toplevel"$(b,toplevel) forces top-level cases (i.e. not nested \
or-patterns) to break across lines, otherwise break naturally at \
the margin.";Decl.Value.make~name:"fit-or-vertical"`Fit_or_vertical"$(b,fit-or-vertical) tries to fit all or-patterns on the same \
line, otherwise breaks.";Decl.Value.make~name:"vertical"`Vertical"$(b,vertical) vertically breaks branches.";Decl.Value.make~name:"all"`All"$(b,all) forces all pattern matches to break across lines."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_cases=elt}))(funconf->conf.fmt_opts.break_cases)letbreak_collection_expressions=letdoc="Break collection expressions (lists and arrays) elements by elements."inletnames=["break-collection-expressions"]inletall=[Decl.Value.make~name:"fit-or-vertical"`Fit_or_vertical"$(b,fit-or-vertical) vertically breaks expressions if they do \
not fit on a single line.";Decl.Value.make~name:"wrap"`Wrap"$(b,wrap) will group simple expressions and try to format them \
in a single line."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_collection_expressions=elt}))(funconf->conf.fmt_opts.break_collection_expressions)letbreak_colon=letdoc="Break before or after colon in value binding declarations and type \
constraints."inletnames=["break-colon"]inletall=[Decl.Value.make~name:"after"`After"$(b,after) breaks after the colon.";Decl.Value.make~name:"before"`Before"$(b,before) breaks before the colon."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_colon=elt}))(funconf->conf.fmt_opts.break_colon)letbreak_fun_decl=letdoc="Style for function declarations and types."inletnames=["break-fun-decl"]inletall=[Decl.Value.make~name:"wrap"`Wrap"$(b,wrap) breaks only if necessary.";Decl.Value.make~name:"fit-or-vertical"`Fit_or_vertical"$(b,fit-or-vertical) vertically breaks arguments if they do not \
fit on a single line.";Decl.Value.make~name:"smart"`Smart"$(b,smart) is like $(b,fit-or-vertical) but try to fit arguments \
on their line if they fit."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_fun_decl=elt}))(funconf->conf.fmt_opts.break_fun_decl)letbreak_fun_sig=letdoc="Style for function signatures."inletnames=["break-fun-sig"]inletall=[Decl.Value.make~name:"wrap"`Wrap"$(b,wrap) breaks only if necessary.";Decl.Value.make~name:"fit-or-vertical"`Fit_or_vertical"$(b,fit-or-vertical) vertically breaks arguments if they do not \
fit on a single line.";Decl.Value.make~name:"smart"`Smart"$(b,smart) is like $(b,fit-or-vertical) but try to fit arguments \
on their line if they fit."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_fun_sig=elt}))(funconf->conf.fmt_opts.break_fun_sig)letbreak_infix=letdoc="Break sequence of infix operators."inletnames=["break-infix"]inletall=[Decl.Value.make~name:"wrap"`Wrap"$(b,wrap) will group simple expressions and try to format them \
in a single line.";Decl.Value.make~name:"fit-or-vertical"`Fit_or_vertical"$(b,fit-or-vertical) vertically breaks expressions if they do \
not fit on a single line.";Decl.Value.make~name:"wrap-or-vertical"`Wrap_or_vertical"$(b,wrap-or-vertical) behaves like $(b,wrap) for high precedence \
operators and behaves like $(b,fit-or-vertical) for low \
precedence operators."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_infix=elt}))(funconf->conf.fmt_opts.break_infix)letbreak_infix_before_func=letdoc="Break infix operators whose right arguments are anonymous functions \
specially: do not break after the operator so that the first line of \
the function appears docked at the end of line after the operator."inletnames=["break-infix-before-func"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_infix_before_func=elt}))(funconf->conf.fmt_opts.break_infix_before_func)letbreak_separators=letdoc="Break before or after separators such as `;` in list or record \
expressions."inletnames=["break-separators"]inletall=[Decl.Value.make~name:"after"`After"$(b,after) breaks the expressions after the separator.";Decl.Value.make~name:"before"`Before"$(b,before) breaks the expressions before the separator."]inDecl.choice~names~all~default~doc~kind~removed_values:[Decl.Value_removed.make~name:"after-and-docked"~since:V.v0_12~msg:"One can get a similar behaviour by setting \
`break-separators=after`, `space-around-lists=false`, and \
`dock-collection-brackets=false`."](funconfelt->updateconf~f:(funf->{fwithbreak_separators=elt}))(funconf->conf.fmt_opts.break_separators)letbreak_sequences=letdoc="Force sequence expressions to break irrespective of margin."inletnames=["break-sequences"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_sequences=elt}))(funconf->conf.fmt_opts.break_sequences)letbreak_string_literals=letdoc="Break string literals."inletnames=["break-string-literals"]inletall=[Decl.Value.make~name:"auto"`Auto"$(b,auto) mode breaks lines at newlines and wraps string \
literals at the margin.";Decl.Value.make~name:"never"`Never"$(b,never) mode formats string literals as they are parsed, in \
particular, with escape sequences expanded."]inDecl.choice~names~all~default~doc~kind~removed_values:(Decl.Value_removed.make_list~names:["newlines";"newlines-and-wrap";"wrap"]~since:V.v0_12~msg:"It has been replaced by the new default `auto` value, which \
breaks lines at newlines and wraps string literals at the \
margin.")(funconfelt->updateconf~f:(funf->{fwithbreak_string_literals=elt}))(funconf->conf.fmt_opts.break_string_literals)letbreak_struct=letdoc="Break struct-end module items."inletnames=["break-struct"]inletall=[Decl.Value.make~name:"force"`Force"$(b,force) will break struct-end phrases unconditionally.";Decl.Value.make~name:"natural"`Natural"$(b,natural) will break struct-end phrases naturally at the \
margin."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithbreak_struct=Elt.makePoly.(elt.v=`Force)elt.from}))(funconf->letelt=conf.fmt_opts.break_structinifelt.vthenElt.make`Forceelt.fromelseElt.make`Naturalelt.from)letcases_exp_indent=letdocv="COLS"inletdoc="Indentation of cases expressions ($(docv) columns). See also the \
$(b,cases-matching-exp-indent) and $(b,nested-match) options."inletnames=["cases-exp-indent"]inDecl.int~names~default~doc~docv~kind~allow_inline:false(funconfelt->updateconf~f:(funf->{fwithcases_exp_indent=elt}))(funconf->conf.fmt_opts.cases_exp_indent)letcases_matching_exp_indent=letdoc="Indentation of cases right-hand sides which are `match` or `try` \
expressions."inletnames=["cases-matching-exp-indent"]inletall=[Decl.Value.make~name:"normal"`Normal"$(b,normal) indents as it would any other expression.";Decl.Value.make~name:"compact"`Compact"$(b,compact) forces an indentation of 2, unless \
$(b,nested-match) is set to $(b,align) and we're on the last \
case."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithcases_matching_exp_indent=elt}))(funconf->conf.fmt_opts.cases_matching_exp_indent)letdisambiguate_non_breaking_match=letdoc="Add parentheses around matching constructs that fit on a single line."inDecl.flag~names:["disambiguate-non-breaking-match"]~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithdisambiguate_non_breaking_match=elt}))(funconf->conf.fmt_opts.disambiguate_non_breaking_match)letdoc_comments=letdoc="Doc comments position."inletnames=["doc-comments"]inletall=[Decl.Value.make~name:"after-when-possible"`After_when_possible"$(b,after-when-possible) puts doc comments after the \
corresponding code. This option has no effect on variant \
declarations because that would change their meaning and on \
structures, signatures and objects for readability.";Decl.Value.make~name:"before-except-val"`Before_except_val"$(b,before-except-val) puts doc comments before the \
corresponding code, but puts doc comments of $(b,val) and \
$(b,external) declarations after the corresponding declarations.";Decl.Value.make~name:"before"`Before"$(b,before) puts comments before the corresponding code."]inDecl.choice~names~all~default~doc~kind~removed_values:[Decl.Value_removed.make~name:"after"~since:V.v0_14~msg:"This value has been renamed `after-when-possible` to take \
into account the technical limitations of ocamlformat, the \
behavior is unchanged."](funconfelt->updateconf~f:(funf->{fwithdoc_comments=elt}))(funconf->conf.fmt_opts.doc_comments)letdoc_comments_padding=letdocv="PADDING"inletdoc="Add $(docv) spaces before doc comments in type declarations."inletnames=["doc-comments-padding"]inDecl.int~names~default~doc~docv~kind(funconfelt->updateconf~f:(funf->{fwithdoc_comments_padding=elt}))(funconf->conf.fmt_opts.doc_comments_padding)letdoc_comments_tag_only=letdoc="Position of doc comments with only tags."inletnames=["doc-comments-tag-only"]inletall=[Decl.Value.make~name:"default"`Default"$(b,default) means no special treatment.";Decl.Value.make~name:"fit"`Fit"$(b,fit) puts doc comments on the same line."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithdoc_comments_tag_only=elt}))(funconf->conf.fmt_opts.doc_comments_tag_only)letdoc_comments_val=letnames=["doc-comments-val"]inletmsg="If you are using `doc-comments-val=before` in combination with \
`doc-comments=before` then only `doc-comments=before` is now \
required to achive the same behavior. If you are using \
`doc-comments-val=before` in combination with `doc-comments=after` \
this behavior is not available anymore. If you are using \
`doc-comments-val=after` in combination with `doc-comments=before` \
please now use `doc-comments=before-except-val`. If you are using \
`doc-comments-val=after` in combination with `doc-comments=after` \
then only `doc-comments=after-when-possible` is now required to \
achieve the same behavior. If you are using `doc-comments-val=unset` \
the same behavior can now be achieved by setting `doc-comments` \
only."inDecl.removed_option~names~since:V.v0_16~msgletdock_collection_brackets=letdoc="Dock the brackets of lists, arrays and records, so that when the \
collection does not fit on a single line the brackets are opened on \
the preceding line and closed on the following line."inletnames=["dock-collection-brackets"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithdock_collection_brackets=elt}))(funconf->conf.fmt_opts.dock_collection_brackets)letconcrete_syntax_preserved_msg="Concrete syntax will now always be preserved."letescape_chars=letnames=["escape-chars"]inletmsg=concrete_syntax_preserved_msginDecl.removed_option~names~since:V.v0_16~msgletescape_strings=letnames=["escape-strings"]inletmsg=concrete_syntax_preserved_msginDecl.removed_option~names~since:V.v0_16~msgletexp_grouping=letdoc="Style of expression grouping."inletnames=["exp-grouping"]inletall=[Decl.Value.make~name:"parens"`Parens"$(b,parens) groups expressions using parentheses.";Decl.Value.make~name:"preserve"`Preserve"$(b,preserve) preserves the original grouping syntax \
(parentheses or $(i,begin)/$(i,end))."]inDecl.choice~names~all~default~doc~kind~allow_inline:false(funconfelt->updateconf~f:(funf->{fwithexp_grouping=elt}))(funconf->conf.fmt_opts.exp_grouping)letextension_indent=letdocv="COLS"inletdoc="Indentation of items inside extension nodes ($(docv) columns)."inletnames=["extension-indent"]inDecl.int~names~default~doc~docv~kind(funconfelt->updateconf~f:(funf->{fwithextension_indent=elt}))(funconf->conf.fmt_opts.extension_indent)letextension_sugar=letnames=["extension-sugar"]inletmsg=concrete_syntax_preserved_msginDecl.removed_option~names~since:V.v0_17~msgletfield_space=letdoc="Whether or not to use a space between a field name and the \
punctuation symbol (`:` or `=`) preceding the rhs. This option \
affects records and objects."inletnames=["field-space"]inletall=[Decl.Value.make~name:"loose"`Loose"$(b,loose) uses a space.";Decl.Value.make~name:"tight"`Tight"$(b,tight) does not use a space.";Decl.Value.make~name:"tight-decl"`Tight_decl"$(b,tight-decl) is $(b,tight) for declarations and $(b,loose) \
for instantiations."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithfield_space=elt}))(funconf->conf.fmt_opts.field_space)letfunction_indent=letdocv="COLS"inletdoc="Indentation of function cases ($(docv) columns)."inletnames=["function-indent"]inDecl.int~names~default~doc~docv~kind(funconfelt->updateconf~f:(funf->{fwithfunction_indent=elt}))(funconf->conf.fmt_opts.function_indent)letfunction_indent_nested=letdoc="Whether the $(b,function-indent) parameter should be applied even \
when in a sub-block."inletnames=["function-indent-nested"]inletall=[Decl.Value.make~name:"never"`Never"$(b,never) only applies $(b,function-indent) if the function \
block starts a line.";Decl.Value.make~name:"always"`Always"$(b,always) always apply $(b,function-indent).";Decl.Value.make~name:"auto"`Auto"$(b,auto) applies $(b,function-indent) when seen fit."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithfunction_indent_nested=elt}))(funconf->conf.fmt_opts.function_indent_nested)letif_then_else=letdoc="If-then-else formatting."inletnames=["if-then-else"]inletall=[Decl.Value.make~name:"compact"`Compact"$(b,compact) tries to format an if-then-else expression on a \
single line.";Decl.Value.make~name:"fit-or-vertical"`Fit_or_vertical"$(b,fit-or-vertical) vertically breaks branches if they do not \
fit on a single line.";Decl.Value.make~name:"vertical"`Vertical"$(b,vertical) always vertically breaks branches.";Decl.Value.make~name:"keyword-first"`Keyword_first"$(b,keyword-first) formats if-then-else expressions such that \
the if-then-else keywords are the first on the line.";Decl.Value.make~name:"k-r"`K_R"$(b,k-r) formats if-then-else expressions with parentheses that \
match the K&R style."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithif_then_else=elt}))(funconf->conf.fmt_opts.if_then_else)letindent_after_in=letdocv="COLS"inletdoc="Indentation ($(docv) columns) after `let ... in`, unless followed by \
another `let`."inletnames=["indent-after-in"]inDecl.int~names~default~doc~docv~kind~allow_inline:false(funconfelt->updateconf~f:(funf->{fwithindent_after_in=elt}))(funconf->conf.fmt_opts.indent_after_in)letindicate_multiline_delimiters=letdoc="How to indicate that two matching delimiters live on different lines."inletnames=["indicate-multiline-delimiters"]inletall=[Decl.Value.make~name:"no"`No"$(b, no) doesn't do anything special to indicate the closing \
delimiter.";Decl.Value.make~name:"space"`Space"$(b,space) prints a space inside the delimiter to indicate the \
matching one is on a different line.";Decl.Value.make~name:"closing-on-separate-line"`Closing_on_separate_line"$(b, closing-on-separate-line) makes sure that the closing \
delimiter is on its own line."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithindicate_multiline_delimiters=elt}))(funconf->conf.fmt_opts.indicate_multiline_delimiters)letindicate_nested_or_patterns=letdoc="Control whether or not to indicate nested or-pattern using \
indentation."inletnames=["indicate-nested-or-patterns"]inletall=[Decl.Value.make~name:"unsafe-no"`Unsafe_no"$(b,unsafe-no) does not indicate nested or-patterns. Warning: \
this can produce confusing code where a short body of a match \
case is visually hidden by surrounding long patterns, leading to \
misassociation between patterns and body expressions.";Decl.Value.make~name:"space"`Space"$(b,space) starts lines of nested or-patterns with \" |\" rather \
than \"| \"."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithindicate_nested_or_patterns=elt}))(funconf->conf.fmt_opts.indicate_nested_or_patterns)letinfix_precedence=letdoc="Use indentation or also discretionary parentheses to explicitly \
disambiguate precedences of infix operators."inletnames=["infix-precedence"]inletall=[Decl.Value.make~name:"indent"`Indent"$(b,indent) uses indentation to explicitly disambiguate \
precedences of infix operators.";Decl.Value.make~name:"parens"`Parens"$(b,parens) uses parentheses to explicitly disambiguate \
precedences of infix operators."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithinfix_precedence=elt}))(funconf->conf.fmt_opts.infix_precedence)letleading_nested_match_parens=letdoc="Nested match parens formatting."inletnames=["leading-nested-match-parens"]inDecl.flag~names~default~doc~kind~allow_inline:false(funconfelt->updateconf~f:(funf->{fwithleading_nested_match_parens=elt}))(funconf->conf.fmt_opts.leading_nested_match_parens)letlet_and=letdoc="Style of let_and."inletnames=["let-and"]inletall=[Decl.Value.make~name:"compact"`Compact"$(b,compact) will try to format `let p = e and p = e` in a \
single line.";Decl.Value.make~name:"sparse"`Sparse"$(b,sparse) will always break between them."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithlet_and=elt}))(funconf->conf.fmt_opts.let_and)letlet_binding_indent=letdocv="COLS"inletdoc="Indentation of let binding expressions ($(docv) columns) if they do \
not fit on a single line."inletnames=["let-binding-indent"]inDecl.int~names~default~doc~docv~kind~allow_inline:false(funconfelt->updateconf~f:(funf->{fwithlet_binding_indent=elt}))(funconf->conf.fmt_opts.let_binding_indent)letlet_binding_spacing=letdoc="Spacing between let binding."inletnames=["let-binding-spacing"]inletall=[Decl.Value.make~name:"compact"`Compact"$(b,compact) spacing separates adjacent let bindings in a module \
according to module-item-spacing.";Decl.Value.make~name:"sparse"`Sparse"$(b,sparse) places two open lines between a multi-line \
module-level let binding and the next.";Decl.Value.make~name:"double-semicolon"`Double_semicolon"$(b,double-semicolon) places double semicolons and an open line \
between a multi-line module-level let binding and the next."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithlet_binding_spacing=elt}))(funconf->conf.fmt_opts.let_binding_spacing)letlet_module=letdoc="Module binding formatting."inletall=[Decl.Value.make~name:"compact"`Compact"$(b,compact) does not break a line after the $(i,let module ... \
=) and before the $(i,in) if the module declaration does not fit \
on a single line.";Decl.Value.make~name:"sparse"`Sparse"$(b,sparse) breaks a line after $(i,let module ... =) and before \
the $(i,in) if the module declaration does not fit on a single \
line."]inDecl.choice~names:["let-module"]~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithlet_module=elt}))(funconf->conf.fmt_opts.let_module)letlet_open=letnames=["let-open"]inletmsg=concrete_syntax_preserved_msginDecl.removed_option~names~since:V.v0_17~msgletline_endings=letdoc="Line endings used."inletall=[Decl.Value.make~name:"lf"`Lf"$(b,lf) uses Unix line endings.";Decl.Value.make~name:"crlf"`Crlf"$(b,crlf) uses Windows line endings."]inDecl.choice~names:["line-endings"]~all~default~doc~allow_inline:false~kind(funconfelt->updateconf~f:(funf->{fwithline_endings=elt}))(funconf->conf.fmt_opts.line_endings)letmargin=letdocv="COLS"inletdoc="Format code to fit within $(docv) columns."inDecl.int~names:["m";"margin"]~default~doc~docv~kind~allow_inline:false(funconfelt->updateconf~f:(funf->{fwithmargin=elt}))(funconf->conf.fmt_opts.margin)letmatch_indent=letdocv="COLS"inletdoc="Indentation of match/try cases ($(docv) columns)."inletnames=["match-indent"]inDecl.int~names~default~doc~docv~kind(funconfelt->updateconf~f:(funf->{fwithmatch_indent=elt}))(funconf->conf.fmt_opts.match_indent)letmatch_indent_nested=letdoc="Whether the $(b,match-indent) parameter should be applied even when \
in a sub-block."inletnames=["match-indent-nested"]inletall=[Decl.Value.make~name:"never"`Never"$(b,never) only applies $(b,match-indent) if the match block \
starts a line.";Decl.Value.make~name:"always"`Always"$(b,always) always apply $(b,match-indent).";Decl.Value.make~name:"auto"`Auto"$(b,auto) applies $(b,match-indent) when seen fit."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithmatch_indent_nested=elt}))(funconf->conf.fmt_opts.match_indent_nested)letdefault_max_indent=(* Creating a fresh formatter in case the value of max-indent has been
changed for stdout. *)letfs=Format.formatter_of_buffer(Buffer.create0)inInt.to_string(Format.pp_get_max_indentfs())letmax_indent=letdocv="COLS"inletdoc="Maximum offset ($(docv) columns) added to a new line in addition to \
the offset of the previous line."inDecl.anyArg.(some~none:default_max_indentint)~names:["max-indent"]~doc~docv~kind~default~allow_inline:false~values:Int(funconfelt->updateconf~f:(funf->{fwithmax_indent=elt}))(funconf->conf.fmt_opts.max_indent)letmodule_item_spacing=letdoc="Spacing between items of structures and signatures."inletnames=["module-item-spacing"]inletall=[Decl.Value.make~name:"compact"`Compact"$(b,compact) will not leave open lines between one-liners of \
similar sorts.";Decl.Value.make~name:"sparse"`Sparse"$(b,sparse) will always break a line between two items.";Decl.Value.make~name:"preserve"`Preserve"$(b,preserve) will not leave open lines between one-liners of \
similar sorts unless there is an open line in the input."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithmodule_item_spacing=elt}))(funconf->conf.fmt_opts.module_item_spacing)letnested_match=letdoc="Style of a pattern-matching nested in the last case of another \
pattern-matching."inletnames=["nested-match"]inletall=[Decl.Value.make~name:"wrap"`Wrap"$(b,wrap) wraps the nested pattern-matching with parentheses and \
adds indentation.";Decl.Value.make~name:"align"`Align"$(b,align) vertically aligns the nested pattern-matching under \
the encompassing pattern-matching."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithnested_match=elt}))(funconf->conf.fmt_opts.nested_match)letocp_indent_compat=letdoc="Attempt to generate output which does not change (much) when \
post-processing with ocp-indent."inletnames=["ocp-indent-compat"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithocp_indent_compat=elt}))(funconf->conf.fmt_opts.ocp_indent_compat)letparens_ite=letdoc="Uses parentheses around if-then-else branches that spread across \
multiple lines."inletnames=["parens-ite"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithparens_ite=elt}))(funconf->conf.fmt_opts.parens_ite)letparens_tuple=letdoc="Parens tuple expressions."inletnames=["parens-tuple"]inletall=[Decl.Value.make~name:"always"`Always"$(b,always) always uses parentheses around tuples.";Decl.Value.make~name:"multi-line-only"`Multi_line_only"$(b,multi-line-only) mode will try to skip parens for \
single-line tuples."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithparens_tuple=elt}))(funconf->conf.fmt_opts.parens_tuple)letparens_tuple_patterns=letdoc="Parens tuple patterns."inletnames=["parens-tuple-patterns"]inletall=[Decl.Value.make~name:"multi-line-only"`Multi_line_only"$(b,multi-line-only) mode will try to skip parens for \
single-line tuple patterns.";Decl.Value.make~name:"always"`Always"$(b,always) always uses parentheses around tuples patterns."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithparens_tuple_patterns=elt}))(funconf->conf.fmt_opts.parens_tuple_patterns)letparse_docstrings=letdoc="Parse and format docstrings."inletnames=["parse-docstrings"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithparse_docstrings=elt}))(funconf->conf.fmt_opts.parse_docstrings)letparse_toplevel_phrases=letdoc="Parse and format toplevel phrases and their output."inletnames=["parse-toplevel-phrases"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithparse_toplevel_phrases=elt}))(funconf->conf.fmt_opts.parse_toplevel_phrases)letsequence_blank_line=letdoc="Blank line between expressions of a sequence."inletnames=["sequence-blank-line"]inletall=[Decl.Value.make~name:"preserve-one"`Preserve_one"$(b,preserve) will keep a blank line between two expressions of \
a sequence if the input contains at least one.";Decl.Value.make~name:"compact"`Compact"$(b,compact) will not keep any blank line between expressions of \
a sequence."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithsequence_blank_line=elt}))(funconf->conf.fmt_opts.sequence_blank_line)letsequence_style=letdoc="Style of sequence."inletnames=["sequence-style"]inletall=[Decl.Value.make~name:"terminator"`Terminator"$(b,terminator) only puts spaces after semicolons.";Decl.Value.make~name:"separator"`Separator"$(b,separator) puts spaces before and after semicolons.";Decl.Value.make~name:"before"`Before"$(b,before) breaks the sequence before semicolons."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithsequence_style=elt}))(funconf->conf.fmt_opts.sequence_style)letsingle_case=letdoc="Style of pattern matching expressions with only a single case."inletnames=["single-case"]inletall=[Decl.Value.make~name:"compact"`Compact"$(b,compact) will try to format a single case on a single line.";Decl.Value.make~name:"sparse"`Sparse"$(b,sparse) will always break the line before a single case."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithsingle_case=elt}))(funconf->conf.fmt_opts.single_case)letspace_around_arrays=letdoc="Add a space inside the delimiters of arrays."inletnames=["space-around-arrays"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithspace_around_arrays=elt}))(funconf->conf.fmt_opts.space_around_arrays)letspace_around_lists=letdoc="Add a space inside the delimiters of lists."inletnames=["space-around-lists"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithspace_around_lists=elt}))(funconf->conf.fmt_opts.space_around_lists)letspace_around_records=letdoc="Add a space inside the delimiters of records."inletnames=["space-around-records"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithspace_around_records=elt}))(funconf->conf.fmt_opts.space_around_records)letspace_around_variants=letdoc="Add a space inside the delimiters of variants."inletnames=["space-around-variants"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithspace_around_variants=elt}))(funconf->conf.fmt_opts.space_around_variants)letstritem_extension_indent=letdocv="COLS"inletdoc="Indentation of structure items inside extension nodes ($(docv) \
columns)."inletnames=["stritem-extension-indent"]inDecl.int~names~default~doc~docv~kind(funconfelt->updateconf~f:(funf->{fwithstritem_extension_indent=elt}))(funconf->conf.fmt_opts.stritem_extension_indent)lettype_decl=letdoc="Style of type declaration."inletnames=["type-decl"]inletall=[Decl.Value.make~name:"compact"`Compact"$(b,compact) will try to format constructors and records \
definition in a single line.";Decl.Value.make~name:"sparse"`Sparse"$(b,sparse) will always break between constructors and record \
fields."]inDecl.choice~names~all~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithtype_decl=elt}))(funconf->conf.fmt_opts.type_decl)lettype_decl_indent=letdocv="COLS"inletdoc="Indentation of type declarations ($(docv) columns) if they do not \
fit on a single line."inletnames=["type-decl-indent"]inDecl.int~names~default~doc~docv~kind~allow_inline:false(funconfelt->updateconf~f:(funf->{fwithtype_decl_indent=elt}))(funconf->conf.fmt_opts.type_decl_indent)letwrap_comments=letdoc="Wrap comments and docstrings. Comments and docstrings are divided \
into paragraphs by open lines (two or more consecutive newlines), \
and each paragraph is wrapped at the margin. Multi-line comments \
with vertically-aligned asterisks on the left margin are not \
wrapped. Consecutive comments with both left and right margin \
aligned are not wrapped either."inDecl.flag~default~names:["wrap-comments"]~doc~kind(funconfelt->updateconf~f:(funf->{fwithwrap_comments=elt}))(funconf->conf.fmt_opts.wrap_comments)letwrap_fun_args=letdoc="Style for function call."inletnames=["wrap-fun-args"]inDecl.flag~default~names~doc~kind(funconfelt->updateconf~f:(funf->{fwithwrap_fun_args=elt}))(funconf->conf.fmt_opts.wrap_fun_args)letoptions=Store.[eltassignment_operator;eltbreak_before_in;eltbreak_cases;eltbreak_collection_expressions;eltbreak_colon;eltbreak_fun_decl;eltbreak_fun_sig;eltbreak_infix;eltbreak_infix_before_func;eltbreak_separators;eltbreak_sequences;eltbreak_string_literals;eltbreak_struct;eltcases_exp_indent;eltcases_matching_exp_indent;eltdisambiguate_non_breaking_match;eltdoc_comments;eltdoc_comments_padding;eltdoc_comments_tag_only;eltdock_collection_brackets;eltexp_grouping;eltextension_indent;eltfield_space;eltfunction_indent;eltfunction_indent_nested;eltif_then_else;eltindent_after_in;eltindicate_multiline_delimiters;eltindicate_nested_or_patterns;eltinfix_precedence;eltleading_nested_match_parens;eltlet_and;eltlet_binding_indent;eltlet_binding_spacing;eltlet_module;eltline_endings;eltmargin;eltmatch_indent;eltmatch_indent_nested;eltmax_indent;eltmodule_item_spacing;eltnested_match;eltocp_indent_compat;eltparens_ite;eltparens_tuple;eltparens_tuple_patterns;eltparse_docstrings;eltparse_toplevel_phrases;eltsequence_blank_line;eltsequence_style;eltsingle_case;eltspace_around_arrays;eltspace_around_lists;eltspace_around_records;eltspace_around_variants;eltstritem_extension_indent;elttype_decl;elttype_decl_indent;eltwrap_comments;eltwrap_fun_args;(* removed options *)eltalign_cases;eltalign_constructors_decl;eltalign_variants_decl;eltdoc_comments_val;eltescape_chars;eltescape_strings;eltextension_sugar;eltlet_open]end(* Flags that can be modified in the config file that don't affect
formatting *)letkind=Decl.OperationalmoduleOperational=structletupdate~fc={cwithopr_opts=fc.opr_opts}letcomment_check=letdoc="Control whether to check comments and documentation comments. Unsafe \
to turn off. May be set in $(b,.ocamlformat)."inDecl.flag~default~names:["comment-check"]~doc~kind(funconfelt->updateconf~f:(funf->{fwithcomment_check=elt}))(funconf->conf.opr_opts.comment_check)letdebug=letdoc="Generate debugging output."inDecl.flag~default~names:["g";"debug"]~doc~kind(funconfelt->updateconf~f:(funf->{fwithdebug=elt}))(funconf->conf.opr_opts.debug)letdisable=letdoc="Disable ocamlformat. This is used in attributes to locally disable \
automatic code formatting. One can also use $(b,[@@@ocamlformat \
\"enable\"]) instead of $(b,[@@@ocamlformat \"disable=false\"])."inDecl.flag~names:["disable"]~default~doc~kind~allow_inline:true(funconfelt->updateconf~f:(funf->{fwithdisable=elt}))(funconf->conf.opr_opts.disable)letmargin_check=letdoc="Emit a warning if the formatted output exceeds the margin."inDecl.flag~default~names:["margin-check"]~doc~kind(funconfelt->updateconf~f:(funf->{fwithmargin_check=elt}))(funconf->conf.opr_opts.margin_check)letmax_iters=letdocv="N"inletdoc="Fail if output of formatting does not stabilize within $(docv) \
iterations. May be set in $(b,.ocamlformat)."inDecl.int~names:["n";"max-iters"]~default~doc~docv~kind(funconfelt->updateconf~f:(funf->{fwithmax_iters=elt}))(funconf->conf.opr_opts.max_iters)letocaml_version=letdoc="Version of OCaml syntax of the output."inDecl.ocaml_version~names:["ocaml-version"]~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithocaml_version=elt}))(funconf->conf.opr_opts.ocaml_version)letquiet=letdoc="Quiet. May be set in $(b,.ocamlformat)."inDecl.flag~default~names:["q";"quiet"]~doc~kind(funconfelt->updateconf~f:(funf->{fwithquiet=elt}))(funconf->conf.opr_opts.quiet)letdisable_conf_attrs=letdoc="Disable configuration in attributes."inDecl.flag~default~names:["disable-conf-attrs"]~doc~kind(funconfelt->updateconf~f:(funf->{fwithdisable_conf_attrs=elt}))(funconf->conf.opr_opts.disable_conf_attrs)letversion_check=letdoc="Check that the version matches the one specified in .ocamlformat."inDecl.flag~default~names:["version-check"]~doc~kind(funconfelt->updateconf~f:(funf->{fwithversion_check=elt}))(funconf->conf.opr_opts.version_check)letoptions:Store.t=Store.[eltcomment_check;eltdebug;eltdisable;eltmargin_check;eltmax_iters;eltocaml_version;eltquiet;eltdisable_conf_attrs;eltversion_check]endletoptions=Operational.options@Formatting.options@optionsletparse_lineconfig?(version_check=config.opr_opts.version_check.v)?(disable_conf_attrs=config.opr_opts.disable_conf_attrs.v)~froms=letupdate~config~from~name~value=letname=String.stripnameinletvalue=String.stripvalueinmatch(name,from)with|"version",`File_->ifString.equalVersion.currentvalue||notversion_checkthenOkconfigelseError(Error.Version_mismatch{read=value;installed=Version.current})|name,`Filex->Decl.updateoptions~config~from:(`Parsed(`Filex))~name~value~inline:false|name,`Attributeloc->ifdisable_conf_attrsthen(warn~loc"Configuration in attribute %S ignored."s;Okconfig)elseDecl.updateoptions~config~from:(`Parsed(`Attributeloc))~name~value~inline:trueinlets=matchString.indexs'#'with|Somei->String.subs~pos:0~len:i|None->sinlets=String.stripsinmatchString.split~on:'='swith|[]|[""]->Okconfig|[name;value]->letname=String.stripnameinletvalue=String.stripvalueinupdate~config~from~name~value|[s]->(matchString.stripswith|""->impossible"previous match"(* special case for disable/enable *)|"enable"->update~config~from~name:"disable"~value:"false"|name->update~config~from~name~value:"true")|_->Error(Error.Malformeds)openParsetreeletparse_attr{attr_name={txt;loc=_};attr_payload;_}=matchtxtwith|"ocamlformat"->(matchattr_payloadwith|PStr[{pstr_desc=Pstr_eval({pexp_desc=Pexp_constant{pconst_desc=Pconst_string(str,strloc,None);_};pexp_attributes=[];_},[]);_}]->Ok(str,strloc)|_->Error(`Msg"Invalid format: String expected"))|_whenString.is_prefix~prefix:"ocamlformat."txt->Error(`Msg(Format.sprintf"Invalid format: Unknown suffix %S"(String.chop_prefix_exn~prefix:"ocamlformat."txt)))|_->Error`Ignoreletupdate?(quiet=false)c({attr_name={txt;loc};_}asattr)=letresult=matchparse_attrattrwith|Ok(str,strloc)->parse_line~from:(`Attributestrloc)cstr|>Result.map_error~f:Error.to_string|Error(`Msgmsg)->Errormsg|Error`Ignore->Okcinmatchresultwith|Okconf->conf|Errorerror->letw=Warnings.Attribute_payload(txt,error)inif(notc.opr_opts.quiet.v)&¬quietthenWarning.print_warninglocw;cletupdate_valueconfig~name~value=Decl.updateoptions~config~from:`Commandline~name~value~inline:falseletupdate_statecstate=letdisable=matchstatewith`Enable->false|`Disable->trueinletopr_opts={c.opr_optswithdisable={c.opr_opts.disablewithv=disable}}in{cwithopr_opts}letparse_state_attrattr=matchparse_attrattrwith|Ok("enable",_)->Some`Enable|Ok("disable",_)->Some`Disable|_->Noneletprint_config=Decl.print_configoptionsletterm=Decl.Store.to_termoptionsmoduleUI=structletprofile=Decl.to_uiprofileletopr_opts=Store.to_uiOperational.optionsletfmt_opts=Store.to_uiFormatting.optionsend