tomlf_de_parser Module

Implementation of a parser for transforming a token stream to TOML datastructures.



Interfaces

public interface toml_parser_config

  • private pure function new_parser_config(color, context_detail) result(config)

    Create new configuration for the TOML parser

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in), optional :: color

    Color support for diagnostics

    integer, intent(in), optional :: context_detail

    Record all tokens

    Return Value type(toml_parser_config)

    Configuration of the parser


Derived Types

type, public ::  toml_parser

TOML parser

Components

Type Visibility Attributes Name Initial
type(toml_parser_config), public :: config

Configuration of the parser

type(toml_context), public :: context

Context for producing diagnostics

type(toml_table), public, pointer :: current

Pointer to the currently processed table

type(toml_diagnostic), public, allocatable :: diagnostic

Diagnostic produced while parsing

type(toml_table), public, allocatable :: root

Table containing the document root

type(toml_token), public :: token

Current token

type, public ::  toml_parser_config

Configuration of the TOML parser

Components

Type Visibility Attributes Name Initial
type(toml_terminal), public :: color = toml_terminal()

Use colorful output for diagnostics

integer, public :: context_detail = 0

Record all tokens

Constructor

private pure function new_parser_config (color, context_detail)

Create new configuration for the TOML parser


Subroutines

public subroutine parse(lexer, table, config, context, error)

Parse TOML document and return root table

Arguments

Type IntentOptional Attributes Name
class(abstract_lexer), intent(inout) :: lexer

Instance of the lexer

type(toml_table), intent(out), allocatable :: table

TOML data structure

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 handler