/rust/registry/src/index.crates.io-6f17d22bba15001f/wast-64.0.0/src/lib.rs
Line | Count | Source (jump to first uncovered line) |
1 | | //! A crate for low-level parsing of the WebAssembly text formats: WAT and WAST. |
2 | | //! |
3 | | //! This crate is intended to be a low-level detail of the `wat` crate, |
4 | | //! providing a low-level parsing API for parsing WebAssembly text format |
5 | | //! structures. The API provided by this crate is very similar to |
6 | | //! [`syn`](https://docs.rs/syn) and provides the ability to write customized |
7 | | //! parsers which may be an extension to the core WebAssembly text format. For |
8 | | //! more documentation see the [`parser`] module. |
9 | | //! |
10 | | //! # High-level Overview |
11 | | //! |
12 | | //! This crate provides a few major pieces of functionality |
13 | | //! |
14 | | //! * [`lexer`] - this is a raw lexer for the wasm text format. This is not |
15 | | //! customizable, but if you'd like to iterate over raw tokens this is the |
16 | | //! module for you. You likely won't use this much. |
17 | | //! |
18 | | //! * [`parser`] - this is the workhorse of this crate. The [`parser`] module |
19 | | //! provides the [`Parse`][] trait primarily and utilities |
20 | | //! around working with a [`Parser`](`parser::Parser`) to parse streams of |
21 | | //! tokens. |
22 | | //! |
23 | | //! * [`Module`](crate::core::Module) - this contains an Abstract Syntax Tree |
24 | | //! (AST) of the WebAssembly Text format (WAT) as well as the unofficial WAST |
25 | | //! format. This also has a [`Module::encode`](crate::core::Module::encode) |
26 | | //! method to emit a module in its binary form. |
27 | | //! |
28 | | //! # Stability and WebAssembly Features |
29 | | //! |
30 | | //! This crate provides support for many in-progress WebAssembly features such |
31 | | //! as reference types, multi-value, etc. Be sure to check out the documentation |
32 | | //! of the [`wast` crate](https://docs.rs/wast) for policy information on crate |
33 | | //! stability vs WebAssembly Features. The tl;dr; version is that this crate |
34 | | //! will issue semver-non-breaking releases which will break the parsing of the |
35 | | //! text format. This crate, unlike `wast`, is expected to have numerous Rust |
36 | | //! public API changes, all of which will be accompanied with a semver-breaking |
37 | | //! release. |
38 | | //! |
39 | | //! # Compile-time Cargo features |
40 | | //! |
41 | | //! This crate has a `wasm-module` feature which is turned on by default which |
42 | | //! includes all necessary support to parse full WebAssembly modules. If you |
43 | | //! don't need this (for example you're parsing your own s-expression format) |
44 | | //! then this feature can be disabled. |
45 | | //! |
46 | | //! [`Parse`]: parser::Parse |
47 | | //! [`LexError`]: lexer::LexError |
48 | | |
49 | | #![deny(missing_docs, rustdoc::broken_intra_doc_links)] |
50 | | |
51 | | /// A macro to create a custom keyword parser. |
52 | | /// |
53 | | /// This macro is invoked in one of two forms: |
54 | | /// |
55 | | /// ``` |
56 | | /// // keyword derived from the Rust identifier: |
57 | | /// wast::custom_keyword!(foo); |
58 | | /// |
59 | | /// // or an explicitly specified string representation of the keyword: |
60 | | /// wast::custom_keyword!(my_keyword = "the-wasm-keyword"); |
61 | | /// ``` |
62 | | /// |
63 | | /// This can then be used to parse custom keyword for custom items, such as: |
64 | | /// |
65 | | /// ``` |
66 | | /// use wast::parser::{Parser, Result, Parse}; |
67 | | /// |
68 | | /// struct InlineModule<'a> { |
69 | | /// inline_text: &'a str, |
70 | | /// } |
71 | | /// |
72 | | /// mod kw { |
73 | | /// wast::custom_keyword!(inline); |
74 | | /// } |
75 | | /// |
76 | | /// // Parse an inline string module of the form: |
77 | | /// // |
78 | | /// // (inline "(module (func))") |
79 | | /// impl<'a> Parse<'a> for InlineModule<'a> { |
80 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
81 | | /// parser.parse::<kw::inline>()?; |
82 | | /// Ok(InlineModule { |
83 | | /// inline_text: parser.parse()?, |
84 | | /// }) |
85 | | /// } |
86 | | /// } |
87 | | /// ``` |
88 | | /// |
89 | | /// Note that the keyword name can only start with a lower-case letter, i.e. 'a'..'z'. |
90 | | #[macro_export] |
91 | | macro_rules! custom_keyword { |
92 | | ($name:ident) => { |
93 | | $crate::custom_keyword!($name = stringify!($name)); |
94 | | }; |
95 | | ($name:ident = $kw:expr) => { |
96 | | #[allow(non_camel_case_types)] |
97 | | #[allow(missing_docs)] |
98 | | #[derive(Debug, Copy, Clone)] |
99 | | pub struct $name(pub $crate::token::Span); |
100 | | |
101 | | impl<'a> $crate::parser::Parse<'a> for $name { |
102 | 0 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { |
103 | 0 | parser.step(|c| { |
104 | 0 | if let Some((kw, rest)) = c.keyword()? { |
105 | 0 | if kw == $kw { |
106 | 0 | return Ok(($name(c.cur_span()), rest)); |
107 | 0 | } |
108 | 0 | } |
109 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) |
110 | 0 | }) Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::after as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::alias as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::any as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::anyfunc as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::anyref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::arg as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::array as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::arrayref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::assert_exception as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::assert_exhaustion as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::assert_invalid as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::assert_malformed as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::assert_return as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::assert_trap as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::assert_unlinkable as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::before as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::binary as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::block as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::borrow as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::catch as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::catch_all as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::code as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::component as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::data as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::declare as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::delegate as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::do as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::dtor as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::elem as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::end as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::tag as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::export as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::extern as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::externref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::eq as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::eqref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::f32 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::f32x4 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::f64 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::f64x2 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::field as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::first as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::func as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::funcref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::get as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::global as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i16x8 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i31 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i31ref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i32 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i32x4 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i64 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i64x2 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i8 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::i8x16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::import as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::instance as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::instantiate as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::interface as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::invoke as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::item as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::last as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::local as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::memory as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::module as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::modulecode as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::nan_arithmetic as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::nan_canonical as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::nofunc as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::noextern as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::none as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::null as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::nullfuncref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::nullexternref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::nullref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::offset as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::outer as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::own as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::param as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::parent as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::passive as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::quote as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::else as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::if as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::loop as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::mut as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::type as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::ref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::ref_func as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::ref_null as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::register as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::rec as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::rep as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::resource as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::resource_new as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::resource_drop as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::resource_rep as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::result as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::shared as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::start as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::sub as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::final as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::table as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::then as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::try as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::v128 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::value as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::s8 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::s16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::s32 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::s64 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::u8 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::u16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::u32 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::u64 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::char as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::case as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::refines as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::record as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::string as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::bool_ as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::float32 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::float64 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::variant as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::flags as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::option as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::tuple as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::list as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::error as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::canon as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::lift as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::lower as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::enum_ as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::string_utf8 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::string_utf16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::string_latin1_utf16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::struct as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::structref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::realloc as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::post_return as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::with as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::core as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::true_ as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::false_ as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::language as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::sdk as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::processed_by as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::mem_info as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::needed as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::export_info as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::kw::import_info as wast::parser::Parse>::parse::{closure#0} |
111 | 0 | } Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::after as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::alias as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::any as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::anyfunc as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::anyref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::arg as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::array as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::arrayref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::assert_exception as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::assert_exhaustion as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::assert_invalid as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::assert_malformed as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::assert_return as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::assert_trap as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::assert_unlinkable as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::before as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::binary as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::block as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::borrow as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::catch as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::catch_all as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::code as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::component as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::data as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::declare as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::delegate as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::do as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::dtor as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::elem as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::end as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::tag as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::export as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::extern as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::externref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::eq as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::eqref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::f32 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::f32x4 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::f64 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::f64x2 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::field as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::first as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::func as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::funcref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::get as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::global as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i16 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i16x8 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i31 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i31ref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i32 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i32x4 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i64 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i64x2 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i8 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::i8x16 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::import as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::instance as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::instantiate as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::interface as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::invoke as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::item as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::last as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::local as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::memory as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::module as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::modulecode as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::nan_arithmetic as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::nan_canonical as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::nofunc as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::noextern as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::none as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::null as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::nullfuncref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::nullexternref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::nullref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::offset as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::outer as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::own as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::param as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::parent as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::passive as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::quote as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::else as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::if as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::loop as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::mut as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::type as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::ref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::ref_func as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::ref_null as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::register as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::rec as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::rep as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::resource as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::resource_new as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::resource_drop as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::resource_rep as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::result as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::shared as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::start as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::sub as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::final as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::table as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::then as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::try as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::v128 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::value as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::s8 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::s16 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::s32 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::s64 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::u8 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::u16 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::u32 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::u64 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::char as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::case as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::refines as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::record as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::string as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::bool_ as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::float32 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::float64 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::variant as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::flags as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::option as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::tuple as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::list as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::error as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::canon as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::lift as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::lower as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::enum_ as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::string_utf8 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::string_utf16 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::string_latin1_utf16 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::struct as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::structref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::realloc as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::post_return as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::with as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::core as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::true_ as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::false_ as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::language as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::sdk as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::processed_by as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::mem_info as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::needed as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::export_info as wast::parser::Parse>::parse Unexecuted instantiation: <wast::kw::import_info as wast::parser::Parse>::parse |
112 | | } |
113 | | |
114 | | impl $crate::parser::Peek for $name { |
115 | 0 | fn peek(cursor: $crate::parser::Cursor<'_>) -> $crate::parser::Result<bool> { |
116 | 0 | Ok(if let Some((kw, _rest)) = cursor.keyword()? { |
117 | 0 | kw == $kw |
118 | | } else { |
119 | 0 | false |
120 | | }) |
121 | 0 | } Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::after as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::alias as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::any as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::anyfunc as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::anyref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::arg as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::array as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::arrayref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::assert_exception as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::assert_exhaustion as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::assert_invalid as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::assert_malformed as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::assert_return as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::assert_trap as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::assert_unlinkable as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::before as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::binary as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::block as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::borrow as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::catch as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::catch_all as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::code as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::component as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::data as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::declare as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::delegate as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::do as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::dtor as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::elem as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::end as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::tag as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::export as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::extern as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::externref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::eq as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::eqref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::f32 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::f32x4 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::f64 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::f64x2 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::field as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::first as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::func as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::funcref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::get as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::global as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i16 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i16x8 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i31 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i31ref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i32 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i32x4 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i64 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i64x2 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i8 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::i8x16 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::import as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::instance as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::instantiate as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::interface as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::invoke as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::item as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::last as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::local as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::memory as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::module as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::modulecode as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::nan_arithmetic as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::nan_canonical as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::nofunc as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::noextern as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::none as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::null as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::nullfuncref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::nullexternref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::nullref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::offset as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::outer as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::own as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::param as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::parent as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::passive as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::quote as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::else as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::if as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::loop as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::mut as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::type as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::ref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::ref_func as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::ref_null as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::register as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::rec as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::rep as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::resource as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::resource_new as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::resource_drop as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::resource_rep as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::result as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::shared as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::start as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::sub as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::final as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::table as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::then as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::try as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::v128 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::value as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::s8 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::s16 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::s32 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::s64 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::u8 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::u16 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::u32 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::u64 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::char as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::case as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::refines as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::record as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::string as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::bool_ as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::float32 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::float64 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::variant as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::flags as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::option as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::tuple as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::list as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::error as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::canon as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::lift as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::lower as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::enum_ as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::string_utf8 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::string_utf16 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::string_latin1_utf16 as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::struct as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::structref as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::realloc as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::post_return as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::with as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::core as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::true_ as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::false_ as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::language as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::sdk as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::processed_by as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::mem_info as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::needed as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::export_info as wast::parser::Peek>::peek Unexecuted instantiation: <wast::kw::import_info as wast::parser::Peek>::peek |
122 | | |
123 | 0 | fn display() -> &'static str { |
124 | 0 | concat!("`", $kw, "`") |
125 | 0 | } Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::display Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::display Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::display Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::display Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::display Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::display Unexecuted instantiation: <wast::core::custom::parse_sym_flags::flag as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::after as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::alias as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::any as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::anyfunc as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::anyref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::arg as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::array as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::arrayref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::assert_exception as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::assert_exhaustion as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::assert_invalid as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::assert_malformed as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::assert_return as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::assert_trap as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::assert_unlinkable as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::before as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::binary as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::block as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::borrow as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::catch as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::catch_all as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::code as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::component as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::data as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::declare as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::delegate as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::do as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::dtor as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::elem as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::end as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::tag as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::export as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::extern as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::externref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::eq as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::eqref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::f32 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::f32x4 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::f64 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::f64x2 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::field as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::first as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::func as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::funcref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::get as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::global as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i16 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i16x8 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i31 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i31ref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i32 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i32x4 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i64 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i64x2 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i8 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::i8x16 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::import as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::instance as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::instantiate as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::interface as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::invoke as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::item as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::last as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::local as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::memory as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::module as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::modulecode as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::nan_arithmetic as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::nan_canonical as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::nofunc as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::noextern as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::none as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::null as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::nullfuncref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::nullexternref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::nullref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::offset as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::outer as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::own as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::param as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::parent as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::passive as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::quote as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::else as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::if as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::loop as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::mut as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::type as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::ref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::ref_func as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::ref_null as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::register as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::rec as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::rep as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::resource as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::resource_new as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::resource_drop as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::resource_rep as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::result as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::shared as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::start as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::sub as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::final as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::table as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::then as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::try as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::v128 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::value as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::s8 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::s16 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::s32 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::s64 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::u8 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::u16 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::u32 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::u64 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::char as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::case as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::refines as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::record as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::string as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::bool_ as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::float32 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::float64 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::variant as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::flags as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::option as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::tuple as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::list as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::error as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::canon as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::lift as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::lower as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::enum_ as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::string_utf8 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::string_utf16 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::string_latin1_utf16 as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::struct as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::structref as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::realloc as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::post_return as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::with as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::core as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::true_ as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::false_ as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::language as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::sdk as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::processed_by as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::mem_info as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::needed as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::export_info as wast::parser::Peek>::display Unexecuted instantiation: <wast::kw::import_info as wast::parser::Peek>::display |
126 | | } |
127 | | }; |
128 | | } |
129 | | |
130 | | /// A macro for defining custom reserved symbols. |
131 | | /// |
132 | | /// This is like `custom_keyword!` but for reserved symbols (`Token::Reserved`) |
133 | | /// instead of keywords (`Token::Keyword`). |
134 | | /// |
135 | | /// ``` |
136 | | /// use wast::parser::{Parser, Result, Parse}; |
137 | | /// |
138 | | /// // Define a custom reserved symbol, the "spaceship" operator: `<=>`. |
139 | | /// wast::custom_reserved!(spaceship = "<=>"); |
140 | | /// |
141 | | /// /// A "three-way comparison" like `(<=> a b)` that returns -1 if `a` is less |
142 | | /// /// than `b`, 0 if they're equal, and 1 if `a` is greater than `b`. |
143 | | /// struct ThreeWayComparison<'a> { |
144 | | /// lhs: wast::core::Expression<'a>, |
145 | | /// rhs: wast::core::Expression<'a>, |
146 | | /// } |
147 | | /// |
148 | | /// impl<'a> Parse<'a> for ThreeWayComparison<'a> { |
149 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
150 | | /// parser.parse::<spaceship>()?; |
151 | | /// let lhs = parser.parse()?; |
152 | | /// let rhs = parser.parse()?; |
153 | | /// Ok(ThreeWayComparison { lhs, rhs }) |
154 | | /// } |
155 | | /// } |
156 | | /// ``` |
157 | | #[macro_export] |
158 | | macro_rules! custom_reserved { |
159 | | ($name:ident) => { |
160 | | $crate::custom_reserved!($name = stringify!($name)); |
161 | | }; |
162 | | ($name:ident = $rsv:expr) => { |
163 | | #[allow(non_camel_case_types)] |
164 | | #[allow(missing_docs)] |
165 | | #[derive(Debug)] |
166 | | pub struct $name(pub $crate::token::Span); |
167 | | |
168 | | impl<'a> $crate::parser::Parse<'a> for $name { |
169 | | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { |
170 | | parser.step(|c| { |
171 | | if let Some((rsv, rest)) = c.reserved()? { |
172 | | if rsv == $rsv { |
173 | | return Ok(($name(c.cur_span()), rest)); |
174 | | } |
175 | | } |
176 | | Err(c.error(concat!("expected reserved symbol `", $rsv, "`"))) |
177 | | }) |
178 | | } |
179 | | } |
180 | | |
181 | | impl $crate::parser::Peek for $name { |
182 | | fn peek(cursor: $crate::parser::Cursor<'_>) -> Result<bool> { |
183 | | if let Some((rsv, _rest)) = cursor.reserved()? { |
184 | | Ok(rsv == $rsv) |
185 | | } else { |
186 | | Ok(false) |
187 | | } |
188 | | } |
189 | | |
190 | | fn display() -> &'static str { |
191 | | concat!("`", $rsv, "`") |
192 | | } |
193 | | } |
194 | | }; |
195 | | } |
196 | | |
197 | | /// A macro, like [`custom_keyword`], to create a type which can be used to |
198 | | /// parse/peek annotation directives. |
199 | | /// |
200 | | /// Note that when you're parsing custom annotations it can be somewhat tricky |
201 | | /// due to the nature that most of them are skipped. You'll want to be sure to |
202 | | /// consult the documentation of [`Parser::register_annotation`][register] when |
203 | | /// using this macro. |
204 | | /// |
205 | | /// # Examples |
206 | | /// |
207 | | /// To see an example of how to use this macro, let's invent our own syntax for |
208 | | /// the [producers section][section] which looks like: |
209 | | /// |
210 | | /// ```wat |
211 | | /// (@producer "wat" "1.0.2") |
212 | | /// ``` |
213 | | /// |
214 | | /// Here, for simplicity, we'll assume everything is a `processed-by` directive, |
215 | | /// but you could get much more fancy with this as well. |
216 | | /// |
217 | | /// ``` |
218 | | /// # use wast::*; |
219 | | /// # use wast::parser::*; |
220 | | /// |
221 | | /// // First we define the custom annotation keyword we're using, and by |
222 | | /// // convention we define it in an `annotation` module. |
223 | | /// mod annotation { |
224 | | /// wast::annotation!(producer); |
225 | | /// } |
226 | | /// |
227 | | /// struct Producer<'a> { |
228 | | /// name: &'a str, |
229 | | /// version: &'a str, |
230 | | /// } |
231 | | /// |
232 | | /// impl<'a> Parse<'a> for Producer<'a> { |
233 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
234 | | /// // Remember that parser conventionally parse the *interior* of an |
235 | | /// // s-expression, so we parse our `@producer` annotation and then we |
236 | | /// // parse the payload of our annotation. |
237 | | /// parser.parse::<annotation::producer>()?; |
238 | | /// Ok(Producer { |
239 | | /// name: parser.parse()?, |
240 | | /// version: parser.parse()?, |
241 | | /// }) |
242 | | /// } |
243 | | /// } |
244 | | /// ``` |
245 | | /// |
246 | | /// Note though that this is only half of the parser for annotations. The other |
247 | | /// half is calling the [`register_annotation`][register] method at the right |
248 | | /// time to ensure the parser doesn't automatically skip our `@producer` |
249 | | /// directive. Note that we *can't* call it inside the `Parse for Producer` |
250 | | /// definition because that's too late and the annotation would already have |
251 | | /// been skipped. |
252 | | /// |
253 | | /// Instead we'll need to call it from a higher level-parser before the |
254 | | /// parenthesis have been parsed, like so: |
255 | | /// |
256 | | /// ``` |
257 | | /// # use wast::*; |
258 | | /// # use wast::parser::*; |
259 | | /// struct Module<'a> { |
260 | | /// fields: Vec<ModuleField<'a>>, |
261 | | /// } |
262 | | /// |
263 | | /// impl<'a> Parse<'a> for Module<'a> { |
264 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
265 | | /// // .. parse module header here ... |
266 | | /// |
267 | | /// // register our custom `@producer` annotation before we start |
268 | | /// // parsing the parentheses of each field |
269 | | /// let _r = parser.register_annotation("producer"); |
270 | | /// |
271 | | /// let mut fields = Vec::new(); |
272 | | /// while !parser.is_empty() { |
273 | | /// fields.push(parser.parens(|p| p.parse())?); |
274 | | /// } |
275 | | /// Ok(Module { fields }) |
276 | | /// } |
277 | | /// } |
278 | | /// |
279 | | /// enum ModuleField<'a> { |
280 | | /// Producer(Producer<'a>), |
281 | | /// // ... |
282 | | /// } |
283 | | /// # struct Producer<'a>(&'a str); |
284 | | /// # impl<'a> Parse<'a> for Producer<'a> { |
285 | | /// # fn parse(parser: Parser<'a>) -> Result<Self> { Ok(Producer(parser.parse()?)) } |
286 | | /// # } |
287 | | /// # mod annotation { wast::annotation!(producer); } |
288 | | /// |
289 | | /// impl<'a> Parse<'a> for ModuleField<'a> { |
290 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
291 | | /// // and here `peek` works and our delegated parsing works because the |
292 | | /// // annotation has been registered. |
293 | | /// if parser.peek::<annotation::producer>()? { |
294 | | /// return Ok(ModuleField::Producer(parser.parse()?)); |
295 | | /// } |
296 | | /// |
297 | | /// // .. typically we'd parse other module fields here... |
298 | | /// |
299 | | /// Err(parser.error("unknown module field")) |
300 | | /// } |
301 | | /// } |
302 | | /// ``` |
303 | | /// |
304 | | /// [register]: crate::parser::Parser::register_annotation |
305 | | /// [section]: https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md |
306 | | #[macro_export] |
307 | | macro_rules! annotation { |
308 | | ($name:ident) => { |
309 | | $crate::annotation!($name = stringify!($name)); |
310 | | }; |
311 | | ($name:ident = $annotation:expr) => { |
312 | | #[allow(non_camel_case_types)] |
313 | | #[allow(missing_docs)] |
314 | | #[derive(Debug)] |
315 | | pub struct $name(pub $crate::token::Span); |
316 | | |
317 | | impl<'a> $crate::parser::Parse<'a> for $name { |
318 | 0 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { |
319 | 0 | parser.step(|c| { |
320 | 0 | if let Some((a, rest)) = c.reserved()? { |
321 | 0 | if a == concat!("@", $annotation) { |
322 | 0 | return Ok(($name(c.cur_span()), rest)); |
323 | 0 | } |
324 | 0 | } |
325 | 0 | Err(c.error(concat!("expected annotation `@", $annotation, "`"))) |
326 | 0 | }) Unexecuted instantiation: <wast::annotation::custom as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::annotation::name as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::annotation::producers as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::annotation::dylink_0 as wast::parser::Parse>::parse::{closure#0} |
327 | 0 | } Unexecuted instantiation: <wast::annotation::custom as wast::parser::Parse>::parse Unexecuted instantiation: <wast::annotation::name as wast::parser::Parse>::parse Unexecuted instantiation: <wast::annotation::producers as wast::parser::Parse>::parse Unexecuted instantiation: <wast::annotation::dylink_0 as wast::parser::Parse>::parse |
328 | | } |
329 | | |
330 | | impl $crate::parser::Peek for $name { |
331 | 0 | fn peek(cursor: $crate::parser::Cursor<'_>) -> $crate::parser::Result<bool> { |
332 | 0 | Ok(if let Some((a, _rest)) = cursor.reserved()? { |
333 | 0 | a == concat!("@", $annotation) |
334 | | } else { |
335 | 0 | false |
336 | | }) |
337 | 0 | } Unexecuted instantiation: <wast::annotation::custom as wast::parser::Peek>::peek Unexecuted instantiation: <wast::annotation::name as wast::parser::Peek>::peek Unexecuted instantiation: <wast::annotation::producers as wast::parser::Peek>::peek Unexecuted instantiation: <wast::annotation::dylink_0 as wast::parser::Peek>::peek |
338 | | |
339 | 0 | fn display() -> &'static str { |
340 | 0 | concat!("`@", $annotation, "`") |
341 | 0 | } Unexecuted instantiation: <wast::annotation::custom as wast::parser::Peek>::display Unexecuted instantiation: <wast::annotation::name as wast::parser::Peek>::display Unexecuted instantiation: <wast::annotation::producers as wast::parser::Peek>::display Unexecuted instantiation: <wast::annotation::dylink_0 as wast::parser::Peek>::display |
342 | | } |
343 | | }; |
344 | | } |
345 | | |
346 | | pub mod lexer; |
347 | | pub mod parser; |
348 | | pub mod token; |
349 | | |
350 | | mod encode; |
351 | | mod error; |
352 | | mod gensym; |
353 | | mod names; |
354 | | pub use self::error::*; |
355 | | |
356 | | macro_rules! id { |
357 | | ($($t:tt)*) => ($($t)*) |
358 | | } |
359 | | |
360 | | #[cfg(feature = "wasm-module")] |
361 | | id! { |
362 | | mod wast; |
363 | | mod wat; |
364 | | pub use self::wast::*; |
365 | | pub use self::wat::*; |
366 | | |
367 | | // Support for core wasm parsing |
368 | | pub mod core; |
369 | | |
370 | | // Support for component model parsing |
371 | | pub mod component; |
372 | | } |
373 | | |
374 | | /// Common keyword used to parse WebAssembly text files. |
375 | | pub mod kw { |
376 | | custom_keyword!(after); |
377 | | custom_keyword!(alias); |
378 | | custom_keyword!(any); |
379 | | custom_keyword!(anyfunc); |
380 | | custom_keyword!(anyref); |
381 | | custom_keyword!(arg); |
382 | | custom_keyword!(array); |
383 | | custom_keyword!(arrayref); |
384 | | custom_keyword!(assert_exception); |
385 | | custom_keyword!(assert_exhaustion); |
386 | | custom_keyword!(assert_invalid); |
387 | | custom_keyword!(assert_malformed); |
388 | | custom_keyword!(assert_return); |
389 | | custom_keyword!(assert_trap); |
390 | | custom_keyword!(assert_unlinkable); |
391 | | custom_keyword!(before); |
392 | | custom_keyword!(binary); |
393 | | custom_keyword!(block); |
394 | | custom_keyword!(borrow); |
395 | | custom_keyword!(catch); |
396 | | custom_keyword!(catch_all); |
397 | | custom_keyword!(code); |
398 | | custom_keyword!(component); |
399 | | custom_keyword!(data); |
400 | | custom_keyword!(declare); |
401 | | custom_keyword!(delegate); |
402 | | custom_keyword!(r#do = "do"); |
403 | | custom_keyword!(dtor); |
404 | | custom_keyword!(elem); |
405 | | custom_keyword!(end); |
406 | | custom_keyword!(tag); |
407 | | custom_keyword!(export); |
408 | | custom_keyword!(r#extern = "extern"); |
409 | | custom_keyword!(externref); |
410 | | custom_keyword!(eq); |
411 | | custom_keyword!(eqref); |
412 | | custom_keyword!(f32); |
413 | | custom_keyword!(f32x4); |
414 | | custom_keyword!(f64); |
415 | | custom_keyword!(f64x2); |
416 | | custom_keyword!(field); |
417 | | custom_keyword!(first); |
418 | | custom_keyword!(func); |
419 | | custom_keyword!(funcref); |
420 | | custom_keyword!(get); |
421 | | custom_keyword!(global); |
422 | | custom_keyword!(i16); |
423 | | custom_keyword!(i16x8); |
424 | | custom_keyword!(i31); |
425 | | custom_keyword!(i31ref); |
426 | | custom_keyword!(i32); |
427 | | custom_keyword!(i32x4); |
428 | | custom_keyword!(i64); |
429 | | custom_keyword!(i64x2); |
430 | | custom_keyword!(i8); |
431 | | custom_keyword!(i8x16); |
432 | | custom_keyword!(import); |
433 | | custom_keyword!(instance); |
434 | | custom_keyword!(instantiate); |
435 | | custom_keyword!(interface); |
436 | | custom_keyword!(invoke); |
437 | | custom_keyword!(item); |
438 | | custom_keyword!(last); |
439 | | custom_keyword!(local); |
440 | | custom_keyword!(memory); |
441 | | custom_keyword!(module); |
442 | | custom_keyword!(modulecode); |
443 | | custom_keyword!(nan_arithmetic = "nan:arithmetic"); |
444 | | custom_keyword!(nan_canonical = "nan:canonical"); |
445 | | custom_keyword!(nofunc); |
446 | | custom_keyword!(noextern); |
447 | | custom_keyword!(none); |
448 | | custom_keyword!(null); |
449 | | custom_keyword!(nullfuncref); |
450 | | custom_keyword!(nullexternref); |
451 | | custom_keyword!(nullref); |
452 | | custom_keyword!(offset); |
453 | | custom_keyword!(outer); |
454 | | custom_keyword!(own); |
455 | | custom_keyword!(param); |
456 | | custom_keyword!(parent); |
457 | | custom_keyword!(passive); |
458 | | custom_keyword!(quote); |
459 | | custom_keyword!(r#else = "else"); |
460 | | custom_keyword!(r#if = "if"); |
461 | | custom_keyword!(r#loop = "loop"); |
462 | | custom_keyword!(r#mut = "mut"); |
463 | | custom_keyword!(r#type = "type"); |
464 | | custom_keyword!(r#ref = "ref"); |
465 | | custom_keyword!(ref_func = "ref.func"); |
466 | | custom_keyword!(ref_null = "ref.null"); |
467 | | custom_keyword!(register); |
468 | | custom_keyword!(rec); |
469 | | custom_keyword!(rep); |
470 | | custom_keyword!(resource); |
471 | | custom_keyword!(resource_new = "resource.new"); |
472 | | custom_keyword!(resource_drop = "resource.drop"); |
473 | | custom_keyword!(resource_rep = "resource.rep"); |
474 | | custom_keyword!(result); |
475 | | custom_keyword!(shared); |
476 | | custom_keyword!(start); |
477 | | custom_keyword!(sub); |
478 | | custom_keyword!(r#final = "final"); |
479 | | custom_keyword!(table); |
480 | | custom_keyword!(then); |
481 | | custom_keyword!(r#try = "try"); |
482 | | custom_keyword!(v128); |
483 | | custom_keyword!(value); |
484 | | custom_keyword!(s8); |
485 | | custom_keyword!(s16); |
486 | | custom_keyword!(s32); |
487 | | custom_keyword!(s64); |
488 | | custom_keyword!(u8); |
489 | | custom_keyword!(u16); |
490 | | custom_keyword!(u32); |
491 | | custom_keyword!(u64); |
492 | | custom_keyword!(char); |
493 | | custom_keyword!(case); |
494 | | custom_keyword!(refines); |
495 | | custom_keyword!(record); |
496 | | custom_keyword!(string); |
497 | | custom_keyword!(bool_ = "bool"); |
498 | | custom_keyword!(float32); |
499 | | custom_keyword!(float64); |
500 | | custom_keyword!(variant); |
501 | | custom_keyword!(flags); |
502 | | custom_keyword!(option); |
503 | | custom_keyword!(tuple); |
504 | | custom_keyword!(list); |
505 | | custom_keyword!(error); |
506 | | custom_keyword!(canon); |
507 | | custom_keyword!(lift); |
508 | | custom_keyword!(lower); |
509 | | custom_keyword!(enum_ = "enum"); |
510 | | custom_keyword!(string_utf8 = "string-encoding=utf8"); |
511 | | custom_keyword!(string_utf16 = "string-encoding=utf16"); |
512 | | custom_keyword!(string_latin1_utf16 = "string-encoding=latin1+utf16"); |
513 | | custom_keyword!(r#struct = "struct"); |
514 | | custom_keyword!(structref); |
515 | | custom_keyword!(realloc); |
516 | | custom_keyword!(post_return = "post-return"); |
517 | | custom_keyword!(with); |
518 | | custom_keyword!(core); |
519 | | custom_keyword!(true_ = "true"); |
520 | | custom_keyword!(false_ = "false"); |
521 | | custom_keyword!(language); |
522 | | custom_keyword!(sdk); |
523 | | custom_keyword!(processed_by = "processed-by"); |
524 | | custom_keyword!(mem_info = "mem-info"); |
525 | | custom_keyword!(needed); |
526 | | custom_keyword!(export_info = "export-info"); |
527 | | custom_keyword!(import_info = "import-info"); |
528 | | } |
529 | | |
530 | | /// Common annotations used to parse WebAssembly text files. |
531 | | pub mod annotation { |
532 | | annotation!(custom); |
533 | | annotation!(name); |
534 | | annotation!(producers); |
535 | | annotation!(dylink_0 = "dylink.0"); |
536 | | } |