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).iter(0) {
    println!("{:?}", token?);
}

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

Structs§

  • A fully parsed integer from a source string with a payload ready to parse into an integral type.
  • Description of the parsed integer from the source.
  • A structure used to lex the s-expression syntax of WAT files.
  • A single token parsed from a Lexer.

Enums§

  • Possible parsed float values
  • Description of a parsed float from the source.
  • Errors that can be generated while lexing.
  • A sign token for an integer.
  • Classification of what was parsed from the input stream.