package ocp-indent
Install
Dune Dependency
Authors
Maintainers
Sources
md5=3bc327e38f453f38494098725c97d2cb
sha512=5b28ae8695612c95cb0f5748de9b9f01d8ef4ad18b31340dc526ccae5fb1b6ee7e12024ff1beb817a43796183a83bca144222ca2d77d7750f2ff56108b5fa350
doc/ocp-indent.lib/IndentBlock/index.html
Module IndentBlock
Source
Indenter block
reverse block
updates the stack to account for the original indentation, assumed as correct. Useful for partial indentation
Return the padding of the block, ie expected relative indentation of sub-blocks
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
.
guess_indent line block
For indenting empty lines: attempt to guess what the most probable indent at this point would be
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.
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
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