Minimal YAML reading interface for CABLE.
The YAML file is parsed with yaFyaml and immediately copied into a plain tree of cable_yaml_node_t values, so no yaFyaml types are visible outside this module. Every node is a scalar, a mapping or a sequence. Mapping entries keep their file order, and each child node stores the key it was found under.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | CABLE_YAML_UNDEFINED | = | 0 | |
| integer, | public, | parameter | :: | CABLE_YAML_SCALAR | = | 1 | |
| integer, | public, | parameter | :: | CABLE_YAML_MAPPING | = | 2 | |
| integer, | public, | parameter | :: | CABLE_YAML_SEQUENCE | = | 3 |
A node of a parsed YAML document.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | node_kind | = | CABLE_YAML_UNDEFINED |
One of the |
|
| character(len=:), | public, | allocatable | :: | key |
The mapping key this node was found under. Unallocated for the root node and for sequence items. |
||
| character(len=:), | public, | allocatable | :: | text |
The scalar value as text. Only allocated for scalar nodes. |
||
| type(cable_yaml_node_t), | public, | allocatable | :: | children(:) |
Mapping values (in file order) or sequence items. |
| procedure, public :: copy_node | |
| generic, public :: assignment(=) => copy_node | |
| procedure, public :: is_scalar => node_is_scalar | |
| procedure, public :: is_mapping => node_is_mapping | |
| procedure, public :: is_sequence => node_is_sequence | |
| procedure, public :: size => node_size | |
| procedure, public :: has => node_has | |
| procedure, public :: get => node_get | |
| procedure, public :: at => node_at | |
| procedure, public :: as_string => node_as_string | |
| procedure, public :: as_integer => node_as_integer | |
| procedure, public :: as_real => node_as_real | |
| procedure, public :: as_logical => node_as_logical | |
| procedure, public :: get_string => node_get_string | |
| procedure, public :: get_integer => node_get_integer | |
| procedure, public :: get_real => node_get_real | |
| procedure, public :: get_logical => node_get_logical |
Parse the YAML file at file_name. Aborts if the file cannot be read or
is not valid YAML.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | file_name |
Parse YAML held in a string. Aborts if the text is not valid YAML.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
Copy a yaFyaml node and everything below it into a cable_yaml_node_t.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(YAML_Node), | intent(in), | target | :: | parsed_node |
The text of a scalar yaFyaml node. Non-string scalars are rendered in the
form they are written in YAML (true/false for booleans).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(YAML_Node), | intent(in), | target | :: | parsed_node |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
Number of children of a mapping or sequence. Zero for scalars.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
Position of key among the children of a mapping, or 0 if absent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | key |
Whether this node is a mapping containing key.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | key |
The value stored under key. Aborts if this node has no such key.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | key |
The child_index-th child (1-based) of a mapping or sequence.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | child_index |
The text of a scalar node. Aborts for mappings and sequences.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
The scalar value as an integer. Aborts if it is not one.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
The scalar value as a real. Aborts if it is not one.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
The scalar value as a logical (true or false). Aborts otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this |
Shorthand for this%get(key)%as_string().
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | key |
Shorthand for this%get(key)%as_integer().
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | key |
Shorthand for this%get(key)%as_real().
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | key |
Shorthand for this%get(key)%as_logical().
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | key |
Deep copy of a node and everything below it.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_yaml_node_t), | intent(inout) | :: | destination | |||
| type(cable_yaml_node_t), | intent(in) | :: | source |