{"id":18041631,"url":"https://github.com/katyo/clex","last_synced_at":"2025-08-22T10:35:04.146Z","repository":{"id":41536841,"uuid":"509949161","full_name":"katyo/clex","owner":"katyo","description":"Fast and robust C source lexer in Rust","archived":false,"fork":false,"pushed_at":"2022-07-03T18:55:36.000Z","size":15,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T06:31:32.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/katyo.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}},"created_at":"2022-07-03T07:06:40.000Z","updated_at":"2022-09-29T08:06:10.000Z","dependencies_parsed_at":"2022-09-01T15:41:51.298Z","dependency_job_id":null,"html_url":"https://github.com/katyo/clex","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fclex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fclex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fclex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fclex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katyo","download_url":"https://codeload.github.com/katyo/clex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248095119,"owners_count":21046790,"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":[],"created_at":"2024-10-30T16:11:08.459Z","updated_at":"2025-04-09T19:21:04.247Z","avatar_url":"https://github.com/katyo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C source lexer in Rust\n\n[![github](https://img.shields.io/badge/github-katyo/clex-8da0cb.svg?style=for-the-badge\u0026logo=github)](https://github.com/katyo/clex)\n[![crate](https://img.shields.io/crates/v/clex.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust)](https://crates.io/crates/clex)\n[![docs](https://img.shields.io/badge/docs.rs-clex-66c2a5?style=for-the-badge\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/clex)\n[![MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n[![CI](https://img.shields.io/github/workflow/status/katyo/clex/Rust?style=for-the-badge\u0026logo=github-actions\u0026logoColor=white)](https://github.com/katyo/clex/actions?query=workflow%3ARust)\n\nThis is a fast and robust C source lexer in Rust. For example it can be used to extract some metadata from sources like comments or strings.\n\n## Library usage\n\n```rust\nuse clex::{Lexer, Token};\n\nlet src = r#\"\nstatic const char *s = \"world\";\n\nint main() {\n  // Hello world\n  printf(\"Hello %s\\n\", s);\n\n  return 0;\n}\n\"#;\n\nfor lexeme in Lexer::from(src) {\n  match lexeme.token {\n    Token::Comment =\u003e {\n      println!(\"comment: {:?}\", lexeme.comment().unwrap());\n    }\n    Token::String =\u003e {\n      println!(\"string: {:?}\", lexeme.string().unwrap());\n    }\n    _ =\u003e {}\n  }\n}\n```\n\nThis example prints the following:\n\n```text\nstring: \"world\"\ncomment: \"Hello world\"\nstring: \"Hello %s\\n\"\n```\n\n## Command-line usage\n\nCurrently command-line tool is used to test this library.\nYou can use it to analyze variuos C-sources and extract data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Fclex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatyo%2Fclex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Fclex/lists"}