forked from katzen-cafe/iowo
31 lines
548 B
Rust
31 lines
548 B
Rust
|
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);
|
||
|
}
|
||
|
}
|