{"id":30277179,"url":"https://github.com/ysdragon/toml","last_synced_at":"2026-02-12T01:12:55.026Z","repository":{"id":302898821,"uuid":"1013854672","full_name":"ysdragon/toml","owner":"ysdragon","description":"A comprehensive TOML parser for the Ring programming language","archived":false,"fork":false,"pushed_at":"2025-08-12T14:52:50.000Z","size":406,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-12T15:15:53.514Z","etag":null,"topics":["ring-programming-language","toml","tomlc17"],"latest_commit_sha":null,"homepage":"","language":"Ring","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ysdragon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-07-04T15:19:37.000Z","updated_at":"2025-08-12T14:52:53.000Z","dependencies_parsed_at":"2025-07-04T17:27:37.666Z","dependency_job_id":"f31c8bb2-23ae-466c-98a9-7bb018dcb7fb","html_url":"https://github.com/ysdragon/toml","commit_stats":null,"previous_names":["ysdragon/toml"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ysdragon/toml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Ftoml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Ftoml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Ftoml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Ftoml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysdragon","download_url":"https://codeload.github.com/ysdragon/toml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Ftoml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270702562,"owners_count":24630877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ring-programming-language","toml","tomlc17"],"created_at":"2025-08-16T11:14:14.477Z","updated_at":"2026-02-12T01:12:55.018Z","avatar_url":"https://github.com/ysdragon.png","language":"Ring","readme":"# Ring TOML\n\nA comprehensive TOML parser extension for the Ring programming language, built as a wrapper around the [`tomlc17`](https://github.com/cktan/tomlc17) C library.\n\n## Features\n\n*   Cross-platform (Linux, macOS, FreeBSD, and Windows).\n*   Parse TOML files and strings into Ring Lists.\n*   Supports all TOML data types, including strings, numbers, booleans, dates, times, arrays, and tables.\n\n## Getting Started\n\n### Installation\n\n#### Using RingPM\n\n```shell\nringpm install toml from ysdragon\n```\n\n#### Manual Build\n\n##### Prerequisites\n\n*   [Ring](http://ring-lang.net) programming language (1.22 or later)\n*   CMake (3.5 or later)\n*   C compiler (GCC, Clang, or MSVC)\n\n##### Manual Build Steps\n\n1.  **Clone the repository:**\n    ```bash\n    git clone --recursive https://github.com/ysdragon/toml.git\n    cd toml\n    ```\n\n2.  **Set RING environment variable to your Ring installation directory:**\n\n    On Windows (cmd):\n    ```cmd\n    set RING=X:\\path\\to\\ring\n    ```\n\n    On Windows (PowerShell):\n    ```powershell\n    $env:RING = \"X:\\path\\to\\ring\"\n    ```\n\n    On Unix-like systems:\n    ```bash\n    export RING=/path/to/ring\n    ```\n3. **Build the extension:**\n    ```bash\n    cmake -Bbuild -DCMAKE_BUILD_TYPE=Release\n    cmake --build build\n    ```\n\n    This will compile the extension and place the resulting shared library (`libring_toml.so` on Linux or FreeBSD, `ring_toml.dll` on Windows) into the `lib/\u003cos\u003e/\u003carch\u003e` directory.\n\n## Usage\n\n```ring\n// Load the TOML extension\nload \"toml.ring\"\n\n// Parse a TOML file\npToml = toml_parse_file(\"examples/example.toml\")\n\n// Access data using the toml_get() function\ntitle = toml_get(pToml, \"title\")\ndb_ip = toml_get(pToml, \"database.ip_address\")\nfirst_product_name = toml_get(pToml, \"products[1].name\")\n\n? \"Title: \" + title\n? \"Database IP: \" + db_ip\n? \"First Product: \" + first_product_name\n\n// You can also convert the entire TOML structure to a Ring list\naTomlList = toml2list(pToml)\nsee aTomlList\n```\n\n## API Reference\n\n### High-Level Functions\n\n*   `toml_get(pTomlResult, cPath)`: Retrieves a value from the parsed TOML data using a dot-separated path.\n    *   `pTomlResult`: The pointer returned by `toml_parse()` or `toml_parse_file()`.\n    *   `cPath`: A string representing the path to the desired value (e.g., `\"database.user.name\"`, `\"products[2].sku\"`).\n    *   Returns `NULL` for invalid paths (empty, consecutive dots, leading/trailing dots).\n\n*   `toml_exists(pTomlResult, cPath)`: Checks if a key exists at the given path.\n    *   Returns `true` if the path exists, `false` otherwise.\n\n*   `toml_keys(pTomlResult, cPath)`: Returns a list of keys at the given path.\n    *   If `cPath` is empty or `NULL`, returns top-level keys.\n    *   Returns `NULL` if the path doesn't exist or doesn't point to a table.\n\n### Core Extension Functions\n\n*   `toml_parse(cTomlString)`: Parses a TOML-formatted string. Returns a pointer to the parsed result.\n*   `toml_parse_file(cFilePath)`: Parses a TOML file. Returns a pointer to the parsed result.\n*   `toml2list(pTomlResult)`: Converts the entire parsed TOML result into a Ring list.\n*   `toml_get_ex(pTomlResult, cKey)`: Retrieves a specific value, table, or array by its key from the top level.\n*   `toml_type(pTomlResult, cKey)`: Returns the TOML type of a value by its key as an integer (see Type Constants below).\n*   `toml_lasterror()`: Returns a string containing the last error message if a parsing operation fails.\n\n### Type Constants\n\nThese constants are defined in `toml.rh` and can be used with `toml_type()` for type checking:\n\n| Constant | Description |\n|----------|-------------|\n| `TOML_UNKNOWN` | Unknown or invalid type |\n| `TOML_STRING` | String value |\n| `TOML_INT64` | Integer value |\n| `TOML_FP64` | Floating-point value |\n| `TOML_BOOLEAN` | Boolean value |\n| `TOML_DATE` | Date (YYYY-MM-DD) |\n| `TOML_TIME` | Time (HH:MM:SS) |\n| `TOML_DATETIME` | Date and time without timezone |\n| `TOML_DATETIMETZ` | Date and time with timezone |\n| `TOML_ARRAY` | Array |\n| `TOML_TABLE` | Table (inline or standard) |\n\n## Examples\n\nThe [**`examples`**](examples) directory contains several files demonstrating how to use the Ring TOML extension.\n\n*   [**`example1.ring`**](examples/example1.ring): Demonstrates basic TOML file parsing and how to access various data types using the `toml_get()` helper function.\n*   [**`example2.ring`**](examples/example2.ring): Shows how to parse an inline TOML string and convert the entire structure into a Ring list for easier manipulation.\n*   [**`example3.ring`**](examples/example3.ring): Illustrates an alternative way to access TOML data by using the `toml_get_ex()` function to directly extract arrays and tables without first converting to a list.\n*   [**`example4.ring`**](examples/example4.ring): Shows how to perform type checking on TOML data using the `toml_type()` function and the predefined type constants.\n\n## Running Tests\n\nThe project includes a test suite to verify the functionality of the extension. To run the tests:\n\n```bash\nring tests/TOML_test.ring\n```\n\nThe test script will parse `tests/test.toml` and run a series of assertions against the parsed data, covering all major features of the library.\n\n## Limitations\n\n*   **Read-only**: This library currently only supports parsing TOML. Writing/serializing Ring data structures back to TOML format is not yet supported (the underlying `tomlc17` library is parser-only).\n\n## License\n\nThis project is licensed under the [MIT](LICENSE) License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysdragon%2Ftoml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysdragon%2Ftoml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysdragon%2Ftoml/lists"}