{"id":16856396,"url":"https://github.com/vallentin/comment-parser","last_synced_at":"2025-03-22T06:31:08.655Z","repository":{"id":57609121,"uuid":"240304650","full_name":"vallentin/comment-parser","owner":"vallentin","description":"This crate implements a (pull) parser for extracting comments from code in various programming languages.","archived":false,"fork":false,"pushed_at":"2024-01-14T17:26:20.000Z","size":18,"stargazers_count":10,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T08:53:37.011Z","etag":null,"topics":["extract-comments","parser","rust","rust-crate","rust-library"],"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/vallentin.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":"2020-02-13T16:16:13.000Z","updated_at":"2025-03-03T22:01:15.000Z","dependencies_parsed_at":"2024-10-28T12:27:56.190Z","dependency_job_id":"896a1d3f-35ab-4c28-8868-c8cb7a6a9579","html_url":"https://github.com/vallentin/comment-parser","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"dfde159b010393d5867abbb8866974b6ecbc2083"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fcomment-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fcomment-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fcomment-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2Fcomment-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vallentin","download_url":"https://codeload.github.com/vallentin/comment-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244918500,"owners_count":20531682,"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":["extract-comments","parser","rust","rust-crate","rust-library"],"created_at":"2024-10-13T14:04:07.088Z","updated_at":"2025-03-22T06:31:07.935Z","avatar_url":"https://github.com/vallentin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# comment-parser\n\n[![Build Status](https://github.com/vallentin/comment-parser/workflows/Rust/badge.svg)](https://github.com/vallentin/comment-parser/actions?query=workflow%3ARust)\n[![Build Status](https://travis-ci.org/vallentin/comment-parser.svg?branch=master)](https://travis-ci.org/vallentin/comment-parser)\n[![Latest Version](https://img.shields.io/crates/v/comment-parser.svg)](https://crates.io/crates/comment-parser)\n[![Docs](https://docs.rs/comment-parser/badge.svg)](https://docs.rs/comment-parser)\n[![License](https://img.shields.io/github/license/vallentin/comment-parser.svg)](https://github.com/vallentin/comment-parser)\n\nThis crate implements a (pull) parser for extracting comments\nfrom code in various programming languages.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\ncomment-parser = \"0.1\"\n```\n\n## Extract Comments from Rust Code\n\n```rust\nuse comment_parser::CommentParser;\n\nlet rust = r#\"\n/* This is\nthe main\nfunction */\nfn main() {\n    // println! is a macro\n    println!(\"Hello World\"); // Prints \"Hello World\"\n}\n\"#;\n\nlet rules = comment_parser::get_syntax(\"rust\").unwrap();\n\nlet parser = CommentParser::new(rust, rules);\n\nfor comment in parser {\n    println!(\"{:?}\", comment);\n}\n```\n\nThis will output the following:\n\n```text\nBlockComment(_, \" This is\\nthe main\\nfunction \")\nLineComment(_, \" println! is a macro\")\nLineComment(_, \" Prints \\\"Hello World\\\"\")\n```\n\n## Extract Comments from Python Code\n\n```rust\nuse comment_parser::CommentParser;\n\nlet python = r#\"\n# In Python main is not a function\nif __name__ == \"__main__\":\n    # print is a function\n    print(\"Hello World\")  # Prints \"Hello World\"\n\"#;\n\nlet rules = comment_parser::get_syntax(\"python\").unwrap();\n\nlet parser = CommentParser::new(python, rules);\n\nfor comment in parser {\n    println!(\"{:?}\", comment);\n}\n```\n\nThis will output the following:\n\n```text\nLineComment(_, \" In Python main is not a function\")\nLineComment(_, \" print is a function\")\nLineComment(_, \" Prints \\\"Hello World\\\"\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Fcomment-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvallentin%2Fcomment-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Fcomment-parser/lists"}