[][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.

WasmString

A parsed string.

Enums

FloatVal

Possible parsed float values

LexError

Errors that can be generated while lexing.

SignToken

A sign token for an integer.

Token

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