package merlin-lib

  1. Overview
  2. Docs
Merlin's libraries

Install

Dune Dependency

Authors

Maintainers

Sources

merlin-5.4.1-503.tbz
sha256=49b3b4c778c12125fc7405e73790b0b312d5d79749dd73d4838b6562a2533022
sha512=6350ff076ac61727c48bc098a05520c5d343f3323b2f3b6d7d69fdd568e51abca6945cbcbc3a6ae97fd198bd7bbdcae823fbd0f3f14a37972fe713da2ed14f2d

doc/merlin-lib.utils/Merlin_utils/Misc/Utf8_lexeme/index.html

Module Misc.Utf8_lexemeSource

Sourcetype t = string
Sourceval normalize : string -> (t, t) Result.t

Normalize the given UTF-8 encoded string. Invalid UTF-8 sequences results in a error and are replaced by U+FFFD. Identifier characters are put in NFC normalized form. Other Unicode characters are left unchanged.

Sourceval capitalize : string -> (t, t) Result.t

Like normalize, but if the string starts with a lowercase identifier character, it is replaced by the corresponding uppercase character. Subsequent characters are not changed.

Sourceval uncapitalize : string -> (t, t) Result.t

Like normalize, but if the string starts with an uppercase identifier character, it is replaced by the corresponding lowercase character. Subsequent characters are not changed.

Sourceval is_capitalized : t -> bool

Returns true if the given normalized string starts with an uppercase identifier character, false otherwise. May return wrong results if the string is not normalized.

Sourceval is_valid_identifier : t -> bool

Check whether the given normalized string is a valid OCaml identifier:

  • all characters are identifier characters
  • it does not start with a digit or a single quote
Sourceval is_lowercase : t -> bool

Returns true if the given normalized string only contains lowercase identifier character, false otherwise. May return wrong results if the string is not normalized.

Sourcetype validation_result =
  1. | Valid
  2. | Invalid_character of Uchar.t
    (*

    Character not allowed

    *)
  3. | Invalid_beginning of Uchar.t
    (*

    Character not allowed as first char

    *)
Sourceval validate_identifier : ?with_dot:bool -> t -> validation_result

Like is_valid_identifier, but returns a more detailed error code. Dots can be allowed to extend support to path-like identifiers.

Sourceval starts_like_a_valid_identifier : t -> bool

Checks whether the given normalized string starts with an identifier character other than a digit or a single quote. Subsequent characters are not checked.

OCaml

Innovation. Community. Security.