1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585(**************************************************************************)(* *)(* 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_around_multiline_strings=eltfalse;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=elttrue;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_around_multiline_strings=eltfalse;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_around_multiline_strings=elttrue;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=eltNone;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=eltfalse;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:Noneendletprofile=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.[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_deindent_fun=letdoc="Deindent a line beginning with `fun`."inletnames=["let-binding-deindent-fun"]inDecl.flag~names~default~doc~kind(funconfelt->updateconf~f:(funf->{fwithlet_binding_deindent_fun=elt}))(funconf->conf.fmt_opts.let_binding_deindent_fun)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="Comments 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_deindent_fun;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->ifelt.vthenBox_debug.enable_stacktraces:=true;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