Enum rcalc::Token
[−]
[src]
pub enum Token { NUMBER(usize), PLUS, MINUS, MULTIPLY, DIVIDE, DIVIDEINT, MODULO, EXPONENT, FACTORIAL, LPAREN, RPAREN, EOF, NONE, }
Describes a Token scanned by the Lexer.
As there as a limited number of Tokens, all Token types are easily enumerated, consisting largely of
- Data types (Integer)
- Operands (Plus, Minus, Multiply, Divide, Exponent)
- Controls (Lparen, Rparen, EOF)
For the Parser and Interpereter to adequately process Tokens, Tokens must be cloneable and equatable.
Examples
All tokens except those representing data types are symbolic; only data types must hold a value.
let plus = Token::PLUS; let num = Token::NUMBER(23);
Variants
NUMBER(usize)
PLUS
MINUS
MULTIPLY
DIVIDE
DIVIDEINT
MODULO
EXPONENT
FACTORIAL
LPAREN
RPAREN
EOF
NONE
Trait Implementations
impl Clone for Token
[src]
fn clone(&self) -> Token
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more