forked from katzen-cafe/iowo
34 lines
647 B
Rust
34 lines
647 B
Rust
use crate::parser::{syntax_kind::SyntaxKind::*, CompletedMarker, Parser};
|
|
|
|
use super::lit::literal;
|
|
|
|
pub fn instr(p: &mut Parser) -> Option<CompletedMarker> {
|
|
if !p.at(IDENT) {
|
|
return None;
|
|
}
|
|
|
|
let instr = p.start();
|
|
|
|
instr_name(p);
|
|
instr_params(p);
|
|
|
|
Some(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);
|
|
}
|
|
}
|