Implementation of a parser for transforming a token stream to TOML datastructures.
Create new configuration for the TOML parser
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in), | optional | :: | color |
Color support for diagnostics |
|
integer, | intent(in), | optional | :: | context_detail |
Record all tokens |
Configuration of the parser
TOML parser
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 |
Configuration of the TOML parser
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 |
private pure function new_parser_config (color, context_detail) | Create new configuration for the TOML parser |
Parse TOML document and return root table
Type | Intent | Optional | 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 |