Our approach to new lines is each item consumes new lines _before_ itself, but not newlines after itself. This allows us to enforce new lines between some items. The only place we handle new lines after an item is in the root parser.
()
| 92 | /// some items. The only place we handle new lines after an item is in the root |
| 93 | /// parser. |
| 94 | pub(crate) fn new_line<'a, I>() -> impl Parser<'a, I, (), ParserError<'a>> + Clone |
| 95 | where |
| 96 | I: Input<'a, Token = lr::Token, Span = Span> + BorrowInput<'a>, |
| 97 | { |
| 98 | select_ref! { |
| 99 | lr::Token { kind: TokenKind::NewLine, .. } => (), |
| 100 | lr::Token { kind: TokenKind::Start, .. } => (), |
| 101 | } |
| 102 | .labelled("new line") |
| 103 | } |
| 104 | |
| 105 | fn ctrl<'a, I>(char: char) -> impl Parser<'a, I, (), ParserError<'a>> + Clone |
| 106 | where |
no outgoing calls
no test coverage detected