Module wast::lexer

source · []
Expand description

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

A parsed float.

A parsed integer, signed or unsigned.

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

A parsed string.

Enums

Possible parsed float values

Errors that can be generated while lexing.

A sign token for an integer.

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