lyaml 6.2.7 Reference

# Module `lyaml.implicit`

## Functions

null (value) | Parse a null token to a null value.
bool (value) | Parse a boolean token to the equivalent value.
binary (value) | Parse a binary token, such as '0b1010_0111_0100_1010_1110'.
octal (value) | Parse an octal token, such as '012345'.
decimal (value) | Parse a decimal token, such as '0' or '12345'.
hexadecimal (value) | Parse a hexadecimal token, such as '0xdeadbeef'.
sexagesimal (value) | Parse a sexagesimal token, such as '190:20:30'.
nan (value) | Parse a `nan` token.
inf (value) | Parse a signed `inf` token.
float (value) | Parse a floating point number token, such as '1e-3' or '-0.12'.
sexfloat (value) | Parse a sexagesimal float, such as '190:20:30.15'.

## Functions

null (value)
  Parse a null token to a null value.

  ### Parameters:

  - value token

  ### Returns:

  lyaml.null, for an empty string or literal ~

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_null = implicit.null(token)

bool (value)
  Parse a boolean token to the equivalent value. Treats capilalized, lower and upper-cased variants of true/false, yes/no or on/off tokens as boolean `true` and `false` values.

  ### Parameters:

  - value token

  ### Returns:

  bool if a valid boolean token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_bool = implicit.bool(token)

binary (value)
  Parse a binary token, such as '0b1010_0111_0100_1010_1110'.

  ### Parameters:

  - value string token

  ### Returns:

  int integer equivalent, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_int = implicit.binary(value)

octal (value)
  Parse an octal token, such as '012345'.

  ### Parameters:

  - value string token

  ### Returns:

  int integer equivalent, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_int = implicit.octal(value)

decimal (value)
  Parse a decimal token, such as '0' or '12345'.

  ### Parameters:

  - value string token

  ### Returns:

  int integer equivalent, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_int = implicit.decimal(value)

hexadecimal (value)
  Parse a hexadecimal token, such as '0xdeadbeef'.

  ### Parameters:

  - value string token

  ### Returns:

  int integer equivalent, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_int = implicit.hexadecimal(value)

sexagesimal (value)
  Parse a sexagesimal token, such as '190:20:30'. Useful for times and angles.

  ### Parameters:

  - value string token

  ### Returns:

  int integer equivalent, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_int = implicit.sexagesimal(value)

nan (value)
  Parse a `nan` token.

  ### Parameters:

  - value string token

  ### Returns:

  nan not-a-number, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_nan = implicit.nan(value)

inf (value)
  Parse a signed `inf` token.

  ### Parameters:

  - value string token

  ### Returns:

  number plus/minus-infinity, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_inf = implicit.inf(value)

float (value)
  Parse a floating point number token, such as '1e-3' or '-0.12'.

  ### Parameters:

  - value string token

  ### Returns:

  number float equivalent, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_float = implicit.float(value)

sexfloat (value)
  Parse a sexagesimal float, such as '190:20:30.15'. Useful for times and angles.

  ### Parameters:

  - value string token

  ### Returns:

  number float equivalent, if a valid token was recognized

  ### Or

  nil otherwise, nil

  ### Usage:

      maybe_float = implicit.sexfloat(value)

generated by LDoc 1.4.6 Last updated 2020-11-27 16:17:28