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

use super::{atom, lit::literal};

pub fn instr(p: &mut Parser) -> Option<CompletedMarker> {
    if !p.at(IDENT) {
        return None;
    }

    let instr = p.start("instr");

    instr_name(p);
    instr_params(p);

    Some(instr.complete(p, INSTR))
}

fn instr_name(p: &mut Parser) {
    let instr_name = p.start("instr_name");

    while p.at(IDENT) {
        p.do_bump();
    }

    instr_name.complete(p, INSTR_NAME);
}

fn instr_params(p: &mut Parser) {
    if let Some(start) = atom(p) {
        while atom(p).is_some() {}

        start.precede(p, "params_start").complete(p, INSTR_PARAMS);
    }
}
