valkyrie-ast 0.0.11

Strong typed abstract syntax tree of valkyrie language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[cfg(feature = "pretty-print")]
mod display;
use super::*;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NumberLiteralNode {
    pub value: String,
    pub unit: Option<IdentifierNode>,
    pub span: Range<u32>,
}

impl NumberLiteralNode {
    pub fn new<S: ToString>(text: S, span: Range<u32>) -> NumberLiteralNode {
        NumberLiteralNode { value: text.to_string(), unit: None, span }
    }
}