{"id":20431465,"url":"https://github.com/devyatsu/pkl_fast","last_synced_at":"2025-05-08T17:32:58.776Z","repository":{"id":221908509,"uuid":"755758714","full_name":"DevYatsu/pkl_fast","owner":"DevYatsu","description":"A rust library aiming to easily and efficiently work with Apple's PKL format.","archived":false,"fork":false,"pushed_at":"2024-08-20T19:36:16.000Z","size":210,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T11:45:17.379Z","etag":null,"topics":["apple","crate","lexer","library","parser","pkl","rust","tokenizer"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/DevYatsu.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}},"created_at":"2024-02-11T00:31:10.000Z","updated_at":"2024-08-23T21:29:30.000Z","dependencies_parsed_at":"2024-08-09T03:33:45.392Z","dependency_job_id":"cea9af11-9b7b-493b-809a-e7b2447bc6b7","html_url":"https://github.com/DevYatsu/pkl_fast","commit_stats":null,"previous_names":["devyatsu/pkl_fast","devyatsu/pkl_parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevYatsu%2Fpkl_fast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevYatsu%2Fpkl_fast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevYatsu%2Fpkl_fast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevYatsu%2Fpkl_fast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevYatsu","download_url":"https://codeload.github.com/DevYatsu/pkl_fast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224748449,"owners_count":17363312,"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","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":["apple","crate","lexer","library","parser","pkl","rust","tokenizer"],"created_at":"2024-11-15T08:11:55.852Z","updated_at":"2024-11-15T08:11:57.587Z","avatar_url":"https://github.com/DevYatsu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pkl_fast\n\nFastest pkl-parsing crate out there (and surely the only one)!\n\nI am currently working on a big rework, as the current lexer (logos) does not cover all the features I need, I am replacing it with the pest crate, all the work on the pkl parser was moved to another crate of my own [pkl-parser](https://crates.io/crates/pkl-parser) which can be considered finished! Just need to adapt interpreting the pkl ast node to this new parser, sry for the delay!\n\n## Features\n\n- Parse Pkl string into a structured representation (hashmap) in rust\n- Parse Pkl string into an AST\n- Support for strings, integers (decimal, octal, hex, binary), floats, boolean, objects (amends syntax as well), class instances\n- Boolean API supported\n- String API (mostly) supported\n- Int/Float/Duration/DataSize properties and methods supported\n\n## Currently Not Supported\n\n- Multiline String containing \u003c\u003c\"\u003e\u003e not preceded by a backlash, String interpolation and Strings with custom delimiters\n- Lists methods API, only properties are supported\n- Listings, Mappings, Maps\n- functions -\u003e thus also functions and methods taking functions as parameters\n- Packages (official or not) imports not supported\n- Globbed imports + dynamic imports + amends expresions\n- type annotations\n- Classes declarations\n- If expressions\n\n## Installation\n\nWhen in your rust project, simply run: `cargo add new-pkl` (for the moment use new-pkl crate, new stable release coming to pkl_fast really soon)\n\n## Usage\n\nHere's an example of how to parse a PKL string and retrieve values from the context:\n\n```rust\nuse new_pkl::{Pkl, PklResult, PklValue};\n\nfn main() -\u003e PklResult\u003c()\u003e {\n    let source = r#\"\n    bool_var = true\n    int_var = 42\n    float_var = 3.14\n    $string_var = \"hello\"\n    object_var {\n        key1 = \"value1\"\n        key2 = 2\n    }\n    \"#;\n\n    let mut pkl = Pkl::new();\n    pkl.parse(source)?;\n\n    println!(\"{:?}\", pkl.get(\"int_var\")); // Ok(PklValue::Int(42))\n\n    // Get values\n    println!(\"{:?}\", pkl.get_bool(\"bool_var\")); // Ok(true)\n    println!(\"{:?}\", pkl.get_int(\"int_var\")); // Ok(42)\n    println!(\"{:?}\", pkl.get_float(\"float_var\")); // Ok(3.14)\n    println!(\"{:?}\", pkl.get_string(\"$string_var\")); // Ok(\"hello\")\n    println!(\"{:?}\", pkl.get_object(\"object_var\")); // Ok(HashMap with key1 and key2)\n\n    // Modify values\n    pkl.set(\"int_var\", PklValue::Int(100));\n\n    // Remove values\n    pkl.remove(\"float_var\");\n    println!(\"{:?}\", pkl.get_float(\"float_var\")); // Err(\"Variable `float_var` not found\")\n\n    // Or just generate an ast\n    let mut pkl = Pkl::new();\n    // the ast contains the start and end indexes of each value and statement\n    let ast = pkl.generate_ast(source)?;\n\n    Ok(())\n}\n```\n\n### LICENSE\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevyatsu%2Fpkl_fast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevyatsu%2Fpkl_fast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevyatsu%2Fpkl_fast/lists"}