Files
orchid/orchid-std/src/macros/rule/vec_attrs.rs
2025-07-12 00:46:10 +02:00

16 lines
465 B
Rust

use orchid_base::interner::Tok;
use crate::macros::mactree::{Ph, PhKind};
use crate::macros::{MacTok, MacTree};
/// Returns the name, priority and at_least_one of the expression if it is
/// a vectorial placeholder
#[must_use]
pub fn vec_attrs(expr: &MacTree) -> Option<(Tok<String>, u8, bool)> {
match (*expr.tok).clone() {
MacTok::Ph(Ph { kind: PhKind::Vector { priority, at_least_one }, name }) =>
Some((name, priority, at_least_one)),
_ => None,
}
}