package ocp-indent

  1. Overview
  2. Docs
A simple tool to indent OCaml programs

Install

Dune Dependency

Authors

Maintainers

Sources

1.8.0.tar.gz
md5=d4d11e1aaedd7d3268ac7d5813de43ca
sha512=246a97f04b44371900a6f39eab34d9b674d6afa9026e78fce2ef171b5d28fcca0b49f353b2de9d09cb5529b896e47c253acc3074618060862e8a7debd9289afc

doc/ocp-indent.lib/IndentBlock/index.html

Module IndentBlockSource

Sourcetype t

Indenter block

Sourceval shift : t -> int -> t

Shift a block by a given offset

Sourceval set_column : t -> int -> t

Set the start column of the given block to column

Sourceval reverse : t -> t

reverse block updates the stack to account for the original indentation, assumed as correct. Useful for partial indentation

Sourceval offset : t -> int

Return the current line offset

Sourceval padding : t -> int

Return the padding of the block, ie expected relative indentation of sub-blocks

Sourceval indent : t -> int

Return the block indentation

Sourceval original_column : t -> int

Return the block original starting column

Sourceval empty : t

The empty block

update t str tok computes the new block state after processing the token tok in block t. The next tokens can be observed in the stream str.

Sourceval dump : t -> unit

Display token and stack of the block

Sourceval guess_indent : int -> t -> int

guess_indent line block For indenting empty lines: attempt to guess what the most probable indent at this point would be

Sourceval is_clean : t -> bool

A block is considered clean when it is not linked to any parser state (ie it's not within a comment, string, or ocamldoc stuff). This is not enough for a safe checkpoint: lots of rules depend on the previous/next token to decide indentation.

Sourceval is_at_top : t -> bool

True only when the block is at the root of the file (the stack is empty, the block isn't included in any syntactical construct). Implies is_clean

Sourceval is_declaration : t -> bool

Returns true if the given block is at a top-level declaration level, ie not within any expression or type definition, but possibly inside a module, signature or class definition. Implies is_clean. Should be safe for checkpoints

Sourceval is_in_comment : t -> bool

Either we are at a comment, or within an ocamldoc block

OCaml

Innovation. Community. Security.