[][src]Enum wast::lexer::Token

pub enum Token<'a> {
    LParen(&'a str),
    RParen(&'a str),
    String {
        val: Cow<'a, [u8]>,
        src: &'a str,
    },
    Id(&'a str),
    Keyword(&'a str),
    Reserved(&'a str),
    Integer(Integer<'a>),
    Float(Float<'a>),
}

The kinds of tokens that can be lexed for WAT s-expressions.

Variants

LParen(&'a str)

A left-parenthesis, including the source text for where it comes from.

RParen(&'a str)

A right-parenthesis, including the source text for where it comes from.

String

A string literal, which is actually a list of bytes.

Fields of String

val: Cow<'a, [u8]>

The list of bytes that this string literal represents.

src: &'a str

The original source text of this string literal.

Id(&'a str)

An identifier (like $foo).

All identifiers start with $ and the payload here is the original source text.

Keyword(&'a str)

A keyword, or something that starts with an alphabetic character.

The payload here is the original source text.

Reserved(&'a str)

A reserved series of idchar symbols. Unknown what this is meant to be used for, you'll probably generate an error about an unexpected token.

Integer(Integer<'a>)

An integer.

Float(Float<'a>)

A float.

Methods

impl<'a> Token<'a>[src]

pub fn src(&self) -> &'a str[src]

Returns the original source text for this token.

Trait Implementations

impl<'a> Debug for Token<'a>[src]

impl<'a> PartialEq<Token<'a>> for Token<'a>[src]

impl<'a> StructuralPartialEq for Token<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Token<'a>

impl<'a> Send for Token<'a>

impl<'a> Sync for Token<'a>

impl<'a> Unpin for Token<'a>

impl<'a> UnwindSafe for Token<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.