()
| 121 | } |
| 122 | |
| 123 | fn doc_comment<'a, I>() -> impl Parser<'a, I, String, ParserError<'a>> + Clone |
| 124 | where |
| 125 | I: Input<'a, Token = lr::Token, Span = Span> + BorrowInput<'a>, |
| 126 | { |
| 127 | // doc comments must start on a new line, so we enforce a new line (which |
| 128 | // can also be a file start) before the doc comment |
| 129 | // |
| 130 | // TODO: we currently lose any empty newlines between doc comments; |
| 131 | // eventually we want to retain or restrict them |
| 132 | (new_line().repeated().at_least(1).ignore_then(select_ref! { |
| 133 | lr::Token { kind: TokenKind::DocComment(dc), .. } => dc.clone(), |
| 134 | })) |
| 135 | .repeated() |
| 136 | .at_least(1) |
| 137 | .collect() |
| 138 | .map(|lines: Vec<String>| lines.join("\n")) |
| 139 | .labelled("doc comment") |
| 140 | } |
| 141 | |
| 142 | fn with_doc_comment<'a, I, P, O>(parser: P) -> impl Parser<'a, I, O, ParserError<'a>> + Clone + 'a |
| 143 | where |
no test coverage detected