[−][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
- 
[ lexer] - this is a raw lexer for the wasm text format. This is not customizable, but if you'd like to iterate over raw tokens this is the module for you. You likely won't use this much.
- 
[ parser] - this is the workhorse of this crate. The [parser] module provides theParsetrait primarily and utilities around working with aParserto parse streams of tokens.
- 
[ Module] - this contains an Abstract Syntax Tree (AST) of the WebAssembly Text format (WAT) as well as the unofficial WAST format. This also has a [Module::encode] method to emit a module in its binary form.
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 | 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  | 
| LParen | A convenience type to use with  | 
| NameAnnotation | An  | 
| Span | A position in the original source stream, used to render errors. | 
Enums
| Index | A reference to another item in a wasm module. |