/src/wasm-tools/crates/wast/src/ast/mod.rs
Line | Count | Source (jump to first uncovered line) |
1 | | /// A macro to create a custom keyword parser. |
2 | | /// |
3 | | /// This macro is invoked in one of two forms: |
4 | | /// |
5 | | /// ``` |
6 | | /// // keyword derived from the Rust identifier: |
7 | | /// wast::custom_keyword!(foo); |
8 | | /// |
9 | | /// // or an explicitly specified string representation of the keyword: |
10 | | /// wast::custom_keyword!(my_keyword = "the-wasm-keyword"); |
11 | | /// ``` |
12 | | /// |
13 | | /// This can then be used to parse custom keyword for custom items, such as: |
14 | | /// |
15 | | /// ``` |
16 | | /// use wast::parser::{Parser, Result, Parse}; |
17 | | /// |
18 | | /// struct InlineModule<'a> { |
19 | | /// inline_text: &'a str, |
20 | | /// } |
21 | | /// |
22 | | /// mod kw { |
23 | | /// wast::custom_keyword!(inline); |
24 | | /// } |
25 | | /// |
26 | | /// // Parse an inline string module of the form: |
27 | | /// // |
28 | | /// // (inline "(module (func))") |
29 | | /// impl<'a> Parse<'a> for InlineModule<'a> { |
30 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
31 | | /// parser.parse::<kw::inline>()?; |
32 | | /// Ok(InlineModule { |
33 | | /// inline_text: parser.parse()?, |
34 | | /// }) |
35 | | /// } |
36 | | /// } |
37 | | /// ``` |
38 | | /// |
39 | | /// Note that the keyword name can only start with a lower-case letter, i.e. 'a'..'z'. |
40 | | #[macro_export] |
41 | | macro_rules! custom_keyword { |
42 | | ($name:ident) => { |
43 | | $crate::custom_keyword!($name = stringify!($name)); |
44 | | }; |
45 | | ($name:ident = $kw:expr) => { |
46 | | #[allow(non_camel_case_types)] |
47 | | #[allow(missing_docs)] |
48 | 928k | #[derive(Debug, Copy, Clone)] <wast::ast::kw::func as core::clone::Clone>::clone Line | Count | Source | 48 | 928k | #[derive(Debug, Copy, Clone)] |
|
49 | | pub struct $name(pub $crate::Span); |
50 | | |
51 | | impl<'a> $crate::parser::Parse<'a> for $name { |
52 | 27.5M | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { |
53 | 27.5M | parser.step(|c| { |
54 | 27.5M | if let Some((kw, rest)) = c.keyword() { |
55 | 27.5M | if kw == $kw { |
56 | 27.5M | return Ok(($name(c.cur_span()), rest)); |
57 | 0 | } |
58 | 0 | } |
59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) |
60 | 27.5M | }) Unexecuted instantiation: <wast::ast::kw::assert_trap as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::item as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::try as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::first as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::event as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 17.0k | parser.step(|c| { | 54 | 17.0k | if let Some((kw, rest)) = c.keyword() { | 55 | 17.0k | if kw == $kw { | 56 | 17.0k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 17.0k | }) |
<wast::ast::kw::f64 as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 11.0M | parser.step(|c| { | 54 | 11.0M | if let Some((kw, rest)) = c.keyword() { | 55 | 11.0M | if kw == $kw { | 56 | 11.0M | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 11.0M | }) |
<wast::ast::kw::assert_exhaustion as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 2 | parser.step(|c| { | 54 | 2 | if let Some((kw, rest)) = c.keyword() { | 55 | 2 | if kw == $kw { | 56 | 2 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 2 | }) |
Unexecuted instantiation: <wast::ast::kw::anyfunc as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::assert_return_arithmetic_nan_f32x4 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::catch as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::anyref as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 6.58k | parser.step(|c| { | 54 | 6.58k | if let Some((kw, rest)) = c.keyword() { | 55 | 6.58k | if kw == $kw { | 56 | 6.58k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 6.58k | }) |
Unexecuted instantiation: <wast::ast::kw::assert_malformed as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::delegate as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::passive as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::ref_null as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::get as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::dataref as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::start as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 490 | parser.step(|c| { | 54 | 490 | if let Some((kw, rest)) = c.keyword() { | 55 | 490 | if kw == $kw { | 56 | 490 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 490 | }) |
Unexecuted instantiation: <wast::ast::kw::declare as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::nan_canonical as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::outer as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 22.8k | parser.step(|c| { | 54 | 22.8k | if let Some((kw, rest)) = c.keyword() { | 55 | 22.8k | if kw == $kw { | 56 | 22.8k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 22.8k | }) |
Unexecuted instantiation: <wast::ast::kw::eq as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::f32x4 as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 265 | parser.step(|c| { | 54 | 265 | if let Some((kw, rest)) = c.keyword() { | 55 | 265 | if kw == $kw { | 56 | 265 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 265 | }) |
Unexecuted instantiation: <wast::ast::kw::i31ref as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::type as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 758k | parser.step(|c| { | 54 | 758k | if let Some((kw, rest)) = c.keyword() { | 55 | 758k | if kw == $kw { | 56 | 758k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 758k | }) |
<wast::ast::kw::struct as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 2 | parser.step(|c| { | 54 | 2 | if let Some((kw, rest)) = c.keyword() { | 55 | 2 | if kw == $kw { | 56 | 2 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 2 | }) |
Unexecuted instantiation: <wast::ast::kw::assert_return_canonical_nan_f32x4 as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::before as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 6 | parser.step(|c| { | 54 | 6 | if let Some((kw, rest)) = c.keyword() { | 55 | 6 | if kw == $kw { | 56 | 6 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 6 | }) |
<wast::ast::kw::alias as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 1 | parser.step(|c| { | 54 | 1 | if let Some((kw, rest)) = c.keyword() { | 55 | 1 | if kw == $kw { | 56 | 1 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 1 | }) |
Unexecuted instantiation: <wast::ast::kw::end as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::nan_arithmetic as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::then as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 1 | parser.step(|c| { | 54 | 1 | if let Some((kw, rest)) = c.keyword() { | 55 | 1 | if kw == $kw { | 56 | 1 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 1 | }) |
Unexecuted instantiation: <wast::ast::kw::assert_unlinkable as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::f32 as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 5.85M | parser.step(|c| { | 54 | 5.85M | if let Some((kw, rest)) = c.keyword() { | 55 | 5.85M | if kw == $kw { | 56 | 5.85M | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 5.85M | }) |
Unexecuted instantiation: <wast::ast::kw::i31 as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::instance as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 7.52k | parser.step(|c| { | 54 | 7.52k | if let Some((kw, rest)) = c.keyword() { | 55 | 7.52k | if kw == $kw { | 56 | 7.52k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 7.52k | }) |
Unexecuted instantiation: <wast::ast::kw::if as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::i64 as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 2.45M | parser.step(|c| { | 54 | 2.45M | if let Some((kw, rest)) = c.keyword() { | 55 | 2.45M | if kw == $kw { | 56 | 2.45M | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 2.45M | }) |
<wast::ast::kw::local as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 128k | parser.step(|c| { | 54 | 128k | if let Some((kw, rest)) = c.keyword() { | 55 | 128k | if kw == $kw { | 56 | 128k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 128k | }) |
Unexecuted instantiation: <wast::ast::kw::nullref as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::memory as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 66.0k | parser.step(|c| { | 54 | 66.0k | if let Some((kw, rest)) = c.keyword() { | 55 | 66.0k | if kw == $kw { | 56 | 66.0k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 66.0k | }) |
Unexecuted instantiation: <wast::ast::kw::null as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::module as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 73.1k | parser.step(|c| { | 54 | 73.1k | if let Some((kw, rest)) = c.keyword() { | 55 | 73.1k | if kw == $kw { | 56 | 73.1k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 73.1k | }) |
Unexecuted instantiation: <wast::ast::kw::quote as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::parent as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::mut as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 114k | parser.step(|c| { | 54 | 114k | if let Some((kw, rest)) = c.keyword() { | 55 | 114k | if kw == $kw { | 56 | 114k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 114k | }) |
Unexecuted instantiation: <wast::ast::kw::register as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::shared as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::field as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::rtt as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::assert_return_arithmetic_nan as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::i8x16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::last as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::modulecode as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::code as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::v128 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::catch_all as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::binary as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::else as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 1 | parser.step(|c| { | 54 | 1 | if let Some((kw, rest)) = c.keyword() { | 55 | 1 | if kw == $kw { | 56 | 1 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 1 | }) |
Unexecuted instantiation: <wast::ast::kw::ref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::extern as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::instantiate as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::loop as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::param as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 814k | parser.step(|c| { | 54 | 814k | if let Some((kw, rest)) = c.keyword() { | 55 | 814k | if kw == $kw { | 56 | 814k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 814k | }) |
Unexecuted instantiation: <wast::ast::kw::any as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::assert_return_canonical_nan as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::global as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 226k | parser.step(|c| { | 54 | 226k | if let Some((kw, rest)) = c.keyword() { | 55 | 226k | if kw == $kw { | 56 | 226k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 226k | }) |
<wast::ast::kw::i32 as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 717k | parser.step(|c| { | 54 | 717k | if let Some((kw, rest)) = c.keyword() { | 55 | 717k | if kw == $kw { | 56 | 717k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 717k | }) |
Unexecuted instantiation: <wast::ast::kw::i8 as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::i32x4 as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 623 | parser.step(|c| { | 54 | 623 | if let Some((kw, rest)) = c.keyword() { | 55 | 623 | if kw == $kw { | 56 | 623 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 623 | }) |
Unexecuted instantiation: <wast::ast::kw::unwind as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::elem as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 127k | parser.step(|c| { | 54 | 127k | if let Some((kw, rest)) = c.keyword() { | 55 | 127k | if kw == $kw { | 56 | 127k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 127k | }) |
Unexecuted instantiation: <wast::ast::kw::assert_invalid as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::block as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::f64x2 as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 18 | parser.step(|c| { | 54 | 18 | if let Some((kw, rest)) = c.keyword() { | 55 | 18 | if kw == $kw { | 56 | 18 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 18 | }) |
Unexecuted instantiation: <wast::ast::kw::assert_return_arithmetic_nan_f64x2 as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::do as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 6 | parser.step(|c| { | 54 | 6 | if let Some((kw, rest)) = c.keyword() { | 55 | 6 | if kw == $kw { | 56 | 6 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 6 | }) |
<wast::ast::kw::data as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 249k | parser.step(|c| { | 54 | 249k | if let Some((kw, rest)) = c.keyword() { | 55 | 249k | if kw == $kw { | 56 | 249k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 249k | }) |
<wast::ast::kw::funcref as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 5.77k | parser.step(|c| { | 54 | 5.77k | if let Some((kw, rest)) = c.keyword() { | 55 | 5.77k | if kw == $kw { | 56 | 5.77k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 5.77k | }) |
Unexecuted instantiation: <wast::ast::kw::externref as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::offset as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::array as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 1 | parser.step(|c| { | 54 | 1 | if let Some((kw, rest)) = c.keyword() { | 55 | 1 | if kw == $kw { | 56 | 1 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 1 | }) |
<wast::ast::kw::func as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 1.27M | parser.step(|c| { | 54 | 1.27M | if let Some((kw, rest)) = c.keyword() { | 55 | 1.27M | if kw == $kw { | 56 | 1.27M | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 1.27M | }) |
<wast::ast::kw::assert_return as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 6 | parser.step(|c| { | 54 | 6 | if let Some((kw, rest)) = c.keyword() { | 55 | 6 | if kw == $kw { | 56 | 6 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 6 | }) |
Unexecuted instantiation: <wast::ast::kw::i16 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::i16x8 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::i64x2 as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::import as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 168k | parser.step(|c| { | 54 | 168k | if let Some((kw, rest)) = c.keyword() { | 55 | 168k | if kw == $kw { | 56 | 168k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 168k | }) |
<wast::ast::kw::invoke as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 10 | parser.step(|c| { | 54 | 10 | if let Some((kw, rest)) = c.keyword() { | 55 | 10 | if kw == $kw { | 56 | 10 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 10 | }) |
<wast::ast::kw::table as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 17.2k | parser.step(|c| { | 54 | 17.2k | if let Some((kw, rest)) = c.keyword() { | 55 | 17.2k | if kw == $kw { | 56 | 17.2k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 17.2k | }) |
Unexecuted instantiation: <wast::ast::kw::assert_return_func as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::export as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 209k | parser.step(|c| { | 54 | 209k | if let Some((kw, rest)) = c.keyword() { | 55 | 209k | if kw == $kw { | 56 | 209k | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 209k | }) |
<wast::ast::kw::result as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 3.12M | parser.step(|c| { | 54 | 3.12M | if let Some((kw, rest)) = c.keyword() { | 55 | 3.12M | if kw == $kw { | 56 | 3.12M | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 3.12M | }) |
Unexecuted instantiation: <wast::ast::kw::after as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::arg as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::assert_return_canonical_nan_f64x2 as wast::parser::Parse>::parse::{closure#0}Unexecuted instantiation: <wast::ast::kw::ref_func as wast::parser::Parse>::parse::{closure#0}<wast::ast::kw::eqref as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 53 | 955 | parser.step(|c| { | 54 | 955 | if let Some((kw, rest)) = c.keyword() { | 55 | 955 | if kw == $kw { | 56 | 955 | return Ok(($name(c.cur_span()), rest)); | 57 | 0 | } | 58 | 0 | } | 59 | 0 | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | 955 | }) |
|
61 | 27.5M | } Unexecuted instantiation: <wast::ast::kw::assert_return_func as wast::parser::Parse>::parse <wast::ast::kw::i32 as wast::parser::Parse>::parse Line | Count | Source | 52 | 717k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 717k | } |
<wast::ast::kw::anyref as wast::parser::Parse>::parse Line | Count | Source | 52 | 6.58k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 6.58k | } |
<wast::ast::kw::f32x4 as wast::parser::Parse>::parse Line | Count | Source | 52 | 265 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 265 | } |
Unexecuted instantiation: <wast::ast::kw::i8x16 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::rtt as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::assert_return_canonical_nan_f64x2 as wast::parser::Parse>::parse <wast::ast::kw::f64x2 as wast::parser::Parse>::parse Line | Count | Source | 52 | 18 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 18 | } |
Unexecuted instantiation: <wast::ast::kw::quote as wast::parser::Parse>::parse <wast::ast::kw::event as wast::parser::Parse>::parse Line | Count | Source | 52 | 17.0k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 17.0k | } |
Unexecuted instantiation: <wast::ast::kw::i31 as wast::parser::Parse>::parse <wast::ast::kw::export as wast::parser::Parse>::parse Line | Count | Source | 52 | 209k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 209k | } |
Unexecuted instantiation: <wast::ast::kw::nan_canonical as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::delegate as wast::parser::Parse>::parse <wast::ast::kw::local as wast::parser::Parse>::parse Line | Count | Source | 52 | 128k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 128k | } |
<wast::ast::kw::type as wast::parser::Parse>::parse Line | Count | Source | 52 | 758k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 758k | } |
Unexecuted instantiation: <wast::ast::kw::register as wast::parser::Parse>::parse <wast::ast::kw::result as wast::parser::Parse>::parse Line | Count | Source | 52 | 3.12M | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 3.12M | } |
<wast::ast::kw::assert_exhaustion as wast::parser::Parse>::parse Line | Count | Source | 52 | 2 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 2 | } |
Unexecuted instantiation: <wast::ast::kw::externref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::passive as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::item as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::last as wast::parser::Parse>::parse <wast::ast::kw::func as wast::parser::Parse>::parse Line | Count | Source | 52 | 1.27M | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 1.27M | } |
Unexecuted instantiation: <wast::ast::kw::arg as wast::parser::Parse>::parse <wast::ast::kw::f64 as wast::parser::Parse>::parse Line | Count | Source | 52 | 11.0M | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 11.0M | } |
<wast::ast::kw::array as wast::parser::Parse>::parse Line | Count | Source | 52 | 1 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 1 | } |
Unexecuted instantiation: <wast::ast::kw::field as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::first as wast::parser::Parse>::parse <wast::ast::kw::i64 as wast::parser::Parse>::parse Line | Count | Source | 52 | 2.45M | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 2.45M | } |
Unexecuted instantiation: <wast::ast::kw::unwind as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::assert_return_arithmetic_nan_f64x2 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::i16 as wast::parser::Parse>::parse <wast::ast::kw::invoke as wast::parser::Parse>::parse Line | Count | Source | 52 | 10 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 10 | } |
<wast::ast::kw::param as wast::parser::Parse>::parse Line | Count | Source | 52 | 814k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 814k | } |
Unexecuted instantiation: <wast::ast::kw::if as wast::parser::Parse>::parse <wast::ast::kw::table as wast::parser::Parse>::parse Line | Count | Source | 52 | 17.2k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 17.2k | } |
Unexecuted instantiation: <wast::ast::kw::block as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::any as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::eq as wast::parser::Parse>::parse <wast::ast::kw::instance as wast::parser::Parse>::parse Line | Count | Source | 52 | 7.52k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 7.52k | } |
Unexecuted instantiation: <wast::ast::kw::i31ref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::try as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::get as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::end as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::v128 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::parent as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::after as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::assert_trap as wast::parser::Parse>::parse <wast::ast::kw::i32x4 as wast::parser::Parse>::parse Line | Count | Source | 52 | 623 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 623 | } |
Unexecuted instantiation: <wast::ast::kw::nullref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::ref_func as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::loop as wast::parser::Parse>::parse <wast::ast::kw::funcref as wast::parser::Parse>::parse Line | Count | Source | 52 | 5.77k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 5.77k | } |
Unexecuted instantiation: <wast::ast::kw::dataref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::assert_return_canonical_nan as wast::parser::Parse>::parse <wast::ast::kw::mut as wast::parser::Parse>::parse Line | Count | Source | 52 | 114k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 114k | } |
Unexecuted instantiation: <wast::ast::kw::catch_all as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::catch as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::code as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::assert_invalid as wast::parser::Parse>::parse <wast::ast::kw::data as wast::parser::Parse>::parse Line | Count | Source | 52 | 249k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 249k | } |
<wast::ast::kw::else as wast::parser::Parse>::parse Line | Count | Source | 52 | 1 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 1 | } |
<wast::ast::kw::do as wast::parser::Parse>::parse Line | Count | Source | 52 | 6 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 6 | } |
<wast::ast::kw::memory as wast::parser::Parse>::parse Line | Count | Source | 52 | 66.0k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 66.0k | } |
Unexecuted instantiation: <wast::ast::kw::shared as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::anyfunc as wast::parser::Parse>::parse <wast::ast::kw::f32 as wast::parser::Parse>::parse Line | Count | Source | 52 | 5.85M | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 5.85M | } |
Unexecuted instantiation: <wast::ast::kw::i8 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::modulecode as wast::parser::Parse>::parse <wast::ast::kw::assert_return as wast::parser::Parse>::parse Line | Count | Source | 52 | 6 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 6 | } |
Unexecuted instantiation: <wast::ast::kw::assert_unlinkable as wast::parser::Parse>::parse <wast::ast::kw::eqref as wast::parser::Parse>::parse Line | Count | Source | 52 | 955 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 955 | } |
<wast::ast::kw::outer as wast::parser::Parse>::parse Line | Count | Source | 52 | 22.8k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 22.8k | } |
<wast::ast::kw::struct as wast::parser::Parse>::parse Line | Count | Source | 52 | 2 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 2 | } |
<wast::ast::kw::module as wast::parser::Parse>::parse Line | Count | Source | 52 | 73.1k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 73.1k | } |
Unexecuted instantiation: <wast::ast::kw::assert_malformed as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::extern as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::null as wast::parser::Parse>::parse <wast::ast::kw::then as wast::parser::Parse>::parse Line | Count | Source | 52 | 1 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 1 | } |
Unexecuted instantiation: <wast::ast::kw::nan_arithmetic as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::assert_return_arithmetic_nan as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::ref as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::instantiate as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::assert_return_arithmetic_nan_f32x4 as wast::parser::Parse>::parse <wast::ast::kw::global as wast::parser::Parse>::parse Line | Count | Source | 52 | 226k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 226k | } |
Unexecuted instantiation: <wast::ast::kw::binary as wast::parser::Parse>::parse <wast::ast::kw::alias as wast::parser::Parse>::parse Line | Count | Source | 52 | 1 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 1 | } |
Unexecuted instantiation: <wast::ast::kw::i16x8 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::ref_null as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::declare as wast::parser::Parse>::parse <wast::ast::kw::import as wast::parser::Parse>::parse Line | Count | Source | 52 | 168k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 168k | } |
<wast::ast::kw::before as wast::parser::Parse>::parse Line | Count | Source | 52 | 6 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 6 | } |
Unexecuted instantiation: <wast::ast::kw::i64x2 as wast::parser::Parse>::parse Unexecuted instantiation: <wast::ast::kw::offset as wast::parser::Parse>::parse <wast::ast::kw::start as wast::parser::Parse>::parse Line | Count | Source | 52 | 490 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 490 | } |
Unexecuted instantiation: <wast::ast::kw::assert_return_canonical_nan_f32x4 as wast::parser::Parse>::parse <wast::ast::kw::elem as wast::parser::Parse>::parse Line | Count | Source | 52 | 127k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 53 | | parser.step(|c| { | 54 | | if let Some((kw, rest)) = c.keyword() { | 55 | | if kw == $kw { | 56 | | return Ok(($name(c.cur_span()), rest)); | 57 | | } | 58 | | } | 59 | | Err(c.error(concat!("expected keyword `", $kw, "`"))) | 60 | | }) | 61 | 127k | } |
|
62 | | } |
63 | | |
64 | | impl $crate::parser::Peek for $name { |
65 | 107M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { |
66 | 107M | if let Some((kw, _rest)) = cursor.keyword() { |
67 | 97.3M | kw == $kw |
68 | | } else { |
69 | 9.94M | false |
70 | | } |
71 | 107M | } Unexecuted instantiation: <wast::ast::kw::ref_func as wast::parser::Peek>::peek <wast::ast::kw::dataref as wast::parser::Peek>::peek Line | Count | Source | 65 | 163k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 163k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 31.2k | kw == $kw | 68 | | } else { | 69 | 132k | false | 70 | | } | 71 | 163k | } |
<wast::ast::kw::i16x8 as wast::parser::Peek>::peek Line | Count | Source | 65 | 906 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 906 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 906 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 906 | } |
<wast::ast::kw::eq as wast::parser::Peek>::peek Line | Count | Source | 65 | 42 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 42 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 1 | kw == $kw | 68 | | } else { | 69 | 41 | false | 70 | | } | 71 | 42 | } |
<wast::ast::kw::i64 as wast::parser::Peek>::peek Line | Count | Source | 65 | 19.3M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 19.3M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 19.3M | kw == $kw | 68 | | } else { | 69 | 5.41k | false | 70 | | } | 71 | 19.3M | } |
Unexecuted instantiation: <wast::ast::kw::nullref as wast::parser::Peek>::peek <wast::ast::kw::start as wast::parser::Peek>::peek Line | Count | Source | 65 | 458k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 458k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 458k | kw == $kw | 68 | | } else { | 69 | 11 | false | 70 | | } | 71 | 458k | } |
<wast::ast::kw::assert_return_canonical_nan as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::assert_return_func as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::assert_invalid as wast::parser::Peek>::peek Line | Count | Source | 65 | 15 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 15 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 15 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 15 | } |
<wast::ast::kw::data as wast::parser::Peek>::peek Line | Count | Source | 65 | 331k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 331k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 331k | kw == $kw | 68 | | } else { | 69 | 52 | false | 70 | | } | 71 | 331k | } |
<wast::ast::kw::invoke as wast::parser::Peek>::peek Line | Count | Source | 65 | 21 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 21 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 21 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 21 | } |
<wast::ast::kw::assert_return_arithmetic_nan_f64x2 as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::i31ref as wast::parser::Peek>::peek Line | Count | Source | 65 | 163k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 163k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 31.2k | kw == $kw | 68 | | } else { | 69 | 132k | false | 70 | | } | 71 | 163k | } |
<wast::ast::kw::f32 as wast::parser::Peek>::peek Line | Count | Source | 65 | 16.9M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 16.9M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 16.9M | kw == $kw | 68 | | } else { | 69 | 4 | false | 70 | | } | 71 | 16.9M | } |
<wast::ast::kw::param as wast::parser::Peek>::peek Line | Count | Source | 65 | 11.3M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 11.3M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 8.06M | kw == $kw | 68 | | } else { | 69 | 3.23M | false | 70 | | } | 71 | 11.3M | } |
<wast::ast::kw::ref as wast::parser::Peek>::peek Line | Count | Source | 65 | 31.8k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 31.8k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 31.8k | kw == $kw | 68 | | } else { | 69 | 21 | false | 70 | | } | 71 | 31.8k | } |
<wast::ast::kw::result as wast::parser::Peek>::peek Line | Count | Source | 65 | 9.73M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 9.73M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6.49M | kw == $kw | 68 | | } else { | 69 | 3.24M | false | 70 | | } | 71 | 9.73M | } |
<wast::ast::kw::anyref as wast::parser::Peek>::peek Line | Count | Source | 65 | 178k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 178k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 46.3k | kw == $kw | 68 | | } else { | 69 | 132k | false | 70 | | } | 71 | 178k | } |
Unexecuted instantiation: <wast::ast::kw::block as wast::parser::Peek>::peek <wast::ast::kw::event as wast::parser::Peek>::peek Line | Count | Source | 65 | 86.9k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 86.9k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 86.9k | kw == $kw | 68 | | } else { | 69 | 11 | false | 70 | | } | 71 | 86.9k | } |
<wast::ast::kw::nan_arithmetic as wast::parser::Peek>::peek Line | Count | Source | 65 | 528 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 528 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 0 | kw == $kw | 68 | | } else { | 69 | 528 | false | 70 | | } | 71 | 528 | } |
<wast::ast::kw::assert_return as wast::parser::Peek>::peek Line | Count | Source | 65 | 12 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 12 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 12 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 12 | } |
<wast::ast::kw::declare as wast::parser::Peek>::peek Line | Count | Source | 65 | 95.3k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 95.3k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 1.57k | kw == $kw | 68 | | } else { | 69 | 93.7k | false | 70 | | } | 71 | 95.3k | } |
<wast::ast::kw::assert_return_arithmetic_nan as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::delegate as wast::parser::Peek>::peek Line | Count | Source | 65 | 2 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 2 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 2 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 2 | } |
Unexecuted instantiation: <wast::ast::kw::get as wast::parser::Peek>::peek <wast::ast::kw::eqref as wast::parser::Peek>::peek Line | Count | Source | 65 | 165k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 165k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 33.1k | kw == $kw | 68 | | } else { | 69 | 132k | false | 70 | | } | 71 | 165k | } |
<wast::ast::kw::outer as wast::parser::Peek>::peek Line | Count | Source | 65 | 854k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 854k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 22.8k | kw == $kw | 68 | | } else { | 69 | 831k | false | 70 | | } | 71 | 854k | } |
<wast::ast::kw::type as wast::parser::Peek>::peek Line | Count | Source | 65 | 6.19M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6.19M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 5.89M | kw == $kw | 68 | | } else { | 69 | 306k | false | 70 | | } | 71 | 6.19M | } |
<wast::ast::kw::v128 as wast::parser::Peek>::peek Line | Count | Source | 65 | 7.56k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 7.56k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 7.55k | kw == $kw | 68 | | } else { | 69 | 4 | false | 70 | | } | 71 | 7.56k | } |
<wast::ast::kw::func as wast::parser::Peek>::peek Line | Count | Source | 65 | 2.16M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 2.16M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 2.07M | kw == $kw | 68 | | } else { | 69 | 96.0k | false | 70 | | } | 71 | 2.16M | } |
Unexecuted instantiation: <wast::ast::kw::parent as wast::parser::Peek>::peek <wast::ast::kw::assert_trap as wast::parser::Peek>::peek Line | Count | Source | 65 | 12 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 12 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 12 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 12 | } |
Unexecuted instantiation: <wast::ast::kw::try as wast::parser::Peek>::peek <wast::ast::kw::f64 as wast::parser::Peek>::peek Line | Count | Source | 65 | 11.0M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 11.0M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 11.0M | kw == $kw | 68 | | } else { | 69 | 4 | false | 70 | | } | 71 | 11.0M | } |
<wast::ast::kw::i32x4 as wast::parser::Peek>::peek Line | Count | Source | 65 | 906 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 906 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 906 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 906 | } |
<wast::ast::kw::shared as wast::parser::Peek>::peek Line | Count | Source | 65 | 5.39k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 5.39k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 0 | kw == $kw | 68 | | } else { | 69 | 5.39k | false | 70 | | } | 71 | 5.39k | } |
<wast::ast::kw::nan_canonical as wast::parser::Peek>::peek Line | Count | Source | 65 | 528 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 528 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 0 | kw == $kw | 68 | | } else { | 69 | 528 | false | 70 | | } | 71 | 528 | } |
<wast::ast::kw::any as wast::parser::Peek>::peek Line | Count | Source | 65 | 42 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 42 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 1 | kw == $kw | 68 | | } else { | 69 | 41 | false | 70 | | } | 71 | 42 | } |
<wast::ast::kw::do as wast::parser::Peek>::peek Line | Count | Source | 65 | 10 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 10 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 10 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 10 | } |
<wast::ast::kw::memory as wast::parser::Peek>::peek Line | Count | Source | 65 | 854k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 854k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 854k | kw == $kw | 68 | | } else { | 69 | 17 | false | 70 | | } | 71 | 854k | } |
<wast::ast::kw::table as wast::parser::Peek>::peek Line | Count | Source | 65 | 844k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 844k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 844k | kw == $kw | 68 | | } else { | 69 | 32 | false | 70 | | } | 71 | 844k | } |
Unexecuted instantiation: <wast::ast::kw::null as wast::parser::Peek>::peek <wast::ast::kw::assert_return_canonical_nan_f64x2 as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::binary as wast::parser::Peek>::peek Line | Count | Source | 65 | 10.7k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 10.7k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 0 | kw == $kw | 68 | | } else { | 69 | 10.7k | false | 70 | | } | 71 | 10.7k | } |
<wast::ast::kw::i8 as wast::parser::Peek>::peek Line | Count | Source | 65 | 16 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 16 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 16 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 16 | } |
<wast::ast::kw::alias as wast::parser::Peek>::peek Line | Count | Source | 65 | 26 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 26 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 21 | kw == $kw | 68 | | } else { | 69 | 5 | false | 70 | | } | 71 | 26 | } |
<wast::ast::kw::i16 as wast::parser::Peek>::peek Line | Count | Source | 65 | 16 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 16 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 16 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 16 | } |
Unexecuted instantiation: <wast::ast::kw::if as wast::parser::Peek>::peek <wast::ast::kw::i31 as wast::parser::Peek>::peek Line | Count | Source | 65 | 42 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 42 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 1 | kw == $kw | 68 | | } else { | 69 | 41 | false | 70 | | } | 71 | 42 | } |
Unexecuted instantiation: <wast::ast::kw::ref_null as wast::parser::Peek>::peek <wast::ast::kw::register as wast::parser::Peek>::peek Line | Count | Source | 65 | 15 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 15 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 15 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 15 | } |
<wast::ast::kw::funcref as wast::parser::Peek>::peek Line | Count | Source | 65 | 184k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 184k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 52.0k | kw == $kw | 68 | | } else { | 69 | 132k | false | 70 | | } | 71 | 184k | } |
<wast::ast::kw::module as wast::parser::Peek>::peek Line | Count | Source | 65 | 74.7k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 74.7k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 74.6k | kw == $kw | 68 | | } else { | 69 | 39 | false | 70 | | } | 71 | 74.7k | } |
<wast::ast::kw::mut as wast::parser::Peek>::peek Line | Count | Source | 65 | 174k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 174k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 145k | kw == $kw | 68 | | } else { | 69 | 29.8k | false | 70 | | } | 71 | 174k | } |
<wast::ast::kw::catch_all as wast::parser::Peek>::peek Line | Count | Source | 65 | 2 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 2 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 2 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 2 | } |
<wast::ast::kw::assert_malformed as wast::parser::Peek>::peek Line | Count | Source | 65 | 15 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 15 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 15 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 15 | } |
<wast::ast::kw::then as wast::parser::Peek>::peek Line | Count | Source | 65 | 13.1k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 13.1k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 13.1k | kw == $kw | 68 | | } else { | 69 | 1 | false | 70 | | } | 71 | 13.1k | } |
<wast::ast::kw::i32 as wast::parser::Peek>::peek Line | Count | Source | 65 | 20.1M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 20.1M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 20.0M | kw == $kw | 68 | | } else { | 69 | 5.41k | false | 70 | | } | 71 | 20.1M | } |
Unexecuted instantiation: <wast::ast::kw::item as wast::parser::Peek>::peek Unexecuted instantiation: <wast::ast::kw::arg as wast::parser::Peek>::peek <wast::ast::kw::catch as wast::parser::Peek>::peek Line | Count | Source | 65 | 2 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 2 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 2 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 2 | } |
<wast::ast::kw::f64x2 as wast::parser::Peek>::peek Line | Count | Source | 65 | 18 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 18 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 18 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 18 | } |
<wast::ast::kw::assert_exhaustion as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::export as wast::parser::Peek>::peek Line | Count | Source | 65 | 537k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 537k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 537k | kw == $kw | 68 | | } else { | 69 | 57 | false | 70 | | } | 71 | 537k | } |
<wast::ast::kw::anyfunc as wast::parser::Peek>::peek Line | Count | Source | 65 | 178k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 178k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 46.3k | kw == $kw | 68 | | } else { | 69 | 132k | false | 70 | | } | 71 | 178k | } |
<wast::ast::kw::field as wast::parser::Peek>::peek Line | Count | Source | 65 | 4 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 4 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 2 | kw == $kw | 68 | | } else { | 69 | 2 | false | 70 | | } | 71 | 4 | } |
<wast::ast::kw::assert_return_arithmetic_nan_f32x4 as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::global as wast::parser::Peek>::peek Line | Count | Source | 65 | 769k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 769k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 769k | kw == $kw | 68 | | } else { | 69 | 11 | false | 70 | | } | 71 | 769k | } |
<wast::ast::kw::quote as wast::parser::Peek>::peek Line | Count | Source | 65 | 22 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 22 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 0 | kw == $kw | 68 | | } else { | 69 | 22 | false | 70 | | } | 71 | 22 | } |
<wast::ast::kw::else as wast::parser::Peek>::peek Line | Count | Source | 65 | 2.05k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 2.05k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 2.05k | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 2.05k | } |
<wast::ast::kw::struct as wast::parser::Peek>::peek Line | Count | Source | 65 | 7 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 7 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 7 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 7 | } |
<wast::ast::kw::passive as wast::parser::Peek>::peek Line | Count | Source | 65 | 249k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 249k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 1 | kw == $kw | 68 | | } else { | 69 | 249k | false | 70 | | } | 71 | 249k | } |
<wast::ast::kw::assert_unlinkable as wast::parser::Peek>::peek Line | Count | Source | 65 | 4 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 4 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 4 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 4 | } |
Unexecuted instantiation: <wast::ast::kw::modulecode as wast::parser::Peek>::peek <wast::ast::kw::offset as wast::parser::Peek>::peek Line | Count | Source | 65 | 51.0k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 51.0k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 50.9k | kw == $kw | 68 | | } else { | 69 | 27 | false | 70 | | } | 71 | 51.0k | } |
Unexecuted instantiation: <wast::ast::kw::last as wast::parser::Peek>::peek <wast::ast::kw::assert_return_canonical_nan_f32x4 as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::array as wast::parser::Peek>::peek Line | Count | Source | 65 | 5 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 5 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 5 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 5 | } |
Unexecuted instantiation: <wast::ast::kw::end as wast::parser::Peek>::peek <wast::ast::kw::extern as wast::parser::Peek>::peek Line | Count | Source | 65 | 42 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 42 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 1 | kw == $kw | 68 | | } else { | 69 | 41 | false | 70 | | } | 71 | 42 | } |
<wast::ast::kw::first as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::elem as wast::parser::Peek>::peek Line | Count | Source | 65 | 458k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 458k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 458k | kw == $kw | 68 | | } else { | 69 | 11 | false | 70 | | } | 71 | 458k | } |
<wast::ast::kw::rtt as wast::parser::Peek>::peek Line | Count | Source | 65 | 4 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 4 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 4 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 4 | } |
<wast::ast::kw::f32x4 as wast::parser::Peek>::peek Line | Count | Source | 65 | 283 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 283 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 283 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 283 | } |
Unexecuted instantiation: <wast::ast::kw::loop as wast::parser::Peek>::peek <wast::ast::kw::i8x16 as wast::parser::Peek>::peek Line | Count | Source | 65 | 906 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 906 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 906 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 906 | } |
<wast::ast::kw::local as wast::parser::Peek>::peek Line | Count | Source | 65 | 1.24M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 1.24M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 336k | kw == $kw | 68 | | } else { | 69 | 906k | false | 70 | | } | 71 | 1.24M | } |
<wast::ast::kw::code as wast::parser::Peek>::peek Line | Count | Source | 65 | 3 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 3 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 3 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 3 | } |
Unexecuted instantiation: <wast::ast::kw::instantiate as wast::parser::Peek>::peek <wast::ast::kw::instance as wast::parser::Peek>::peek Line | Count | Source | 65 | 69.9k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 69.9k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 69.9k | kw == $kw | 68 | | } else { | 69 | 5 | false | 70 | | } | 71 | 69.9k | } |
<wast::ast::kw::unwind as wast::parser::Peek>::peek Line | Count | Source | 65 | 2 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 2 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 2 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 2 | } |
<wast::ast::kw::before as wast::parser::Peek>::peek Line | Count | Source | 65 | 6 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 6 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 6 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 6 | } |
<wast::ast::kw::i64x2 as wast::parser::Peek>::peek Line | Count | Source | 65 | 283 | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 283 | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 283 | kw == $kw | 68 | | } else { | 69 | 0 | false | 70 | | } | 71 | 283 | } |
Unexecuted instantiation: <wast::ast::kw::after as wast::parser::Peek>::peek <wast::ast::kw::externref as wast::parser::Peek>::peek Line | Count | Source | 65 | 178k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 178k | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 46.3k | kw == $kw | 68 | | } else { | 69 | 132k | false | 70 | | } | 71 | 178k | } |
<wast::ast::kw::import as wast::parser::Peek>::peek Line | Count | Source | 65 | 1.92M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 66 | 1.92M | if let Some((kw, _rest)) = cursor.keyword() { | 67 | 1.92M | kw == $kw | 68 | | } else { | 69 | 21 | false | 70 | | } | 71 | 1.92M | } |
|
72 | | |
73 | 50.8M | fn display() -> &'static str {<wast::ast::kw::externref as wast::parser::Peek>::display Line | Count | Source | 73 | 7.53k | fn display() -> &'static str { |
<wast::ast::kw::func as wast::parser::Peek>::display Line | Count | Source | 73 | 127k | fn display() -> &'static str { |
<wast::ast::kw::funcref as wast::parser::Peek>::display Line | Count | Source | 73 | 7.53k | fn display() -> &'static str { |
<wast::ast::kw::assert_invalid as wast::parser::Peek>::display Line | Count | Source | 73 | 15 | fn display() -> &'static str { |
<wast::ast::kw::data as wast::parser::Peek>::display Line | Count | Source | 73 | 32 | fn display() -> &'static str { |
<wast::ast::kw::invoke as wast::parser::Peek>::display Line | Count | Source | 73 | 13 | fn display() -> &'static str { |
<wast::ast::kw::i8 as wast::parser::Peek>::display Line | Count | Source | 73 | 16 | fn display() -> &'static str { |
<wast::ast::kw::assert_return_arithmetic_nan_f64x2 as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::i16 as wast::parser::Peek>::display Line | Count | Source | 73 | 16 | fn display() -> &'static str { |
<wast::ast::kw::event as wast::parser::Peek>::display Line | Count | Source | 73 | 33 | fn display() -> &'static str { |
<wast::ast::kw::i31 as wast::parser::Peek>::display Line | Count | Source | 73 | 32 | fn display() -> &'static str { |
<wast::ast::kw::eqref as wast::parser::Peek>::display Line | Count | Source | 73 | 3 | fn display() -> &'static str { |
<wast::ast::kw::register as wast::parser::Peek>::display Line | Count | Source | 73 | 15 | fn display() -> &'static str { |
<wast::ast::kw::struct as wast::parser::Peek>::display Line | Count | Source | 73 | 5 | fn display() -> &'static str { |
<wast::ast::kw::v128 as wast::parser::Peek>::display Line | Count | Source | 73 | 7.55k | fn display() -> &'static str { |
<wast::ast::kw::module as wast::parser::Peek>::display Line | Count | Source | 73 | 27 | fn display() -> &'static str { |
<wast::ast::kw::assert_trap as wast::parser::Peek>::display Line | Count | Source | 73 | 12 | fn display() -> &'static str { |
<wast::ast::kw::assert_malformed as wast::parser::Peek>::display Line | Count | Source | 73 | 15 | fn display() -> &'static str { |
<wast::ast::kw::dataref as wast::parser::Peek>::display Line | Count | Source | 73 | 3 | fn display() -> &'static str { |
<wast::ast::kw::i32x4 as wast::parser::Peek>::display Line | Count | Source | 73 | 283 | fn display() -> &'static str { |
<wast::ast::kw::f64 as wast::parser::Peek>::display Line | Count | Source | 73 | 7.55k | fn display() -> &'static str { |
<wast::ast::kw::memory as wast::parser::Peek>::display Line | Count | Source | 73 | 103k | fn display() -> &'static str { |
<wast::ast::kw::f32 as wast::parser::Peek>::display Line | Count | Source | 73 | 11.0M | fn display() -> &'static str { |
<wast::ast::kw::param as wast::parser::Peek>::display Line | Count | Source | 73 | 3.12M | fn display() -> &'static str { |
<wast::ast::kw::assert_exhaustion as wast::parser::Peek>::display Line | Count | Source | 73 | 4 | fn display() -> &'static str { |
<wast::ast::kw::assert_unlinkable as wast::parser::Peek>::display Line | Count | Source | 73 | 4 | fn display() -> &'static str { |
<wast::ast::kw::i16x8 as wast::parser::Peek>::display Line | Count | Source | 73 | 906 | fn display() -> &'static str { |
<wast::ast::kw::instance as wast::parser::Peek>::display Line | Count | Source | 73 | 10 | fn display() -> &'static str { |
<wast::ast::kw::rtt as wast::parser::Peek>::display Line | Count | Source | 73 | 4 | fn display() -> &'static str { |
<wast::ast::kw::i64x2 as wast::parser::Peek>::display Line | Count | Source | 73 | 283 | fn display() -> &'static str { |
<wast::ast::kw::assert_return_canonical_nan_f32x4 as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::assert_return_func as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::i32 as wast::parser::Peek>::display Line | Count | Source | 73 | 19.3M | fn display() -> &'static str { |
<wast::ast::kw::i8x16 as wast::parser::Peek>::display Line | Count | Source | 73 | 906 | fn display() -> &'static str { |
<wast::ast::kw::assert_return_canonical_nan as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::i31ref as wast::parser::Peek>::display Line | Count | Source | 73 | 3 | fn display() -> &'static str { |
<wast::ast::kw::assert_return_arithmetic_nan_f32x4 as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::anyfunc as wast::parser::Peek>::display Line | Count | Source | 73 | 7.53k | fn display() -> &'static str { |
<wast::ast::kw::global as wast::parser::Peek>::display Line | Count | Source | 73 | 4.87k | fn display() -> &'static str { |
<wast::ast::kw::anyref as wast::parser::Peek>::display Line | Count | Source | 73 | 958 | fn display() -> &'static str { |
<wast::ast::kw::type as wast::parser::Peek>::display Line | Count | Source | 73 | 1 | fn display() -> &'static str { |
<wast::ast::kw::assert_return as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::array as wast::parser::Peek>::display Line | Count | Source | 73 | 4 | fn display() -> &'static str { |
<wast::ast::kw::eq as wast::parser::Peek>::display Line | Count | Source | 73 | 32 | fn display() -> &'static str { |
<wast::ast::kw::first as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::extern as wast::parser::Peek>::display Line | Count | Source | 73 | 32 | fn display() -> &'static str { |
<wast::ast::kw::i64 as wast::parser::Peek>::display Line | Count | Source | 73 | 16.9M | fn display() -> &'static str { |
<wast::ast::kw::f32x4 as wast::parser::Peek>::display Line | Count | Source | 73 | 18 | fn display() -> &'static str { |
<wast::ast::kw::table as wast::parser::Peek>::display Line | Count | Source | 73 | 114k | fn display() -> &'static str { |
<wast::ast::kw::any as wast::parser::Peek>::display Line | Count | Source | 73 | 32 | fn display() -> &'static str { |
<wast::ast::kw::assert_return_arithmetic_nan as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
<wast::ast::kw::assert_return_canonical_nan_f64x2 as wast::parser::Peek>::display Line | Count | Source | 73 | 6 | fn display() -> &'static str { |
|
74 | | concat!("`", $kw, "`") |
75 | | } |
76 | | } |
77 | | }; |
78 | | } |
79 | | |
80 | | /// A macro for defining custom reserved symbols. |
81 | | /// |
82 | | /// This is like `custom_keyword!` but for reserved symbols (`Token::Reserved`) |
83 | | /// instead of keywords (`Token::Keyword`). |
84 | | /// |
85 | | /// ``` |
86 | | /// use wast::parser::{Parser, Result, Parse}; |
87 | | /// |
88 | | /// // Define a custom reserved symbol, the "spaceship" operator: `<=>`. |
89 | | /// wast::custom_reserved!(spaceship = "<=>"); |
90 | | /// |
91 | | /// /// A "three-way comparison" like `(<=> a b)` that returns -1 if `a` is less |
92 | | /// /// than `b`, 0 if they're equal, and 1 if `a` is greater than `b`. |
93 | | /// struct ThreeWayComparison<'a> { |
94 | | /// lhs: wast::Expression<'a>, |
95 | | /// rhs: wast::Expression<'a>, |
96 | | /// } |
97 | | /// |
98 | | /// impl<'a> Parse<'a> for ThreeWayComparison<'a> { |
99 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
100 | | /// parser.parse::<spaceship>()?; |
101 | | /// let lhs = parser.parse()?; |
102 | | /// let rhs = parser.parse()?; |
103 | | /// Ok(ThreeWayComparison { lhs, rhs }) |
104 | | /// } |
105 | | /// } |
106 | | /// ``` |
107 | | #[macro_export] |
108 | | macro_rules! custom_reserved { |
109 | | ($name:ident) => { |
110 | | $crate::custom_reserved!($name = stringify!($name)); |
111 | | }; |
112 | | ($name:ident = $rsv:expr) => { |
113 | | #[allow(non_camel_case_types)] |
114 | | #[allow(missing_docs)] |
115 | | #[derive(Debug)] |
116 | | pub struct $name(pub $crate::Span); |
117 | | |
118 | | impl<'a> $crate::parser::Parse<'a> for $name { |
119 | | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { |
120 | | parser.step(|c| { |
121 | | if let Some((rsv, rest)) = c.reserved() { |
122 | | if rsv == $rsv { |
123 | | return Ok(($name(c.cur_span()), rest)); |
124 | | } |
125 | | } |
126 | | Err(c.error(concat!("expected reserved symbol `", $rsv, "`"))) |
127 | | }) |
128 | | } |
129 | | } |
130 | | |
131 | | impl $crate::parser::Peek for $name { |
132 | | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { |
133 | | if let Some((rsv, _rest)) = cursor.reserved() { |
134 | | rsv == $rsv |
135 | | } else { |
136 | | false |
137 | | } |
138 | | } |
139 | | |
140 | | fn display() -> &'static str { |
141 | | concat!("`", $rsv, "`") |
142 | | } |
143 | | } |
144 | | }; |
145 | | } |
146 | | |
147 | | /// A macro, like [`custom_keyword`], to create a type which can be used to |
148 | | /// parse/peek annotation directives. |
149 | | /// |
150 | | /// Note that when you're parsing custom annotations it can be somewhat tricky |
151 | | /// due to the nature that most of them are skipped. You'll want to be sure to |
152 | | /// consult the documentation of [`Parser::register_annotation`][register] when |
153 | | /// using this macro. |
154 | | /// |
155 | | /// # Examples |
156 | | /// |
157 | | /// To see an example of how to use this macro, let's invent our own syntax for |
158 | | /// the [producers section][section] which looks like: |
159 | | /// |
160 | | /// ```wat |
161 | | /// (@producer "wat" "1.0.2") |
162 | | /// ``` |
163 | | /// |
164 | | /// Here, for simplicity, we'll assume everything is a `processed-by` directive, |
165 | | /// but you could get much more fancy with this as well. |
166 | | /// |
167 | | /// ``` |
168 | | /// # use wast::*; |
169 | | /// # use wast::parser::*; |
170 | | /// |
171 | | /// // First we define the custom annotation keyword we're using, and by |
172 | | /// // convention we define it in an `annotation` module. |
173 | | /// mod annotation { |
174 | | /// wast::annotation!(producer); |
175 | | /// } |
176 | | /// |
177 | | /// struct Producer<'a> { |
178 | | /// name: &'a str, |
179 | | /// version: &'a str, |
180 | | /// } |
181 | | /// |
182 | | /// impl<'a> Parse<'a> for Producer<'a> { |
183 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
184 | | /// // Remember that parser conventionally parse the *interior* of an |
185 | | /// // s-expression, so we parse our `@producer` annotation and then we |
186 | | /// // parse the payload of our annotation. |
187 | | /// parser.parse::<annotation::producer>()?; |
188 | | /// Ok(Producer { |
189 | | /// name: parser.parse()?, |
190 | | /// version: parser.parse()?, |
191 | | /// }) |
192 | | /// } |
193 | | /// } |
194 | | /// ``` |
195 | | /// |
196 | | /// Note though that this is only half of the parser for annotations. The other |
197 | | /// half is calling the [`register_annotation`][register] method at the right |
198 | | /// time to ensure the parser doesn't automatically skip our `@producer` |
199 | | /// directive. Note that we *can't* call it inside the `Parse for Producer` |
200 | | /// definition because that's too late and the annotation would already have |
201 | | /// been skipped. |
202 | | /// |
203 | | /// Instead we'll need to call it from a higher level-parser before the |
204 | | /// parenthesis have been parsed, like so: |
205 | | /// |
206 | | /// ``` |
207 | | /// # use wast::*; |
208 | | /// # use wast::parser::*; |
209 | | /// struct Module<'a> { |
210 | | /// fields: Vec<ModuleField<'a>>, |
211 | | /// } |
212 | | /// |
213 | | /// impl<'a> Parse<'a> for Module<'a> { |
214 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
215 | | /// // .. parse module header here ... |
216 | | /// |
217 | | /// // register our custom `@producer` annotation before we start |
218 | | /// // parsing the parentheses of each field |
219 | | /// let _r = parser.register_annotation("producer"); |
220 | | /// |
221 | | /// let mut fields = Vec::new(); |
222 | | /// while !parser.is_empty() { |
223 | | /// fields.push(parser.parens(|p| p.parse())?); |
224 | | /// } |
225 | | /// Ok(Module { fields }) |
226 | | /// } |
227 | | /// } |
228 | | /// |
229 | | /// enum ModuleField<'a> { |
230 | | /// Producer(Producer<'a>), |
231 | | /// // ... |
232 | | /// } |
233 | | /// # struct Producer<'a>(&'a str); |
234 | | /// # impl<'a> Parse<'a> for Producer<'a> { |
235 | | /// # fn parse(parser: Parser<'a>) -> Result<Self> { Ok(Producer(parser.parse()?)) } |
236 | | /// # } |
237 | | /// # mod annotation { wast::annotation!(producer); } |
238 | | /// |
239 | | /// impl<'a> Parse<'a> for ModuleField<'a> { |
240 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
241 | | /// // and here `peek` works and our delegated parsing works because the |
242 | | /// // annotation has been registered. |
243 | | /// if parser.peek::<annotation::producer>() { |
244 | | /// return Ok(ModuleField::Producer(parser.parse()?)); |
245 | | /// } |
246 | | /// |
247 | | /// // .. typically we'd parse other module fields here... |
248 | | /// |
249 | | /// Err(parser.error("unknown module field")) |
250 | | /// } |
251 | | /// } |
252 | | /// ``` |
253 | | /// |
254 | | /// [register]: crate::parser::Parser::register_annotation |
255 | | /// [section]: https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md |
256 | | #[macro_export] |
257 | | macro_rules! annotation { |
258 | | ($name:ident) => { |
259 | | $crate::annotation!($name = stringify!($name)); |
260 | | }; |
261 | | ($name:ident = $annotation:expr) => { |
262 | | #[allow(non_camel_case_types)] |
263 | | #[allow(missing_docs)] |
264 | | #[derive(Debug)] |
265 | | pub struct $name(pub $crate::Span); |
266 | | |
267 | | impl<'a> $crate::parser::Parse<'a> for $name { |
268 | 251k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { |
269 | 251k | parser.step(|c| { |
270 | 251k | if let Some((a, rest)) = c.annotation() { |
271 | 251k | if a == $annotation { |
272 | 251k | return Ok(($name(c.cur_span()), rest)); |
273 | 0 | } |
274 | 0 | } |
275 | 0 | Err(c.error(concat!("expected annotation `@", $annotation, "`"))) |
276 | 251k | }) <wast::ast::annotation::custom as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 269 | 6 | parser.step(|c| { | 270 | 6 | if let Some((a, rest)) = c.annotation() { | 271 | 6 | if a == $annotation { | 272 | 6 | return Ok(($name(c.cur_span()), rest)); | 273 | 0 | } | 274 | 0 | } | 275 | 0 | Err(c.error(concat!("expected annotation `@", $annotation, "`"))) | 276 | 6 | }) |
<wast::ast::annotation::name as wast::parser::Parse>::parse::{closure#0}Line | Count | Source | 269 | 251k | parser.step(|c| { | 270 | 251k | if let Some((a, rest)) = c.annotation() { | 271 | 251k | if a == $annotation { | 272 | 251k | return Ok(($name(c.cur_span()), rest)); | 273 | 0 | } | 274 | 0 | } | 275 | 0 | Err(c.error(concat!("expected annotation `@", $annotation, "`"))) | 276 | 251k | }) |
|
277 | 251k | } <wast::ast::annotation::custom as wast::parser::Parse>::parse Line | Count | Source | 268 | 6 | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 269 | | parser.step(|c| { | 270 | | if let Some((a, rest)) = c.annotation() { | 271 | | if a == $annotation { | 272 | | return Ok(($name(c.cur_span()), rest)); | 273 | | } | 274 | | } | 275 | | Err(c.error(concat!("expected annotation `@", $annotation, "`"))) | 276 | | }) | 277 | 6 | } |
<wast::ast::annotation::name as wast::parser::Parse>::parse Line | Count | Source | 268 | 251k | fn parse(parser: $crate::parser::Parser<'a>) -> $crate::parser::Result<Self> { | 269 | | parser.step(|c| { | 270 | | if let Some((a, rest)) = c.annotation() { | 271 | | if a == $annotation { | 272 | | return Ok(($name(c.cur_span()), rest)); | 273 | | } | 274 | | } | 275 | | Err(c.error(concat!("expected annotation `@", $annotation, "`"))) | 276 | | }) | 277 | 251k | } |
|
278 | | } |
279 | | |
280 | | impl $crate::parser::Peek for $name { |
281 | 2.27M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { |
282 | 2.27M | if let Some((a, _rest)) = cursor.annotation() { |
283 | 251k | a == $annotation |
284 | | } else { |
285 | 2.01M | false |
286 | | } |
287 | 2.27M | } <wast::ast::annotation::custom as wast::parser::Peek>::peek Line | Count | Source | 281 | 69.9k | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 282 | 69.9k | if let Some((a, _rest)) = cursor.annotation() { | 283 | 6 | a == $annotation | 284 | | } else { | 285 | 69.9k | false | 286 | | } | 287 | 69.9k | } |
<wast::ast::annotation::name as wast::parser::Peek>::peek Line | Count | Source | 281 | 2.20M | fn peek(cursor: $crate::parser::Cursor<'_>) -> bool { | 282 | 2.20M | if let Some((a, _rest)) = cursor.annotation() { | 283 | 251k | a == $annotation | 284 | | } else { | 285 | 1.94M | false | 286 | | } | 287 | 2.20M | } |
|
288 | | |
289 | | fn display() -> &'static str { |
290 | | concat!("`@", $annotation, "`") |
291 | | } |
292 | | } |
293 | | }; |
294 | | } |
295 | | |
296 | | macro_rules! reexport { |
297 | | ($(mod $name:ident;)*) => ($(mod $name; pub use self::$name::*;)*); |
298 | | } |
299 | | |
300 | | reexport! { |
301 | | mod token; |
302 | | } |
303 | | |
304 | | #[cfg(feature = "wasm-module")] |
305 | | reexport! { |
306 | | mod alias; |
307 | | mod assert_expr; |
308 | | mod custom; |
309 | | mod event; |
310 | | mod export; |
311 | | mod expr; |
312 | | mod func; |
313 | | mod global; |
314 | | mod import; |
315 | | mod instance; |
316 | | mod memory; |
317 | | mod module; |
318 | | mod nested_module; |
319 | | mod table; |
320 | | mod types; |
321 | | mod wast; |
322 | | } |
323 | | |
324 | | /// Common keyword used to parse WebAssembly text files. |
325 | | pub mod kw { |
326 | | custom_keyword!(after); |
327 | | custom_keyword!(alias); |
328 | | custom_keyword!(any); |
329 | | custom_keyword!(anyfunc); |
330 | | custom_keyword!(anyref); |
331 | | custom_keyword!(arg); |
332 | | custom_keyword!(array); |
333 | | custom_keyword!(assert_exhaustion); |
334 | | custom_keyword!(assert_invalid); |
335 | | custom_keyword!(assert_malformed); |
336 | | custom_keyword!(assert_return); |
337 | | custom_keyword!(assert_return_arithmetic_nan); |
338 | | custom_keyword!(assert_return_arithmetic_nan_f32x4); |
339 | | custom_keyword!(assert_return_arithmetic_nan_f64x2); |
340 | | custom_keyword!(assert_return_canonical_nan); |
341 | | custom_keyword!(assert_return_canonical_nan_f32x4); |
342 | | custom_keyword!(assert_return_canonical_nan_f64x2); |
343 | | custom_keyword!(assert_return_func); |
344 | | custom_keyword!(assert_trap); |
345 | | custom_keyword!(assert_unlinkable); |
346 | | custom_keyword!(before); |
347 | | custom_keyword!(binary); |
348 | | custom_keyword!(block); |
349 | | custom_keyword!(catch); |
350 | | custom_keyword!(catch_all); |
351 | | custom_keyword!(code); |
352 | | custom_keyword!(data); |
353 | | custom_keyword!(dataref); |
354 | | custom_keyword!(declare); |
355 | | custom_keyword!(delegate); |
356 | | custom_keyword!(r#do = "do"); |
357 | | custom_keyword!(elem); |
358 | | custom_keyword!(end); |
359 | | custom_keyword!(event); |
360 | | custom_keyword!(export); |
361 | | custom_keyword!(r#extern = "extern"); |
362 | | custom_keyword!(externref); |
363 | | custom_keyword!(eq); |
364 | | custom_keyword!(eqref); |
365 | | custom_keyword!(f32); |
366 | | custom_keyword!(f32x4); |
367 | | custom_keyword!(f64); |
368 | | custom_keyword!(f64x2); |
369 | | custom_keyword!(field); |
370 | | custom_keyword!(first); |
371 | | custom_keyword!(func); |
372 | | custom_keyword!(funcref); |
373 | | custom_keyword!(get); |
374 | | custom_keyword!(global); |
375 | | custom_keyword!(i16); |
376 | | custom_keyword!(i16x8); |
377 | | custom_keyword!(i31); |
378 | | custom_keyword!(i31ref); |
379 | | custom_keyword!(i32); |
380 | | custom_keyword!(i32x4); |
381 | | custom_keyword!(i64); |
382 | | custom_keyword!(i64x2); |
383 | | custom_keyword!(i8); |
384 | | custom_keyword!(i8x16); |
385 | | custom_keyword!(import); |
386 | | custom_keyword!(instance); |
387 | | custom_keyword!(instantiate); |
388 | | custom_keyword!(invoke); |
389 | | custom_keyword!(item); |
390 | | custom_keyword!(last); |
391 | | custom_keyword!(local); |
392 | | custom_keyword!(memory); |
393 | | custom_keyword!(module); |
394 | | custom_keyword!(modulecode); |
395 | | custom_keyword!(nan_arithmetic = "nan:arithmetic"); |
396 | | custom_keyword!(nan_canonical = "nan:canonical"); |
397 | | custom_keyword!(null); |
398 | | custom_keyword!(nullref); |
399 | | custom_keyword!(offset); |
400 | | custom_keyword!(outer); |
401 | | custom_keyword!(param); |
402 | | custom_keyword!(parent); |
403 | | custom_keyword!(passive); |
404 | | custom_keyword!(quote); |
405 | | custom_keyword!(r#else = "else"); |
406 | | custom_keyword!(r#if = "if"); |
407 | | custom_keyword!(r#loop = "loop"); |
408 | | custom_keyword!(r#mut = "mut"); |
409 | | custom_keyword!(r#type = "type"); |
410 | | custom_keyword!(r#ref = "ref"); |
411 | | custom_keyword!(ref_func = "ref.func"); |
412 | | custom_keyword!(ref_null = "ref.null"); |
413 | | custom_keyword!(register); |
414 | | custom_keyword!(result); |
415 | | custom_keyword!(rtt); |
416 | | custom_keyword!(shared); |
417 | | custom_keyword!(start); |
418 | | custom_keyword!(r#struct = "struct"); |
419 | | custom_keyword!(table); |
420 | | custom_keyword!(then); |
421 | | custom_keyword!(r#try = "try"); |
422 | | custom_keyword!(unwind); |
423 | | custom_keyword!(v128); |
424 | | } |
425 | | |
426 | | /// Common annotations used to parse WebAssembly text files. |
427 | | pub mod annotation { |
428 | | annotation!(custom); |
429 | | annotation!(name); |
430 | | } |