onefig/nodes/
ident.rs

1use flexar::prelude::*;
2use crate::{lexer::Token, errors::SyntaxError};
3
4#[derive(Debug)]
5pub struct Ident(pub Box<str>);
6
7flexar::parser! {
8    [[Ident] parxt: Token]
9    parse {
10        (Ident(x)) => ((x.clone()));
11        (Str(x)) => ((x.clone()));
12        (Int(x)) => ((x.to_string().into_boxed_str()));
13        (Bool(x)) => ((x.to_string().into_boxed_str()));
14    } else Err(SY006: parxt.current_token());
15}