[][src]Crate wast

A crate for low-level parsing of the WebAssembly text formats: WAT and WAST.

This crate is intended to be a low-level detail of the wat crate, providing a low-level parsing API for parsing WebAssembly text format structures. The API provided by this crate is very similar to syn and provides the ability to write customized parsers which may be an extension to the core WebAssembly text format. For more documentation see the [parser] module.

High-level Overview

This crate provides a few major pieces of functionality

Stability and WebAssembly Features

This crate provides support for many in-progress WebAssembly features such as reference types, multi-value, etc. Be sure to check out the documentation of the wast crate for policy information on crate stability vs WebAssembly Features. The tl;dr; version is that this crate will issue semver-non-breaking releases which will break the parsing of the text format. This crate, unlike wast, is expected to have numerous Rust public API changes, all of which will be accompanied with a semver-breaking release.

Compile-time Cargo features

This crate has a wasm-module feature which is turned on by default which includes all necessary support to parse full WebAssembly modules. If you don't need this (for example you're parsing your own s-expression format) then this feature can be disabled.

Modules

annotation

Common annotations used to parse WebAssembly text files.

kw

Common keyword used to parse WebAssembly text files.

lexer

Definition of a lexer for the WebAssembly text format.

parser

Traits for parsing the WebAssembly Text format

Macros

annotation

A macro, like [custom_keyword], to create a type which can be used to parse/peek annotation directives.

custom_keyword

A macro to create a custom keyword parser.

Structs

Error

A convenience error type to tie together all the detailed errors produced by this crate.

Float32

A parsed floating-point type

Float64

A parsed floating-point type

Id

An identifier in a WebAssembly module, prefixed by $ in the textual format.

LParen

A convenience type to use with Parser::peek to see if the next token is an s-expression.

NameAnnotation

An @name annotation in source, currently of the form @name "foo"

Span

A position in the original source stream, used to render errors.

Enums

Index

A reference to another item in a wasm module.