tomlf_de Module

TOML deserialization module

This module provides interfaces for loading and parsing TOML documents from various sources (files, strings, and I/O units).

The primary interfaces are:

All parsing functions return an allocatable toml_table that contains the parsed document. If parsing fails, the table will not be allocated and error information is provided via the optional error argument.



Interfaces

public interface toml_load

Load a TOML data structure from the provided source

  • private subroutine toml_load_file(table, filename, config, context, error)

    Load TOML data structure from file

    Arguments

    Type IntentOptional Attributes Name
    type(toml_table), intent(out), allocatable :: table

    Instance of the TOML data structure, not allocated in case of error

    character(kind=tfc, len=*), intent(in) :: filename
    type(toml_parser_config), intent(in), optional :: config

    Configuration for the parser

    type(toml_context), intent(out), optional :: context

    Context tracking the origin of the data structure to allow rich reports

    type(toml_error), intent(out), optional, allocatable :: error

    Error handling, provides detailed diagnostic in case of error

  • private subroutine toml_load_unit(table, io, config, context, error)

    Load TOML data structure from unit

    Arguments

    Type IntentOptional Attributes Name
    type(toml_table), intent(out), allocatable :: table

    Instance of the TOML data structure, not allocated in case of error

    integer, intent(in) :: io

    Unit to read from

    type(toml_parser_config), intent(in), optional :: config

    Configuration for the parser

    type(toml_context), intent(out), optional :: context

    Context tracking the origin of the data structure to allow rich reports

    type(toml_error), intent(out), optional, allocatable :: error

    Error handling, provides detailed diagnostic in case of error

public interface toml_loads

Load a TOML data structure from a string

  • private subroutine toml_load_string(table, string, config, context, error)

    Load TOML data structure from string

    Arguments

    Type IntentOptional Attributes Name
    type(toml_table), intent(out), allocatable :: table

    Instance of the TOML data structure, not allocated in case of error

    character(kind=tfc, len=*), intent(in) :: string

    String containing TOML document

    type(toml_parser_config), intent(in), optional :: config

    Configuration for the parser

    type(toml_context), intent(out), optional :: context

    Context tracking the origin of the data structure to allow rich reports

    type(toml_error), intent(out), optional, allocatable :: error

    Error handling, provides detailed diagnostic in case of error

public interface toml_parse

Parse a TOML document.

This interface is deprecated in favor of toml_load and toml_loads

  • private subroutine toml_parse_unit(table, unit, error)

    Parse a TOML input from a given IO unit.

    Arguments

    Type IntentOptional Attributes Name
    type(toml_table), intent(out), allocatable :: table

    Instance of the TOML data structure, not allocated in case of error

    integer, intent(in) :: unit

    Unit to read from

    type(toml_error), intent(out), optional, allocatable :: error

    Error handling, provides detailed diagnostic in case of error

  • private subroutine toml_parse_string(table, string, error)

    Wrapper to parse a TOML string.

    Arguments

    Type IntentOptional Attributes Name
    type(toml_table), intent(out), allocatable :: table

    Instance of the TOML data structure, not allocated in case of error

    character(len=*), intent(in), target :: string

    String containing TOML document

    type(toml_error), intent(out), optional, allocatable :: error

    Error handling, provides detailed diagnostic in case of error