Enum scanlex::Token [] [src]

pub enum Token {
    Num(f64),
    Int(i64),
    Str(String),
    Iden(String),
    Char(char),
    Error(ScanError),
    End,
}

Represents a token returned by Scanner::get

Variants

a floating-point number, stored as double-precision float

an integer, stored as eight-byte unsigned

a quoted string

an identifier \a+[\a\d_]*

a character (anything not recognized as any of the above

represents an error

end of stream

Methods

impl Token
[src]

[src]

is this the end token?

[src]

is this token a float?

[src]

extract the float

[src]

extract the float, or complain

[src]

is this token an integer?

[src]

extract the integer

[src]

extract the integer, or complain

[src]

extract the integer as a particular subtype

[src]

is this token an integer?

[src]

extract the number, not caring about float or integer

[src]

extract the number, not caring about float or integer, or complain

[src]

is this token a string?

[src]

extract the string

[src]

extract a reference the string

[src]

extract the string, or complain

[src]

is this token an identifier?

[src]

extract the identifier

[src]

extract a reference to the identifier

[src]

extract the identifier, or complain

[src]

is this token a character?

[src]

extract the character

[src]

extract the character, or complain

[src]

is this token an error?

[src]

extract the error

Trait Implementations

impl Debug for Token
[src]

[src]

Formats the value using the given formatter. Read more

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 !=.

Auto Trait Implementations

impl Send for Token

impl Sync for Token