1 unstable release
0.1.0 | Nov 4, 2023 |
---|
#15 in #line-comment
17KB
147 lines
komment-parser-rs
Extract dependencies list from comment and create Cargo.toml out of it. This is utility which we shall be using into crab-playground-pro
Refer this Example to know the capability of the crate.
use komment_parser_rs::parse::{get_comment_with_deps, parse_block_comments};
fn main() {
// Getting the list of block comments from the code.
let source_code_string = r#"
// This is a line comment
/* This is a block comment */
/* [dependencies]
rand = "0.1.0"
*/
// Another line comment
fn main() {
/* This is another block comment */
println!("Hello World");
}"#;
let block_comments =
parse_block_comments(source_code_string).expect("Failed to get the comment from file");
println!("\nList of all block comments : \n{:#?}", block_comments);
let deps_comment = get_comment_with_deps(source_code_string).unwrap();
println!("\nComment with dependency : \n{}", deps_comment);
}
Dependencies
~88KB