Crates.io | doctor |
lib.rs | doctor |
version | 0.3.4 |
source | src |
created_at | 2021-01-06 22:06:52.981691 |
updated_at | 2021-01-12 17:11:22.474929 |
description | Flexible low level parser for Javadoc-style doc comments: Javadoc, JSDoc, TSDoc, etc. |
homepage | |
repository | https://github.com/vovacodes/doctor |
max_upload_size | |
id | 333432 |
size | 42,603 |
use doctor::parse;
use doctor::ast::{DocComment, Description, BodyItem, BlockTag, InlineTag};
assert_eq!(
parse(
r#"/**
* This is a doc comment.
* It contains an {@inlineTag with some body} in its description.
*
* @blockTag1
* @blockTag2 with body text
* @blockTag3 with body text and {@inlineTag}
*/"#
),
Ok(DocComment {
description: Some(Description {
body_items: vec![
BodyItem::TextSegment("This is a doc comment.\n"),
BodyItem::TextSegment("It contains an "),
BodyItem::InlineTag(InlineTag {
name: "inlineTag",
body_lines: vec!["with some body"],
}),
BodyItem::TextSegment("in its description.\n"),
BodyItem::TextSegment("\n"),
]
}),
block_tags: vec![
BlockTag {
name: "blockTag1",
body_items: vec![]
},
BlockTag {
name: "blockTag2",
body_items: vec![BodyItem::TextSegment("with body text\n"),]
},
BlockTag {
name: "blockTag3",
body_items: vec![
BodyItem::TextSegment("with body text and "),
BodyItem::InlineTag(InlineTag {
name: "inlineTag",
body_lines: vec![]
}),
BodyItem::TextSegment("\n"),
]
},
]
})
);
For additional info check the documentation.
Please check the contributing documentation
License: MIT