{"id":29085820,"url":"https://github.com/archermarx/tinytoml","last_synced_at":"2026-02-01T20:05:22.472Z","repository":{"id":176920986,"uuid":"659482377","full_name":"archermarx/TinyTOML","owner":"archermarx","description":"Small, single-file TOML parser written in Modern Fortran","archived":false,"fork":false,"pushed_at":"2025-11-23T05:09:04.000Z","size":42,"stargazers_count":5,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-23T05:19:22.532Z","etag":null,"topics":["config","fortran","modern-fortran","parser","toml"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/archermarx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-06-28T00:01:24.000Z","updated_at":"2025-11-10T09:43:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"54fbff5a-77bd-4bc4-a5d8-870c26771d70","html_url":"https://github.com/archermarx/TinyTOML","commit_stats":null,"previous_names":["archermarx/tinytoml"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/archermarx/TinyTOML","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archermarx%2FTinyTOML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archermarx%2FTinyTOML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archermarx%2FTinyTOML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archermarx%2FTinyTOML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archermarx","download_url":"https://codeload.github.com/archermarx/TinyTOML/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archermarx%2FTinyTOML/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28988483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T18:17:03.387Z","status":"ssl_error","status_checked_at":"2026-02-01T18:16:57.287Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","fortran","modern-fortran","parser","toml"],"created_at":"2025-06-27T23:06:09.829Z","updated_at":"2026-02-01T20:05:22.467Z","avatar_url":"https://github.com/archermarx.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinyTOML\n\nA small TOML-parsing library written in Modern Fortran. I wrote this instead of using [TOML-f](https://github.com/toml-f/toml-f) because\nI needed TOML parsing in my research code and on an HPC cluster and didn't want to take on a large external library.\nYou should probably use that library instead of this one if you can.\n\nConsists of a single c. 1000 line file.\n\nDoes not currently support all TOML features. Missing features include:\n - Nested arrays\n - Arrays of inline tables\n - Arrays of strings\n - Nested tables (i.e. [tab1.tab2])\n - Dates and times\n\n## Installation\n\nTo install, just download the files from this repository and add the source file to your Fortran project's\nsource directory. Compile using your build system of choice.\n\nA sample Makefile is provided for building the example code. Clone the repository and run `make`.\nTo run the example program, type\n`./toml.exe test/example.toml`\n\n## Compatibility\n\nTested with both gfortran and ifort on Linux.\n\n## Usage\n\nLet's say we have a TOML file saved as `example.toml`. Its contents are:\n\n```toml\n[options]\nstring_option = \"a string\"\narray_option = [1.0, 0.1]\nfloat_option = 0.1\nbool_option = false\ninteger_option = 2\n\n[[fruits]]\ntype=\"apple\"\nproperties = {mass_g=83.798, color = \"red\", in_stock = 1}\n\n[[fruits]]\ntype=\"orange\"\nproperties = {mass_g=131.293, color = \"orange\", in_stock = 3}\n```\n\nTo read this file in our program, we must first define a `toml_object` object.\nThis is the root note of the parsed TOML file. We can then read toml data from a\nfile using the `parse_file` function\n\n```fortran\nuse TinyTOML\n\ntype(toml_object):: toml_content\n\ntoml_content = parse_file(\"example.toml)\n```\n\nTo get a sub-object, such as the `[options]` table, we use the `get` function.\nPassing a string retrieves the corresponding key, while passing an integer gives the value at that index.\n\n```fortran\ntype(toml_object):: options\n\n! Since \"options\" is the first thing in the file,\n! these are all equivalent\noptions = toml_content%get(\"options\")\noptions = toml_content%get(1)\noptions = get(toml_content, \"options\")\noptions = get(toml_content, 1)\n```\n\nIn order to read the value of a TOML object into a Fortran data-type, we use the `read_value` subroutine.\nThis supports integers, logicals, reals, and arrays thereof, in addition to strings. When reading arrays,\nyou are expected to pass an `allocatable` variable.\n\n```fortran\nreal(f64):: float_option\nreal(f64), allocatable:: array_option(:)\n\ncall read_value(options%get(\"float_option\"), float_option)\ncall read_value(options%get(\"array_option\"), array_option)\n```\n\nIf you want to try to read an option from the TOML file but assign a default value if the target key isn't found, you can use\nthe following pattern. Passing `error = .false.` to the `get` method suppresses the throwing of an error and instead returns\na `toml_object` with a `KEY_NOT_FOUND` error code (error code 15).\n\n```fortran\ncall read_value(option%get(\"nonexistent_option\", error = .false.), float_option, default = 2.0_f64)\n```\n\nTo dump the contents of a `toml_object` into a string, call the `stringify` function, i.e.\n\n```fortran\nprint*, options%stringify()\nprint*, stringify(options) ! this is equivalent\n```\n\nWith the file above, this produces the following JSON-like output.\n\n```\noptions: {string_option::string = \"a string\", array_option: [1.0::float, -0.1d20::float], float_option::float = nan, bool_option::bool = false, integer_option::int = 2}\n```\n\nA more complete example of usage is available in the `test` directory.\n\n## Contribution\n\nThis library is a work-in-progress. Please feel free to open issues and pull requests to improve this repo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchermarx%2Ftinytoml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchermarx%2Ftinytoml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchermarx%2Ftinytoml/lists"}