{"id":30979625,"url":"https://github.com/ysdragon/yaml","last_synced_at":"2025-10-15T19:51:46.278Z","repository":{"id":313766860,"uuid":"1052634459","full_name":"ysdragon/yaml","owner":"ysdragon","description":" A YAML parser for the Ring programming language.","archived":false,"fork":false,"pushed_at":"2025-09-08T10:31:27.000Z","size":0,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-08T11:27:17.580Z","etag":null,"topics":["ring","ring-language","ring-programming-language","yaml","yml"],"latest_commit_sha":null,"homepage":"","language":"Ring","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/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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T10:31:21.000Z","updated_at":"2025-09-08T10:40:38.000Z","dependencies_parsed_at":"2025-09-08T11:27:20.023Z","dependency_job_id":"2c887448-2c73-4e7a-ac7d-0e371fe55a7a","html_url":"https://github.com/ysdragon/yaml","commit_stats":null,"previous_names":["ysdragon/yaml"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ysdragon/yaml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fyaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fyaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fyaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fyaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysdragon","download_url":"https://codeload.github.com/ysdragon/yaml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fyaml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274770733,"owners_count":25346211,"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-09-12T02:00:09.324Z","response_time":60,"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","ring-language","ring-programming-language","yaml","yml"],"created_at":"2025-09-12T07:01:23.178Z","updated_at":"2025-10-15T19:51:41.211Z","avatar_url":"https://github.com/ysdragon.png","language":"Ring","readme":"# Ring YAML\r\n\r\n[license]: https://img.shields.io/github/license/ysdragon/yaml?style=for-the-badge\u0026logo=opensourcehardware\u0026label=License\u0026logoColor=C0CAF5\u0026labelColor=414868\u0026color=8c73cc\r\n[![][license]](https://github.com/ysdragon/yaml/blob/master/LICENSE)\r\n\r\nAn easy-to-use YAML parsing and manipulation library for the Ring programming language. This library is built as a wrapper around the [`libyaml`](https://github.com/yaml/libyaml) C library.\r\n\r\n## ✨ Features\r\n\r\n-   **Load YAML Data**: Effortlessly load YAML data from files or directly from strings.\r\n-   **Complex Data Structures**: Seamlessly parse intricate and deeply nested YAML structures.\r\n-   **Intuitive Data Access**: Access your data with ease using dot notation via the `yaml_get` function.\r\n-   **Cross-Platform Compatibility**: Works flawlessly across Windows, Linux, macOS, and FreeBSD.\r\n\r\n## 📋 Prerequisites\r\n\r\n-   **Ring Language**: Ensure you have Ring version 1.23 or higher installed. You can download it from the [official Ring website](https://ring-lang.github.io/download.html).\r\n\r\n## 🚀 Installation\r\n\r\n### Using RingPM\r\n\r\nThe recommended way to install Ring YAML is through the Ring Package Manager (RingPM).\r\n\r\n```bash\r\nringpm install yaml from ysdragon\r\n```\r\n\r\n## 💡 Usage\r\n\r\nFirst, you need to load the library in your Ring script:\r\n\r\n```ring\r\nload \"yaml.ring\"\r\n```\r\n\r\n### Loading a YAML File\r\n\r\n```ring\r\nyamlData = yaml_load(\"path/to/your/file.yaml\")\r\n\r\nif (isNull(yamlData)) {\r\n    print(\"Error loading YAML: \" + yaml_lasterror() + \"\\n\")\r\nelse\r\n    print(yamlData)  // Print the entire data structure\r\n}\r\n```\r\n\r\n### Loading from a YAML String\r\n\r\n```ring\r\nyamlString = `\r\nproduct: Laptop\r\nprice: 1299.99\r\nspecs:\r\n  processor: i7\r\n  memory: 16GB\r\nitems:\r\n  - name: Mouse\r\n  - name: Keyboard\r\n`\r\n\r\ndata = yaml_load(yamlString)\r\n? data\r\n```\r\n\r\n### Accessing Data\r\n\r\nYou can access your YAML data in two convenient ways:\r\n\r\n**1. Using Standard Ring List Syntax:**\r\n\r\n```ring\r\n// Access nested values\r\nproduct = data[:product]             // \"Laptop\"\r\nprocessor = data[:specs][:processor] // \"i7\"\r\n\r\n// Access array elements\r\nfirstItem = data[:items][1][:name] // \"Mouse\"\r\n```\r\n\r\n**2. Using the `yaml_get` function with Dot Notation:**\r\n\r\n```ring\r\n// Access nested values\r\nproduct = yaml_get(data, \"product\")          // \"Laptop\"\r\nprocessor = yaml_get(data, \"specs.processor\")  // \"i7\"\r\n\r\n// Access array elements (1-based indexing)\r\nfirstItem = yaml_get(data, \"items[1].name\") // \"Mouse\"\r\n// or\r\nfirstItem = yaml_get(data, \"items.[1].name\") // \"Mouse\"\r\n```\r\n\r\n### Error Handling\r\n\r\nIt's good practice to check for errors, especially when dealing with file I/O.\r\n\r\n```ring\r\ndata = yaml_load(\"nonexistent.yaml\")\r\n\r\nif (isNull(data)) {\r\n    ? \"Failed to load YAML file: \" + yaml_lasterror()\r\n}\r\n```\r\n\r\n## 📚 API Reference\r\n\r\n### `yaml_load(source)`\r\n\r\nLoads YAML data from a file or a string.\r\n\r\n-   **Parameters:**\r\n    -   `source` (string): The file path (if it ends with `.yaml` or `.yml`) or the YAML string to be parsed.\r\n-   **Returns:** A Ring list containing the parsed key-value pairs, or `NULL` if an error occurs.\r\n\r\n### `yaml_get(data, path)`\r\n\r\nAccesses nested data within a parsed YAML structure using dot notation.\r\n\r\n-   **Parameters:**\r\n    -   `data`: The YAML data loaded by the `yaml_load` function.\r\n    -   `path` (string): A dot-separated path to the desired value (e.g., `\"product.specs.processor\"`).\r\n-   **Returns:** The value at the specified path, or `NULL` if the path is not found.\r\n\r\n### `yaml_lasterror()`\r\n\r\nRetrieves the last error message that occurred.\r\n\r\n-   **Returns:** A string containing the details of the last error.\r\n\r\n### `yaml_version()`\r\n\r\nRetrieves the libyaml version.\r\n\r\n-   **Returns:** A string representing the libyaml version.\r\n\r\n## Examples\r\n\r\nFor more in-depth examples, please refer to the [`examples/`](examples/) directory in the repository.\r\n\r\n## 🛠️ Development\r\n\r\nIf you wish to contribute to the development of Ring YAML or build it from the source, follow these steps.\r\n\r\n### Prerequisites\r\n\r\n-   **CMake**: Version 3.16 or higher.\r\n-   **C Compiler**: A C compiler compatible with your platform (e.g., GCC, Clang, MSVC).\r\n-   **Ring Source Code**: You will need to have the Ring language source code available on your machine.\r\n\r\n### Build Steps\r\n\r\n1.  **Clone the Repository:**\r\n    ```sh\r\n    git clone https://github.com/ysdragon/yaml.git --recursive\r\n    ```\r\n    \u003e **Note**: If you installed the library via RingPM, you can skip this step.\r\n\r\n2.  **Set the `RING` Environment Variable:**\r\n    This variable must point to the root directory of the Ring language source code.\r\n\r\n    -   **Windows (Command Prompt):**\r\n        ```cmd\r\n        set RING=X:\\path\\to\\ring\r\n        ```\r\n    -   **Windows (PowerShell):**\r\n        ```powershell\r\n        $env:RING = \"X:\\path\\to\\ring\"\r\n        ```\r\n    -   **Unix-like Systems (Linux, macOS or FreeBSD):**\r\n        ```bash\r\n        export RING=/path/to/ring\r\n        ```\r\n\r\n3.  **Configure with CMake:**\r\n    Create a build directory and run CMake from within it.\r\n    ```sh\r\n    mkdir build\r\n    cd build\r\n    cmake ..\r\n    ```\r\n\r\n4.  **Build the Project:**\r\n    Compile the source code using the build toolchain configured by CMake.\r\n    ```sh\r\n    cmake --build .\r\n    ```\r\n\r\n    The compiled library will be available in the `lib/\u003cos\u003e/\u003carch\u003e` directory.\r\n\r\n## 🤝 Contributing\r\n\r\nContributions are always welcome! If you have suggestions for improvements or have identified a bug, please feel free to open an issue or submit a pull request.\r\n\r\n## 📄 License\r\n\r\nThis project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for more details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysdragon%2Fyaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysdragon%2Fyaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysdragon%2Fyaml/lists"}