1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465(** Functions managing blanks *)typebuf=Input.buffertypepos=Input.pos(** A blank function is just a function progressing in a buffer *)typeblank=buf->pos->buf*postypet=blank(** Use when you have no blank chars *)letnone:blank=funsn->(s,n)(** Blank from a charset *)letfrom_charset:Charset.t->blank=funcssn->letrecfnsn=let(c,s',n')=Input.readsninifCharset.memcscthenfns'n'else(s,n)infnsn(** Blank from a terminal *)letfrom_terminal:'aLex.t->blank=funtsn->trylet(_,s,n)=t.fsnin(s,n)withLex.NoParse->(s,n)letline_comments:?cs:Charset.t->string->blank=fun?(cs=Charset.from_string" \t\n\r")start_comment->letstart_comment=(Lex.stringstart_comment()).finfunsn->letrecfnsn=let(c,s',n')=Input.readsninifCharset.memcscthenfns'n'elsetrylet(_,s,n)=start_commentsninletrecgnsn=let(c,s',n')=Input.readsninifc<>'\n'&&c<>'\r'thengns'n'elsefnsningnsnwithLex.NoParse->(s,n)infnsn(** Layout records *)typelayout_config={old_blanks_before:bool(** Ignoring blanks with the old blank function before parsing? *);new_blanks_before:bool(** Then ignore blanks with the new blank function (before parsing)? *);new_blanks_after:bool(** Use the new blank function one last time before resuming old layout? *);old_blanks_after:bool(** Use then the old blank function one last time as well? *)}letdefault_layout_config:layout_config={old_blanks_before=true;new_blanks_before=false;new_blanks_after=false;old_blanks_after=true}