aboutsummaryrefslogtreecommitdiffstats
path: root/parser/src/conversion/block.rs
diff options
context:
space:
mode:
Diffstat (limited to 'parser/src/conversion/block.rs')
-rw-r--r--parser/src/conversion/block.rs20
1 files changed, 4 insertions, 16 deletions
diff --git a/parser/src/conversion/block.rs b/parser/src/conversion/block.rs
index f5697fc..e23cce2 100644
--- a/parser/src/conversion/block.rs
+++ b/parser/src/conversion/block.rs
@@ -236,23 +236,11 @@ fn convert_raw_directive(pair: Pair<Rule>) -> Result<e::Raw, Error> {
Ok(raw_block)
}
-fn convert_comment_block(pair: Pair<Rule>) -> String {
- let iter = pair.into_inner();
- let block = iter.skip(1).next().unwrap();
- let text = block.into_inner().map(|l| match l.as_rule() {
- Rule::comment_line_blank => "",
- Rule::comment_line => l.as_str(),
- _ => unreachable!(),
- }.into()).collect::<Vec<&str>>().join("\n");
- text
-}
-
fn convert_comment(pair: Pair<Rule>) -> Result<e::Comment, Error> {
- let block = pair.into_inner().skip(1).next().unwrap();
- let children = block.into_inner().map(|l| match l.as_rule() {
- Rule::comment_title => String::from(l.as_str()),
- Rule::comment_block => convert_comment_block(l),
+ let lines = pair.into_inner().map(|l| match l.as_rule() {
+ Rule::comment_line_blank => "\n",
+ Rule::comment_line => l.as_str(),
_ => unreachable!(),
}.into()).collect();
- Ok(e::Comment::with_children(children))
+ Ok(e::Comment::with_children(lines))
}