iowo/crates/lang/src/parser/grammar/expression/instruction.rs

31 lines
548 B
Rust
Raw Normal View History

2024-04-24 11:07:38 +02:00
use crate::parser::{syntax_kind::SyntaxKind::*, Parser};
use super::lit::literal;
pub fn instr(p: &mut Parser) {
let instr = p.start();
instr_name(p);
instr_params(p);
instr.complete(p, INSTR);
}
fn instr_name(p: &mut Parser) {
let instr_name = p.start();
while p.at(IDENT) {
p.do_bump();
}
instr_name.complete(p, INSTR_NAME);
}
fn instr_params(p: &mut Parser) {
if let Some(start) = literal(p) {
while literal(p).is_some() {}
start.precede(p).complete(p, INSTR_PARAMS);
}
}