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

Trait Implementations

impl Clone for Token
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Token
[src]

[src]

Formats the value using the given formatter.

impl PartialEq for Token
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.