# Module OASISValues

    module OASISValues: sig .. end

Parse, print and check values

This module allows to parse values that should match a particular content (URL, list).

The whole module is not exported.

- Author(s): Sylvain Le Gall

### Types and exception

    type 'a t = {

`` | `parse : `ctxt:OASISContext.t -> string -> 'a`;` | `(*` | Parse a string into value | `*)`
`` | `update : `'a -> 'a -> 'a`;` | `(*` | Merge two values into one | `*)`
`` | `print : `'a -> string`;` | `(*` | Convert a value to string | `*)`

`}`

Definition of a value.

    exception Not_printable

The value exist but there is no easy way to represent it.

    exception Not_combinable

It is not possible to combine values.

    val update_fail : 'a -> 'b -> 'c

Always raise `OASISValues.Not_combinable`.

### Basic values and combinators

    val blackbox : 'a t

Hidden value to build phantom data storage, cannot set/get it using string.

    val string : string t

String value.

    val string_not_empty : string t

String value, must not be "".

    val boolean : bool t

Boolean value, use `bool_of_string` to parse.

    val expandable : string t -> string t

Extra check to see if the string value, can be expanded using `Buffer.add_substitute` rules.

    val dot_separated : 'a t -> 'a list t

`dot_separated v` When parsing split the input string using '.' separator and apply `v.parse`. Merge by concatenate two values, and print by joining `v.print` generated strings using a '.' separator. Don't strip whitespaces.

    val comma_separated : 'a t -> 'a list t

Same as `OASISValues.dot_separated` using ',' as separator. Strip whitespaces before and after the input string.

    val newline_separated : 'a t -> 'a list t

Same `OASISValues.dot_separated` using '\n' as separator. Strip whitespaces before and after the input string.

    val space_separated : string list t

Same as `OASISValues.dot_separated` using blanks as separator.

    val with_optional_parentheses : 'a t -> 'b t -> ('a * 'b option) t

`with_optional_parentheses v_main v_opt` Combine two values. The input string `"abcd (defg)"` is split between the part not between parentheses and the one between. `v_main` is applied to the first one and `v_opt` to the latter. If no parentheses is found, only apply `v_main`.

    val opt : 'a t -> 'a option t

Optional value.

    val choices : (unit -> string) -> (string * 'a) list -> 'a t

`choices nm lst` Value that must be in a list of predefined choices. Find the right association in `lst`, comparison is case insensitive. If something failed output a message using `nm` as the name of the value represented.

### Standard values

    val url : string t

URL value.

    val copyright : string t

Copyright value.

    val file : string t

File value.

    val files : string list t

File list value.

    val file_glob : string t

File with glob value.

    val directory : string t

Directory value.

    val modules : string list t

Module list value.

    val categories : string list t

Category list value.

    val findlib_name : string t

Findlib package name value, without its path.

    val findlib_full : string t

Findlib package name with path value, e.g. oasis.base.

    val internal_library : string t

Internal library.

    val command_line : (string * string list) t

Command line.

    val command_line_options : string list t

Arguments of command line programs. See `OASISUtils.POSIX.split` for more information.