{"id":15887843,"url":"https://github.com/sssooonnnggg/rslua","last_synced_at":"2025-03-20T08:32:59.372Z","repository":{"id":57663704,"uuid":"262689623","full_name":"sssooonnnggg/rslua","owner":"sssooonnnggg","description":"Yet another Lua lexer and Lua parser for Lua 5.3 written in pure Rust.","archived":false,"fork":false,"pushed_at":"2023-09-24T03:43:26.000Z","size":317,"stargazers_count":59,"open_issues_count":0,"forks_count":7,"subscribers_count":6,"default_branch":"dev","last_synced_at":"2025-02-28T03:47:31.814Z","etag":null,"topics":["ast","handwritten","lexer","lua","parser","rust","transpiler"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sssooonnnggg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-05-10T01:21:55.000Z","updated_at":"2025-02-12T21:30:21.000Z","dependencies_parsed_at":"2023-09-24T07:08:36.967Z","dependency_job_id":null,"html_url":"https://github.com/sssooonnnggg/rslua","commit_stats":{"total_commits":192,"total_committers":2,"mean_commits":96.0,"dds":"0.26041666666666663","last_synced_commit":"5e976af7a54e78ba94201cf53c5a1df8abcd6225"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssooonnnggg%2Frslua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssooonnnggg%2Frslua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssooonnnggg%2Frslua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssooonnnggg%2Frslua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sssooonnnggg","download_url":"https://codeload.github.com/sssooonnnggg/rslua/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066237,"owners_count":20392405,"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":["ast","handwritten","lexer","lua","parser","rust","transpiler"],"created_at":"2024-10-06T06:05:19.095Z","updated_at":"2025-03-20T08:32:58.870Z","avatar_url":"https://github.com/sssooonnnggg.png","language":"Rust","readme":"# rslua \n\n[![Crates.io](https://img.shields.io/crates/v/rslua)](https://crates.io/crates/rslua)\n![Rust](https://github.com/sssooonnnggg/rslua/workflows/Rust/badge.svg)\n\nYet another Lua lexer and Lua parser for Lua 5.3 written in pure Rust.\n\n## Lexer\n\n- **input** str\n- **output** Result\u003cVec\\\u003cToken\u003e, LexError\u003e\n\n```rust\nuse rslua::lexer::Lexer;\nlet mut lexer = Lexer::default();\nlet tokens = lexer.run(input_lua_code)?;\n```\n\n### Lexer Config\n\n| Key | Type | Default | Descripten | \n| --- | --- | --- | --- |\n| `use_origin_string` | bool | false | Use origin string as token value instead of escaped one. |\n| `reserve_comments` | bool | false | Reserve comments as tokens. |\n\n## Parser\n\n- **input** Vec\\\u003cToken\u003e\n- **output** Result\u003cBlock, SyntaxError\u003e\n\n```rust\nlet mut parser = Parser::default();\nlet block = parser.run(tokens)?;\n```\n\n## AST walker\n\nUse `ast_walker` to travel the AST, implement the `AstVisitor` trait to run custom logic.\n\n## A complete example\n\nRead Lua source files from `./lua` folder, parse them, generate ASTs and walk them through, use a `LuaWritter` struct which impletements the `AstVisitor` trait to re-generate formatted Lua source again to `./tmp` folder.\n\nSee [tests/lua_to_lua.rs](tests/lua_to_lua.rs)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsssooonnnggg%2Frslua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsssooonnnggg%2Frslua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsssooonnnggg%2Frslua/lists"}