pub enum Token {
Show 13 variants
Exponent(Box<Token>, Box<Token>),
Multiply(Box<Token>, Box<Token>),
Divide(Box<Token>, Box<Token>),
Add(Box<Token>, Box<Token>),
Subtract(Box<Token>, Box<Token>),
Equality(Box<Token>, Box<Token>),
Parenthesis(Box<Token>),
Answer(Uuid),
Number(Number),
Variable(Box<Variable>),
Negative(Box<Token>),
Boolean(bool),
Store(String, Box<Token>),
}Expand description
Represents either a single parser token or an entire tokenized expression.
2+2 would parse down roughly to Add(Number(2), Number(2)).
Variants§
Exponent(Box<Token>, Box<Token>)
Exponent token, parsed from “^”.
Multiply(Box<Token>, Box<Token>)
Multiply token, parse from “*”.
Divide(Box<Token>, Box<Token>)
Divide token, parsed from “/”.
Add(Box<Token>, Box<Token>)
Add token, parsed from “+”.
Subtract(Box<Token>, Box<Token>)
Subtract token, parsed from “-”.
Equality(Box<Token>, Box<Token>)
Equality token, parsed from “=”.
Parenthesis(Box<Token>)
Parenthesis token, parsed from “()”.
Answer(Uuid)
Answer token, parsed from an inverse offset preceded by an @
Number(Number)
Number token, parsed from any number 0-9.
Variable(Box<Variable>)
Variable token, holds the symbol of a variable along with the value at parsing
Negative(Box<Token>)
Negative token, parsed from any negative sign
Boolean(bool)
Boolean token, not currently parsed but can be returned from simplify functions.
Store(String, Box<Token>)
Store token, used to store values into variables. First string is the id of the variable, second are the tokens to be stored in the variable