MCPcopy Create free account
hub / github.com/PRQL/prql / doc_comment

Function doc_comment

prqlc/prqlc-parser/src/parser/mod.rs:123–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121}
122
123fn doc_comment<'a, I>() -> impl Parser<'a, I, String, ParserError<'a>> + Clone
124where
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
142fn with_doc_comment<'a, I, P, O>(parser: P) -> impl Parser<'a, I, O, ParserError<'a>> + Clone + 'a
143where

Callers 2

with_doc_commentFunction · 0.70
parse_doc_commentFunction · 0.70

Calls 3

new_lineFunction · 0.85
mapMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected