use super::*;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SubscriptCallNode {
pub kind: RangeKind,
pub base: ExpressionKind,
pub monadic: bool,
pub terms: Vec<RangeTermNode>,
pub span: Range<u32>,
}
impl ValkyrieNode for SubscriptCallNode {
fn get_range(&self) -> Range<usize> {
Range { start: self.span.start as usize, end: self.span.end as usize }
}
}
impl SubscriptCallNode {
pub fn with_base(self, base: ExpressionKind) -> Self {
Self { base, ..self }
}
pub fn method(&self) -> &'static str {
match self.kind {
RangeKind::Ordinal => "subscript1",
RangeKind::Offset => "subscript0",
}
}
}