[][src]Module wast::lexer

Definition of a lexer for the WebAssembly text format.

This module provides a Lexer type which is an iterate over the raw tokens of a WebAssembly text file. A Lexer accounts for every single byte in a WebAssembly text field, returning tokens even for comments and whitespace. Typically you'll ignore comments and whitespace, however.

If you'd like to iterate over the tokens in a file you can do so via:

use wast::lexer::Lexer;

let wat = "(module (func $foo))";
for token in Lexer::new(wat) {
    println!("{:?}", token?);
}

Note that you'll typically not use this module but will rather use ParseBuffer instead.

Structs

Float

A parsed float.

Integer

A parsed integer, signed or unsigned.

Lexer

A structure used to lex the s-expression syntax of WAT files.

Enums

Comment

The types of comments that can be lexed from WAT source text, including the original text of the comment itself.

FloatVal

Possible parsed float values

LexError

Errors that can be generated while lexing.

Source

A fragment of source lex'd from an input string.

Token

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