use enumset::enum_set;

use crate::lst_parser::{
    syntax_kind::{SyntaxKind::*, TokenSet},
    CompletedMarker, Parser,
};

use self::{attr_set::attr_set, vec::vec_matrix_list};

mod attr_set;
mod vec;

const COLLECTION_START: TokenSet = enum_set!(L_BRACK | L_BRACE);

pub fn collection(p: &mut Parser) -> Option<CompletedMarker> {
    if !COLLECTION_START.contains(p.current()) {
        return None;
    }

    Some(match p.current() {
        L_BRACK => vec_matrix_list(p),
        L_BRACE => attr_set(p),
        _ => unreachable!(),
    })
}
