Enum wast::lexer::Token [−][src]
pub enum Token<'a> {
LineComment(&'a str),
BlockComment(&'a str),
Whitespace(&'a str),
LParen(&'a str),
RParen(&'a str),
String(WasmString<'a>),
Id(&'a str),
Keyword(&'a str),
Reserved(&'a str),
Integer(Integer<'a>),
Float(Float<'a>),
}Expand description
A fragment of source lex’d from an input string.
This enumeration contains all kinds of fragments, including comments and whitespace. For most cases you’ll probably ignore these and simply look at tokens.
Variants
LineComment(&'a str)A line comment, preceded with ;;
Tuple Fields of LineComment
0: &'a strBlockComment(&'a str)A block comment, surrounded by (; and ;). Note that these can be
nested.
Tuple Fields of BlockComment
0: &'a strWhitespace(&'a str)A fragment of source that represents whitespace.
Tuple Fields of Whitespace
0: &'a strLParen(&'a str)A left-parenthesis, including the source text for where it comes from.
Tuple Fields of LParen
0: &'a strRParen(&'a str)A right-parenthesis, including the source text for where it comes from.
Tuple Fields of RParen
0: &'a strString(WasmString<'a>)A string literal, which is actually a list of bytes.
Tuple Fields of String
0: WasmString<'a>Id(&'a str)An identifier (like $foo).
All identifiers start with $ and the payload here is the original
source text.
Tuple Fields of Id
0: &'a strKeyword(&'a str)A keyword, or something that starts with an alphabetic character.
The payload here is the original source text.
Tuple Fields of Keyword
0: &'a strReserved(&'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.
Tuple Fields of Reserved
0: &'a strInteger(Integer<'a>)An integer.
Tuple Fields of Integer
0: Integer<'a>Float(Float<'a>)A float.
Tuple Fields of Float
0: Float<'a>