use crate::SyntaxKind::{
DIVERT, EOF, GATHER, GATHER_DASHES, HASH, IDENT, L_PAREN, MINUS, NEWLINE, PLUS, R_PAREN, STAR,
THREAD, TUNNEL_ONWARDS,
};
use super::Parser;
pub(crate) fn gather_line(p: &mut Parser<'_, '_>) {
p.start_node(GATHER);
gather_dashes(p);
p.skip_ws();
if p.current() == L_PAREN && p.nth(1) == IDENT && p.nth(2) == R_PAREN {
super::choice::label(p);
p.skip_ws();
}
if matches!(p.current(), STAR | PLUS) {
super::choice::choice(p);
} else {
if !matches!(
p.current(),
NEWLINE | EOF | HASH | DIVERT | TUNNEL_ONWARDS | THREAD
) {
super::content::mixed_content(p);
}
if super::divert::at_divert(p) {
super::divert::divert(p);
}
if p.current() == HASH {
super::tag::tags(p);
}
if p.at(NEWLINE) {
p.bump();
} else if !p.at_eof() {
p.error("expected newline after gather".into());
}
}
p.finish_node();
}
fn gather_dashes(p: &mut Parser<'_, '_>) {
p.start_node(GATHER_DASHES);
while p.current() == MINUS {
p.bump();
p.skip_ws();
}
p.finish_node();
}