mathypad_core/expression/
tokens.rs

1//! Token definitions for mathematical expressions
2
3use crate::units::Unit;
4
5/// Tokens for mathematical expressions with unit support
6#[derive(Debug, Clone)]
7pub enum Token {
8    Number(f64),
9    NumberWithUnit(f64, Unit),
10    Plus,
11    Minus,
12    Multiply,
13    Divide,
14    Power,
15    LeftParen,
16    RightParen,
17    To,                   // for conversions like "to KiB"
18    In,                   // for conversions like "in KiB"
19    Of,                   // for percentage operations like "10% of 50"
20    LineReference(usize), // for referencing other lines like "line1", "line2"
21    Variable(String),     // for variable references like "servers", "ram"
22    Assign,               // for assignment operator "="
23    Function(String),     // for function calls like "sqrt", "sin", "cos"
24}