package ocp-indent
Install
Dune Dependency
Authors
Maintainers
Sources
md5=70db6649a8c08a682ad63730c9752e31
sha512=565353de333dd44375366fff75e85a6256c3cd9ff52b3db79803141f975e77cda04dfe32f5e0f2d4c82c59be8f04e9c2bf4d066b113b2cdf267f4c3dcfa401da
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), and for top-level constructs. 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