package ocp-indent-nlfork

  1. Overview
  2. Docs
ocp-indent library, "newline tokens" fork

Install

Dune Dependency

Authors

Maintainers

Sources

nlfork-1.5.4.tar.gz
md5=e9d1a7de64e169536ddf16023b111409
sha512=4637eb4ac2a47001f7b236ad7fdcbf7fe1a659e947a46aacd7ff2f2e386c82c423468aabd6adcabed8caf869d4a8f3f592ea1134b4ba77b7d37080e01cc497dc

doc/ocp-indent-nlfork.lib/IndentPrinter/index.html

Module IndentPrinterSource

Sourcetype output_elt =
  1. | Newline
  2. | Indent of int
  3. | Whitespace of string
  4. | Text of string

Passed to the function specified with the Extended output_kind

Sourcetype 'a output_kind =
  1. | Numeric of int -> 'a -> 'a
  2. | Print of string -> 'a -> 'a
  3. | Extended of IndentBlock.t -> output_elt -> 'a -> 'a

* If Print f, the whole input is fed as strings through f, with expected lines reindented (with spaces). * If Numeric f, the indentation values (i.e. total number of leading spaces) for each lines on which in_lines is true are passed through the function. * If Extended f, every element is fed to f with arguments state element. There is at least an element for each token, but there may be more (whitespace, multiline tokens...). You may safely raise an exception from f to stop further processing. This version can be used for syntax highlighting or storing checkpoints.

Sourcetype 'a output = {
  1. debug : bool;
  2. config : IndentConfig.t;
    (*

    Returns true on the lines that should be reindented (lines start at 1)

    *)
  3. in_lines : int -> bool;
    (*

    if true, partial indent will adapt to the current indent of the file

    *)
  4. adaptive : bool;
  5. indent_empty : bool;
  6. kind : 'a output_kind;
}
Sourceval std_output : unit output
Sourceval proceed : 'a output -> Nstream.t -> IndentBlock.t -> 'a -> 'a
OCaml

Innovation. Community. Security.