/src/wasm-tools/crates/wast/src/parser.rs
Line | Count | Source |
1 | | //! Traits for parsing the WebAssembly Text format |
2 | | //! |
3 | | //! This module contains the traits, abstractions, and utilities needed to |
4 | | //! define custom parsers for WebAssembly text format items. This module exposes |
5 | | //! a recursive descent parsing strategy and centers around the [`Parse`] trait |
6 | | //! for defining new fragments of WebAssembly text syntax. |
7 | | //! |
8 | | //! The top-level [`parse`] function can be used to fully parse AST fragments: |
9 | | //! |
10 | | //! ``` |
11 | | //! use wast::Wat; |
12 | | //! use wast::parser::{self, ParseBuffer}; |
13 | | //! |
14 | | //! # fn foo() -> Result<(), wast::Error> { |
15 | | //! let wat = "(module (func))"; |
16 | | //! let buf = ParseBuffer::new(wat)?; |
17 | | //! let module = parser::parse::<Wat>(&buf)?; |
18 | | //! # Ok(()) |
19 | | //! # } |
20 | | //! ``` |
21 | | //! |
22 | | //! and you can also define your own new syntax with the [`Parse`] trait: |
23 | | //! |
24 | | //! ``` |
25 | | //! use wast::kw; |
26 | | //! use wast::core::{Imports, Func}; |
27 | | //! use wast::parser::{Parser, Parse, Result}; |
28 | | //! |
29 | | //! // Fields of a WebAssembly which only allow imports and functions, and all |
30 | | //! // imports must come before all the functions |
31 | | //! struct OnlyImportsAndFunctions<'a> { |
32 | | //! imports: Vec<Imports<'a>>, |
33 | | //! functions: Vec<Func<'a>>, |
34 | | //! } |
35 | | //! |
36 | | //! impl<'a> Parse<'a> for OnlyImportsAndFunctions<'a> { |
37 | | //! fn parse(parser: Parser<'a>) -> Result<Self> { |
38 | | //! // While the second token is `import` (the first is `(`, so we care |
39 | | //! // about the second) we parse an `ast::ModuleImport` inside of |
40 | | //! // parentheses. The `parens` function here ensures that what we |
41 | | //! // parse inside of it is surrounded by `(` and `)`. |
42 | | //! let mut imports = Vec::new(); |
43 | | //! while parser.peek2::<kw::import>()? { |
44 | | //! let import = parser.parens(|p| p.parse())?; |
45 | | //! imports.push(import); |
46 | | //! } |
47 | | //! |
48 | | //! // Afterwards we assume everything else is a function. Note that |
49 | | //! // `parse` here is a generic function and type inference figures out |
50 | | //! // that we're parsing functions here and imports above. |
51 | | //! let mut functions = Vec::new(); |
52 | | //! while !parser.is_empty() { |
53 | | //! let func = parser.parens(|p| p.parse())?; |
54 | | //! functions.push(func); |
55 | | //! } |
56 | | //! |
57 | | //! Ok(OnlyImportsAndFunctions { imports, functions }) |
58 | | //! } |
59 | | //! } |
60 | | //! ``` |
61 | | //! |
62 | | //! This module is heavily inspired by [`syn`](https://docs.rs/syn) so you can |
63 | | //! likely also draw inspiration from the excellent examples in the `syn` crate. |
64 | | |
65 | | use crate::Error; |
66 | | use crate::lexer::{Float, Integer, Lexer, Token, TokenKind}; |
67 | | use crate::token::Span; |
68 | | use bumpalo::Bump; |
69 | | use std::borrow::Cow; |
70 | | use std::cell::{Cell, RefCell}; |
71 | | use std::collections::HashMap; |
72 | | use std::fmt; |
73 | | use std::usize; |
74 | | |
75 | | /// The maximum recursive depth of parens to parse. |
76 | | /// |
77 | | /// This is sort of a fundamental limitation of the way this crate is |
78 | | /// designed. Everything is done through recursive descent parsing which |
79 | | /// means, well, that we're recursively going down the stack as we parse |
80 | | /// nested data structures. While we can handle this for wasm expressions |
81 | | /// since that's a pretty local decision, handling this for nested |
82 | | /// modules/components which be far trickier. For now we just say that when |
83 | | /// the parser goes too deep we return an error saying there's too many |
84 | | /// nested items. It would be great to not return an error here, though! |
85 | | #[cfg(feature = "wasm-module")] |
86 | | pub(crate) const MAX_PARENS_DEPTH: usize = 100; |
87 | | |
88 | | /// A top-level convenience parsing function that parses a `T` from `buf` and |
89 | | /// requires that all tokens in `buf` are consume. |
90 | | /// |
91 | | /// This generic parsing function can be used to parse any `T` implementing the |
92 | | /// [`Parse`] trait. It is not used from [`Parse`] trait implementations. |
93 | | /// |
94 | | /// # Examples |
95 | | /// |
96 | | /// ``` |
97 | | /// use wast::Wat; |
98 | | /// use wast::parser::{self, ParseBuffer}; |
99 | | /// |
100 | | /// # fn foo() -> Result<(), wast::Error> { |
101 | | /// let wat = "(module (func))"; |
102 | | /// let buf = ParseBuffer::new(wat)?; |
103 | | /// let module = parser::parse::<Wat>(&buf)?; |
104 | | /// # Ok(()) |
105 | | /// # } |
106 | | /// ``` |
107 | | /// |
108 | | /// or parsing simply a fragment |
109 | | /// |
110 | | /// ``` |
111 | | /// use wast::parser::{self, ParseBuffer}; |
112 | | /// |
113 | | /// # fn foo() -> Result<(), wast::Error> { |
114 | | /// let wat = "12"; |
115 | | /// let buf = ParseBuffer::new(wat)?; |
116 | | /// let val = parser::parse::<u32>(&buf)?; |
117 | | /// assert_eq!(val, 12); |
118 | | /// # Ok(()) |
119 | | /// # } |
120 | | /// ``` |
121 | 14.9k | pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> { |
122 | 14.9k | let parser = buf.parser(); |
123 | 14.9k | let result = parser.parse()?; |
124 | 10.8k | if parser.cursor().token()?.is_none() { |
125 | 10.8k | Ok(result) |
126 | | } else { |
127 | 28 | Err(parser.error("extra tokens remaining after parse")) |
128 | | } |
129 | 14.9k | } wast::parser::parse::<wast::wast::Wast> Line | Count | Source | 121 | 2.23k | pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> { | 122 | 2.23k | let parser = buf.parser(); | 123 | 2.23k | let result = parser.parse()?; | 124 | 22 | if parser.cursor().token()?.is_none() { | 125 | 8 | Ok(result) | 126 | | } else { | 127 | 14 | Err(parser.error("extra tokens remaining after parse")) | 128 | | } | 129 | 2.23k | } |
wast::parser::parse::<wast::wat::Wat> Line | Count | Source | 121 | 12.7k | pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> { | 122 | 12.7k | let parser = buf.parser(); | 123 | 12.7k | let result = parser.parse()?; | 124 | 10.8k | if parser.cursor().token()?.is_none() { | 125 | 10.8k | Ok(result) | 126 | | } else { | 127 | 14 | Err(parser.error("extra tokens remaining after parse")) | 128 | | } | 129 | 12.7k | } |
|
130 | | |
131 | | /// A trait for parsing a fragment of syntax in a recursive descent fashion. |
132 | | /// |
133 | | /// The [`Parse`] trait is the main abstraction you'll be working with when |
134 | | /// defining custom parsers or custom syntax for your WebAssembly text format |
135 | | /// (or when using the official format items). Almost all items in the |
136 | | /// [`core`](crate::core) module implement the [`Parse`] trait, and you'll |
137 | | /// commonly use this with: |
138 | | /// |
139 | | /// * The top-level [`parse`] function to parse an entire input. |
140 | | /// * The intermediate [`Parser::parse`] function to parse an item out of an |
141 | | /// input stream and then parse remaining items. |
142 | | /// |
143 | | /// Implementation of [`Parse`] take a [`Parser`] as input and will mutate the |
144 | | /// parser as they parse syntax. Once a token is consumed it cannot be |
145 | | /// "un-consumed". Utilities such as [`Parser::peek`] and [`Parser::lookahead1`] |
146 | | /// can be used to determine what to parse next. |
147 | | /// |
148 | | /// ## When to parse `(` and `)`? |
149 | | /// |
150 | | /// Conventionally types are not responsible for parsing their own `(` and `)` |
151 | | /// tokens which surround the type. For example, WebAssembly globals look like: |
152 | | /// |
153 | | /// ```text |
154 | | /// (global (mut i32)) |
155 | | /// ``` |
156 | | /// |
157 | | /// But the [`Global`](crate::core::Global) type parser looks like: |
158 | | /// |
159 | | /// ``` |
160 | | /// # use wast::kw; |
161 | | /// # use wast::parser::{Parser, Parse, Result}; |
162 | | /// # struct Global<'a>(&'a str); |
163 | | /// impl<'a> Parse<'a> for Global<'a> { |
164 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
165 | | /// parser.parse::<kw::global>()?; |
166 | | /// // ... |
167 | | /// # panic!() |
168 | | /// } |
169 | | /// } |
170 | | /// ``` |
171 | | /// |
172 | | /// It is assumed here that the `(` and `)` tokens which surround a `global` |
173 | | /// statement in the WebAssembly text format are parsed by the parent item |
174 | | /// parsing `Global`. |
175 | | /// |
176 | | /// Note that this is just a convention, so it's not necessarily required for |
177 | | /// all types. It's recommended that your types stick to this convention where |
178 | | /// possible to avoid nested calls to [`Parser::parens`] or accidentally trying |
179 | | /// to parse too many parentheses. |
180 | | /// |
181 | | /// # Examples |
182 | | /// |
183 | | /// Let's say you want to define your own WebAssembly text format which only |
184 | | /// contains globals and functions. You also require all globals to be listed |
185 | | /// before all functions. An example [`Parse`] implementation might look like: |
186 | | /// |
187 | | /// ``` |
188 | | /// use wast::core::{Global, Func}; |
189 | | /// use wast::kw; |
190 | | /// use wast::parser::{Parser, Parse, Result}; |
191 | | /// |
192 | | /// // Fields of a WebAssembly which only allow globals and functions, and all |
193 | | /// // globals must come before all the functions |
194 | | /// struct OnlyGlobalsAndFunctions<'a> { |
195 | | /// globals: Vec<Global<'a>>, |
196 | | /// functions: Vec<Func<'a>>, |
197 | | /// } |
198 | | /// |
199 | | /// impl<'a> Parse<'a> for OnlyGlobalsAndFunctions<'a> { |
200 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
201 | | /// // While the second token is `global` (the first is `(`, so we care |
202 | | /// // about the second) we parse a `Global` inside of parentheses. The |
203 | | /// // `parens` function here ensures that what we parse inside of it |
204 | | /// // is surrounded by `(` and `)`. |
205 | | /// let mut globals = Vec::new(); |
206 | | /// while parser.peek2::<kw::global>()? { |
207 | | /// let global = parser.parens(|p| p.parse())?; |
208 | | /// globals.push(global); |
209 | | /// } |
210 | | /// |
211 | | /// // Afterwards we assume everything else is a function. Note that |
212 | | /// // `parse` here is a generic function and type inference figures out |
213 | | /// // that we're parsing functions here and globals above. |
214 | | /// let mut functions = Vec::new(); |
215 | | /// while !parser.is_empty() { |
216 | | /// let func = parser.parens(|p| p.parse())?; |
217 | | /// functions.push(func); |
218 | | /// } |
219 | | /// |
220 | | /// Ok(OnlyGlobalsAndFunctions { globals, functions }) |
221 | | /// } |
222 | | /// } |
223 | | /// ``` |
224 | | pub trait Parse<'a>: Sized { |
225 | | /// Attempts to parse `Self` from `parser`, returning an error if it could |
226 | | /// not be parsed. |
227 | | /// |
228 | | /// This method will mutate the state of `parser` after attempting to parse |
229 | | /// an instance of `Self`. If an error happens then it is likely fatal and |
230 | | /// there is no guarantee of how many tokens have been consumed from |
231 | | /// `parser`. |
232 | | /// |
233 | | /// As recommended in the documentation of [`Parse`], implementations of |
234 | | /// this function should not start out by parsing `(` and `)` tokens, but |
235 | | /// rather parents calling recursive parsers should parse the `(` and `)` |
236 | | /// tokens for their child item that's being parsed. |
237 | | /// |
238 | | /// # Errors |
239 | | /// |
240 | | /// This function will return an error if `Self` could not be parsed. Note |
241 | | /// that creating an [`Error`] is not exactly a cheap operation, so |
242 | | /// [`Error`] is typically fatal and propagated all the way back to the top |
243 | | /// parse call site. |
244 | | fn parse(parser: Parser<'a>) -> Result<Self>; |
245 | | } |
246 | | |
247 | | impl<'a, T> Parse<'a> for Box<T> |
248 | | where |
249 | | T: Parse<'a>, |
250 | | { |
251 | 578k | fn parse(parser: Parser<'a>) -> Result<Self> { |
252 | 578k | Ok(Box::new(parser.parse()?)) |
253 | 578k | } <alloc::boxed::Box<wast::core::expr::BrOnCastFail> as wast::parser::Parse>::parse Line | Count | Source | 251 | 762 | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 762 | Ok(Box::new(parser.parse()?)) | 253 | 762 | } |
<alloc::boxed::Box<wast::core::expr::CallIndirect> as wast::parser::Parse>::parse Line | Count | Source | 251 | 278 | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 278 | Ok(Box::new(parser.parse()?)) | 253 | 278 | } |
Unexecuted instantiation: <alloc::boxed::Box<wast::core::expr::BrOnCastDescEq> as wast::parser::Parse>::parse Unexecuted instantiation: <alloc::boxed::Box<wast::core::expr::BrOnCastDescEqFail> as wast::parser::Parse>::parse <alloc::boxed::Box<wast::core::expr::BrOnCast> as wast::parser::Parse>::parse Line | Count | Source | 251 | 516 | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 516 | Ok(Box::new(parser.parse()?)) | 253 | 516 | } |
<alloc::boxed::Box<wast::core::expr::BlockType> as wast::parser::Parse>::parse Line | Count | Source | 251 | 577k | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 577k | Ok(Box::new(parser.parse()?)) | 253 | 577k | } |
|
254 | | } |
255 | | |
256 | | /// A trait for types which be used to "peek" to see if they're the next token |
257 | | /// in an input stream of [`Parser`]. |
258 | | /// |
259 | | /// Often when implementing [`Parse`] you'll need to query what the next token |
260 | | /// in the stream is to figure out what to parse next. This [`Peek`] trait |
261 | | /// defines the set of types that can be tested whether they're the next token |
262 | | /// in the input stream. |
263 | | /// |
264 | | /// Implementations of [`Peek`] should only be present on types that consume |
265 | | /// exactly one token (not zero, not more, exactly one). Types implementing |
266 | | /// [`Peek`] should also typically implement [`Parse`] should also typically |
267 | | /// implement [`Parse`]. |
268 | | /// |
269 | | /// See the documentation of [`Parser::peek`] for example usage. |
270 | | pub trait Peek { |
271 | | /// Tests to see whether this token is the first token within the [`Cursor`] |
272 | | /// specified. |
273 | | /// |
274 | | /// Returns `true` if [`Parse`] for this type is highly likely to succeed |
275 | | /// failing no other error conditions happening (like an integer literal |
276 | | /// being too big). |
277 | | fn peek(cursor: Cursor<'_>) -> Result<bool>; |
278 | | |
279 | | /// The same as `peek`, except it checks the token immediately following |
280 | | /// the current token. |
281 | 8.56M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { |
282 | 8.56M | match cursor.token()? { |
283 | 8.55M | Some(token) => cursor.advance_past(&token), |
284 | 114 | None => return Ok(false), |
285 | | } |
286 | 8.55M | Self::peek(cursor) |
287 | 8.56M | } <wast::kw::definition as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 9 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 9 | match cursor.token()? { | 283 | 9 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 9 | Self::peek(cursor) | 287 | 9 | } |
<wast::kw::catch_all_ref as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 55.7k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 55.7k | match cursor.token()? { | 283 | 55.7k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 55.7k | Self::peek(cursor) | 287 | 55.7k | } |
Unexecuted instantiation: <wast::kw::on as wast::parser::Peek>::peek2 <wast::kw::mut as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 994k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 994k | match cursor.token()? { | 283 | 994k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 994k | Self::peek(cursor) | 287 | 994k | } |
<wast::kw::item as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 299k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 299k | match cursor.token()? { | 283 | 299k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 299k | Self::peek(cursor) | 287 | 299k | } |
<wast::kw::type as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 783k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 783k | match cursor.token()? { | 283 | 783k | Some(token) => cursor.advance_past(&token), | 284 | 8 | None => return Ok(false), | 285 | | } | 286 | 783k | Self::peek(cursor) | 287 | 783k | } |
<wast::kw::catch as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 337k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 337k | match cursor.token()? { | 283 | 337k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 337k | Self::peek(cursor) | 287 | 337k | } |
<wast::kw::exact as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 22.4k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 22.4k | match cursor.token()? { | 283 | 22.4k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 22.4k | Self::peek(cursor) | 287 | 22.4k | } |
<wast::kw::local as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 183k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 183k | match cursor.token()? { | 283 | 183k | Some(token) => cursor.advance_past(&token), | 284 | 2 | None => return Ok(false), | 285 | | } | 286 | 183k | Self::peek(cursor) | 287 | 183k | } |
<wast::kw::param as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 1.49M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 1.49M | match cursor.token()? { | 283 | 1.49M | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 1.49M | Self::peek(cursor) | 287 | 1.49M | } |
<wast::kw::quote as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 19 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 19 | match cursor.token()? { | 283 | 19 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 19 | Self::peek(cursor) | 287 | 19 | } |
<wast::kw::table as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 19.7k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 19.7k | match cursor.token()? { | 283 | 19.7k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 19.7k | Self::peek(cursor) | 287 | 19.7k | } |
<wast::kw::memory as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 4.44k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 4.44k | match cursor.token()? { | 283 | 4.44k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 4.44k | Self::peek(cursor) | 287 | 4.44k | } |
<wast::kw::module as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 13.8k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 13.8k | match cursor.token()? { | 283 | 13.2k | Some(token) => cursor.advance_past(&token), | 284 | 9 | None => return Ok(false), | 285 | | } | 286 | 13.2k | Self::peek(cursor) | 287 | 13.8k | } |
<wast::kw::offset as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 19.7k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 19.7k | match cursor.token()? { | 283 | 19.7k | Some(token) => cursor.advance_past(&token), | 284 | 2 | None => return Ok(false), | 285 | | } | 286 | 19.7k | Self::peek(cursor) | 287 | 19.7k | } |
<wast::kw::result as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 1.34M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 1.34M | match cursor.token()? { | 283 | 1.34M | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 1.34M | Self::peek(cursor) | 287 | 1.34M | } |
<wast::kw::shared as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 89.7k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 89.7k | match cursor.token()? { | 283 | 89.7k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 89.7k | Self::peek(cursor) | 287 | 89.7k | } |
<wast::kw::instance as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 9 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 9 | match cursor.token()? { | 283 | 9 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 9 | Self::peek(cursor) | 287 | 9 | } |
<wast::kw::pagesize as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 18.9k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 18.9k | match cursor.token()? { | 283 | 18.9k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 18.9k | Self::peek(cursor) | 287 | 18.9k | } |
<wast::kw::catch_all as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 313k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 313k | match cursor.token()? { | 283 | 313k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 313k | Self::peek(cursor) | 287 | 313k | } |
<wast::kw::catch_ref as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 313k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 313k | match cursor.token()? { | 283 | 313k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 313k | Self::peek(cursor) | 287 | 313k | } |
<wast::kw::component as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 2.15k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 2.15k | match cursor.token()? { | 283 | 2.14k | Some(token) => cursor.advance_past(&token), | 284 | 9 | None => return Ok(false), | 285 | | } | 286 | 2.14k | Self::peek(cursor) | 287 | 2.15k | } |
<wast::wast::WastDirectiveToken as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 2.23k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 2.23k | match cursor.token()? { | 283 | 1.49k | Some(token) => cursor.advance_past(&token), | 284 | 68 | None => return Ok(false), | 285 | | } | 286 | 1.49k | Self::peek(cursor) | 287 | 2.23k | } |
<wast::core::types::Type as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 521k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 521k | match cursor.token()? { | 283 | 521k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 521k | Self::peek(cursor) | 287 | 521k | } |
<wast::core::types::RefType as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 10.2k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 10.2k | match cursor.token()? { | 283 | 10.2k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 10.2k | Self::peek(cursor) | 287 | 10.2k | } |
<wast::annotation::name as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 1.70M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 1.70M | match cursor.token()? { | 283 | 1.70M | Some(token) => cursor.advance_past(&token), | 284 | 16 | None => return Ok(false), | 285 | | } | 286 | 1.70M | Self::peek(cursor) | 287 | 1.70M | } |
<wast::token::Index as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 30 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 30 | match cursor.token()? { | 283 | 30 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 30 | Self::peek(cursor) | 287 | 30 | } |
<wast::token::LParen as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 14.2k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 14.2k | match cursor.token()? { | 283 | 14.2k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 14.2k | Self::peek(cursor) | 287 | 14.2k | } |
|
288 | | |
289 | | /// Returns a human-readable name of this token to display when generating |
290 | | /// errors about this token missing. |
291 | | fn display() -> &'static str; |
292 | | } |
293 | | |
294 | | /// A convenience type definition for `Result` where the error is hardwired to |
295 | | /// [`Error`]. |
296 | | pub type Result<T, E = Error> = std::result::Result<T, E>; |
297 | | |
298 | | /// A low-level buffer of tokens which represents a completely lexed file. |
299 | | /// |
300 | | /// A `ParseBuffer` will immediately lex an entire file and then store all |
301 | | /// tokens internally. A `ParseBuffer` only used to pass to the top-level |
302 | | /// [`parse`] function. |
303 | | pub struct ParseBuffer<'a> { |
304 | | lexer: Lexer<'a>, |
305 | | cur: Cell<Position>, |
306 | | known_annotations: RefCell<HashMap<String, usize>>, |
307 | | track_instr_spans: bool, |
308 | | depth: Cell<usize>, |
309 | | strings: Bump, |
310 | | } |
311 | | |
312 | | /// The current position within a `Lexer` that we're at. This simultaneously |
313 | | /// stores the byte position that the lexer was last positioned at as well as |
314 | | /// the next significant token. |
315 | | /// |
316 | | /// Note that "significant" here does not mean that `token` is the next token |
317 | | /// to be lexed at `offset`. Instead it's the next non-whitespace, |
318 | | /// non-annotation, non-comment token. This simple cache-of-sorts avoids |
319 | | /// re-parsing tokens the majority of the time, or at least that's the |
320 | | /// intention. |
321 | | /// |
322 | | /// If `token` is set to `None` then it means that either it hasn't been |
323 | | /// calculated at or the lexer is at EOF. Basically it means go talk to the |
324 | | /// lexer. |
325 | | #[derive(Copy, Clone)] |
326 | | struct Position { |
327 | | offset: usize, |
328 | | token: Option<Token>, |
329 | | } |
330 | | |
331 | | /// An in-progress parser for the tokens of a WebAssembly text file. |
332 | | /// |
333 | | /// A `Parser` is argument to the [`Parse`] trait and is now the input stream is |
334 | | /// interacted with to parse new items. Cloning [`Parser`] or copying a parser |
335 | | /// refers to the same stream of tokens to parse, you cannot clone a [`Parser`] |
336 | | /// and clone two items. |
337 | | /// |
338 | | /// For more information about a [`Parser`] see its methods. |
339 | | #[derive(Copy, Clone)] |
340 | | pub struct Parser<'a> { |
341 | | buf: &'a ParseBuffer<'a>, |
342 | | } |
343 | | |
344 | | /// A helpful structure to perform a lookahead of one token to determine what to |
345 | | /// parse. |
346 | | /// |
347 | | /// For more information see the [`Parser::lookahead1`] method. |
348 | | pub struct Lookahead1<'a> { |
349 | | parser: Parser<'a>, |
350 | | attempts: Vec<&'static str>, |
351 | | } |
352 | | |
353 | | /// An immutable cursor into a list of tokens. |
354 | | /// |
355 | | /// This cursor cannot be mutated but can be used to parse more tokens in a list |
356 | | /// of tokens. Cursors are created from the [`Parser::step`] method. This is a |
357 | | /// very low-level parsing structure and you likely won't use it much. |
358 | | #[derive(Copy, Clone)] |
359 | | pub struct Cursor<'a> { |
360 | | parser: Parser<'a>, |
361 | | pos: Position, |
362 | | } |
363 | | |
364 | | impl ParseBuffer<'_> { |
365 | | /// Creates a new [`ParseBuffer`] by lexing the given `input` completely. |
366 | | /// |
367 | | /// # Errors |
368 | | /// |
369 | | /// Returns an error if `input` fails to lex. |
370 | 14.9k | pub fn new(input: &str) -> Result<ParseBuffer<'_>> { |
371 | 14.9k | ParseBuffer::new_with_lexer(Lexer::new(input)) |
372 | 14.9k | } |
373 | | |
374 | | /// Creates a new [`ParseBuffer`] by lexing the given `input` completely. |
375 | | /// |
376 | | /// # Errors |
377 | | /// |
378 | | /// Returns an error if `input` fails to lex. |
379 | 14.9k | pub fn new_with_lexer(lexer: Lexer<'_>) -> Result<ParseBuffer<'_>> { |
380 | 14.9k | Ok(ParseBuffer { |
381 | 14.9k | lexer, |
382 | 14.9k | depth: Cell::new(0), |
383 | 14.9k | cur: Cell::new(Position { |
384 | 14.9k | offset: 0, |
385 | 14.9k | token: None, |
386 | 14.9k | }), |
387 | 14.9k | known_annotations: Default::default(), |
388 | 14.9k | strings: Default::default(), |
389 | 14.9k | track_instr_spans: false, |
390 | 14.9k | }) |
391 | 14.9k | } |
392 | | |
393 | | /// Indicates whether the [`Expression::instr_spans`] field will be filled |
394 | | /// in. |
395 | | /// |
396 | | /// This is useful when enabling DWARF debugging information via |
397 | | /// [`EncodeOptions::dwarf`], for example. |
398 | | /// |
399 | | /// [`Expression::instr_spans`]: crate::core::Expression::instr_spans |
400 | | /// [`EncodeOptions::dwarf`]: crate::core::EncodeOptions::dwarf |
401 | 0 | pub fn track_instr_spans(&mut self, track: bool) -> &mut Self { |
402 | 0 | self.track_instr_spans = track; |
403 | 0 | self |
404 | 0 | } |
405 | | |
406 | 14.9k | fn parser(&self) -> Parser<'_> { |
407 | 14.9k | Parser { buf: self } |
408 | 14.9k | } |
409 | | |
410 | | /// Stores an owned allocation in this `Parser` to attach the lifetime of |
411 | | /// the vector to `self`. |
412 | | /// |
413 | | /// This will return a reference to `s`, but one that's safely rooted in the |
414 | | /// `Parser`. |
415 | 23.9k | fn push_str(&self, s: Vec<u8>) -> &[u8] { |
416 | 23.9k | self.strings.alloc_slice_copy(&s) |
417 | 23.9k | } |
418 | | |
419 | | /// Lexes the next "significant" token from the `pos` specified. |
420 | | /// |
421 | | /// This will skip irrelevant tokens such as whitespace, comments, and |
422 | | /// unknown annotations. |
423 | 84.8M | fn advance_token(&self, mut pos: usize) -> Result<Option<Token>> { |
424 | 84.8M | let token = loop { |
425 | 145M | let token = match self.lexer.parse(&mut pos)? { |
426 | 145M | Some(token) => token, |
427 | 30.5k | None => return Ok(None), |
428 | | }; |
429 | 145M | match token.kind { |
430 | | // Always skip whitespace and comments. |
431 | | TokenKind::Whitespace | TokenKind::LineComment | TokenKind::BlockComment => { |
432 | 60.2M | continue; |
433 | | } |
434 | | |
435 | | // If an lparen is seen then this may be skipped if it's an |
436 | | // annotation of the form `(@foo ...)`. In this situation |
437 | | // everything up to and including the closing rparen is skipped. |
438 | | // |
439 | | // Note that the annotation is only skipped if it's an unknown |
440 | | // annotation as known annotations are specifically registered |
441 | | // as "someone's gonna parse this". |
442 | | TokenKind::LParen => { |
443 | 16.2M | if let Some(annotation) = self.lexer.annotation(pos)? { |
444 | 4.46k | let text = annotation.annotation(self.lexer.input())?; |
445 | 4.34k | match self.known_annotations.borrow().get(&text[..]) { |
446 | | Some(0) | None => { |
447 | 4.25k | self.skip_annotation(&mut pos)?; |
448 | 2.86k | continue; |
449 | | } |
450 | 85 | Some(_) => {} |
451 | | } |
452 | 16.2M | } |
453 | 16.2M | break token; |
454 | | } |
455 | 68.6M | _ => break token, |
456 | | } |
457 | | }; |
458 | 84.8M | Ok(Some(token)) |
459 | 84.8M | } |
460 | | |
461 | 4.25k | fn skip_annotation(&self, pos: &mut usize) -> Result<()> { |
462 | 4.25k | let mut depth = 1; |
463 | 4.25k | let span = Span { offset: *pos }; |
464 | | loop { |
465 | 55.5k | let token = match self.lexer.parse(pos)? { |
466 | 54.1k | Some(token) => token, |
467 | | None => { |
468 | 1.05k | break Err(Error::new(span, "unclosed annotation".to_string())); |
469 | | } |
470 | | }; |
471 | 54.1k | match token.kind { |
472 | 15.2k | TokenKind::LParen => depth += 1, |
473 | | TokenKind::RParen => { |
474 | 3.44k | depth -= 1; |
475 | 3.44k | if depth == 0 { |
476 | 2.86k | break Ok(()); |
477 | 586 | } |
478 | | } |
479 | 35.4k | _ => {} |
480 | | } |
481 | | } |
482 | 4.25k | } |
483 | | } |
484 | | |
485 | | impl<'a> Parser<'a> { |
486 | | /// Returns whether there are no more `Token` tokens to parse from this |
487 | | /// [`Parser`]. |
488 | | /// |
489 | | /// This indicates that either we've reached the end of the input, or we're |
490 | | /// a sub-[`Parser`] inside of a parenthesized expression and we've hit the |
491 | | /// `)` token. |
492 | | /// |
493 | | /// Note that if `false` is returned there *may* be more comments. Comments |
494 | | /// and whitespace are not considered for whether this parser is empty. |
495 | 23.8M | pub fn is_empty(self) -> bool { |
496 | 23.8M | match self.cursor().token() { |
497 | 23.8M | Ok(Some(token)) => matches!(token.kind, TokenKind::RParen), |
498 | 37 | Ok(None) => true, |
499 | 16 | Err(_) => false, |
500 | | } |
501 | 23.8M | } |
502 | | |
503 | | #[cfg(feature = "wasm-module")] |
504 | 13.9k | pub(crate) fn has_meaningful_tokens(self) -> bool { |
505 | 14.8k | self.buf.lexer.iter(0).any(|t| match t { |
506 | 14.4k | Ok(token) => !matches!( |
507 | 14.4k | token.kind, |
508 | | TokenKind::Whitespace | TokenKind::LineComment | TokenKind::BlockComment |
509 | | ), |
510 | 409 | Err(_) => true, |
511 | 14.8k | }) |
512 | 13.9k | } |
513 | | |
514 | | /// Parses a `T` from this [`Parser`]. |
515 | | /// |
516 | | /// This method has a trivial definition (it simply calls |
517 | | /// [`T::parse`](Parse::parse)) but is here for syntactic purposes. This is |
518 | | /// what you'll call 99% of the time in a [`Parse`] implementation in order |
519 | | /// to parse sub-items. |
520 | | /// |
521 | | /// Typically you always want to use `?` with the result of this method, you |
522 | | /// should not handle errors and decide what else to parse. To handle |
523 | | /// branches in parsing, use [`Parser::peek`]. |
524 | | /// |
525 | | /// # Examples |
526 | | /// |
527 | | /// A good example of using `parse` is to see how the [`TableType`] type is |
528 | | /// parsed in this crate. A [`TableType`] is defined in the official |
529 | | /// specification as [`tabletype`][spec] and is defined as: |
530 | | /// |
531 | | /// [spec]: https://webassembly.github.io/spec/core/text/types.html#table-types |
532 | | /// |
533 | | /// ```text |
534 | | /// tabletype ::= lim:limits et:reftype |
535 | | /// ``` |
536 | | /// |
537 | | /// so to parse a [`TableType`] we recursively need to parse a [`Limits`] |
538 | | /// and a [`RefType`] |
539 | | /// |
540 | | /// ``` |
541 | | /// # use wast::core::*; |
542 | | /// # use wast::parser::*; |
543 | | /// struct TableType<'a> { |
544 | | /// limits: Limits, |
545 | | /// elem: RefType<'a>, |
546 | | /// } |
547 | | /// |
548 | | /// impl<'a> Parse<'a> for TableType<'a> { |
549 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
550 | | /// // parse the `lim` then `et` in sequence |
551 | | /// Ok(TableType { |
552 | | /// limits: parser.parse()?, |
553 | | /// elem: parser.parse()?, |
554 | | /// }) |
555 | | /// } |
556 | | /// } |
557 | | /// ``` |
558 | | /// |
559 | | /// [`Limits`]: crate::core::Limits |
560 | | /// [`TableType`]: crate::core::TableType |
561 | | /// [`RefType`]: crate::core::RefType |
562 | 51.2M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { |
563 | 51.2M | T::parse(self) |
564 | 51.2M | } <wast::parser::Parser>::parse::<wast::wast::Wast> Line | Count | Source | 562 | 2.23k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2.23k | T::parse(self) | 564 | 2.23k | } |
<wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::BrOnCastFail>> Line | Count | Source | 562 | 762 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 762 | T::parse(self) | 564 | 762 | } |
<wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::CallIndirect>> Line | Count | Source | 562 | 278 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 278 | T::parse(self) | 564 | 278 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::BrOnCastDescEq>> Unexecuted instantiation: <wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::BrOnCastDescEqFail>> <wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::BrOnCast>> Line | Count | Source | 562 | 516 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 516 | T::parse(self) | 564 | 516 | } |
<wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::BlockType>> Line | Count | Source | 562 | 577k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 577k | T::parse(self) | 564 | 577k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::kw::i32>> Line | Count | Source | 562 | 6 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 6 | T::parse(self) | 564 | 6 | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::kw::i64>> Line | Count | Source | 562 | 6 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 6 | T::parse(self) | 564 | 6 | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::kw::shared>> Line | Count | Source | 562 | 55.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 55.8k | T::parse(self) | 564 | 55.8k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::token::NameAnnotation>> Line | Count | Source | 562 | 1.70M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.70M | T::parse(self) | 564 | 1.70M | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::token::Id>> Line | Count | Source | 562 | 2.02M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2.02M | T::parse(self) | 564 | 2.02M | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::token::Index>> Line | Count | Source | 562 | 396k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 396k | T::parse(self) | 564 | 396k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::core::types::FunctionType>> Line | Count | Source | 562 | 206k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 206k | T::parse(self) | 564 | 206k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::core::types::FunctionTypeNoNames>> Line | Count | Source | 562 | 577k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 577k | T::parse(self) | 564 | 577k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<core::option::Option<wast::core::types::HeapType>> <wast::parser::Parser>::parse::<core::option::Option<wast::core::import::InlineImport>> Line | Count | Source | 562 | 279k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 279k | T::parse(self) | 564 | 279k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<core::option::Option<u32>> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::Ordered<wast::core::expr::StructAccess>> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::Ordered<wast::core::expr::TableArg>> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::Ordered<wast::token::Index>> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::wast::NanPattern<wast::token::F32>> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::wast::NanPattern<wast::token::F64>> <wast::parser::Parser>::parse::<wast::core::types::TypeUse<wast::core::types::FunctionType>> Line | Count | Source | 562 | 206k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 206k | T::parse(self) | 564 | 206k | } |
<wast::parser::Parser>::parse::<wast::core::types::TypeUse<wast::core::types::FunctionTypeNoNames>> Line | Count | Source | 562 | 577k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 577k | T::parse(self) | 564 | 577k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::annotation::metadata_code_branch_hint> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::annotation::name> <wast::parser::Parser>::parse::<wast::annotation::custom> Line | Count | Source | 562 | 3 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3 | T::parse(self) | 564 | 3 | } |
<wast::parser::Parser>::parse::<wast::annotation::dylink_0> Line | Count | Source | 562 | 2 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2 | T::parse(self) | 564 | 2 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::annotation::producers> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::definition> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::descriptor> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_trap> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::export_info> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::import_info> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::processed_by> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::runtime_path> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_return> <wast::parser::Parser>::parse::<wast::kw::catch_all_ref> Line | Count | Source | 562 | 806 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 806 | T::parse(self) | 564 | 806 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::nan_canonical> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_invalid> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::nan_arithmetic> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_exception> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_malformed> <wast::parser::Parser>::parse::<wast::kw::assert_exhaustion> Line | Count | Source | 562 | 1 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1 | T::parse(self) | 564 | 1 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_suspension> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_unlinkable> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_invalid_custom> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::assert_malformed_custom> <wast::parser::Parser>::parse::<wast::kw::eq> Line | Count | Source | 562 | 11.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 11.6k | T::parse(self) | 564 | 11.6k | } |
<wast::parser::Parser>::parse::<wast::kw::i8> Line | Count | Source | 562 | 500k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 500k | T::parse(self) | 564 | 500k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::on> <wast::parser::Parser>::parse::<wast::kw::any> Line | Count | Source | 562 | 17.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 17.0k | T::parse(self) | 564 | 17.0k | } |
<wast::parser::Parser>::parse::<wast::kw::exn> Line | Count | Source | 562 | 34.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 34.4k | T::parse(self) | 564 | 34.4k | } |
<wast::parser::Parser>::parse::<wast::kw::f32> Line | Count | Source | 562 | 4 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4 | T::parse(self) | 564 | 4 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::f64> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::get> <wast::parser::Parser>::parse::<wast::kw::i16> Line | Count | Source | 562 | 166k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 166k | T::parse(self) | 564 | 166k | } |
<wast::parser::Parser>::parse::<wast::kw::i31> Line | Count | Source | 562 | 4.79k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4.79k | T::parse(self) | 564 | 4.79k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::i32> <wast::parser::Parser>::parse::<wast::kw::i64> Line | Count | Source | 562 | 35.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 35.8k | T::parse(self) | 564 | 35.8k | } |
<wast::parser::Parser>::parse::<wast::kw::mut> Line | Count | Source | 562 | 712k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 712k | T::parse(self) | 564 | 712k | } |
<wast::parser::Parser>::parse::<wast::kw::rec> Line | Count | Source | 562 | 64.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 64.2k | T::parse(self) | 564 | 64.2k | } |
<wast::parser::Parser>::parse::<wast::kw::ref> Line | Count | Source | 562 | 585k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 585k | T::parse(self) | 564 | 585k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::sdk> <wast::parser::Parser>::parse::<wast::kw::sub> Line | Count | Source | 562 | 162k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 162k | T::parse(self) | 564 | 162k | } |
<wast::parser::Parser>::parse::<wast::kw::tag> Line | Count | Source | 562 | 28.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 28.6k | T::parse(self) | 564 | 28.6k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::code> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::cont> <wast::parser::Parser>::parse::<wast::kw::data> Line | Count | Source | 562 | 15.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 15.8k | T::parse(self) | 564 | 15.8k | } |
<wast::parser::Parser>::parse::<wast::kw::elem> Line | Count | Source | 562 | 29.1k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 29.1k | T::parse(self) | 564 | 29.1k | } |
<wast::parser::Parser>::parse::<wast::kw::else> Line | Count | Source | 562 | 2.60k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2.60k | T::parse(self) | 564 | 2.60k | } |
<wast::parser::Parser>::parse::<wast::kw::func> Line | Count | Source | 562 | 352k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 352k | T::parse(self) | 564 | 352k | } |
<wast::parser::Parser>::parse::<wast::kw::item> Line | Count | Source | 562 | 46.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 46.0k | T::parse(self) | 564 | 46.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::last> <wast::parser::Parser>::parse::<wast::kw::none> Line | Count | Source | 562 | 176k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 176k | T::parse(self) | 564 | 176k | } |
<wast::parser::Parser>::parse::<wast::kw::null> Line | Count | Source | 562 | 576k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 576k | T::parse(self) | 564 | 576k | } |
<wast::parser::Parser>::parse::<wast::kw::then> Line | Count | Source | 562 | 31.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 31.2k | T::parse(self) | 564 | 31.2k | } |
<wast::parser::Parser>::parse::<wast::kw::type> Line | Count | Source | 562 | 731k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 731k | T::parse(self) | 564 | 731k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::v128> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::wait> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::after> <wast::parser::Parser>::parse::<wast::kw::array> Line | Count | Source | 562 | 282k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 282k | T::parse(self) | 564 | 282k | } |
<wast::parser::Parser>::parse::<wast::kw::catch> Line | Count | Source | 562 | 24.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 24.2k | T::parse(self) | 564 | 24.2k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::exact> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::f32x4> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::f64x2> <wast::parser::Parser>::parse::<wast::kw::field> Line | Count | Source | 562 | 633k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 633k | T::parse(self) | 564 | 633k | } |
<wast::parser::Parser>::parse::<wast::kw::final> Line | Count | Source | 562 | 11.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 11.2k | T::parse(self) | 564 | 11.2k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::first> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::i16x8> <wast::parser::Parser>::parse::<wast::kw::i32x4> Line | Count | Source | 562 | 99.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 99.6k | T::parse(self) | 564 | 99.6k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::i64x2> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::i8x16> <wast::parser::Parser>::parse::<wast::kw::local> Line | Count | Source | 562 | 28.1k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 28.1k | T::parse(self) | 564 | 28.1k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::noexn> <wast::parser::Parser>::parse::<wast::kw::param> Line | Count | Source | 562 | 241k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 241k | T::parse(self) | 564 | 241k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::quote> <wast::parser::Parser>::parse::<wast::kw::start> Line | Count | Source | 562 | 256 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 256 | T::parse(self) | 564 | 256 | } |
<wast::parser::Parser>::parse::<wast::kw::table> Line | Count | Source | 562 | 55.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 55.2k | T::parse(self) | 564 | 55.2k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::before> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::binary> <wast::parser::Parser>::parse::<wast::kw::export> Line | Count | Source | 562 | 60.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 60.0k | T::parse(self) | 564 | 60.0k | } |
<wast::parser::Parser>::parse::<wast::kw::extern> Line | Count | Source | 562 | 13.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 13.6k | T::parse(self) | 564 | 13.6k | } |
<wast::parser::Parser>::parse::<wast::kw::global> Line | Count | Source | 562 | 111k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 111k | T::parse(self) | 564 | 111k | } |
<wast::parser::Parser>::parse::<wast::kw::import> Line | Count | Source | 562 | 58.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 58.2k | T::parse(self) | 564 | 58.2k | } |
<wast::parser::Parser>::parse::<wast::kw::invoke> Line | Count | Source | 562 | 3 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3 | T::parse(self) | 564 | 3 | } |
<wast::parser::Parser>::parse::<wast::kw::memory> Line | Count | Source | 562 | 36.9k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 36.9k | T::parse(self) | 564 | 36.9k | } |
<wast::parser::Parser>::parse::<wast::kw::module> Line | Count | Source | 562 | 10.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 10.8k | T::parse(self) | 564 | 10.8k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::needed> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::nocont> <wast::parser::Parser>::parse::<wast::kw::nofunc> Line | Count | Source | 562 | 31.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 31.8k | T::parse(self) | 564 | 31.8k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::offset> <wast::parser::Parser>::parse::<wast::kw::result> Line | Count | Source | 562 | 595k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 595k | T::parse(self) | 564 | 595k | } |
<wast::parser::Parser>::parse::<wast::kw::shared> Line | Count | Source | 562 | 121k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 121k | T::parse(self) | 564 | 121k | } |
<wast::parser::Parser>::parse::<wast::kw::struct> Line | Count | Source | 562 | 81.3k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 81.3k | T::parse(self) | 564 | 81.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::switch> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::thread> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::acq_rel> <wast::parser::Parser>::parse::<wast::kw::declare> Line | Count | Source | 562 | 3.08k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3.08k | T::parse(self) | 564 | 3.08k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::seq_cst> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::instance> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::language> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::mem_info> <wast::parser::Parser>::parse::<wast::kw::noextern> Line | Count | Source | 562 | 21.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 21.0k | T::parse(self) | 564 | 21.0k | } |
<wast::parser::Parser>::parse::<wast::kw::pagesize> Line | Count | Source | 562 | 18.9k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 18.9k | T::parse(self) | 564 | 18.9k | } |
<wast::parser::Parser>::parse::<wast::kw::register> Line | Count | Source | 562 | 1 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1 | T::parse(self) | 564 | 1 | } |
<wast::parser::Parser>::parse::<wast::kw::catch_all> Line | Count | Source | 562 | 257k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 257k | T::parse(self) | 564 | 257k | } |
<wast::parser::Parser>::parse::<wast::kw::catch_ref> Line | Count | Source | 562 | 94 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 94 | T::parse(self) | 564 | 94 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::component> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::describes> <wast::parser::Parser>::parse::<wast::wat::Wat> Line | Count | Source | 562 | 13.9k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 13.9k | T::parse(self) | 564 | 13.9k | } |
<wast::parser::Parser>::parse::<wast::wast::WastInvoke> Line | Count | Source | 562 | 3 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3 | T::parse(self) | 564 | 3 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::wast::WastThread> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::wast::WastExecute> <wast::parser::Parser>::parse::<wast::wast::WastDirective> Line | Count | Source | 562 | 20 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 20 | T::parse(self) | 564 | 20 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::wast::WastArg> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::wast::WastRet> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::wast::QuoteWat> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::token::NameAnnotation> <wast::parser::Parser>::parse::<wast::token::Id> Line | Count | Source | 562 | 11.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 11.8k | T::parse(self) | 564 | 11.8k | } |
<wast::parser::Parser>::parse::<wast::token::F32> Line | Count | Source | 562 | 193k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 193k | T::parse(self) | 564 | 193k | } |
<wast::parser::Parser>::parse::<wast::token::F64> Line | Count | Source | 562 | 498k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 498k | T::parse(self) | 564 | 498k | } |
<wast::parser::Parser>::parse::<wast::token::Index> Line | Count | Source | 562 | 4.45M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4.45M | T::parse(self) | 564 | 4.45M | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::component::Component> Unexecuted instantiation: <wast::parser::Parser>::parse::<alloc::string::String> <wast::parser::Parser>::parse::<wast::core::tag::Tag> Line | Count | Source | 562 | 21.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 21.4k | T::parse(self) | 564 | 21.4k | } |
<wast::parser::Parser>::parse::<wast::core::tag::TagType> Line | Count | Source | 562 | 28.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 28.6k | T::parse(self) | 564 | 28.6k | } |
<wast::parser::Parser>::parse::<wast::core::expr::Expression> Line | Count | Source | 562 | 278k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 278k | T::parse(self) | 564 | 278k | } |
<wast::parser::Parser>::parse::<wast::core::expr::MemoryCopy> Line | Count | Source | 562 | 6 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 6 | T::parse(self) | 564 | 6 | } |
<wast::parser::Parser>::parse::<wast::core::expr::MemoryInit> Line | Count | Source | 562 | 16 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 16 | T::parse(self) | 564 | 16 | } |
<wast::parser::Parser>::parse::<wast::core::expr::Instruction> Line | Count | Source | 562 | 9.24M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 9.24M | T::parse(self) | 564 | 9.24M | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ResumeTable> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ResumeThrow> <wast::parser::Parser>::parse::<wast::core::expr::SelectTypes> Line | Count | Source | 562 | 91.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 91.5k | T::parse(self) | 564 | 91.5k | } |
<wast::parser::Parser>::parse::<wast::core::expr::ArrayNewData> Line | Count | Source | 562 | 2 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2 | T::parse(self) | 564 | 2 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ArrayNewElem> <wast::parser::Parser>::parse::<wast::core::expr::BrOnCastFail> Line | Count | Source | 562 | 762 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 762 | T::parse(self) | 564 | 762 | } |
<wast::parser::Parser>::parse::<wast::core::expr::CallIndirect> Line | Count | Source | 562 | 278 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 278 | T::parse(self) | 564 | 278 | } |
<wast::parser::Parser>::parse::<wast::core::expr::I8x16Shuffle> Line | Count | Source | 562 | 26 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 26 | T::parse(self) | 564 | 26 | } |
<wast::parser::Parser>::parse::<wast::core::expr::StructAccess> Line | Count | Source | 562 | 536 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 536 | T::parse(self) | 564 | 536 | } |
<wast::parser::Parser>::parse::<wast::core::expr::ArrayNewFixed> Line | Count | Source | 562 | 9.07k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 9.07k | T::parse(self) | 564 | 9.07k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::RefCastDescEq> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::BrOnCastDescEq> <wast::parser::Parser>::parse::<wast::core::expr::BrTableIndices> Line | Count | Source | 562 | 44.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 44.0k | T::parse(self) | 564 | 44.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ResumeThrowRef> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::BrOnCastDescEqFail> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::Resume> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::Switch> <wast::parser::Parser>::parse::<wast::core::expr::LaneArg> Line | Count | Source | 562 | 9.28k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 9.28k | T::parse(self) | 564 | 9.28k | } |
<wast::parser::Parser>::parse::<wast::core::expr::RefCast> Line | Count | Source | 562 | 2.16k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2.16k | T::parse(self) | 564 | 2.16k | } |
<wast::parser::Parser>::parse::<wast::core::expr::RefTest> Line | Count | Source | 562 | 6.65k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 6.65k | T::parse(self) | 564 | 6.65k | } |
<wast::parser::Parser>::parse::<wast::core::expr::BrOnCast> Line | Count | Source | 562 | 516 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 516 | T::parse(self) | 564 | 516 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ContBind> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::Ordering> <wast::parser::Parser>::parse::<wast::core::expr::TableArg> Line | Count | Source | 562 | 24.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 24.2k | T::parse(self) | 564 | 24.2k | } |
<wast::parser::Parser>::parse::<wast::core::expr::TryTable> Line | Count | Source | 562 | 110k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 110k | T::parse(self) | 564 | 110k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ArrayCopy> <wast::parser::Parser>::parse::<wast::core::expr::ArrayFill> Line | Count | Source | 562 | 46 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 46 | T::parse(self) | 564 | 46 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ArrayInit> <wast::parser::Parser>::parse::<wast::core::expr::BlockType> Line | Count | Source | 562 | 577k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 577k | T::parse(self) | 564 | 577k | } |
<wast::parser::Parser>::parse::<wast::core::expr::MemoryArg> Line | Count | Source | 562 | 123k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 123k | T::parse(self) | 564 | 123k | } |
<wast::parser::Parser>::parse::<wast::core::expr::TableCopy> Line | Count | Source | 562 | 24 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 24 | T::parse(self) | 564 | 24 | } |
<wast::parser::Parser>::parse::<wast::core::expr::TableInit> Line | Count | Source | 562 | 14 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 14 | T::parse(self) | 564 | 14 | } |
<wast::parser::Parser>::parse::<wast::core::expr::V128Const> Line | Count | Source | 562 | 99.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 99.6k | T::parse(self) | 564 | 99.6k | } |
<wast::parser::Parser>::parse::<wast::core::func::LocalParser> Line | Count | Source | 562 | 28.1k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 28.1k | T::parse(self) | 564 | 28.1k | } |
<wast::parser::Parser>::parse::<wast::core::func::Func> Line | Count | Source | 562 | 155k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 155k | T::parse(self) | 564 | 155k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::wast::V128Pattern> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::wast::WastArgCore> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::wast::WastRetCore> <wast::parser::Parser>::parse::<wast::core::table::Elem> Line | Count | Source | 562 | 29.1k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 29.1k | T::parse(self) | 564 | 29.1k | } |
<wast::parser::Parser>::parse::<wast::core::table::Table> Line | Count | Source | 562 | 14.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 14.5k | T::parse(self) | 564 | 14.5k | } |
<wast::parser::Parser>::parse::<wast::core::types::GlobalType> Line | Count | Source | 562 | 89.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 89.7k | T::parse(self) | 564 | 89.7k | } |
<wast::parser::Parser>::parse::<wast::core::types::MemoryType> Line | Count | Source | 562 | 31.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 31.0k | T::parse(self) | 564 | 31.0k | } |
<wast::parser::Parser>::parse::<wast::core::types::StructType> Line | Count | Source | 562 | 76.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 76.5k | T::parse(self) | 564 | 76.5k | } |
<wast::parser::Parser>::parse::<wast::core::types::StorageType> Line | Count | Source | 562 | 906k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 906k | T::parse(self) | 564 | 906k | } |
<wast::parser::Parser>::parse::<wast::core::types::FunctionType> Line | Count | Source | 562 | 311k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 311k | T::parse(self) | 564 | 311k | } |
<wast::parser::Parser>::parse::<wast::core::types::InnerTypeKind> Line | Count | Source | 562 | 482k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 482k | T::parse(self) | 564 | 482k | } |
<wast::parser::Parser>::parse::<wast::core::types::AbstractHeapType> Line | Count | Source | 562 | 350k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 350k | T::parse(self) | 564 | 350k | } |
<wast::parser::Parser>::parse::<wast::core::types::FunctionTypeNoNames> Line | Count | Source | 562 | 345k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 345k | T::parse(self) | 564 | 345k | } |
<wast::parser::Parser>::parse::<wast::core::types::Rec> Line | Count | Source | 562 | 64.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 64.2k | T::parse(self) | 564 | 64.2k | } |
<wast::parser::Parser>::parse::<wast::core::types::Type> Line | Count | Source | 562 | 482k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 482k | T::parse(self) | 564 | 482k | } |
<wast::parser::Parser>::parse::<wast::core::types::Limits> Line | Count | Source | 562 | 55.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 55.8k | T::parse(self) | 564 | 55.8k | } |
<wast::parser::Parser>::parse::<wast::core::types::RefType> Line | Count | Source | 562 | 613k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 613k | T::parse(self) | 564 | 613k | } |
<wast::parser::Parser>::parse::<wast::core::types::TypeDef> Line | Count | Source | 562 | 482k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 482k | T::parse(self) | 564 | 482k | } |
<wast::parser::Parser>::parse::<wast::core::types::ValType> Line | Count | Source | 562 | 6.54M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 6.54M | T::parse(self) | 564 | 6.54M | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::types::ContType> <wast::parser::Parser>::parse::<wast::core::types::HeapType> Line | Count | Source | 562 | 1.02M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.02M | T::parse(self) | 564 | 1.02M | } |
<wast::parser::Parser>::parse::<wast::core::types::ArrayType> Line | Count | Source | 562 | 272k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 272k | T::parse(self) | 564 | 272k | } |
<wast::parser::Parser>::parse::<wast::core::types::TableType> Line | Count | Source | 562 | 24.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 24.7k | T::parse(self) | 564 | 24.7k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::CustomPlace> <wast::parser::Parser>::parse::<wast::core::custom::RawCustomSection> Line | Count | Source | 562 | 3 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3 | T::parse(self) | 564 | 3 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::CustomPlaceAnchor> <wast::parser::Parser>::parse::<wast::core::custom::Custom> Line | Count | Source | 562 | 5 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 5 | T::parse(self) | 564 | 5 | } |
<wast::parser::Parser>::parse::<wast::core::custom::Dylink0> Line | Count | Source | 562 | 2 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2 | T::parse(self) | 564 | 2 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::Producers> <wast::parser::Parser>::parse::<wast::core::export::ExportKind> Line | Count | Source | 562 | 45.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 45.4k | T::parse(self) | 564 | 45.4k | } |
<wast::parser::Parser>::parse::<wast::core::export::InlineExport> Line | Count | Source | 562 | 294k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 294k | T::parse(self) | 564 | 294k | } |
<wast::parser::Parser>::parse::<wast::core::export::Export> Line | Count | Source | 562 | 45.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 45.4k | T::parse(self) | 564 | 45.4k | } |
<wast::parser::Parser>::parse::<wast::core::global::Global> Line | Count | Source | 562 | 75.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 75.4k | T::parse(self) | 564 | 75.4k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::import::InlineImport> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::import::ImportGroupItemCommon> <wast::parser::Parser>::parse::<wast::core::import::Imports> Line | Count | Source | 562 | 58.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 58.2k | T::parse(self) | 564 | 58.2k | } |
<wast::parser::Parser>::parse::<wast::core::import::ItemSig> Line | Count | Source | 562 | 58.1k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 58.1k | T::parse(self) | 564 | 58.1k | } |
<wast::parser::Parser>::parse::<wast::core::memory::Data> Line | Count | Source | 562 | 15.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 15.8k | T::parse(self) | 564 | 15.8k | } |
<wast::parser::Parser>::parse::<wast::core::memory::Memory> Line | Count | Source | 562 | 27.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 27.0k | T::parse(self) | 564 | 27.0k | } |
<wast::parser::Parser>::parse::<wast::core::memory::DataVal> Line | Count | Source | 562 | 15.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 15.8k | T::parse(self) | 564 | 15.8k | } |
<wast::parser::Parser>::parse::<wast::core::module::Module> Line | Count | Source | 562 | 10.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 10.8k | T::parse(self) | 564 | 10.8k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::parse_sym_flags::flag> <wast::parser::Parser>::parse::<&[u8]> Line | Count | Source | 562 | 192k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 192k | T::parse(self) | 564 | 192k | } |
<wast::parser::Parser>::parse::<&str> Line | Count | Source | 562 | 176k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 176k | T::parse(self) | 564 | 176k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<(i8, wast::token::Span)> <wast::parser::Parser>::parse::<(u8, wast::token::Span)> Line | Count | Source | 562 | 304 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 304 | T::parse(self) | 564 | 304 | } |
<wast::parser::Parser>::parse::<(i32, wast::token::Span)> Line | Count | Source | 562 | 735k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 735k | T::parse(self) | 564 | 735k | } |
<wast::parser::Parser>::parse::<(u32, wast::token::Span)> Line | Count | Source | 562 | 4.48M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4.48M | T::parse(self) | 564 | 4.48M | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<(i16, wast::token::Span)> Unexecuted instantiation: <wast::parser::Parser>::parse::<(u16, wast::token::Span)> <wast::parser::Parser>::parse::<(i64, wast::token::Span)> Line | Count | Source | 562 | 1.07M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.07M | T::parse(self) | 564 | 1.07M | } |
<wast::parser::Parser>::parse::<(u64, wast::token::Span)> Line | Count | Source | 562 | 103k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 103k | T::parse(self) | 564 | 103k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<i8> <wast::parser::Parser>::parse::<u8> Line | Count | Source | 562 | 304 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 304 | T::parse(self) | 564 | 304 | } |
<wast::parser::Parser>::parse::<i32> Line | Count | Source | 562 | 735k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 735k | T::parse(self) | 564 | 735k | } |
<wast::parser::Parser>::parse::<u32> Line | Count | Source | 562 | 28.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 28.0k | T::parse(self) | 564 | 28.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<i16> <wast::parser::Parser>::parse::<i64> Line | Count | Source | 562 | 1.07M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.07M | T::parse(self) | 564 | 1.07M | } |
<wast::parser::Parser>::parse::<u64> Line | Count | Source | 562 | 103k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 103k | T::parse(self) | 564 | 103k | } |
|
565 | | |
566 | | /// Performs a cheap test to see whether the current token in this stream is |
567 | | /// `T`. |
568 | | /// |
569 | | /// This method can be used to efficiently determine what next to parse. The |
570 | | /// [`Peek`] trait is defined for types which can be used to test if they're |
571 | | /// the next item in the input stream. |
572 | | /// |
573 | | /// Nothing is actually parsed in this method, nor does this mutate the |
574 | | /// state of this [`Parser`]. Instead, this simply performs a check. |
575 | | /// |
576 | | /// This method is frequently combined with the [`Parser::lookahead1`] |
577 | | /// method to automatically produce nice error messages if some tokens |
578 | | /// aren't found. |
579 | | /// |
580 | | /// # Examples |
581 | | /// |
582 | | /// For an example of using the `peek` method let's take a look at parsing |
583 | | /// the [`Limits`] type. This is [defined in the official spec][spec] as: |
584 | | /// |
585 | | /// ```text |
586 | | /// limits ::= n:u32 |
587 | | /// | n:u32 m:u32 |
588 | | /// ``` |
589 | | /// |
590 | | /// which means that it's either one `u32` token or two, so we need to know |
591 | | /// whether to consume two tokens or one: |
592 | | /// |
593 | | /// ``` |
594 | | /// # use wast::parser::*; |
595 | | /// struct Limits { |
596 | | /// min: u32, |
597 | | /// max: Option<u32>, |
598 | | /// } |
599 | | /// |
600 | | /// impl<'a> Parse<'a> for Limits { |
601 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
602 | | /// // Always parse the first number... |
603 | | /// let min = parser.parse()?; |
604 | | /// |
605 | | /// // ... and then test if there's a second number before parsing |
606 | | /// let max = if parser.peek::<u32>()? { |
607 | | /// Some(parser.parse()?) |
608 | | /// } else { |
609 | | /// None |
610 | | /// }; |
611 | | /// |
612 | | /// Ok(Limits { min, max }) |
613 | | /// } |
614 | | /// } |
615 | | /// ``` |
616 | | /// |
617 | | /// [spec]: https://webassembly.github.io/spec/core/text/types.html#limits |
618 | | /// [`Limits`]: crate::core::Limits |
619 | 37.2M | pub fn peek<T: Peek>(self) -> Result<bool> { |
620 | 37.2M | T::peek(self.cursor()) |
621 | 37.2M | } <wast::parser::Parser>::peek::<wast::annotation::metadata_code_branch_hint> Line | Count | Source | 619 | 4.33M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 4.33M | T::peek(self.cursor()) | 621 | 4.33M | } |
<wast::parser::Parser>::peek::<wast::annotation::custom> Line | Count | Source | 619 | 683 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 683 | T::peek(self.cursor()) | 621 | 683 | } |
<wast::parser::Parser>::peek::<wast::annotation::dylink_0> Line | Count | Source | 619 | 668 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 668 | T::peek(self.cursor()) | 621 | 668 | } |
<wast::parser::Parser>::peek::<wast::annotation::producers> Line | Count | Source | 619 | 668 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 668 | T::peek(self.cursor()) | 621 | 668 | } |
<wast::parser::Parser>::peek::<wast::kw::descriptor> Line | Count | Source | 619 | 482k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 482k | T::peek(self.cursor()) | 621 | 482k | } |
<wast::parser::Parser>::peek::<wast::kw::assert_trap> Line | Count | Source | 619 | 7 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 7 | T::peek(self.cursor()) | 621 | 7 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::export_info> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::import_info> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::processed_by> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::runtime_path> <wast::parser::Parser>::peek::<wast::kw::assert_return> Line | Count | Source | 619 | 7 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 7 | T::peek(self.cursor()) | 621 | 7 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::nan_canonical> <wast::parser::Parser>::peek::<wast::kw::assert_invalid> Line | Count | Source | 619 | 10 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 10 | T::peek(self.cursor()) | 621 | 10 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::nan_arithmetic> <wast::parser::Parser>::peek::<wast::kw::assert_exception> Line | Count | Source | 619 | 6 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 6 | T::peek(self.cursor()) | 621 | 6 | } |
<wast::parser::Parser>::peek::<wast::kw::assert_malformed> Line | Count | Source | 619 | 10 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 10 | T::peek(self.cursor()) | 621 | 10 | } |
<wast::parser::Parser>::peek::<wast::kw::assert_exhaustion> Line | Count | Source | 619 | 7 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 7 | T::peek(self.cursor()) | 621 | 7 | } |
<wast::parser::Parser>::peek::<wast::kw::assert_suspension> Line | Count | Source | 619 | 6 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 6 | T::peek(self.cursor()) | 621 | 6 | } |
<wast::parser::Parser>::peek::<wast::kw::assert_unlinkable> Line | Count | Source | 619 | 6 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 6 | T::peek(self.cursor()) | 621 | 6 | } |
<wast::parser::Parser>::peek::<wast::kw::assert_invalid_custom> Line | Count | Source | 619 | 10 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 10 | T::peek(self.cursor()) | 621 | 10 | } |
<wast::parser::Parser>::peek::<wast::kw::assert_malformed_custom> Line | Count | Source | 619 | 10 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 10 | T::peek(self.cursor()) | 621 | 10 | } |
<wast::parser::Parser>::peek::<wast::kw::eq> Line | Count | Source | 619 | 259k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 259k | T::peek(self.cursor()) | 621 | 259k | } |
<wast::parser::Parser>::peek::<wast::kw::i8> Line | Count | Source | 619 | 906k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 906k | T::peek(self.cursor()) | 621 | 906k | } |
<wast::parser::Parser>::peek::<wast::kw::any> Line | Count | Source | 619 | 277k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 277k | T::peek(self.cursor()) | 621 | 277k | } |
<wast::parser::Parser>::peek::<wast::kw::exn> Line | Count | Source | 619 | 311k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 311k | T::peek(self.cursor()) | 621 | 311k | } |
<wast::parser::Parser>::peek::<wast::kw::f32> Line | Count | Source | 619 | 4 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 4 | T::peek(self.cursor()) | 621 | 4 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::f64> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::get> <wast::parser::Parser>::peek::<wast::kw::i16> Line | Count | Source | 619 | 405k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 405k | T::peek(self.cursor()) | 621 | 405k | } |
<wast::parser::Parser>::peek::<wast::kw::i31> Line | Count | Source | 619 | 234k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 234k | T::peek(self.cursor()) | 621 | 234k | } |
<wast::parser::Parser>::peek::<wast::kw::i32> Line | Count | Source | 619 | 111k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 111k | T::peek(self.cursor()) | 621 | 111k | } |
<wast::parser::Parser>::peek::<wast::kw::i64> Line | Count | Source | 619 | 111k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 111k | T::peek(self.cursor()) | 621 | 111k | } |
<wast::parser::Parser>::peek::<wast::kw::mut> Line | Count | Source | 619 | 83.1k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 83.1k | T::peek(self.cursor()) | 621 | 83.1k | } |
<wast::parser::Parser>::peek::<wast::kw::rec> Line | Count | Source | 619 | 507k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 507k | T::peek(self.cursor()) | 621 | 507k | } |
<wast::parser::Parser>::peek::<wast::kw::ref> Line | Count | Source | 619 | 585k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 585k | T::peek(self.cursor()) | 621 | 585k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::sdk> <wast::parser::Parser>::peek::<wast::kw::sub> Line | Count | Source | 619 | 482k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 482k | T::peek(self.cursor()) | 621 | 482k | } |
<wast::parser::Parser>::peek::<wast::kw::tag> Line | Count | Source | 619 | 29.3k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 29.3k | T::peek(self.cursor()) | 621 | 29.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::code> <wast::parser::Parser>::peek::<wast::kw::cont> Line | Count | Source | 619 | 277k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 277k | T::peek(self.cursor()) | 621 | 277k | } |
<wast::parser::Parser>::peek::<wast::kw::data> Line | Count | Source | 619 | 38.0k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 38.0k | T::peek(self.cursor()) | 621 | 38.0k | } |
<wast::parser::Parser>::peek::<wast::kw::elem> Line | Count | Source | 619 | 67.1k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 67.1k | T::peek(self.cursor()) | 621 | 67.1k | } |
<wast::parser::Parser>::peek::<wast::kw::func> Line | Count | Source | 619 | 1.35M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 1.35M | T::peek(self.cursor()) | 621 | 1.35M | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::last> <wast::parser::Parser>::peek::<wast::kw::none> Line | Count | Source | 619 | 176k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 176k | T::peek(self.cursor()) | 621 | 176k | } |
<wast::parser::Parser>::peek::<wast::kw::null> Line | Count | Source | 619 | 585k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 585k | T::peek(self.cursor()) | 621 | 585k | } |
<wast::parser::Parser>::peek::<wast::kw::then> Line | Count | Source | 619 | 62.9k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 62.9k | T::peek(self.cursor()) | 621 | 62.9k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::type> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::v128> <wast::parser::Parser>::peek::<wast::kw::wait> Line | Count | Source | 619 | 6 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 6 | T::peek(self.cursor()) | 621 | 6 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::after> <wast::parser::Parser>::peek::<wast::kw::array> Line | Count | Source | 619 | 516k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 516k | T::peek(self.cursor()) | 621 | 516k | } |
<wast::parser::Parser>::peek::<wast::kw::catch> Line | Count | Source | 619 | 282k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 282k | T::peek(self.cursor()) | 621 | 282k | } |
<wast::parser::Parser>::peek::<wast::kw::exact> Line | Count | Source | 619 | 54.3k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 54.3k | T::peek(self.cursor()) | 621 | 54.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::f32x4> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::f64x2> <wast::parser::Parser>::peek::<wast::kw::final> Line | Count | Source | 619 | 162k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 162k | T::peek(self.cursor()) | 621 | 162k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::first> <wast::parser::Parser>::peek::<wast::kw::i16x8> Line | Count | Source | 619 | 99.6k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 99.6k | T::peek(self.cursor()) | 621 | 99.6k | } |
<wast::parser::Parser>::peek::<wast::kw::i32x4> Line | Count | Source | 619 | 99.6k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 99.6k | T::peek(self.cursor()) | 621 | 99.6k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::i64x2> <wast::parser::Parser>::peek::<wast::kw::i8x16> Line | Count | Source | 619 | 99.6k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 99.6k | T::peek(self.cursor()) | 621 | 99.6k | } |
<wast::parser::Parser>::peek::<wast::kw::noexn> Line | Count | Source | 619 | 176k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 176k | T::peek(self.cursor()) | 621 | 176k | } |
<wast::parser::Parser>::peek::<wast::kw::param> Line | Count | Source | 619 | 837k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 837k | T::peek(self.cursor()) | 621 | 837k | } |
<wast::parser::Parser>::peek::<wast::kw::start> Line | Count | Source | 619 | 67.4k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 67.4k | T::peek(self.cursor()) | 621 | 67.4k | } |
<wast::parser::Parser>::peek::<wast::kw::table> Line | Count | Source | 619 | 305k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 305k | T::peek(self.cursor()) | 621 | 305k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::before> <wast::parser::Parser>::peek::<wast::kw::binary> Line | Count | Source | 619 | 10.8k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 10.8k | T::peek(self.cursor()) | 621 | 10.8k | } |
<wast::parser::Parser>::peek::<wast::kw::export> Line | Count | Source | 619 | 112k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 112k | T::peek(self.cursor()) | 621 | 112k | } |
<wast::parser::Parser>::peek::<wast::kw::extern> Line | Count | Source | 619 | 325k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 325k | T::peek(self.cursor()) | 621 | 325k | } |
<wast::parser::Parser>::peek::<wast::kw::global> Line | Count | Source | 619 | 231k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 231k | T::peek(self.cursor()) | 621 | 231k | } |
<wast::parser::Parser>::peek::<wast::kw::import> Line | Count | Source | 619 | 443k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 443k | T::peek(self.cursor()) | 621 | 443k | } |
<wast::parser::Parser>::peek::<wast::kw::invoke> Line | Count | Source | 619 | 9 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 9 | T::peek(self.cursor()) | 621 | 9 | } |
<wast::parser::Parser>::peek::<wast::kw::memory> Line | Count | Source | 619 | 265k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 265k | T::peek(self.cursor()) | 621 | 265k | } |
<wast::parser::Parser>::peek::<wast::kw::module> Line | Count | Source | 619 | 20 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 20 | T::peek(self.cursor()) | 621 | 20 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::needed> <wast::parser::Parser>::peek::<wast::kw::nocont> Line | Count | Source | 619 | 176k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 176k | T::peek(self.cursor()) | 621 | 176k | } |
<wast::parser::Parser>::peek::<wast::kw::nofunc> Line | Count | Source | 619 | 229k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 229k | T::peek(self.cursor()) | 621 | 229k | } |
<wast::parser::Parser>::peek::<wast::kw::offset> Line | Count | Source | 619 | 4.44k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 4.44k | T::peek(self.cursor()) | 621 | 4.44k | } |
<wast::parser::Parser>::peek::<wast::kw::result> Line | Count | Source | 619 | 595k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 595k | T::peek(self.cursor()) | 621 | 595k | } |
<wast::parser::Parser>::peek::<wast::kw::shared> Line | Count | Source | 619 | 636k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 636k | T::peek(self.cursor()) | 621 | 636k | } |
<wast::parser::Parser>::peek::<wast::kw::struct> Line | Count | Source | 619 | 597k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 597k | T::peek(self.cursor()) | 621 | 597k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::switch> <wast::parser::Parser>::peek::<wast::kw::thread> Line | Count | Source | 619 | 6 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 6 | T::peek(self.cursor()) | 621 | 6 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::acq_rel> <wast::parser::Parser>::peek::<wast::kw::declare> Line | Count | Source | 619 | 29.1k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 29.1k | T::peek(self.cursor()) | 621 | 29.1k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::seq_cst> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::language> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::mem_info> <wast::parser::Parser>::peek::<wast::kw::noextern> Line | Count | Source | 619 | 197k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 197k | T::peek(self.cursor()) | 621 | 197k | } |
<wast::parser::Parser>::peek::<wast::kw::register> Line | Count | Source | 619 | 10 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 10 | T::peek(self.cursor()) | 621 | 10 | } |
<wast::parser::Parser>::peek::<wast::kw::catch_all> Line | Count | Source | 619 | 258k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 258k | T::peek(self.cursor()) | 621 | 258k | } |
<wast::parser::Parser>::peek::<wast::kw::catch_ref> Line | Count | Source | 619 | 282k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 282k | T::peek(self.cursor()) | 621 | 282k | } |
<wast::parser::Parser>::peek::<wast::kw::component> Line | Count | Source | 619 | 19 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 19 | T::peek(self.cursor()) | 621 | 19 | } |
<wast::parser::Parser>::peek::<wast::kw::describes> Line | Count | Source | 619 | 482k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 482k | T::peek(self.cursor()) | 621 | 482k | } |
<wast::parser::Parser>::peek::<wast::token::Id> Line | Count | Source | 619 | 7.11M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 7.11M | T::peek(self.cursor()) | 621 | 7.11M | } |
<wast::parser::Parser>::peek::<wast::token::Index> Line | Count | Source | 619 | 1.68M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 1.68M | T::peek(self.cursor()) | 621 | 1.68M | } |
<wast::parser::Parser>::peek::<wast::token::LParen> Line | Count | Source | 619 | 2.10M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 2.10M | T::peek(self.cursor()) | 621 | 2.10M | } |
<wast::parser::Parser>::peek::<wast::token::RParen> Line | Count | Source | 619 | 4.44k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 4.44k | T::peek(self.cursor()) | 621 | 4.44k | } |
<wast::parser::Parser>::peek::<wast::core::types::FunctionType> Line | Count | Source | 619 | 206k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 206k | T::peek(self.cursor()) | 621 | 206k | } |
<wast::parser::Parser>::peek::<wast::core::types::AbstractHeapType> Line | Count | Source | 619 | 296k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 296k | T::peek(self.cursor()) | 621 | 296k | } |
<wast::parser::Parser>::peek::<wast::core::types::FunctionTypeNoNames> Line | Count | Source | 619 | 577k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 577k | T::peek(self.cursor()) | 621 | 577k | } |
<wast::parser::Parser>::peek::<wast::core::types::Type> Line | Count | Source | 619 | 533k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 533k | T::peek(self.cursor()) | 621 | 533k | } |
<wast::parser::Parser>::peek::<wast::core::types::RefType> Line | Count | Source | 619 | 56.4k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 56.4k | T::peek(self.cursor()) | 621 | 56.4k | } |
<wast::parser::Parser>::peek::<wast::core::types::ValType> Line | Count | Source | 619 | 239k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 239k | T::peek(self.cursor()) | 621 | 239k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::types::HeapType> <wast::parser::Parser>::peek::<wast::core::export::InlineExport> Line | Count | Source | 619 | 308k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 308k | T::peek(self.cursor()) | 621 | 308k | } |
<wast::parser::Parser>::peek::<wast::core::import::InlineImport> Line | Count | Source | 619 | 279k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 279k | T::peek(self.cursor()) | 621 | 279k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::custom::parse_sym_flags::flag> <wast::parser::Parser>::peek::<&[u8]> Line | Count | Source | 619 | 15.8k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 15.8k | T::peek(self.cursor()) | 621 | 15.8k | } |
<wast::parser::Parser>::peek::<u32> Line | Count | Source | 619 | 4.53M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 4.53M | T::peek(self.cursor()) | 621 | 4.53M | } |
<wast::parser::Parser>::peek::<u64> Line | Count | Source | 619 | 60.1k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 60.1k | T::peek(self.cursor()) | 621 | 60.1k | } |
|
622 | | |
623 | | /// Same as the [`Parser::peek`] method, except checks the next token, not |
624 | | /// the current token. |
625 | 8.56M | pub fn peek2<T: Peek>(self) -> Result<bool> { |
626 | 8.56M | T::peek2(self.cursor()) |
627 | 8.56M | } <wast::parser::Parser>::peek2::<wast::annotation::name> Line | Count | Source | 625 | 1.70M | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 1.70M | T::peek2(self.cursor()) | 627 | 1.70M | } |
<wast::parser::Parser>::peek2::<wast::kw::definition> Line | Count | Source | 625 | 9 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 9 | T::peek2(self.cursor()) | 627 | 9 | } |
<wast::parser::Parser>::peek2::<wast::kw::catch_all_ref> Line | Count | Source | 625 | 55.7k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 55.7k | T::peek2(self.cursor()) | 627 | 55.7k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek2::<wast::kw::on> <wast::parser::Parser>::peek2::<wast::kw::mut> Line | Count | Source | 625 | 994k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 994k | T::peek2(self.cursor()) | 627 | 994k | } |
<wast::parser::Parser>::peek2::<wast::kw::item> Line | Count | Source | 625 | 299k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 299k | T::peek2(self.cursor()) | 627 | 299k | } |
<wast::parser::Parser>::peek2::<wast::kw::type> Line | Count | Source | 625 | 783k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 783k | T::peek2(self.cursor()) | 627 | 783k | } |
<wast::parser::Parser>::peek2::<wast::kw::catch> Line | Count | Source | 625 | 337k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 337k | T::peek2(self.cursor()) | 627 | 337k | } |
<wast::parser::Parser>::peek2::<wast::kw::exact> Line | Count | Source | 625 | 22.4k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 22.4k | T::peek2(self.cursor()) | 627 | 22.4k | } |
<wast::parser::Parser>::peek2::<wast::kw::local> Line | Count | Source | 625 | 183k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 183k | T::peek2(self.cursor()) | 627 | 183k | } |
<wast::parser::Parser>::peek2::<wast::kw::param> Line | Count | Source | 625 | 1.49M | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 1.49M | T::peek2(self.cursor()) | 627 | 1.49M | } |
<wast::parser::Parser>::peek2::<wast::kw::quote> Line | Count | Source | 625 | 19 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 19 | T::peek2(self.cursor()) | 627 | 19 | } |
<wast::parser::Parser>::peek2::<wast::kw::table> Line | Count | Source | 625 | 19.7k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 19.7k | T::peek2(self.cursor()) | 627 | 19.7k | } |
<wast::parser::Parser>::peek2::<wast::kw::memory> Line | Count | Source | 625 | 4.44k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 4.44k | T::peek2(self.cursor()) | 627 | 4.44k | } |
<wast::parser::Parser>::peek2::<wast::kw::module> Line | Count | Source | 625 | 13.8k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 13.8k | T::peek2(self.cursor()) | 627 | 13.8k | } |
<wast::parser::Parser>::peek2::<wast::kw::offset> Line | Count | Source | 625 | 19.7k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 19.7k | T::peek2(self.cursor()) | 627 | 19.7k | } |
<wast::parser::Parser>::peek2::<wast::kw::result> Line | Count | Source | 625 | 1.34M | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 1.34M | T::peek2(self.cursor()) | 627 | 1.34M | } |
<wast::parser::Parser>::peek2::<wast::kw::shared> Line | Count | Source | 625 | 89.7k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 89.7k | T::peek2(self.cursor()) | 627 | 89.7k | } |
<wast::parser::Parser>::peek2::<wast::kw::instance> Line | Count | Source | 625 | 9 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 9 | T::peek2(self.cursor()) | 627 | 9 | } |
<wast::parser::Parser>::peek2::<wast::kw::pagesize> Line | Count | Source | 625 | 18.9k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 18.9k | T::peek2(self.cursor()) | 627 | 18.9k | } |
<wast::parser::Parser>::peek2::<wast::kw::catch_all> Line | Count | Source | 625 | 313k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 313k | T::peek2(self.cursor()) | 627 | 313k | } |
<wast::parser::Parser>::peek2::<wast::kw::catch_ref> Line | Count | Source | 625 | 313k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 313k | T::peek2(self.cursor()) | 627 | 313k | } |
<wast::parser::Parser>::peek2::<wast::kw::component> Line | Count | Source | 625 | 2.15k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 2.15k | T::peek2(self.cursor()) | 627 | 2.15k | } |
<wast::parser::Parser>::peek2::<wast::wast::WastDirectiveToken> Line | Count | Source | 625 | 2.23k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 2.23k | T::peek2(self.cursor()) | 627 | 2.23k | } |
<wast::parser::Parser>::peek2::<wast::token::Index> Line | Count | Source | 625 | 30 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 30 | T::peek2(self.cursor()) | 627 | 30 | } |
<wast::parser::Parser>::peek2::<wast::token::LParen> Line | Count | Source | 625 | 14.2k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 14.2k | T::peek2(self.cursor()) | 627 | 14.2k | } |
<wast::parser::Parser>::peek2::<wast::core::types::Type> Line | Count | Source | 625 | 521k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 521k | T::peek2(self.cursor()) | 627 | 521k | } |
<wast::parser::Parser>::peek2::<wast::core::types::RefType> Line | Count | Source | 625 | 10.2k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 10.2k | T::peek2(self.cursor()) | 627 | 10.2k | } |
|
628 | | |
629 | | /// Same as the [`Parser::peek2`] method, except checks the next next token, |
630 | | /// not the next token. |
631 | 0 | pub fn peek3<T: Peek>(self) -> Result<bool> { |
632 | 0 | let mut cursor = self.cursor(); |
633 | 0 | match cursor.token()? { |
634 | 0 | Some(token) => cursor.advance_past(&token), |
635 | 0 | None => return Ok(false), |
636 | | } |
637 | 0 | match cursor.token()? { |
638 | 0 | Some(token) => cursor.advance_past(&token), |
639 | 0 | None => return Ok(false), |
640 | | } |
641 | 0 | T::peek(cursor) |
642 | 0 | } |
643 | | |
644 | | /// A helper structure to perform a sequence of `peek` operations and if |
645 | | /// they all fail produce a nice error message. |
646 | | /// |
647 | | /// This method purely exists for conveniently producing error messages and |
648 | | /// provides no functionality that [`Parser::peek`] doesn't already give. |
649 | | /// The [`Lookahead1`] structure has one main method [`Lookahead1::peek`], |
650 | | /// which is the same method as [`Parser::peek`]. The difference is that the |
651 | | /// [`Lookahead1::error`] method needs no arguments. |
652 | | /// |
653 | | /// # Examples |
654 | | /// |
655 | | /// Let's look at the parsing of [`Index`]. This type is either a `u32` or |
656 | | /// an [`Id`] and is used in name resolution primarily. The [official |
657 | | /// grammar for an index][spec] is: |
658 | | /// |
659 | | /// ```text |
660 | | /// idx ::= x:u32 |
661 | | /// | v:id |
662 | | /// ``` |
663 | | /// |
664 | | /// Which is to say that an index is either a `u32` or an [`Id`]. When |
665 | | /// parsing an [`Index`] we can do: |
666 | | /// |
667 | | /// ``` |
668 | | /// # use wast::token::*; |
669 | | /// # use wast::parser::*; |
670 | | /// enum Index<'a> { |
671 | | /// Num(u32), |
672 | | /// Id(Id<'a>), |
673 | | /// } |
674 | | /// |
675 | | /// impl<'a> Parse<'a> for Index<'a> { |
676 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
677 | | /// let mut l = parser.lookahead1(); |
678 | | /// if l.peek::<Id>()? { |
679 | | /// Ok(Index::Id(parser.parse()?)) |
680 | | /// } else if l.peek::<u32>()? { |
681 | | /// Ok(Index::Num(parser.parse()?)) |
682 | | /// } else { |
683 | | /// // produces error message of `expected identifier or u32` |
684 | | /// Err(l.error()) |
685 | | /// } |
686 | | /// } |
687 | | /// } |
688 | | /// ``` |
689 | | /// |
690 | | /// [spec]: https://webassembly.github.io/spec/core/text/modules.html#indices |
691 | | /// [`Index`]: crate::token::Index |
692 | | /// [`Id`]: crate::token::Id |
693 | 4.42M | pub fn lookahead1(self) -> Lookahead1<'a> { |
694 | 4.42M | Lookahead1 { |
695 | 4.42M | attempts: Vec::new(), |
696 | 4.42M | parser: self, |
697 | 4.42M | } |
698 | 4.42M | } |
699 | | |
700 | | /// Parse an item surrounded by parentheses. |
701 | | /// |
702 | | /// WebAssembly's text format is all based on s-expressions, so naturally |
703 | | /// you're going to want to parse a lot of parenthesized things! As noted in |
704 | | /// the documentation of [`Parse`] you typically don't parse your own |
705 | | /// surrounding `(` and `)` tokens, but the parser above you parsed them for |
706 | | /// you. This is method method the parser above you uses. |
707 | | /// |
708 | | /// This method will parse a `(` token, and then call `f` on a sub-parser |
709 | | /// which when finished asserts that a `)` token is the next token. This |
710 | | /// requires that `f` consumes all tokens leading up to the paired `)`. |
711 | | /// |
712 | | /// Usage will often simply be `parser.parens(|p| p.parse())?` to |
713 | | /// automatically parse a type within parentheses, but you can, as always, |
714 | | /// go crazy and do whatever you'd like too. |
715 | | /// |
716 | | /// # Examples |
717 | | /// |
718 | | /// A good example of this is to see how a `Module` is parsed. This isn't |
719 | | /// the exact definition, but it's close enough! |
720 | | /// |
721 | | /// ``` |
722 | | /// # use wast::kw; |
723 | | /// # use wast::core::*; |
724 | | /// # use wast::parser::*; |
725 | | /// struct Module<'a> { |
726 | | /// fields: Vec<ModuleField<'a>>, |
727 | | /// } |
728 | | /// |
729 | | /// impl<'a> Parse<'a> for Module<'a> { |
730 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
731 | | /// // Modules start out with a `module` keyword |
732 | | /// parser.parse::<kw::module>()?; |
733 | | /// |
734 | | /// // And then everything else is `(field ...)`, so while we've got |
735 | | /// // items left we continuously parse parenthesized items. |
736 | | /// let mut fields = Vec::new(); |
737 | | /// while !parser.is_empty() { |
738 | | /// fields.push(parser.parens(|p| p.parse())?); |
739 | | /// } |
740 | | /// Ok(Module { fields }) |
741 | | /// } |
742 | | /// } |
743 | | /// ``` |
744 | 5.30M | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { |
745 | 5.30M | self.buf.depth.set(self.buf.depth.get() + 1); |
746 | 5.30M | let before = self.buf.cur.get(); |
747 | 5.30M | let res = self.step(|cursor| { |
748 | 5.30M | let mut cursor = match cursor.lparen()? { |
749 | 5.29M | Some(rest) => rest, |
750 | 1.09k | None => return Err(cursor.error("expected `(`")), |
751 | | }; |
752 | 5.29M | cursor.parser.buf.cur.set(cursor.pos); |
753 | 5.29M | let result = f(cursor.parser)?; |
754 | | |
755 | | // Reset our cursor's state to whatever the current state of the |
756 | | // parser is. |
757 | 5.29M | cursor.pos = cursor.parser.buf.cur.get(); |
758 | | |
759 | 5.29M | match cursor.rparen()? { |
760 | 5.29M | Some(rest) => Ok((result, rest)), |
761 | 22 | None => Err(cursor.error("expected `)`")), |
762 | | } |
763 | 5.30M | }); <wast::parser::Parser>::parens::<alloc::vec::Vec<wast::core::memory::DataVal>, <wast::core::memory::Memory as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 6 | let res = self.step(|cursor| { | 748 | 6 | let mut cursor = match cursor.lparen()? { | 749 | 6 | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 6 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 6 | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 0 | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 0 | match cursor.rparen()? { | 760 | 0 | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 6 | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::types::TypeUse<wast::core::types::FunctionType>, <wast::core::func::Func as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::types::TypeUse<wast::core::types::FunctionType>, <wast::core::import::ItemSig as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wat::Wat, wast::wast::parse_wat>::{closure#0}<wast::parser::Parser>::parens::<wast::wast::WastInvoke, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#7}>::{closure#0}Line | Count | Source | 747 | 1 | let res = self.step(|cursor| { | 748 | 1 | let mut cursor = match cursor.lparen()? { | 749 | 1 | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 1 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 1 | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 0 | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 0 | match cursor.rparen()? { | 760 | 0 | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 1 | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#4}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#5}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#8}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#9}>::{closure#0}<wast::parser::Parser>::parens::<wast::wast::WastDirective, <wast::wast::Wast as wast::parser::Parse>::parse::{closure#0}::{closure#0}>::{closure#0}Line | Count | Source | 747 | 23 | let res = self.step(|cursor| { | 748 | 23 | let mut cursor = match cursor.lparen()? { | 749 | 20 | Some(rest) => rest, | 750 | 3 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 20 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 20 | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 2 | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 2 | match cursor.rparen()? { | 760 | 2 | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 23 | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastDirective, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#1}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastArg, <wast::wast::WastInvoke as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastRet, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#6}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#2}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#3}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#1}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::token::NameAnnotation, <core::option::Option<wast::token::NameAnnotation> as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::token::Id, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#0}::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::token::Id, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#0}>::{closure#0}<wast::parser::Parser>::parens::<wast::token::Index, <wast::core::table::Elem as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 16.0k | let res = self.step(|cursor| { | 748 | 16.0k | let mut cursor = match cursor.lparen()? { | 749 | 16.0k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 16.0k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 16.0k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 16.0k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 16.0k | match cursor.rparen()? { | 760 | 16.0k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 16.0k | }); |
<wast::parser::Parser>::parens::<wast::token::Index, <wast::core::memory::Data as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 2.46k | let res = self.step(|cursor| { | 748 | 2.46k | let mut cursor = match cursor.lparen()? { | 749 | 2.46k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 2.46k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 2.46k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 2.46k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 2.46k | match cursor.rparen()? { | 760 | 2.46k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 2.46k | }); |
<wast::parser::Parser>::parens::<wast::token::Index, <wast::core::types::TypeUse<wast::core::types::FunctionType> as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 184k | let res = self.step(|cursor| { | 748 | 184k | let mut cursor = match cursor.lparen()? { | 749 | 184k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 184k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 184k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 184k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 184k | match cursor.rparen()? { | 760 | 184k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 184k | }); |
<wast::parser::Parser>::parens::<wast::token::Index, <wast::core::types::TypeUse<wast::core::types::FunctionTypeNoNames> as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 64.5k | let res = self.step(|cursor| { | 748 | 64.5k | let mut cursor = match cursor.lparen()? { | 749 | 64.5k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 64.5k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 64.5k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 64.5k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 64.5k | match cursor.rparen()? { | 760 | 64.5k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 64.5k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::component::Component, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#1}>::{closure#0}<wast::parser::Parser>::parens::<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::item>::{closure#0}>::{closure#0}Line | Count | Source | 747 | 46.0k | let res = self.step(|cursor| { | 748 | 46.0k | let mut cursor = match cursor.lparen()? { | 749 | 46.0k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 46.0k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 46.0k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 46.0k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 46.0k | match cursor.rparen()? { | 760 | 46.0k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 46.0k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::offset>::{closure#0}>::{closure#0}<wast::parser::Parser>::parens::<wast::core::expr::Expression, <wast::core::memory::Data as wast::parser::Parse>::parse::{closure#1}>::{closure#0}Line | Count | Source | 747 | 4.44k | let res = self.step(|cursor| { | 748 | 4.44k | let mut cursor = match cursor.lparen()? { | 749 | 4.44k | Some(rest) => rest, | 750 | 2 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 4.44k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 4.44k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 4.42k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 4.42k | match cursor.rparen()? { | 760 | 4.42k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 4.44k | }); |
<wast::parser::Parser>::parens::<wast::core::expr::TryTableCatch, <wast::core::expr::TryTable as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 282k | let res = self.step(|cursor| { | 748 | 282k | let mut cursor = match cursor.lparen()? { | 749 | 282k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 282k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 282k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 282k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 282k | match cursor.rparen()? { | 760 | 282k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 282k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::expr::Handle, <wast::core::expr::ResumeTable as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::wast::WastRetCore, wast::core::wast::RETS::{closure#15}::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::table::ElemPayload, <wast::core::table::Table as wast::parser::Parse>::parse::{closure#0}>::{closure#0}<wast::parser::Parser>::parens::<wast::core::types::GlobalType, <wast::core::types::GlobalType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 83.1k | let res = self.step(|cursor| { | 748 | 83.1k | let mut cursor = match cursor.lparen()? { | 749 | 83.1k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 83.1k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 83.1k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 83.1k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 83.1k | match cursor.rparen()? { | 760 | 83.1k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 83.1k | }); |
<wast::parser::Parser>::parens::<wast::core::types::StorageType, <wast::core::types::StructField>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 431k | let res = self.step(|cursor| { | 748 | 431k | let mut cursor = match cursor.lparen()? { | 749 | 431k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 431k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 431k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 431k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 431k | match cursor.rparen()? { | 760 | 431k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 431k | }); |
<wast::parser::Parser>::parens::<wast::core::types::StorageType, <wast::core::types::ArrayType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 198k | let res = self.step(|cursor| { | 748 | 198k | let mut cursor = match cursor.lparen()? { | 749 | 198k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 198k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 198k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 198k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 198k | match cursor.rparen()? { | 760 | 198k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 198k | }); |
<wast::parser::Parser>::parens::<wast::core::types::Type, <wast::core::types::Rec as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 457k | let res = self.step(|cursor| { | 748 | 457k | let mut cursor = match cursor.lparen()? { | 749 | 457k | Some(rest) => rest, | 750 | 2 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 457k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 457k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 457k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 457k | match cursor.rparen()? { | 760 | 457k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 457k | }); |
<wast::parser::Parser>::parens::<wast::core::types::RefType, <wast::core::types::RefType as wast::parser::Parse>::parse::{closure#1}>::{closure#0}Line | Count | Source | 747 | 585k | let res = self.step(|cursor| { | 748 | 585k | let mut cursor = match cursor.lparen()? { | 749 | 585k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 585k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 585k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 585k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 585k | match cursor.rparen()? { | 760 | 585k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 585k | }); |
<wast::parser::Parser>::parens::<wast::core::types::TypeDef, <wast::core::types::Type as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 482k | let res = self.step(|cursor| { | 748 | 482k | let mut cursor = match cursor.lparen()? { | 749 | 482k | Some(rest) => rest, | 750 | 5 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 482k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 482k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 482k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 482k | match cursor.rparen()? { | 760 | 482k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 482k | }); |
<wast::parser::Parser>::parens::<wast::core::types::HeapType, <wast::core::types::HeapType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 54.3k | let res = self.step(|cursor| { | 748 | 54.3k | let mut cursor = match cursor.lparen()? { | 749 | 54.3k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 54.3k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 54.3k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 54.3k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 54.3k | match cursor.rparen()? { | 760 | 54.3k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 54.3k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::custom::CustomPlace, <wast::core::custom::RawCustomSection as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::InlineImport, <wast::core::import::InlineImport as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ImportGroupItemCommon, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::import::ImportGroupItemCommon as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#2}>::{closure#0}<wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#4}>::{closure#0}Line | Count | Source | 747 | 58.1k | let res = self.step(|cursor| { | 748 | 58.1k | let mut cursor = match cursor.lparen()? { | 749 | 58.1k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 58.1k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 58.1k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 58.1k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 58.1k | match cursor.rparen()? { | 760 | 58.1k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 58.1k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::types::ExportType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}<wast::parser::Parser>::parens::<wast::core::memory::DataVal, <wast::core::memory::DataVal as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 4 | let res = self.step(|cursor| { | 748 | 4 | let mut cursor = match cursor.lparen()? { | 749 | 4 | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 4 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 4 | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 0 | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 0 | match cursor.rparen()? { | 760 | 0 | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 4 | }); |
<wast::parser::Parser>::parens::<wast::core::module::ModuleField, <wast::core::module::ModuleField as wast::parser::Parse>::parse>::{closure#0}Line | Count | Source | 747 | 534k | let res = self.step(|cursor| { | 748 | 534k | let mut cursor = match cursor.lparen()? { | 749 | 533k | Some(rest) => rest, | 750 | 1.08k | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 533k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 533k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 532k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 532k | match cursor.rparen()? { | 760 | 532k | Some(rest) => Ok((result, rest)), | 761 | 22 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 534k | }); |
<wast::parser::Parser>::parens::<wast::core::module::Module, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#0}>::{closure#0}Line | Count | Source | 747 | 10.8k | let res = self.step(|cursor| { | 748 | 10.8k | let mut cursor = match cursor.lparen()? { | 749 | 10.8k | Some(rest) => rest, | 750 | 2 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 10.8k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 10.8k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 10.8k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 10.8k | match cursor.rparen()? { | 760 | 10.8k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 10.8k | }); |
<wast::parser::Parser>::parens::<&str, <wast::core::export::InlineExport as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 14.6k | let res = self.step(|cursor| { | 748 | 14.6k | let mut cursor = match cursor.lparen()? { | 749 | 14.6k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 14.6k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 14.6k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 14.6k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 14.6k | match cursor.rparen()? { | 760 | 14.6k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 14.6k | }); |
<wast::parser::Parser>::parens::<(wast::core::export::ExportKind, wast::token::Index), <wast::core::export::Export as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 45.4k | let res = self.step(|cursor| { | 748 | 45.4k | let mut cursor = match cursor.lparen()? { | 749 | 45.4k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 45.4k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 45.4k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 45.4k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 45.4k | match cursor.rparen()? { | 760 | 45.4k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 45.4k | }); |
<wast::parser::Parser>::parens::<(bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), wast::core::types::parse_optional<wast::kw::shared, bool, (bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}::{closure#0}, <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}::{closure#1}>::{closure#0}>::{closure#0}Line | Count | Source | 747 | 62.6k | let res = self.step(|cursor| { | 748 | 62.6k | let mut cursor = match cursor.lparen()? { | 749 | 62.6k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 62.6k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 62.6k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 62.6k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 62.6k | match cursor.rparen()? { | 760 | 62.6k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 62.6k | }); |
<wast::parser::Parser>::parens::<(bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 162k | let res = self.step(|cursor| { | 748 | 162k | let mut cursor = match cursor.lparen()? { | 749 | 162k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 162k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 162k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 162k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 162k | match cursor.rparen()? { | 760 | 162k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 162k | }); |
<wast::parser::Parser>::parens::<u32, wast::core::types::page_size::{closure#0}>::{closure#0}Line | Count | Source | 747 | 18.9k | let res = self.step(|cursor| { | 748 | 18.9k | let mut cursor = match cursor.lparen()? { | 749 | 18.9k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 18.9k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 18.9k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 18.9k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 18.9k | match cursor.rparen()? { | 760 | 18.9k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 18.9k | }); |
<wast::parser::Parser>::parens::<(), <wast::core::func::Local>::parse_remainder::{closure#0}>::{closure#0}Line | Count | Source | 747 | 28.1k | let res = self.step(|cursor| { | 748 | 28.1k | let mut cursor = match cursor.lparen()? { | 749 | 28.1k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 28.1k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 28.1k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 28.1k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 28.1k | match cursor.rparen()? { | 760 | 28.1k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 28.1k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Dylink0>::parse_next::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Dylink0>::parse_next::{closure#1}>::{closure#0}<wast::parser::Parser>::parens::<(), <wast::core::types::FunctionType>::finish_parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 837k | let res = self.step(|cursor| { | 748 | 837k | let mut cursor = match cursor.lparen()? { | 749 | 837k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 837k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 837k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 837k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 837k | match cursor.rparen()? { | 760 | 837k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 837k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Producers as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Dylink0 as wast::parser::Parse>::parse::{closure#0}>::{closure#0}<wast::parser::Parser>::parens::<(), <wast::core::expr::SelectTypes as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 52 | let res = self.step(|cursor| { | 748 | 52 | let mut cursor = match cursor.lparen()? { | 749 | 52 | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 52 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 52 | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 52 | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 52 | match cursor.rparen()? { | 760 | 52 | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 52 | }); |
<wast::parser::Parser>::parens::<(), <wast::core::types::StructType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 633k | let res = self.step(|cursor| { | 748 | 633k | let mut cursor = match cursor.lparen()? { | 749 | 633k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 633k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 633k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 633k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 633k | match cursor.rparen()? { | 760 | 633k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 633k | }); |
|
764 | 5.30M | self.buf.depth.set(self.buf.depth.get() - 1); |
765 | 5.30M | if res.is_err() { |
766 | 2.21k | self.buf.cur.set(before); |
767 | 5.29M | } |
768 | 5.30M | res |
769 | 5.30M | } <wast::parser::Parser>::parens::<alloc::vec::Vec<wast::core::memory::DataVal>, <wast::core::memory::Memory as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 6 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 6 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 6 | let before = self.buf.cur.get(); | 747 | 6 | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 6 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 6 | if res.is_err() { | 766 | 6 | self.buf.cur.set(before); | 767 | 6 | } | 768 | 6 | res | 769 | 6 | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::types::TypeUse<wast::core::types::FunctionType>, <wast::core::func::Func as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::types::TypeUse<wast::core::types::FunctionType>, <wast::core::import::ItemSig as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wat::Wat, wast::wast::parse_wat> <wast::parser::Parser>::parens::<wast::wast::WastInvoke, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#7}>Line | Count | Source | 744 | 1 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 1 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 1 | let before = self.buf.cur.get(); | 747 | 1 | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 1 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 1 | if res.is_err() { | 766 | 1 | self.buf.cur.set(before); | 767 | 1 | } | 768 | 1 | res | 769 | 1 | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#4}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#5}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#8}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#9}><wast::parser::Parser>::parens::<wast::wast::WastDirective, <wast::wast::Wast as wast::parser::Parse>::parse::{closure#0}::{closure#0}>Line | Count | Source | 744 | 23 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 23 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 23 | let before = self.buf.cur.get(); | 747 | 23 | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 23 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 23 | if res.is_err() { | 766 | 21 | self.buf.cur.set(before); | 767 | 21 | } | 768 | 23 | res | 769 | 23 | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastDirective, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#1}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastArg, <wast::wast::WastInvoke as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::WastRet, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#6}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#2}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#3}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#1}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::token::NameAnnotation, <core::option::Option<wast::token::NameAnnotation> as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::token::Id, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#0}::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::token::Id, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#0}><wast::parser::Parser>::parens::<wast::token::Index, <wast::core::table::Elem as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 16.0k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 16.0k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 16.0k | let before = self.buf.cur.get(); | 747 | 16.0k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 16.0k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 16.0k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 16.0k | } | 768 | 16.0k | res | 769 | 16.0k | } |
<wast::parser::Parser>::parens::<wast::token::Index, <wast::core::memory::Data as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 2.46k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 2.46k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 2.46k | let before = self.buf.cur.get(); | 747 | 2.46k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 2.46k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 2.46k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 2.46k | } | 768 | 2.46k | res | 769 | 2.46k | } |
<wast::parser::Parser>::parens::<wast::token::Index, <wast::core::types::TypeUse<wast::core::types::FunctionType> as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 184k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 184k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 184k | let before = self.buf.cur.get(); | 747 | 184k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 184k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 184k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 184k | } | 768 | 184k | res | 769 | 184k | } |
<wast::parser::Parser>::parens::<wast::token::Index, <wast::core::types::TypeUse<wast::core::types::FunctionTypeNoNames> as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 64.5k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 64.5k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 64.5k | let before = self.buf.cur.get(); | 747 | 64.5k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 64.5k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 64.5k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 64.5k | } | 768 | 64.5k | res | 769 | 64.5k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::component::Component, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#1}><wast::parser::Parser>::parens::<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::item>::{closure#0}>Line | Count | Source | 744 | 46.0k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 46.0k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 46.0k | let before = self.buf.cur.get(); | 747 | 46.0k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 46.0k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 46.0k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 46.0k | } | 768 | 46.0k | res | 769 | 46.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::offset>::{closure#0}><wast::parser::Parser>::parens::<wast::core::expr::Expression, <wast::core::memory::Data as wast::parser::Parse>::parse::{closure#1}>Line | Count | Source | 744 | 4.44k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 4.44k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 4.44k | let before = self.buf.cur.get(); | 747 | 4.44k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 4.44k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 4.44k | if res.is_err() { | 766 | 25 | self.buf.cur.set(before); | 767 | 4.42k | } | 768 | 4.44k | res | 769 | 4.44k | } |
<wast::parser::Parser>::parens::<wast::core::expr::TryTableCatch, <wast::core::expr::TryTable as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 282k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 282k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 282k | let before = self.buf.cur.get(); | 747 | 282k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 282k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 282k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 282k | } | 768 | 282k | res | 769 | 282k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::expr::Handle, <wast::core::expr::ResumeTable as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::wast::WastRetCore, wast::core::wast::RETS::{closure#15}::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::table::ElemPayload, <wast::core::table::Table as wast::parser::Parse>::parse::{closure#0}><wast::parser::Parser>::parens::<wast::core::types::GlobalType, <wast::core::types::GlobalType as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 83.1k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 83.1k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 83.1k | let before = self.buf.cur.get(); | 747 | 83.1k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 83.1k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 83.1k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 83.1k | } | 768 | 83.1k | res | 769 | 83.1k | } |
<wast::parser::Parser>::parens::<wast::core::types::StorageType, <wast::core::types::StructField>::parse::{closure#0}>Line | Count | Source | 744 | 431k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 431k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 431k | let before = self.buf.cur.get(); | 747 | 431k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 431k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 431k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 431k | } | 768 | 431k | res | 769 | 431k | } |
<wast::parser::Parser>::parens::<wast::core::types::StorageType, <wast::core::types::ArrayType as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 198k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 198k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 198k | let before = self.buf.cur.get(); | 747 | 198k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 198k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 198k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 198k | } | 768 | 198k | res | 769 | 198k | } |
<wast::parser::Parser>::parens::<wast::core::types::Type, <wast::core::types::Rec as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 457k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 457k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 457k | let before = self.buf.cur.get(); | 747 | 457k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 457k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 457k | if res.is_err() { | 766 | 2 | self.buf.cur.set(before); | 767 | 457k | } | 768 | 457k | res | 769 | 457k | } |
<wast::parser::Parser>::parens::<wast::core::types::RefType, <wast::core::types::RefType as wast::parser::Parse>::parse::{closure#1}>Line | Count | Source | 744 | 585k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 585k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 585k | let before = self.buf.cur.get(); | 747 | 585k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 585k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 585k | if res.is_err() { | 766 | 2 | self.buf.cur.set(before); | 767 | 585k | } | 768 | 585k | res | 769 | 585k | } |
<wast::parser::Parser>::parens::<wast::core::types::TypeDef, <wast::core::types::Type as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 482k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 482k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 482k | let before = self.buf.cur.get(); | 747 | 482k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 482k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 482k | if res.is_err() { | 766 | 20 | self.buf.cur.set(before); | 767 | 482k | } | 768 | 482k | res | 769 | 482k | } |
<wast::parser::Parser>::parens::<wast::core::types::HeapType, <wast::core::types::HeapType as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 54.3k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 54.3k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 54.3k | let before = self.buf.cur.get(); | 747 | 54.3k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 54.3k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 54.3k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 54.3k | } | 768 | 54.3k | res | 769 | 54.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::custom::CustomPlace, <wast::core::custom::RawCustomSection as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::InlineImport, <wast::core::import::InlineImport as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ImportGroupItemCommon, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::import::ImportGroupItemCommon as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#2}><wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#4}>Line | Count | Source | 744 | 58.1k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 58.1k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 58.1k | let before = self.buf.cur.get(); | 747 | 58.1k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 58.1k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 58.1k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 58.1k | } | 768 | 58.1k | res | 769 | 58.1k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::import::ItemSig, <wast::core::types::ExportType as wast::parser::Parse>::parse::{closure#0}><wast::parser::Parser>::parens::<wast::core::memory::DataVal, <wast::core::memory::DataVal as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 4 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 4 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 4 | let before = self.buf.cur.get(); | 747 | 4 | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 4 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 4 | if res.is_err() { | 766 | 4 | self.buf.cur.set(before); | 767 | 4 | } | 768 | 4 | res | 769 | 4 | } |
<wast::parser::Parser>::parens::<wast::core::module::ModuleField, <wast::core::module::ModuleField as wast::parser::Parse>::parse> Line | Count | Source | 744 | 534k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 534k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 534k | let before = self.buf.cur.get(); | 747 | 534k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 534k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 534k | if res.is_err() { | 766 | 2.12k | self.buf.cur.set(before); | 767 | 532k | } | 768 | 534k | res | 769 | 534k | } |
<wast::parser::Parser>::parens::<wast::core::module::Module, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#0}>Line | Count | Source | 744 | 10.8k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 10.8k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 10.8k | let before = self.buf.cur.get(); | 747 | 10.8k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 10.8k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 10.8k | if res.is_err() { | 766 | 10 | self.buf.cur.set(before); | 767 | 10.8k | } | 768 | 10.8k | res | 769 | 10.8k | } |
<wast::parser::Parser>::parens::<&str, <wast::core::export::InlineExport as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 14.6k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 14.6k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 14.6k | let before = self.buf.cur.get(); | 747 | 14.6k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 14.6k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 14.6k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 14.6k | } | 768 | 14.6k | res | 769 | 14.6k | } |
<wast::parser::Parser>::parens::<(wast::core::export::ExportKind, wast::token::Index), <wast::core::export::Export as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 45.4k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 45.4k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 45.4k | let before = self.buf.cur.get(); | 747 | 45.4k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 45.4k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 45.4k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 45.4k | } | 768 | 45.4k | res | 769 | 45.4k | } |
<wast::parser::Parser>::parens::<(bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), wast::core::types::parse_optional<wast::kw::shared, bool, (bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}::{closure#0}, <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}::{closure#1}>::{closure#0}>Line | Count | Source | 744 | 62.6k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 62.6k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 62.6k | let before = self.buf.cur.get(); | 747 | 62.6k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 62.6k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 62.6k | if res.is_err() { | 766 | 2 | self.buf.cur.set(before); | 767 | 62.6k | } | 768 | 62.6k | res | 769 | 62.6k | } |
<wast::parser::Parser>::parens::<(bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 162k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 162k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 162k | let before = self.buf.cur.get(); | 747 | 162k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 162k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 162k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 162k | } | 768 | 162k | res | 769 | 162k | } |
<wast::parser::Parser>::parens::<u32, wast::core::types::page_size::{closure#0}>Line | Count | Source | 744 | 18.9k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 18.9k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 18.9k | let before = self.buf.cur.get(); | 747 | 18.9k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 18.9k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 18.9k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 18.9k | } | 768 | 18.9k | res | 769 | 18.9k | } |
<wast::parser::Parser>::parens::<(), <wast::core::func::Local>::parse_remainder::{closure#0}>Line | Count | Source | 744 | 28.1k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 28.1k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 28.1k | let before = self.buf.cur.get(); | 747 | 28.1k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 28.1k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 28.1k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 28.1k | } | 768 | 28.1k | res | 769 | 28.1k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Dylink0>::parse_next::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Dylink0>::parse_next::{closure#1}><wast::parser::Parser>::parens::<(), <wast::core::types::FunctionType>::finish_parse::{closure#0}>Line | Count | Source | 744 | 837k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 837k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 837k | let before = self.buf.cur.get(); | 747 | 837k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 837k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 837k | if res.is_err() { | 766 | 4 | self.buf.cur.set(before); | 767 | 837k | } | 768 | 837k | res | 769 | 837k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Producers as wast::parser::Parse>::parse::{closure#0}>Unexecuted instantiation: <wast::parser::Parser>::parens::<(), <wast::core::custom::Dylink0 as wast::parser::Parse>::parse::{closure#0}><wast::parser::Parser>::parens::<(), <wast::core::expr::SelectTypes as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 52 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 52 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 52 | let before = self.buf.cur.get(); | 747 | 52 | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 52 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 52 | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 52 | } | 768 | 52 | res | 769 | 52 | } |
<wast::parser::Parser>::parens::<(), <wast::core::types::StructType as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 633k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 633k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 633k | let before = self.buf.cur.get(); | 747 | 633k | let res = self.step(|cursor| { | 748 | | let mut cursor = match cursor.lparen()? { | 749 | | Some(rest) => rest, | 750 | | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | | cursor.parser.buf.cur.set(cursor.pos); | 753 | | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | | match cursor.rparen()? { | 760 | | Some(rest) => Ok((result, rest)), | 761 | | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | | }); | 764 | 633k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 633k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 633k | } | 768 | 633k | res | 769 | 633k | } |
|
770 | | |
771 | | /// Return the depth of nested parens we've parsed so far. |
772 | | /// |
773 | | /// This is a low-level method that is only useful for implementing |
774 | | /// recursion limits in custom parsers. |
775 | 0 | pub fn parens_depth(&self) -> usize { |
776 | 0 | self.buf.depth.get() |
777 | 0 | } |
778 | | |
779 | | /// Checks that the parser parens depth hasn't exceeded the maximum depth. |
780 | | #[cfg(feature = "wasm-module")] |
781 | 0 | pub(crate) fn depth_check(&self) -> Result<()> { |
782 | 0 | if self.parens_depth() > MAX_PARENS_DEPTH { |
783 | 0 | Err(self.error("item nesting too deep")) |
784 | | } else { |
785 | 0 | Ok(()) |
786 | | } |
787 | 0 | } |
788 | | |
789 | 129M | fn cursor(self) -> Cursor<'a> { |
790 | 129M | Cursor { |
791 | 129M | parser: self, |
792 | 129M | pos: self.buf.cur.get(), |
793 | 129M | } |
794 | 129M | } |
795 | | |
796 | | /// A low-level parsing method you probably won't use. |
797 | | /// |
798 | | /// This is used to implement parsing of the most primitive types in the |
799 | | /// [`core`](crate::core) module. You probably don't want to use this, but |
800 | | /// probably want to use something like [`Parser::parse`] or |
801 | | /// [`Parser::parens`]. |
802 | 50.2M | pub fn step<F, T>(self, f: F) -> Result<T> |
803 | 50.2M | where |
804 | 50.2M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, |
805 | | { |
806 | 50.2M | let (result, cursor) = f(self.cursor())?; |
807 | 50.2M | self.buf.cur.set(cursor.pos); |
808 | 50.2M | Ok(result) |
809 | 50.2M | } <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<alloc::vec::Vec<wast::core::memory::DataVal>, <wast::core::memory::Memory as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, alloc::vec::Vec<wast::core::memory::DataVal>>Line | Count | Source | 802 | 6 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 6 | where | 804 | 6 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 6 | let (result, cursor) = f(self.cursor())?; | 807 | 0 | self.buf.cur.set(cursor.pos); | 808 | 0 | Ok(result) | 809 | 6 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::TypeUse<wast::core::types::FunctionType>, <wast::core::func::Func as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::types::TypeUse<wast::core::types::FunctionType>>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::TypeUse<wast::core::types::FunctionType>, <wast::core::import::ItemSig as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::types::TypeUse<wast::core::types::FunctionType>>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wat::Wat, wast::wast::parse_wat>::{closure#0}, wast::wat::Wat><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastInvoke, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#7}>::{closure#0}, wast::wast::WastInvoke>Line | Count | Source | 802 | 1 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 1 | where | 804 | 1 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 1 | let (result, cursor) = f(self.cursor())?; | 807 | 0 | self.buf.cur.set(cursor.pos); | 808 | 0 | Ok(result) | 809 | 1 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#4}>::{closure#0}, wast::wast::WastExecute>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#5}>::{closure#0}, wast::wast::WastExecute>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#8}>::{closure#0}, wast::wast::WastExecute>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastExecute, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#9}>::{closure#0}, wast::wast::WastExecute><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastDirective, <wast::wast::Wast as wast::parser::Parse>::parse::{closure#0}::{closure#0}>::{closure#0}, wast::wast::WastDirective>Line | Count | Source | 802 | 23 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 23 | where | 804 | 23 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 23 | let (result, cursor) = f(self.cursor())?; | 807 | 2 | self.buf.cur.set(cursor.pos); | 808 | 2 | Ok(result) | 809 | 23 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastDirective, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#1}>::{closure#0}, wast::wast::WastDirective>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastArg, <wast::wast::WastInvoke as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::wast::WastArg>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::WastRet, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#6}>::{closure#0}, wast::wast::WastRet>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::wast::QuoteWat>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#2}>::{closure#0}, wast::wast::QuoteWat>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#3}>::{closure#0}, wast::wast::QuoteWat>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::wast::QuoteWat, <wast::wast::WastDirective as wast::parser::Parse>::parse::{closure#1}>::{closure#0}, wast::wast::QuoteWat>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::token::NameAnnotation, <core::option::Option<wast::token::NameAnnotation> as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::token::NameAnnotation>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::token::Id, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#0}::{closure#0}>::{closure#0}, wast::token::Id>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::token::Id, <wast::wast::WastThread as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::token::Id><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::token::Index, <wast::core::table::Elem as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::token::Index>Line | Count | Source | 802 | 16.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 16.0k | where | 804 | 16.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 16.0k | let (result, cursor) = f(self.cursor())?; | 807 | 16.0k | self.buf.cur.set(cursor.pos); | 808 | 16.0k | Ok(result) | 809 | 16.0k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::token::Index, <wast::core::memory::Data as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::token::Index>Line | Count | Source | 802 | 2.46k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 2.46k | where | 804 | 2.46k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 2.46k | let (result, cursor) = f(self.cursor())?; | 807 | 2.46k | self.buf.cur.set(cursor.pos); | 808 | 2.46k | Ok(result) | 809 | 2.46k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::token::Index, <wast::core::types::TypeUse<wast::core::types::FunctionType> as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::token::Index>Line | Count | Source | 802 | 184k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 184k | where | 804 | 184k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 184k | let (result, cursor) = f(self.cursor())?; | 807 | 184k | self.buf.cur.set(cursor.pos); | 808 | 184k | Ok(result) | 809 | 184k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::token::Index, <wast::core::types::TypeUse<wast::core::types::FunctionTypeNoNames> as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::token::Index>Line | Count | Source | 802 | 64.5k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 64.5k | where | 804 | 64.5k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 64.5k | let (result, cursor) = f(self.cursor())?; | 807 | 64.5k | self.buf.cur.set(cursor.pos); | 808 | 64.5k | Ok(result) | 809 | 64.5k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::component::Component, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#1}>::{closure#0}, wast::component::Component><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::item>::{closure#0}>::{closure#0}, wast::core::expr::Expression>Line | Count | Source | 802 | 46.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 46.0k | where | 804 | 46.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 46.0k | let (result, cursor) = f(self.cursor())?; | 807 | 46.0k | self.buf.cur.set(cursor.pos); | 808 | 46.0k | Ok(result) | 809 | 46.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::offset>::{closure#0}>::{closure#0}, wast::core::expr::Expression><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::expr::Expression, <wast::core::memory::Data as wast::parser::Parse>::parse::{closure#1}>::{closure#0}, wast::core::expr::Expression>Line | Count | Source | 802 | 4.44k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 4.44k | where | 804 | 4.44k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 4.44k | let (result, cursor) = f(self.cursor())?; | 807 | 4.42k | self.buf.cur.set(cursor.pos); | 808 | 4.42k | Ok(result) | 809 | 4.44k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::expr::TryTableCatch, <wast::core::expr::TryTable as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::expr::TryTableCatch>Line | Count | Source | 802 | 282k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 282k | where | 804 | 282k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 282k | let (result, cursor) = f(self.cursor())?; | 807 | 282k | self.buf.cur.set(cursor.pos); | 808 | 282k | Ok(result) | 809 | 282k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::expr::Handle, <wast::core::expr::ResumeTable as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::expr::Handle>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::wast::WastRetCore, wast::core::wast::RETS::{closure#15}::{closure#0}>::{closure#0}, wast::core::wast::WastRetCore>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::table::ElemPayload, <wast::core::table::Table as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::table::ElemPayload><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::GlobalType, <wast::core::types::GlobalType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::types::GlobalType>Line | Count | Source | 802 | 83.1k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 83.1k | where | 804 | 83.1k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 83.1k | let (result, cursor) = f(self.cursor())?; | 807 | 83.1k | self.buf.cur.set(cursor.pos); | 808 | 83.1k | Ok(result) | 809 | 83.1k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::StorageType, <wast::core::types::StructField>::parse::{closure#0}>::{closure#0}, wast::core::types::StorageType>Line | Count | Source | 802 | 431k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 431k | where | 804 | 431k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 431k | let (result, cursor) = f(self.cursor())?; | 807 | 431k | self.buf.cur.set(cursor.pos); | 808 | 431k | Ok(result) | 809 | 431k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::StorageType, <wast::core::types::ArrayType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::types::StorageType>Line | Count | Source | 802 | 198k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 198k | where | 804 | 198k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 198k | let (result, cursor) = f(self.cursor())?; | 807 | 198k | self.buf.cur.set(cursor.pos); | 808 | 198k | Ok(result) | 809 | 198k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::Type, <wast::core::types::Rec as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::types::Type>Line | Count | Source | 802 | 457k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 457k | where | 804 | 457k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 457k | let (result, cursor) = f(self.cursor())?; | 807 | 457k | self.buf.cur.set(cursor.pos); | 808 | 457k | Ok(result) | 809 | 457k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::RefType, <wast::core::types::RefType as wast::parser::Parse>::parse::{closure#1}>::{closure#0}, wast::core::types::RefType>Line | Count | Source | 802 | 585k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 585k | where | 804 | 585k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 585k | let (result, cursor) = f(self.cursor())?; | 807 | 585k | self.buf.cur.set(cursor.pos); | 808 | 585k | Ok(result) | 809 | 585k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::TypeDef, <wast::core::types::Type as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::types::TypeDef>Line | Count | Source | 802 | 482k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 482k | where | 804 | 482k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 482k | let (result, cursor) = f(self.cursor())?; | 807 | 482k | self.buf.cur.set(cursor.pos); | 808 | 482k | Ok(result) | 809 | 482k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::types::HeapType, <wast::core::types::HeapType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::types::HeapType>Line | Count | Source | 802 | 54.3k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 54.3k | where | 804 | 54.3k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 54.3k | let (result, cursor) = f(self.cursor())?; | 807 | 54.3k | self.buf.cur.set(cursor.pos); | 808 | 54.3k | Ok(result) | 809 | 54.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::custom::CustomPlace, <wast::core::custom::RawCustomSection as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::custom::CustomPlace>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::import::InlineImport, <wast::core::import::InlineImport as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::import::InlineImport>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::import::ImportGroupItemCommon, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::import::ImportGroupItemCommon>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::import::ItemSig, <wast::core::import::ImportGroupItemCommon as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::import::ItemSig>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::import::ItemSig, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#2}>::{closure#0}, wast::core::import::ItemSig><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::import::ItemSig, <wast::core::import::Imports as wast::parser::Parse>::parse::{closure#4}>::{closure#0}, wast::core::import::ItemSig>Line | Count | Source | 802 | 58.1k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 58.1k | where | 804 | 58.1k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 58.1k | let (result, cursor) = f(self.cursor())?; | 807 | 58.1k | self.buf.cur.set(cursor.pos); | 808 | 58.1k | Ok(result) | 809 | 58.1k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::import::ItemSig, <wast::core::types::ExportType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::import::ItemSig><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::memory::DataVal, <wast::core::memory::DataVal as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, wast::core::memory::DataVal>Line | Count | Source | 802 | 4 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 4 | where | 804 | 4 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 4 | let (result, cursor) = f(self.cursor())?; | 807 | 0 | self.buf.cur.set(cursor.pos); | 808 | 0 | Ok(result) | 809 | 4 | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::module::ModuleField, <wast::core::module::ModuleField as wast::parser::Parse>::parse>::{closure#0}, wast::core::module::ModuleField>Line | Count | Source | 802 | 534k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 534k | where | 804 | 534k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 534k | let (result, cursor) = f(self.cursor())?; | 807 | 532k | self.buf.cur.set(cursor.pos); | 808 | 532k | Ok(result) | 809 | 534k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<wast::core::module::Module, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#0}>::{closure#0}, wast::core::module::Module>Line | Count | Source | 802 | 10.8k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 10.8k | where | 804 | 10.8k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 10.8k | let (result, cursor) = f(self.cursor())?; | 807 | 10.8k | self.buf.cur.set(cursor.pos); | 808 | 10.8k | Ok(result) | 809 | 10.8k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<&str, <wast::core::export::InlineExport as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, &str>Line | Count | Source | 802 | 14.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 14.6k | where | 804 | 14.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 14.6k | let (result, cursor) = f(self.cursor())?; | 807 | 14.6k | self.buf.cur.set(cursor.pos); | 808 | 14.6k | Ok(result) | 809 | 14.6k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(wast::core::export::ExportKind, wast::token::Index), <wast::core::export::Export as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, (wast::core::export::ExportKind, wast::token::Index)>Line | Count | Source | 802 | 45.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 45.4k | where | 804 | 45.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 45.4k | let (result, cursor) = f(self.cursor())?; | 807 | 45.4k | self.buf.cur.set(cursor.pos); | 808 | 45.4k | Ok(result) | 809 | 45.4k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), wast::core::types::parse_optional<wast::kw::shared, bool, (bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}::{closure#0}, <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}::{closure#1}>::{closure#0}>::{closure#0}, (bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind)>Line | Count | Source | 802 | 62.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 62.6k | where | 804 | 62.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 62.6k | let (result, cursor) = f(self.cursor())?; | 807 | 62.6k | self.buf.cur.set(cursor.pos); | 808 | 62.6k | Ok(result) | 809 | 62.6k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind), <wast::core::types::TypeDef as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, (bool, core::option::Option<wast::token::Index>, core::option::Option<wast::token::Index>, wast::core::types::InnerTypeKind)>Line | Count | Source | 802 | 162k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 162k | where | 804 | 162k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 162k | let (result, cursor) = f(self.cursor())?; | 807 | 162k | self.buf.cur.set(cursor.pos); | 808 | 162k | Ok(result) | 809 | 162k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<u32, wast::core::types::page_size::{closure#0}>::{closure#0}, u32>Line | Count | Source | 802 | 18.9k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 18.9k | where | 804 | 18.9k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 18.9k | let (result, cursor) = f(self.cursor())?; | 807 | 18.9k | self.buf.cur.set(cursor.pos); | 808 | 18.9k | Ok(result) | 809 | 18.9k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::func::Local>::parse_remainder::{closure#0}>::{closure#0}, ()>Line | Count | Source | 802 | 28.1k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 28.1k | where | 804 | 28.1k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 28.1k | let (result, cursor) = f(self.cursor())?; | 807 | 28.1k | self.buf.cur.set(cursor.pos); | 808 | 28.1k | Ok(result) | 809 | 28.1k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::custom::Dylink0>::parse_next::{closure#0}>::{closure#0}, ()>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::custom::Dylink0>::parse_next::{closure#1}>::{closure#0}, ()><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::types::FunctionType>::finish_parse::{closure#0}>::{closure#0}, ()>Line | Count | Source | 802 | 837k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 837k | where | 804 | 837k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 837k | let (result, cursor) = f(self.cursor())?; | 807 | 837k | self.buf.cur.set(cursor.pos); | 808 | 837k | Ok(result) | 809 | 837k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::custom::Producers as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, ()>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::custom::Dylink0 as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, ()><wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::expr::SelectTypes as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, ()>Line | Count | Source | 802 | 52 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 52 | where | 804 | 52 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 52 | let (result, cursor) = f(self.cursor())?; | 807 | 52 | self.buf.cur.set(cursor.pos); | 808 | 52 | Ok(result) | 809 | 52 | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<(), <wast::core::types::StructType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}, ()>Line | Count | Source | 802 | 633k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 633k | where | 804 | 633k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 633k | let (result, cursor) = f(self.cursor())?; | 807 | 633k | self.buf.cur.set(cursor.pos); | 808 | 633k | Ok(result) | 809 | 633k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::types::RefType as wast::parser::Parse>::parse::{closure#1}::{closure#0}, wast::core::types::RefType><wast::parser::Parser>::step::<<wast::core::expr::ExpressionParser>::paren::{closure#0}, wast::core::expr::Paren>Line | Count | Source | 802 | 13.9M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 13.9M | where | 804 | 13.9M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 13.9M | let (result, cursor) = f(self.cursor())?; | 807 | 13.9M | self.buf.cur.set(cursor.pos); | 808 | 13.9M | Ok(result) | 809 | 13.9M | } |
<wast::parser::Parser>::step::<<wast::core::expr::LoadOrStoreLane>::parse::{closure#0}, bool>Line | Count | Source | 802 | 518 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 518 | where | 804 | 518 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 518 | let (result, cursor) = f(self.cursor())?; | 807 | 518 | self.buf.cur.set(cursor.pos); | 808 | 518 | Ok(result) | 809 | 518 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<wast::core::types::expect_parens_close_then_open::{closure#0}, ()><wast::parser::Parser>::step::<<wast::core::expr::MemArg>::parse::parse_field::{closure#0}, core::option::Option<u64>>Line | Count | Source | 802 | 260k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 260k | where | 804 | 260k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 260k | let (result, cursor) = f(self.cursor())?; | 807 | 260k | self.buf.cur.set(cursor.pos); | 808 | 260k | Ok(result) | 809 | 260k | } |
<wast::parser::Parser>::step::<<wast::annotation::custom as wast::parser::Parse>::parse::{closure#0}, wast::annotation::custom>Line | Count | Source | 802 | 3 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 3 | where | 804 | 3 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 3 | let (result, cursor) = f(self.cursor())?; | 807 | 3 | self.buf.cur.set(cursor.pos); | 808 | 3 | Ok(result) | 809 | 3 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::after as wast::parser::Parse>::parse::{closure#0}, wast::kw::after>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::wast::WastArgCore as wast::parser::Parse>::parse::{closure#0}, for<'a> fn(wast::parser::Parser<'a>) -> core::result::Result<wast::core::wast::WastArgCore<'a>, wast::error::Error>>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::wast::WastRetCore as wast::parser::Parse>::parse::{closure#0}, for<'a> fn(wast::parser::Parser<'a>) -> core::result::Result<wast::core::wast::WastRetCore<'a>, wast::error::Error>>Unexecuted instantiation: <wast::parser::Parser>::step::<<(i8, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (i8, wast::token::Span)>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_malformed as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_malformed>Unexecuted instantiation: <wast::parser::Parser>::step::<<(i16, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (i16, wast::token::Span)><wast::parser::Parser>::step::<<(i32, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (i32, wast::token::Span)>Line | Count | Source | 802 | 735k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 735k | where | 804 | 735k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 735k | let (result, cursor) = f(self.cursor())?; | 807 | 735k | self.buf.cur.set(cursor.pos); | 808 | 735k | Ok(result) | 809 | 735k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_malformed_custom as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_malformed_custom>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::before as wast::parser::Parse>::parse::{closure#0}, wast::kw::before>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::binary as wast::parser::Parse>::parse::{closure#0}, wast::kw::binary>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::block as wast::parser::Parse>::parse::{closure#0}, wast::kw::block>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::borrow as wast::parser::Parse>::parse::{closure#0}, wast::kw::borrow>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::annotation::name as wast::parser::Parse>::parse::{closure#0}, wast::annotation::name><wast::parser::Parser>::step::<<(i64, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (i64, wast::token::Span)>Line | Count | Source | 802 | 1.07M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 1.07M | where | 804 | 1.07M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 1.07M | let (result, cursor) = f(self.cursor())?; | 807 | 1.07M | self.buf.cur.set(cursor.pos); | 808 | 1.07M | Ok(result) | 809 | 1.07M | } |
<wast::parser::Parser>::step::<<wast::token::F32 as wast::parser::Parse>::parse::{closure#0}, wast::token::F32>Line | Count | Source | 802 | 193k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 193k | where | 804 | 193k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 193k | let (result, cursor) = f(self.cursor())?; | 807 | 193k | self.buf.cur.set(cursor.pos); | 808 | 193k | Ok(result) | 809 | 193k | } |
<wast::parser::Parser>::step::<<wast::token::F64 as wast::parser::Parse>::parse::{closure#0}, wast::token::F64>Line | Count | Source | 802 | 498k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 498k | where | 804 | 498k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 498k | let (result, cursor) = f(self.cursor())?; | 807 | 498k | self.buf.cur.set(cursor.pos); | 808 | 498k | Ok(result) | 809 | 498k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_return as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_return>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_trap as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_trap>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_unlinkable as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_unlinkable>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_suspension as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_suspension><wast::parser::Parser>::step::<<wast::kw::catch as wast::parser::Parse>::parse::{closure#0}, wast::kw::catch>Line | Count | Source | 802 | 24.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 24.2k | where | 804 | 24.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 24.2k | let (result, cursor) = f(self.cursor())?; | 807 | 24.2k | self.buf.cur.set(cursor.pos); | 808 | 24.2k | Ok(result) | 809 | 24.2k | } |
<wast::parser::Parser>::step::<<wast::kw::catch_ref as wast::parser::Parse>::parse::{closure#0}, wast::kw::catch_ref>Line | Count | Source | 802 | 94 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 94 | where | 804 | 94 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 94 | let (result, cursor) = f(self.cursor())?; | 807 | 94 | self.buf.cur.set(cursor.pos); | 808 | 94 | Ok(result) | 809 | 94 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::contref as wast::parser::Parse>::parse::{closure#0}, wast::kw::contref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::component as wast::parser::Parse>::parse::{closure#0}, wast::kw::component><wast::parser::Parser>::step::<<wast::kw::data as wast::parser::Parse>::parse::{closure#0}, wast::kw::data>Line | Count | Source | 802 | 15.8k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 15.8k | where | 804 | 15.8k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 15.8k | let (result, cursor) = f(self.cursor())?; | 807 | 15.8k | self.buf.cur.set(cursor.pos); | 808 | 15.8k | Ok(result) | 809 | 15.8k | } |
<wast::parser::Parser>::step::<<wast::kw::declare as wast::parser::Parse>::parse::{closure#0}, wast::kw::declare>Line | Count | Source | 802 | 3.08k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 3.08k | where | 804 | 3.08k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 3.08k | let (result, cursor) = f(self.cursor())?; | 807 | 3.08k | self.buf.cur.set(cursor.pos); | 808 | 3.08k | Ok(result) | 809 | 3.08k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::delegate as wast::parser::Parse>::parse::{closure#0}, wast::kw::delegate><wast::parser::Parser>::step::<<wast::kw::catch_all as wast::parser::Parse>::parse::{closure#0}, wast::kw::catch_all>Line | Count | Source | 802 | 257k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 257k | where | 804 | 257k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 257k | let (result, cursor) = f(self.cursor())?; | 807 | 257k | self.buf.cur.set(cursor.pos); | 808 | 257k | Ok(result) | 809 | 257k | } |
<wast::parser::Parser>::step::<<wast::kw::catch_all_ref as wast::parser::Parse>::parse::{closure#0}, wast::kw::catch_all_ref>Line | Count | Source | 802 | 806 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 806 | where | 804 | 806 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 806 | let (result, cursor) = f(self.cursor())?; | 807 | 806 | self.buf.cur.set(cursor.pos); | 808 | 806 | Ok(result) | 809 | 806 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::code as wast::parser::Parse>::parse::{closure#0}, wast::kw::code>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::cont as wast::parser::Parse>::parse::{closure#0}, wast::kw::cont>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::descriptor as wast::parser::Parse>::parse::{closure#0}, wast::kw::descriptor>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::exact as wast::parser::Parse>::parse::{closure#0}, wast::kw::exact><wast::parser::Parser>::step::<<wast::kw::tag as wast::parser::Parse>::parse::{closure#0}, wast::kw::tag>Line | Count | Source | 802 | 28.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 28.6k | where | 804 | 28.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 28.6k | let (result, cursor) = f(self.cursor())?; | 807 | 28.6k | self.buf.cur.set(cursor.pos); | 808 | 28.6k | Ok(result) | 809 | 28.6k | } |
<wast::parser::Parser>::step::<<wast::kw::exn as wast::parser::Parse>::parse::{closure#0}, wast::kw::exn>Line | Count | Source | 802 | 34.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 34.4k | where | 804 | 34.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 34.4k | let (result, cursor) = f(self.cursor())?; | 807 | 34.4k | self.buf.cur.set(cursor.pos); | 808 | 34.4k | Ok(result) | 809 | 34.4k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::exnref as wast::parser::Parse>::parse::{closure#0}, wast::kw::exnref><wast::parser::Parser>::step::<<wast::token::Id as wast::parser::Parse>::parse::{closure#0}, wast::token::Id>Line | Count | Source | 802 | 11.8k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 11.8k | where | 804 | 11.8k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 11.8k | let (result, cursor) = f(self.cursor())?; | 807 | 11.8k | self.buf.cur.set(cursor.pos); | 808 | 11.8k | Ok(result) | 809 | 11.8k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::describes as wast::parser::Parse>::parse::{closure#0}, wast::kw::describes>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::do as wast::parser::Parse>::parse::{closure#0}, wast::kw::do>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::dtor as wast::parser::Parse>::parse::{closure#0}, wast::kw::dtor><wast::parser::Parser>::step::<<wast::kw::elem as wast::parser::Parse>::parse::{closure#0}, wast::kw::elem>Line | Count | Source | 802 | 29.1k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 29.1k | where | 804 | 29.1k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 29.1k | let (result, cursor) = f(self.cursor())?; | 807 | 29.1k | self.buf.cur.set(cursor.pos); | 808 | 29.1k | Ok(result) | 809 | 29.1k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::end as wast::parser::Parse>::parse::{closure#0}, wast::kw::end><wast::parser::Parser>::step::<<wast::kw::export as wast::parser::Parse>::parse::{closure#0}, wast::kw::export>Line | Count | Source | 802 | 60.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 60.0k | where | 804 | 60.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 60.0k | let (result, cursor) = f(self.cursor())?; | 807 | 60.0k | self.buf.cur.set(cursor.pos); | 808 | 60.0k | Ok(result) | 809 | 60.0k | } |
<wast::parser::Parser>::step::<<wast::kw::extern as wast::parser::Parse>::parse::{closure#0}, wast::kw::extern>Line | Count | Source | 802 | 13.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 13.6k | where | 804 | 13.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 13.6k | let (result, cursor) = f(self.cursor())?; | 807 | 13.6k | self.buf.cur.set(cursor.pos); | 808 | 13.6k | Ok(result) | 809 | 13.6k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::f32x4 as wast::parser::Parse>::parse::{closure#0}, wast::kw::f32x4>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::f64 as wast::parser::Parse>::parse::{closure#0}, wast::kw::f64>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::f64x2 as wast::parser::Parse>::parse::{closure#0}, wast::kw::f64x2><wast::parser::Parser>::step::<<wast::kw::field as wast::parser::Parse>::parse::{closure#0}, wast::kw::field>Line | Count | Source | 802 | 633k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 633k | where | 804 | 633k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 633k | let (result, cursor) = f(self.cursor())?; | 807 | 633k | self.buf.cur.set(cursor.pos); | 808 | 633k | Ok(result) | 809 | 633k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::annotation::producers as wast::parser::Parse>::parse::{closure#0}, wast::annotation::producers>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::alias as wast::parser::Parse>::parse::{closure#0}, wast::kw::alias>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::externref as wast::parser::Parse>::parse::{closure#0}, wast::kw::externref><wast::parser::Parser>::step::<<wast::kw::eq as wast::parser::Parse>::parse::{closure#0}, wast::kw::eq>Line | Count | Source | 802 | 11.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 11.6k | where | 804 | 11.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 11.6k | let (result, cursor) = f(self.cursor())?; | 807 | 11.6k | self.buf.cur.set(cursor.pos); | 808 | 11.6k | Ok(result) | 809 | 11.6k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::eqref as wast::parser::Parse>::parse::{closure#0}, wast::kw::eqref><wast::parser::Parser>::step::<<wast::kw::f32 as wast::parser::Parse>::parse::{closure#0}, wast::kw::f32>Line | Count | Source | 802 | 4 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 4 | where | 804 | 4 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 4 | let (result, cursor) = f(self.cursor())?; | 807 | 4 | self.buf.cur.set(cursor.pos); | 808 | 4 | Ok(result) | 809 | 4 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::first as wast::parser::Parse>::parse::{closure#0}, wast::kw::first><wast::parser::Parser>::step::<<wast::kw::func as wast::parser::Parse>::parse::{closure#0}, wast::kw::func>Line | Count | Source | 802 | 352k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 352k | where | 804 | 352k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 352k | let (result, cursor) = f(self.cursor())?; | 807 | 352k | self.buf.cur.set(cursor.pos); | 808 | 352k | Ok(result) | 809 | 352k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::i16x8 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i16x8><wast::parser::Parser>::step::<<wast::kw::i31 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i31>Line | Count | Source | 802 | 4.79k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 4.79k | where | 804 | 4.79k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 4.79k | let (result, cursor) = f(self.cursor())?; | 807 | 4.79k | self.buf.cur.set(cursor.pos); | 808 | 4.79k | Ok(result) | 809 | 4.79k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::i31ref as wast::parser::Parse>::parse::{closure#0}, wast::kw::i31ref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::i32 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i32><wast::parser::Parser>::step::<<wast::kw::i32x4 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i32x4>Line | Count | Source | 802 | 99.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 99.6k | where | 804 | 99.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 99.6k | let (result, cursor) = f(self.cursor())?; | 807 | 99.6k | self.buf.cur.set(cursor.pos); | 808 | 99.6k | Ok(result) | 809 | 99.6k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::funcref as wast::parser::Parse>::parse::{closure#0}, wast::kw::funcref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::get as wast::parser::Parse>::parse::{closure#0}, wast::kw::get><wast::parser::Parser>::step::<<wast::kw::global as wast::parser::Parse>::parse::{closure#0}, wast::kw::global>Line | Count | Source | 802 | 111k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 111k | where | 804 | 111k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 111k | let (result, cursor) = f(self.cursor())?; | 807 | 111k | self.buf.cur.set(cursor.pos); | 808 | 111k | Ok(result) | 809 | 111k | } |
<wast::parser::Parser>::step::<<wast::kw::i16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i16>Line | Count | Source | 802 | 166k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 166k | where | 804 | 166k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 166k | let (result, cursor) = f(self.cursor())?; | 807 | 166k | self.buf.cur.set(cursor.pos); | 808 | 166k | Ok(result) | 809 | 166k | } |
<wast::parser::Parser>::step::<<wast::kw::i64 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i64>Line | Count | Source | 802 | 35.8k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 35.8k | where | 804 | 35.8k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 35.8k | let (result, cursor) = f(self.cursor())?; | 807 | 35.8k | self.buf.cur.set(cursor.pos); | 808 | 35.8k | Ok(result) | 809 | 35.8k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::instance as wast::parser::Parse>::parse::{closure#0}, wast::kw::instance>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::instantiate as wast::parser::Parse>::parse::{closure#0}, wast::kw::instantiate>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::interface as wast::parser::Parse>::parse::{closure#0}, wast::kw::interface><wast::parser::Parser>::step::<<wast::kw::invoke as wast::parser::Parse>::parse::{closure#0}, wast::kw::invoke>Line | Count | Source | 802 | 3 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 3 | where | 804 | 3 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 3 | let (result, cursor) = f(self.cursor())?; | 807 | 2 | self.buf.cur.set(cursor.pos); | 808 | 2 | Ok(result) | 809 | 3 | } |
<wast::parser::Parser>::step::<<wast::core::types::RefType as wast::parser::Parse>::parse::{closure#0}, core::option::Option<wast::core::types::RefType>>Line | Count | Source | 802 | 613k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 613k | where | 804 | 613k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 613k | let (result, cursor) = f(self.cursor())?; | 807 | 613k | self.buf.cur.set(cursor.pos); | 808 | 613k | Ok(result) | 809 | 613k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::i64x2 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i64x2><wast::parser::Parser>::step::<<wast::kw::i8 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i8>Line | Count | Source | 802 | 500k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 500k | where | 804 | 500k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 500k | let (result, cursor) = f(self.cursor())?; | 807 | 500k | self.buf.cur.set(cursor.pos); | 808 | 500k | Ok(result) | 809 | 500k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::i8x16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i8x16><wast::parser::Parser>::step::<<wast::kw::import as wast::parser::Parse>::parse::{closure#0}, wast::kw::import>Line | Count | Source | 802 | 58.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 58.2k | where | 804 | 58.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 58.2k | let (result, cursor) = f(self.cursor())?; | 807 | 58.2k | self.buf.cur.set(cursor.pos); | 808 | 58.2k | Ok(result) | 809 | 58.2k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::implements as wast::parser::Parse>::parse::{closure#0}, wast::kw::implements><wast::parser::Parser>::step::<<wast::kw::item as wast::parser::Parse>::parse::{closure#0}, wast::kw::item>Line | Count | Source | 802 | 46.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 46.0k | where | 804 | 46.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 46.0k | let (result, cursor) = f(self.cursor())?; | 807 | 46.0k | self.buf.cur.set(cursor.pos); | 808 | 46.0k | Ok(result) | 809 | 46.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::last as wast::parser::Parse>::parse::{closure#0}, wast::kw::last>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nan_arithmetic as wast::parser::Parse>::parse::{closure#0}, wast::kw::nan_arithmetic>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nan_canonical as wast::parser::Parse>::parse::{closure#0}, wast::kw::nan_canonical>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nocont as wast::parser::Parse>::parse::{closure#0}, wast::kw::nocont><wast::parser::Parser>::step::<<wast::kw::nofunc as wast::parser::Parse>::parse::{closure#0}, wast::kw::nofunc>Line | Count | Source | 802 | 31.8k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 31.8k | where | 804 | 31.8k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 31.8k | let (result, cursor) = f(self.cursor())?; | 807 | 31.8k | self.buf.cur.set(cursor.pos); | 808 | 31.8k | Ok(result) | 809 | 31.8k | } |
<wast::parser::Parser>::step::<<wast::annotation::dylink_0 as wast::parser::Parse>::parse::{closure#0}, wast::annotation::dylink_0>Line | Count | Source | 802 | 2 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 2 | where | 804 | 2 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 2 | let (result, cursor) = f(self.cursor())?; | 807 | 2 | self.buf.cur.set(cursor.pos); | 808 | 2 | Ok(result) | 809 | 2 | } |
<wast::parser::Parser>::step::<<wast::kw::local as wast::parser::Parse>::parse::{closure#0}, wast::kw::local>Line | Count | Source | 802 | 28.1k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 28.1k | where | 804 | 28.1k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 28.1k | let (result, cursor) = f(self.cursor())?; | 807 | 28.1k | self.buf.cur.set(cursor.pos); | 808 | 28.1k | Ok(result) | 809 | 28.1k | } |
<wast::parser::Parser>::step::<<wast::kw::memory as wast::parser::Parse>::parse::{closure#0}, wast::kw::memory>Line | Count | Source | 802 | 36.9k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 36.9k | where | 804 | 36.9k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 36.9k | let (result, cursor) = f(self.cursor())?; | 807 | 36.9k | self.buf.cur.set(cursor.pos); | 808 | 36.9k | Ok(result) | 809 | 36.9k | } |
<wast::parser::Parser>::step::<<wast::kw::module as wast::parser::Parse>::parse::{closure#0}, wast::kw::module>Line | Count | Source | 802 | 10.8k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 10.8k | where | 804 | 10.8k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 10.8k | let (result, cursor) = f(self.cursor())?; | 807 | 10.8k | self.buf.cur.set(cursor.pos); | 808 | 10.8k | Ok(result) | 809 | 10.8k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::modulecode as wast::parser::Parse>::parse::{closure#0}, wast::kw::modulecode><wast::parser::Parser>::step::<<wast::kw::noextern as wast::parser::Parse>::parse::{closure#0}, wast::kw::noextern>Line | Count | Source | 802 | 21.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 21.0k | where | 804 | 21.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 21.0k | let (result, cursor) = f(self.cursor())?; | 807 | 21.0k | self.buf.cur.set(cursor.pos); | 808 | 21.0k | Ok(result) | 809 | 21.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::noexn as wast::parser::Parse>::parse::{closure#0}, wast::kw::noexn>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nullexternref as wast::parser::Parse>::parse::{closure#0}, wast::kw::nullexternref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nullexnref as wast::parser::Parse>::parse::{closure#0}, wast::kw::nullexnref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nullref as wast::parser::Parse>::parse::{closure#0}, wast::kw::nullref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::offset as wast::parser::Parse>::parse::{closure#0}, wast::kw::offset>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::on as wast::parser::Parse>::parse::{closure#0}, wast::kw::on><wast::parser::Parser>::step::<<wast::kw::none as wast::parser::Parse>::parse::{closure#0}, wast::kw::none>Line | Count | Source | 802 | 176k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 176k | where | 804 | 176k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 176k | let (result, cursor) = f(self.cursor())?; | 807 | 176k | self.buf.cur.set(cursor.pos); | 808 | 176k | Ok(result) | 809 | 176k | } |
<wast::parser::Parser>::step::<<wast::kw::null as wast::parser::Parse>::parse::{closure#0}, wast::kw::null>Line | Count | Source | 802 | 576k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 576k | where | 804 | 576k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 576k | let (result, cursor) = f(self.cursor())?; | 807 | 576k | self.buf.cur.set(cursor.pos); | 808 | 576k | Ok(result) | 809 | 576k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nullcontref as wast::parser::Parse>::parse::{closure#0}, wast::kw::nullcontref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::nullfuncref as wast::parser::Parse>::parse::{closure#0}, wast::kw::nullfuncref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::outer as wast::parser::Parse>::parse::{closure#0}, wast::kw::outer>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::quote as wast::parser::Parse>::parse::{closure#0}, wast::kw::quote><wast::parser::Parser>::step::<<wast::kw::else as wast::parser::Parse>::parse::{closure#0}, wast::kw::else>Line | Count | Source | 802 | 2.60k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 2.60k | where | 804 | 2.60k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 2.60k | let (result, cursor) = f(self.cursor())?; | 807 | 2.60k | self.buf.cur.set(cursor.pos); | 808 | 2.60k | Ok(result) | 809 | 2.60k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::if as wast::parser::Parse>::parse::{closure#0}, wast::kw::if>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::loop as wast::parser::Parse>::parse::{closure#0}, wast::kw::loop>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::own as wast::parser::Parse>::parse::{closure#0}, wast::kw::own><wast::parser::Parser>::step::<<wast::kw::pagesize as wast::parser::Parse>::parse::{closure#0}, wast::kw::pagesize>Line | Count | Source | 802 | 18.9k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 18.9k | where | 804 | 18.9k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 18.9k | let (result, cursor) = f(self.cursor())?; | 807 | 18.9k | self.buf.cur.set(cursor.pos); | 808 | 18.9k | Ok(result) | 809 | 18.9k | } |
<wast::parser::Parser>::step::<<wast::kw::param as wast::parser::Parse>::parse::{closure#0}, wast::kw::param>Line | Count | Source | 802 | 241k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 241k | where | 804 | 241k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 241k | let (result, cursor) = f(self.cursor())?; | 807 | 241k | self.buf.cur.set(cursor.pos); | 808 | 241k | Ok(result) | 809 | 241k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::parent as wast::parser::Parse>::parse::{closure#0}, wast::kw::parent>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::passive as wast::parser::Parse>::parse::{closure#0}, wast::kw::passive>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_exception as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_exception>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag><wast::parser::Parser>::step::<<wast::core::expr::Instruction as wast::parser::Parse>::parse::{closure#0}, fn(wast::parser::Parser) -> core::result::Result<wast::core::expr::Instruction, wast::error::Error>>Line | Count | Source | 802 | 9.24M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 9.24M | where | 804 | 9.24M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 9.24M | let (result, cursor) = f(self.cursor())?; | 807 | 9.24M | self.buf.cur.set(cursor.pos); | 808 | 9.24M | Ok(result) | 809 | 9.24M | } |
<wast::parser::Parser>::step::<<wast::kw::assert_exhaustion as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_exhaustion>Line | Count | Source | 802 | 1 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 1 | where | 804 | 1 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 1 | let (result, cursor) = f(self.cursor())?; | 807 | 1 | self.buf.cur.set(cursor.pos); | 808 | 1 | Ok(result) | 809 | 1 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag><wast::parser::Parser>::step::<<(u8, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (u8, wast::token::Span)>Line | Count | Source | 802 | 304 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 304 | where | 804 | 304 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 304 | let (result, cursor) = f(self.cursor())?; | 807 | 294 | self.buf.cur.set(cursor.pos); | 808 | 294 | Ok(result) | 809 | 304 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_invalid as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_invalid>Unexecuted instantiation: <wast::parser::Parser>::step::<<(u16, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (u16, wast::token::Span)><wast::parser::Parser>::step::<<(u32, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (u32, wast::token::Span)>Line | Count | Source | 802 | 4.48M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 4.48M | where | 804 | 4.48M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 4.48M | let (result, cursor) = f(self.cursor())?; | 807 | 4.48M | self.buf.cur.set(cursor.pos); | 808 | 4.48M | Ok(result) | 809 | 4.48M | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::assert_invalid_custom as wast::parser::Parse>::parse::{closure#0}, wast::kw::assert_invalid_custom><wast::parser::Parser>::step::<<(u64, wast::token::Span) as wast::parser::Parse>::parse::{closure#0}, (u64, wast::token::Span)>Line | Count | Source | 802 | 103k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 103k | where | 804 | 103k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 103k | let (result, cursor) = f(self.cursor())?; | 807 | 103k | self.buf.cur.set(cursor.pos); | 808 | 103k | Ok(result) | 809 | 103k | } |
<wast::parser::Parser>::step::<<wast::core::types::ValType as wast::parser::Parse>::parse::{closure#0}, core::option::Option<wast::core::types::ValType>>Line | Count | Source | 802 | 6.54M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 6.54M | where | 804 | 6.54M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 6.54M | let (result, cursor) = f(self.cursor())?; | 807 | 6.54M | self.buf.cur.set(cursor.pos); | 808 | 6.54M | Ok(result) | 809 | 6.54M | } |
<wast::parser::Parser>::step::<<wast::kw::mut as wast::parser::Parse>::parse::{closure#0}, wast::kw::mut>Line | Count | Source | 802 | 712k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 712k | where | 804 | 712k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 712k | let (result, cursor) = f(self.cursor())?; | 807 | 712k | self.buf.cur.set(cursor.pos); | 808 | 712k | Ok(result) | 809 | 712k | } |
<wast::parser::Parser>::step::<<wast::kw::type as wast::parser::Parse>::parse::{closure#0}, wast::kw::type>Line | Count | Source | 802 | 731k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 731k | where | 804 | 731k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 731k | let (result, cursor) = f(self.cursor())?; | 807 | 731k | self.buf.cur.set(cursor.pos); | 808 | 731k | Ok(result) | 809 | 731k | } |
<wast::parser::Parser>::step::<<wast::kw::rec as wast::parser::Parse>::parse::{closure#0}, wast::kw::rec>Line | Count | Source | 802 | 64.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 64.2k | where | 804 | 64.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 64.2k | let (result, cursor) = f(self.cursor())?; | 807 | 64.2k | self.buf.cur.set(cursor.pos); | 808 | 64.2k | Ok(result) | 809 | 64.2k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::acq_rel as wast::parser::Parse>::parse::{closure#0}, wast::kw::acq_rel>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::rep as wast::parser::Parse>::parse::{closure#0}, wast::kw::rep>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::resource as wast::parser::Parse>::parse::{closure#0}, wast::kw::resource>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::annotation::metadata_code_branch_hint as wast::parser::Parse>::parse::{closure#0}, wast::annotation::metadata_code_branch_hint><wast::parser::Parser>::step::<<wast::kw::any as wast::parser::Parse>::parse::{closure#0}, wast::kw::any>Line | Count | Source | 802 | 17.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 17.0k | where | 804 | 17.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 17.0k | let (result, cursor) = f(self.cursor())?; | 807 | 17.0k | self.buf.cur.set(cursor.pos); | 808 | 17.0k | Ok(result) | 809 | 17.0k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag><wast::parser::Parser>::step::<<wast::kw::ref as wast::parser::Parse>::parse::{closure#0}, wast::kw::ref>Line | Count | Source | 802 | 585k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 585k | where | 804 | 585k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 585k | let (result, cursor) = f(self.cursor())?; | 807 | 585k | self.buf.cur.set(cursor.pos); | 808 | 585k | Ok(result) | 809 | 585k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::ref_func as wast::parser::Parse>::parse::{closure#0}, wast::kw::ref_func>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::ref_null as wast::parser::Parse>::parse::{closure#0}, wast::kw::ref_null><wast::parser::Parser>::step::<<wast::kw::register as wast::parser::Parse>::parse::{closure#0}, wast::kw::register>Line | Count | Source | 802 | 1 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 1 | where | 804 | 1 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 1 | let (result, cursor) = f(self.cursor())?; | 807 | 1 | self.buf.cur.set(cursor.pos); | 808 | 1 | Ok(result) | 809 | 1 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::resource_new as wast::parser::Parse>::parse::{closure#0}, wast::kw::resource_new>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::resource_drop as wast::parser::Parse>::parse::{closure#0}, wast::kw::resource_drop><wast::parser::Parser>::step::<<wast::kw::start as wast::parser::Parse>::parse::{closure#0}, wast::kw::start>Line | Count | Source | 802 | 256 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 256 | where | 804 | 256 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 256 | let (result, cursor) = f(self.cursor())?; | 807 | 256 | self.buf.cur.set(cursor.pos); | 808 | 256 | Ok(result) | 809 | 256 | } |
<wast::parser::Parser>::step::<<wast::kw::sub as wast::parser::Parse>::parse::{closure#0}, wast::kw::sub>Line | Count | Source | 802 | 162k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 162k | where | 804 | 162k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 162k | let (result, cursor) = f(self.cursor())?; | 807 | 162k | self.buf.cur.set(cursor.pos); | 808 | 162k | Ok(result) | 809 | 162k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::switch as wast::parser::Parse>::parse::{closure#0}, wast::kw::switch><wast::parser::Parser>::step::<<wast::kw::final as wast::parser::Parse>::parse::{closure#0}, wast::kw::final>Line | Count | Source | 802 | 11.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 11.2k | where | 804 | 11.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 11.2k | let (result, cursor) = f(self.cursor())?; | 807 | 11.2k | self.buf.cur.set(cursor.pos); | 808 | 11.2k | Ok(result) | 809 | 11.2k | } |
<wast::parser::Parser>::step::<<wast::kw::table as wast::parser::Parse>::parse::{closure#0}, wast::kw::table>Line | Count | Source | 802 | 55.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 55.2k | where | 804 | 55.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 55.2k | let (result, cursor) = f(self.cursor())?; | 807 | 55.2k | self.buf.cur.set(cursor.pos); | 808 | 55.2k | Ok(result) | 809 | 55.2k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::resource_rep as wast::parser::Parse>::parse::{closure#0}, wast::kw::resource_rep><wast::parser::Parser>::step::<<wast::kw::result as wast::parser::Parse>::parse::{closure#0}, wast::kw::result>Line | Count | Source | 802 | 595k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 595k | where | 804 | 595k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 595k | let (result, cursor) = f(self.cursor())?; | 807 | 595k | self.buf.cur.set(cursor.pos); | 808 | 595k | Ok(result) | 809 | 595k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::seq_cst as wast::parser::Parse>::parse::{closure#0}, wast::kw::seq_cst><wast::parser::Parser>::step::<<wast::kw::shared as wast::parser::Parse>::parse::{closure#0}, wast::kw::shared>Line | Count | Source | 802 | 121k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 121k | where | 804 | 121k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 121k | let (result, cursor) = f(self.cursor())?; | 807 | 121k | self.buf.cur.set(cursor.pos); | 808 | 121k | Ok(result) | 809 | 121k | } |
<wast::parser::Parser>::step::<<wast::kw::then as wast::parser::Parse>::parse::{closure#0}, wast::kw::then>Line | Count | Source | 802 | 31.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 31.2k | where | 804 | 31.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 31.2k | let (result, cursor) = f(self.cursor())?; | 807 | 31.2k | self.buf.cur.set(cursor.pos); | 808 | 31.2k | Ok(result) | 809 | 31.2k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::s32 as wast::parser::Parse>::parse::{closure#0}, wast::kw::s32>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::s64 as wast::parser::Parse>::parse::{closure#0}, wast::kw::s64>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::u8 as wast::parser::Parse>::parse::{closure#0}, wast::kw::u8>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::u16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::u16><wast::parser::Parser>::step::<<wast::core::expr::LaneArg as wast::parser::Parse>::parse::{closure#0}, u8>Line | Count | Source | 802 | 9.80k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 9.80k | where | 804 | 9.80k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 9.80k | let (result, cursor) = f(self.cursor())?; | 807 | 9.80k | self.buf.cur.set(cursor.pos); | 808 | 9.80k | Ok(result) | 809 | 9.80k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::try as wast::parser::Parse>::parse::{closure#0}, wast::kw::try>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::v128 as wast::parser::Parse>::parse::{closure#0}, wast::kw::v128>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::value as wast::parser::Parse>::parse::{closure#0}, wast::kw::value>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::s8 as wast::parser::Parse>::parse::{closure#0}, wast::kw::s8>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::s16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::s16>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::u32 as wast::parser::Parse>::parse::{closure#0}, wast::kw::u32>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::u64 as wast::parser::Parse>::parse::{closure#0}, wast::kw::u64>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::bool_ as wast::parser::Parse>::parse::{closure#0}, wast::kw::bool_>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::float32 as wast::parser::Parse>::parse::{closure#0}, wast::kw::float32>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::float64 as wast::parser::Parse>::parse::{closure#0}, wast::kw::float64>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::variant as wast::parser::Parse>::parse::{closure#0}, wast::kw::variant>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::char as wast::parser::Parse>::parse::{closure#0}, wast::kw::char>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::case as wast::parser::Parse>::parse::{closure#0}, wast::kw::case>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::record as wast::parser::Parse>::parse::{closure#0}, wast::kw::record>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::string as wast::parser::Parse>::parse::{closure#0}, wast::kw::string>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::flags as wast::parser::Parse>::parse::{closure#0}, wast::kw::flags>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::option as wast::parser::Parse>::parse::{closure#0}, wast::kw::option>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::canon as wast::parser::Parse>::parse::{closure#0}, wast::kw::canon>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::lift as wast::parser::Parse>::parse::{closure#0}, wast::kw::lift>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::lower as wast::parser::Parse>::parse::{closure#0}, wast::kw::lower>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::enum_ as wast::parser::Parse>::parse::{closure#0}, wast::kw::enum_>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::string_utf8 as wast::parser::Parse>::parse::{closure#0}, wast::kw::string_utf8>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::tuple as wast::parser::Parse>::parse::{closure#0}, wast::kw::tuple>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::list as wast::parser::Parse>::parse::{closure#0}, wast::kw::list>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::map as wast::parser::Parse>::parse::{closure#0}, wast::kw::map>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::error as wast::parser::Parse>::parse::{closure#0}, wast::kw::error>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::string_utf16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::string_utf16>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::with as wast::parser::Parse>::parse::{closure#0}, wast::kw::with>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::core as wast::parser::Parse>::parse::{closure#0}, wast::kw::core>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::core_type as wast::parser::Parse>::parse::{closure#0}, wast::kw::core_type>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::gc as wast::parser::Parse>::parse::{closure#0}, wast::kw::gc>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::string_latin1_utf16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::string_latin1_utf16><wast::parser::Parser>::step::<<wast::kw::struct as wast::parser::Parse>::parse::{closure#0}, wast::kw::struct>Line | Count | Source | 802 | 81.3k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 81.3k | where | 804 | 81.3k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 81.3k | let (result, cursor) = f(self.cursor())?; | 807 | 81.3k | self.buf.cur.set(cursor.pos); | 808 | 81.3k | Ok(result) | 809 | 81.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::structref as wast::parser::Parse>::parse::{closure#0}, wast::kw::structref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::realloc as wast::parser::Parse>::parse::{closure#0}, wast::kw::realloc>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::post_return as wast::parser::Parse>::parse::{closure#0}, wast::kw::post_return>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::true_ as wast::parser::Parse>::parse::{closure#0}, wast::kw::true_>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::false_ as wast::parser::Parse>::parse::{closure#0}, wast::kw::false_>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::needed as wast::parser::Parse>::parse::{closure#0}, wast::kw::needed>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::export_info as wast::parser::Parse>::parse::{closure#0}, wast::kw::export_info>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::import_info as wast::parser::Parse>::parse::{closure#0}, wast::kw::import_info>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::runtime_path as wast::parser::Parse>::parse::{closure#0}, wast::kw::runtime_path>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::anyref as wast::parser::Parse>::parse::{closure#0}, wast::kw::anyref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::language as wast::parser::Parse>::parse::{closure#0}, wast::kw::language>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::sdk as wast::parser::Parse>::parse::{closure#0}, wast::kw::sdk>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::processed_by as wast::parser::Parse>::parse::{closure#0}, wast::kw::processed_by>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::mem_info as wast::parser::Parse>::parse::{closure#0}, wast::kw::mem_info>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_spawn_ref as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_spawn_ref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::task_return as wast::parser::Parse>::parse::{closure#0}, wast::kw::task_return>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::task_cancel as wast::parser::Parse>::parse::{closure#0}, wast::kw::task_cancel>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::subtask_drop as wast::parser::Parse>::parse::{closure#0}, wast::kw::subtask_drop>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::subtask_cancel as wast::parser::Parse>::parse::{closure#0}, wast::kw::subtask_cancel>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream_new as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream_new><wast::parser::Parser>::step::<<&[u8] as wast::parser::Parse>::parse::{closure#0}, &[u8]>Line | Count | Source | 802 | 192k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 192k | where | 804 | 192k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 192k | let (result, cursor) = f(self.cursor())?; | 807 | 192k | self.buf.cur.set(cursor.pos); | 808 | 192k | Ok(result) | 809 | 192k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_spawn_indirect as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_spawn_indirect>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_available_parallelism as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_available_parallelism>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::backpressure_inc as wast::parser::Parse>::parse::{closure#0}, wast::kw::backpressure_inc>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::backpressure_dec as wast::parser::Parse>::parse::{closure#0}, wast::kw::backpressure_dec>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream_read as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream_read>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future_new as wast::parser::Parse>::parse::{closure#0}, wast::kw::future_new>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future_read as wast::parser::Parse>::parse::{closure#0}, wast::kw::future_read>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future_write as wast::parser::Parse>::parse::{closure#0}, wast::kw::future_write>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future_cancel_read as wast::parser::Parse>::parse::{closure#0}, wast::kw::future_cancel_read>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream_write as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream_write>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream_cancel_read as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream_cancel_read>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream_cancel_write as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream_cancel_write>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream_drop_readable as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream_drop_readable>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream_drop_writable as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream_drop_writable>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future_cancel_write as wast::parser::Parse>::parse::{closure#0}, wast::kw::future_cancel_write>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future_drop_readable as wast::parser::Parse>::parse::{closure#0}, wast::kw::future_drop_readable>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::wait as wast::parser::Parse>::parse::{closure#0}, wast::kw::wait>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::definition as wast::parser::Parse>::parse::{closure#0}, wast::kw::definition>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::async as wast::parser::Parse>::parse::{closure#0}, wast::kw::async>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::callback as wast::parser::Parse>::parse::{closure#0}, wast::kw::callback>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future_drop_writable as wast::parser::Parse>::parse::{closure#0}, wast::kw::future_drop_writable>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::error_context_new as wast::parser::Parse>::parse::{closure#0}, wast::kw::error_context_new>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::error_context_debug_message as wast::parser::Parse>::parse::{closure#0}, wast::kw::error_context_debug_message>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::error_context_drop as wast::parser::Parse>::parse::{closure#0}, wast::kw::error_context_drop>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::stream as wast::parser::Parse>::parse::{closure#0}, wast::kw::stream>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::future as wast::parser::Parse>::parse::{closure#0}, wast::kw::future>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::waitable_set_drop as wast::parser::Parse>::parse::{closure#0}, wast::kw::waitable_set_drop>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::waitable_join as wast::parser::Parse>::parse::{closure#0}, wast::kw::waitable_join>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::context_get as wast::parser::Parse>::parse::{closure#0}, wast::kw::context_get>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::context_set as wast::parser::Parse>::parse::{closure#0}, wast::kw::context_set>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_index as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_index>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::error_context as wast::parser::Parse>::parse::{closure#0}, wast::kw::error_context>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::waitable_set_new as wast::parser::Parse>::parse::{closure#0}, wast::kw::waitable_set_new>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::waitable_set_wait as wast::parser::Parse>::parse::{closure#0}, wast::kw::waitable_set_wait>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::waitable_set_poll as wast::parser::Parse>::parse::{closure#0}, wast::kw::waitable_set_poll>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_new_indirect as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_new_indirect>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_suspend_then_promote as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_suspend_then_promote>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_yield_then_promote as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_yield_then_promote>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::cancellable as wast::parser::Parse>::parse::{closure#0}, wast::kw::cancellable>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::versionsuffix as wast::parser::Parse>::parse::{closure#0}, wast::kw::versionsuffix>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_resume_later as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_resume_later>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_suspend as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_suspend>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_yield as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_yield>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_suspend_then_resume as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_suspend_then_resume>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_yield_then_resume as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_yield_then_resume>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::external_id as wast::parser::Parse>::parse::{closure#0}, wast::kw::external_id>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::arg as wast::parser::Parse>::parse::{closure#0}, wast::kw::arg>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag><wast::parser::Parser>::step::<<wast::kw::array as wast::parser::Parse>::parse::{closure#0}, wast::kw::array>Line | Count | Source | 802 | 282k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 282k | where | 804 | 282k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 282k | let (result, cursor) = f(self.cursor())?; | 807 | 282k | self.buf.cur.set(cursor.pos); | 808 | 282k | Ok(result) | 809 | 282k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::arrayref as wast::parser::Parse>::parse::{closure#0}, wast::kw::arrayref>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::core::custom::parse_sym_flags::flag as wast::parser::Parse>::parse::{closure#0}, wast::core::custom::parse_sym_flags::flag> |
810 | | |
811 | | /// Creates an error whose line/column information is pointing at the |
812 | | /// current token. |
813 | | /// |
814 | | /// This is used to produce human-readable error messages which point to the |
815 | | /// right location in the input stream, and the `msg` here is arbitrary text |
816 | | /// used to associate with the error and indicate why it was generated. |
817 | 882 | pub fn error(self, msg: impl fmt::Display) -> Error { |
818 | 882 | self.error_at(self.cursor().cur_span(), msg) |
819 | 882 | } <wast::parser::Parser>::error::<alloc::string::String> Line | Count | Source | 817 | 34 | pub fn error(self, msg: impl fmt::Display) -> Error { | 818 | 34 | self.error_at(self.cursor().cur_span(), msg) | 819 | 34 | } |
<wast::parser::Parser>::error::<&alloc::string::String> Line | Count | Source | 817 | 37 | pub fn error(self, msg: impl fmt::Display) -> Error { | 818 | 37 | self.error_at(self.cursor().cur_span(), msg) | 819 | 37 | } |
<wast::parser::Parser>::error::<&str> Line | Count | Source | 817 | 811 | pub fn error(self, msg: impl fmt::Display) -> Error { | 818 | 811 | self.error_at(self.cursor().cur_span(), msg) | 819 | 811 | } |
|
820 | | |
821 | | /// Creates an error whose line/column information is pointing at the |
822 | | /// given span. |
823 | 2.16k | pub fn error_at(self, span: Span, msg: impl fmt::Display) -> Error { |
824 | 2.16k | Error::parse(span, self.buf.lexer.input(), msg.to_string()) |
825 | 2.16k | } <wast::parser::Parser>::error_at::<alloc::string::String> Line | Count | Source | 823 | 34 | pub fn error_at(self, span: Span, msg: impl fmt::Display) -> Error { | 824 | 34 | Error::parse(span, self.buf.lexer.input(), msg.to_string()) | 825 | 34 | } |
<wast::parser::Parser>::error_at::<&alloc::string::String> Line | Count | Source | 823 | 37 | pub fn error_at(self, span: Span, msg: impl fmt::Display) -> Error { | 824 | 37 | Error::parse(span, self.buf.lexer.input(), msg.to_string()) | 825 | 37 | } |
<wast::parser::Parser>::error_at::<&str> Line | Count | Source | 823 | 2.09k | pub fn error_at(self, span: Span, msg: impl fmt::Display) -> Error { | 824 | 2.09k | Error::parse(span, self.buf.lexer.input(), msg.to_string()) | 825 | 2.09k | } |
|
826 | | |
827 | | /// Returns the span of the current token |
828 | 9.25M | pub fn cur_span(&self) -> Span { |
829 | 9.25M | self.cursor().cur_span() |
830 | 9.25M | } |
831 | | |
832 | | /// Returns the span of the previous token |
833 | 82.8k | pub fn prev_span(&self) -> Span { |
834 | 82.8k | self.cursor() |
835 | 82.8k | .prev_span() |
836 | 82.8k | .unwrap_or_else(|| Span::from_offset(0)) |
837 | 82.8k | } |
838 | | |
839 | | /// Registers a new known annotation with this parser to allow parsing |
840 | | /// annotations with this name. |
841 | | /// |
842 | | /// [WebAssembly annotations][annotation] are a proposal for the text format |
843 | | /// which allows decorating the text format with custom structured |
844 | | /// information. By default all annotations are ignored when parsing, but |
845 | | /// the whole purpose of them is to sometimes parse them! |
846 | | /// |
847 | | /// To support parsing text annotations this method is used to allow |
848 | | /// annotations and their tokens to *not* be skipped. Once an annotation is |
849 | | /// registered with this method, then while the return value has not been |
850 | | /// dropped (e.g. the scope of where this function is called) annotations |
851 | | /// with the name `annotation` will be parse of the token stream and not |
852 | | /// implicitly skipped. |
853 | | /// |
854 | | /// # Skipping annotations |
855 | | /// |
856 | | /// The behavior of skipping unknown/unregistered annotations can be |
857 | | /// somewhat subtle and surprising, so if you're interested in parsing |
858 | | /// annotations it's important to point out the importance of this method |
859 | | /// and where to call it. |
860 | | /// |
861 | | /// Generally when parsing tokens you'll be bottoming out in various |
862 | | /// `Cursor` methods. These are all documented as advancing the stream as |
863 | | /// much as possible to the next token, skipping "irrelevant stuff" like |
864 | | /// comments, whitespace, etc. The `Cursor` methods will also skip unknown |
865 | | /// annotations. This means that if you parse *any* token, it will skip over |
866 | | /// any number of annotations that are unknown at all times. |
867 | | /// |
868 | | /// To parse an annotation you must, before parsing any token of the |
869 | | /// annotation, register the annotation via this method. This includes the |
870 | | /// beginning `(` token, which is otherwise skipped if the annotation isn't |
871 | | /// marked as registered. Typically parser parse the *contents* of an |
872 | | /// s-expression, so this means that the outer parser of an s-expression |
873 | | /// must register the custom annotation name, rather than the inner parser. |
874 | | /// |
875 | | /// # Return |
876 | | /// |
877 | | /// This function returns an RAII guard which, when dropped, will unregister |
878 | | /// the `annotation` given. Parsing `annotation` is only supported while the |
879 | | /// returned value is still alive, and once dropped the parser will go back |
880 | | /// to skipping annotations with the name `annotation`. |
881 | | /// |
882 | | /// # Example |
883 | | /// |
884 | | /// Let's see an example of how the `@name` annotation is parsed for modules |
885 | | /// to get an idea of how this works: |
886 | | /// |
887 | | /// ``` |
888 | | /// # use wast::kw; |
889 | | /// # use wast::token::NameAnnotation; |
890 | | /// # use wast::parser::*; |
891 | | /// struct Module<'a> { |
892 | | /// name: Option<NameAnnotation<'a>>, |
893 | | /// } |
894 | | /// |
895 | | /// impl<'a> Parse<'a> for Module<'a> { |
896 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
897 | | /// // Modules start out with a `module` keyword |
898 | | /// parser.parse::<kw::module>()?; |
899 | | /// |
900 | | /// // Next may be `(@name "foo")`. Typically this annotation would |
901 | | /// // skipped, but we don't want it skipped, so we register it. |
902 | | /// // Note that the parse implementation of |
903 | | /// // `Option<NameAnnotation>` is the one that consumes the |
904 | | /// // parentheses here. |
905 | | /// let _r = parser.register_annotation("name"); |
906 | | /// let name = parser.parse()?; |
907 | | /// |
908 | | /// // ... and normally you'd otherwise parse module fields here ... |
909 | | /// |
910 | | /// Ok(Module { name }) |
911 | | /// } |
912 | | /// } |
913 | | /// ``` |
914 | | /// |
915 | | /// Another example is how we parse the `@custom` annotation. Note that this |
916 | | /// is parsed as part of `ModuleField`, so note how the annotation is |
917 | | /// registered *before* we parse the parentheses of the annotation. |
918 | | /// |
919 | | /// ``` |
920 | | /// # use wast::{kw, annotation}; |
921 | | /// # use wast::core::Custom; |
922 | | /// # use wast::parser::*; |
923 | | /// struct Module<'a> { |
924 | | /// fields: Vec<ModuleField<'a>>, |
925 | | /// } |
926 | | /// |
927 | | /// impl<'a> Parse<'a> for Module<'a> { |
928 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
929 | | /// // Modules start out with a `module` keyword |
930 | | /// parser.parse::<kw::module>()?; |
931 | | /// |
932 | | /// // register the `@custom` annotation *first* before we start |
933 | | /// // parsing fields, because each field is contained in |
934 | | /// // parentheses and to parse the parentheses of an annotation we |
935 | | /// // have to known to not skip it. |
936 | | /// let _r = parser.register_annotation("custom"); |
937 | | /// |
938 | | /// let mut fields = Vec::new(); |
939 | | /// while !parser.is_empty() { |
940 | | /// fields.push(parser.parens(|p| p.parse())?); |
941 | | /// } |
942 | | /// Ok(Module { fields }) |
943 | | /// } |
944 | | /// } |
945 | | /// |
946 | | /// enum ModuleField<'a> { |
947 | | /// Custom(Custom<'a>), |
948 | | /// // ... |
949 | | /// } |
950 | | /// |
951 | | /// impl<'a> Parse<'a> for ModuleField<'a> { |
952 | | /// fn parse(parser: Parser<'a>) -> Result<Self> { |
953 | | /// // Note that because we have previously registered the `@custom` |
954 | | /// // annotation with the parser we known that `peek` methods like |
955 | | /// // this, working on the annotation token, are enabled to ever |
956 | | /// // return `true`. |
957 | | /// if parser.peek::<annotation::custom>()? { |
958 | | /// return Ok(ModuleField::Custom(parser.parse()?)); |
959 | | /// } |
960 | | /// |
961 | | /// // .. typically we'd parse other module fields here... |
962 | | /// |
963 | | /// Err(parser.error("unknown module field")) |
964 | | /// } |
965 | | /// } |
966 | | /// ``` |
967 | | /// |
968 | | /// [annotation]: https://github.com/WebAssembly/annotations |
969 | 134k | pub fn register_annotation<'b>(self, annotation: &'b str) -> impl Drop + 'b |
970 | 134k | where |
971 | 134k | 'a: 'b, |
972 | | { |
973 | 134k | let mut annotations = self.buf.known_annotations.borrow_mut(); |
974 | 134k | if !annotations.contains_key(annotation) { |
975 | 74.6k | annotations.insert(annotation.to_string(), 0); |
976 | 74.6k | } |
977 | 134k | *annotations.get_mut(annotation).unwrap() += 1; |
978 | | |
979 | 134k | return RemoveOnDrop(self, annotation); |
980 | | |
981 | | struct RemoveOnDrop<'a>(Parser<'a>, &'a str); |
982 | | |
983 | | impl Drop for RemoveOnDrop<'_> { |
984 | 134k | fn drop(&mut self) { |
985 | 134k | let mut annotations = self.0.buf.known_annotations.borrow_mut(); |
986 | 134k | let slot = annotations.get_mut(self.1).unwrap(); |
987 | 134k | *slot -= 1; |
988 | 134k | } |
989 | | } |
990 | 134k | } |
991 | | |
992 | | #[cfg(feature = "wasm-module")] |
993 | 551k | pub(crate) fn track_instr_spans(&self) -> bool { |
994 | 551k | self.buf.track_instr_spans |
995 | 551k | } |
996 | | |
997 | | #[cfg(feature = "wasm-module")] |
998 | 26.8k | pub(crate) fn with_standard_annotations_registered<R>( |
999 | 26.8k | self, |
1000 | 26.8k | f: impl FnOnce(Self) -> Result<R>, |
1001 | 26.8k | ) -> Result<R> { |
1002 | 26.8k | let _r = self.register_annotation("custom"); |
1003 | 26.8k | let _r = self.register_annotation("producers"); |
1004 | 26.8k | let _r = self.register_annotation("name"); |
1005 | 26.8k | let _r = self.register_annotation("dylink.0"); |
1006 | 26.8k | let _r = self.register_annotation("metadata.code.branch_hint"); |
1007 | 26.8k | f(self) |
1008 | 26.8k | } <wast::parser::Parser>::with_standard_annotations_registered::<wast::wat::Wat, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 998 | 13.8k | pub(crate) fn with_standard_annotations_registered<R>( | 999 | 13.8k | self, | 1000 | 13.8k | f: impl FnOnce(Self) -> Result<R>, | 1001 | 13.8k | ) -> Result<R> { | 1002 | 13.8k | let _r = self.register_annotation("custom"); | 1003 | 13.8k | let _r = self.register_annotation("producers"); | 1004 | 13.8k | let _r = self.register_annotation("name"); | 1005 | 13.8k | let _r = self.register_annotation("dylink.0"); | 1006 | 13.8k | let _r = self.register_annotation("metadata.code.branch_hint"); | 1007 | 13.8k | f(self) | 1008 | 13.8k | } |
<wast::parser::Parser>::with_standard_annotations_registered::<wast::wast::Wast, <wast::wast::Wast as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 998 | 2.23k | pub(crate) fn with_standard_annotations_registered<R>( | 999 | 2.23k | self, | 1000 | 2.23k | f: impl FnOnce(Self) -> Result<R>, | 1001 | 2.23k | ) -> Result<R> { | 1002 | 2.23k | let _r = self.register_annotation("custom"); | 1003 | 2.23k | let _r = self.register_annotation("producers"); | 1004 | 2.23k | let _r = self.register_annotation("name"); | 1005 | 2.23k | let _r = self.register_annotation("dylink.0"); | 1006 | 2.23k | let _r = self.register_annotation("metadata.code.branch_hint"); | 1007 | 2.23k | f(self) | 1008 | 2.23k | } |
<wast::parser::Parser>::with_standard_annotations_registered::<wast::core::module::Module, <wast::core::module::Module as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 998 | 10.8k | pub(crate) fn with_standard_annotations_registered<R>( | 999 | 10.8k | self, | 1000 | 10.8k | f: impl FnOnce(Self) -> Result<R>, | 1001 | 10.8k | ) -> Result<R> { | 1002 | 10.8k | let _r = self.register_annotation("custom"); | 1003 | 10.8k | let _r = self.register_annotation("producers"); | 1004 | 10.8k | let _r = self.register_annotation("name"); | 1005 | 10.8k | let _r = self.register_annotation("dylink.0"); | 1006 | 10.8k | let _r = self.register_annotation("metadata.code.branch_hint"); | 1007 | 10.8k | f(self) | 1008 | 10.8k | } |
|
1009 | | } |
1010 | | |
1011 | | impl<'a> Cursor<'a> { |
1012 | | /// Returns the span of the next `Token` token. |
1013 | | /// |
1014 | | /// Does not take into account whitespace or comments. |
1015 | 27.4M | pub fn cur_span(&self) -> Span { |
1016 | 27.4M | let offset = match self.token() { |
1017 | 27.4M | Ok(Some(t)) => t.offset, |
1018 | 344 | Ok(None) => self.parser.buf.lexer.input().len(), |
1019 | 0 | Err(_) => self.pos.offset, |
1020 | | }; |
1021 | 27.4M | Span { offset } |
1022 | 27.4M | } |
1023 | | |
1024 | | /// Returns the span of the previous `Token` token. |
1025 | | /// |
1026 | | /// Does not take into account whitespace or comments. |
1027 | 82.8k | pub(crate) fn prev_span(&self) -> Option<Span> { |
1028 | | // TODO |
1029 | 82.8k | Some(Span { |
1030 | 82.8k | offset: self.pos.offset, |
1031 | 82.8k | }) |
1032 | | // let (token, _) = self.parser.buf.tokens.get(self.cur.checked_sub(1)?)?; |
1033 | | // Some(Span { |
1034 | | // offset: token.offset, |
1035 | | // }) |
1036 | 82.8k | } |
1037 | | |
1038 | | /// Same as [`Parser::error`], but works with the current token in this |
1039 | | /// [`Cursor`] instead. |
1040 | 1.28k | pub fn error(&self, msg: impl fmt::Display) -> Error { |
1041 | 1.28k | self.parser.error_at(self.cur_span(), msg) |
1042 | 1.28k | } |
1043 | | |
1044 | | /// Tests whether the next token is an lparen |
1045 | 2.12M | pub fn peek_lparen(self) -> Result<bool> { |
1046 | 483k | Ok(matches!( |
1047 | 2.12M | self.token()?, |
1048 | | Some(Token { |
1049 | | kind: TokenKind::LParen, |
1050 | | .. |
1051 | | }) |
1052 | | )) |
1053 | 2.12M | } |
1054 | | |
1055 | | /// Tests whether the next token is an rparen |
1056 | 4.44k | pub fn peek_rparen(self) -> Result<bool> { |
1057 | 4.44k | Ok(matches!( |
1058 | 4.44k | self.token()?, |
1059 | | Some(Token { |
1060 | | kind: TokenKind::RParen, |
1061 | | .. |
1062 | | }) |
1063 | | )) |
1064 | 4.44k | } |
1065 | | |
1066 | | /// Tests whether the next token is an id |
1067 | 7.63M | pub fn peek_id(self) -> Result<bool> { |
1068 | 7.62M | Ok(matches!( |
1069 | 7.63M | self.token()?, |
1070 | | Some(Token { |
1071 | | kind: TokenKind::Id, |
1072 | | .. |
1073 | | }) |
1074 | | )) |
1075 | 7.63M | } |
1076 | | |
1077 | | /// Tests whether the next token is reserved |
1078 | 0 | pub fn peek_reserved(self) -> Result<bool> { |
1079 | 0 | Ok(matches!( |
1080 | 0 | self.token()?, |
1081 | | Some(Token { |
1082 | | kind: TokenKind::Reserved, |
1083 | | .. |
1084 | | }) |
1085 | | )) |
1086 | 0 | } |
1087 | | |
1088 | | /// Tests whether the next token is a keyword |
1089 | 0 | pub fn peek_keyword(self) -> Result<bool> { |
1090 | 0 | Ok(matches!( |
1091 | 0 | self.token()?, |
1092 | | Some(Token { |
1093 | | kind: TokenKind::Keyword, |
1094 | | .. |
1095 | | }) |
1096 | | )) |
1097 | 0 | } |
1098 | | |
1099 | | /// Tests whether the next token is an integer |
1100 | 6.27M | pub fn peek_integer(self) -> Result<bool> { |
1101 | 594k | Ok(matches!( |
1102 | 6.27M | self.token()?, |
1103 | | Some(Token { |
1104 | | kind: TokenKind::Integer(_), |
1105 | | .. |
1106 | | }) |
1107 | | )) |
1108 | 6.27M | } |
1109 | | |
1110 | | /// Tests whether the next token is a float |
1111 | 0 | pub fn peek_float(self) -> Result<bool> { |
1112 | 0 | Ok(matches!( |
1113 | 0 | self.token()?, |
1114 | | Some(Token { |
1115 | | kind: TokenKind::Float(_), |
1116 | | .. |
1117 | | }) |
1118 | | )) |
1119 | 0 | } |
1120 | | |
1121 | | /// Tests whether the next token is a string |
1122 | 15.8k | pub fn peek_string(self) -> Result<bool> { |
1123 | 4.44k | Ok(matches!( |
1124 | 15.8k | self.token()?, |
1125 | | Some(Token { |
1126 | | kind: TokenKind::String, |
1127 | | .. |
1128 | | }) |
1129 | | )) |
1130 | 15.8k | } |
1131 | | |
1132 | | /// Attempts to advance this cursor if the current token is a `(`. |
1133 | | /// |
1134 | | /// If the current token is `(`, returns a new [`Cursor`] pointing at the |
1135 | | /// rest of the tokens in the stream. Otherwise returns `None`. |
1136 | | /// |
1137 | | /// This function will automatically skip over any comments, whitespace, or |
1138 | | /// unknown annotations. |
1139 | 20.7M | pub fn lparen(mut self) -> Result<Option<Self>> { |
1140 | 20.7M | let token = match self.token()? { |
1141 | 20.7M | Some(token) => token, |
1142 | 34 | None => return Ok(None), |
1143 | | }; |
1144 | 20.7M | match token.kind { |
1145 | 11.1M | TokenKind::LParen => {} |
1146 | 9.53M | _ => return Ok(None), |
1147 | | } |
1148 | 11.1M | self.advance_past(&token); |
1149 | 11.1M | Ok(Some(self)) |
1150 | 20.7M | } |
1151 | | |
1152 | | /// Attempts to advance this cursor if the current token is a `)`. |
1153 | | /// |
1154 | | /// If the current token is `)`, returns a new [`Cursor`] pointing at the |
1155 | | /// rest of the tokens in the stream. Otherwise returns `None`. |
1156 | | /// |
1157 | | /// This function will automatically skip over any comments, whitespace, or |
1158 | | /// unknown annotations. |
1159 | 9.95M | pub fn rparen(mut self) -> Result<Option<Self>> { |
1160 | 9.95M | let token = match self.token()? { |
1161 | 9.95M | Some(token) => token, |
1162 | 22 | None => return Ok(None), |
1163 | | }; |
1164 | 9.95M | match token.kind { |
1165 | 9.95M | TokenKind::RParen => {} |
1166 | 10 | _ => return Ok(None), |
1167 | | } |
1168 | 9.95M | self.advance_past(&token); |
1169 | 9.95M | Ok(Some(self)) |
1170 | 9.95M | } |
1171 | | |
1172 | | /// Attempts to advance this cursor if the current token is a |
1173 | | /// [`Token::Id`](crate::lexer::Token) |
1174 | | /// |
1175 | | /// If the current token is `Id`, returns the identifier minus the leading |
1176 | | /// `$` character as well as a new [`Cursor`] pointing at the rest of the |
1177 | | /// tokens in the stream. Otherwise returns `None`. |
1178 | | /// |
1179 | | /// This function will automatically skip over any comments, whitespace, or |
1180 | | /// unknown annotations. |
1181 | 11.8k | pub fn id(mut self) -> Result<Option<(&'a str, Self)>> { |
1182 | 11.8k | let token = match self.token()? { |
1183 | 11.8k | Some(token) => token, |
1184 | 0 | None => return Ok(None), |
1185 | | }; |
1186 | 11.8k | match token.kind { |
1187 | 11.8k | TokenKind::Id => {} |
1188 | 0 | _ => return Ok(None), |
1189 | | } |
1190 | 11.8k | self.advance_past(&token); |
1191 | 11.8k | let id = match token.id(self.parser.buf.lexer.input())? { |
1192 | 11.8k | Cow::Borrowed(id) => id, |
1193 | | // Our `self.parser.buf` only retains `Vec<u8>` so briefly convert |
1194 | | // this owned string to `Vec<u8>` and then convert it back to `&str` |
1195 | | // out the other end. |
1196 | 0 | Cow::Owned(s) => std::str::from_utf8(self.parser.buf.push_str(s.into_bytes())).unwrap(), |
1197 | | }; |
1198 | 11.8k | Ok(Some((id, self))) |
1199 | 11.8k | } |
1200 | | |
1201 | | /// Attempts to advance this cursor if the current token is a |
1202 | | /// [`Token::Keyword`](crate::lexer::Token) |
1203 | | /// |
1204 | | /// If the current token is `Keyword`, returns the keyword as well as a new |
1205 | | /// [`Cursor`] pointing at the rest of the tokens in the stream. Otherwise |
1206 | | /// returns `None`. |
1207 | | /// |
1208 | | /// This function will automatically skip over any comments, whitespace, or |
1209 | | /// unknown annotations. |
1210 | 50.7M | pub fn keyword(mut self) -> Result<Option<(&'a str, Self)>> { |
1211 | 50.7M | let token = match self.token()? { |
1212 | 50.7M | Some(token) => token, |
1213 | 4.17k | None => return Ok(None), |
1214 | | }; |
1215 | 50.7M | match token.kind { |
1216 | 47.8M | TokenKind::Keyword => {} |
1217 | 2.98M | _ => return Ok(None), |
1218 | | } |
1219 | 47.8M | self.advance_past(&token); |
1220 | 47.8M | Ok(Some((token.keyword(self.parser.buf.lexer.input()), self))) |
1221 | 50.7M | } |
1222 | | |
1223 | | /// Attempts to advance this cursor if the current token is a |
1224 | | /// [`Token::Annotation`](crate::lexer::Token) |
1225 | | /// |
1226 | | /// If the current token is `Annotation`, returns the annotation token as well |
1227 | | /// as a new [`Cursor`] pointing at the rest of the tokens in the stream. |
1228 | | /// Otherwise returns `None`. |
1229 | | /// |
1230 | | /// This function will automatically skip over any comments, whitespace, or |
1231 | | /// unknown annotations. |
1232 | 6.04M | pub fn annotation(mut self) -> Result<Option<(&'a str, Self)>> { |
1233 | 6.04M | let token = match self.token()? { |
1234 | 6.04M | Some(token) => token, |
1235 | 646 | None => return Ok(None), |
1236 | | }; |
1237 | 6.04M | match token.kind { |
1238 | 85 | TokenKind::Annotation => {} |
1239 | 6.04M | _ => return Ok(None), |
1240 | | } |
1241 | 85 | self.advance_past(&token); |
1242 | 85 | let annotation = match token.annotation(self.parser.buf.lexer.input())? { |
1243 | 68 | Cow::Borrowed(id) => id, |
1244 | | // Our `self.parser.buf` only retains `Vec<u8>` so briefly convert |
1245 | | // this owned string to `Vec<u8>` and then convert it back to `&str` |
1246 | | // out the other end. |
1247 | 0 | Cow::Owned(s) => std::str::from_utf8(self.parser.buf.push_str(s.into_bytes())).unwrap(), |
1248 | | }; |
1249 | 68 | Ok(Some((annotation, self))) |
1250 | 6.04M | } |
1251 | | |
1252 | | /// Attempts to advance this cursor if the current token is a |
1253 | | /// [`Token::Reserved`](crate::lexer::Token) |
1254 | | /// |
1255 | | /// If the current token is `Reserved`, returns the reserved token as well |
1256 | | /// as a new [`Cursor`] pointing at the rest of the tokens in the stream. |
1257 | | /// Otherwise returns `None`. |
1258 | | /// |
1259 | | /// This function will automatically skip over any comments, whitespace, or |
1260 | | /// unknown annotations. |
1261 | 0 | pub fn reserved(mut self) -> Result<Option<(&'a str, Self)>> { |
1262 | 0 | let token = match self.token()? { |
1263 | 0 | Some(token) => token, |
1264 | 0 | None => return Ok(None), |
1265 | | }; |
1266 | 0 | match token.kind { |
1267 | 0 | TokenKind::Reserved => {} |
1268 | 0 | _ => return Ok(None), |
1269 | | } |
1270 | 0 | self.advance_past(&token); |
1271 | 0 | Ok(Some((token.reserved(self.parser.buf.lexer.input()), self))) |
1272 | 0 | } |
1273 | | |
1274 | | /// Attempts to advance this cursor if the current token is a |
1275 | | /// [`Token::Integer`](crate::lexer::Token) |
1276 | | /// |
1277 | | /// If the current token is `Integer`, returns the integer as well as a new |
1278 | | /// [`Cursor`] pointing at the rest of the tokens in the stream. Otherwise |
1279 | | /// returns `None`. |
1280 | | /// |
1281 | | /// This function will automatically skip over any comments, whitespace, or |
1282 | | /// unknown annotations. |
1283 | 6.41M | pub fn integer(mut self) -> Result<Option<(Integer<'a>, Self)>> { |
1284 | 6.41M | let token = match self.token()? { |
1285 | 6.41M | Some(token) => token, |
1286 | 2 | None => return Ok(None), |
1287 | | }; |
1288 | 6.41M | let i = match token.kind { |
1289 | 6.41M | TokenKind::Integer(i) => i, |
1290 | 490 | _ => return Ok(None), |
1291 | | }; |
1292 | 6.41M | self.advance_past(&token); |
1293 | 6.41M | Ok(Some(( |
1294 | 6.41M | token.integer(self.parser.buf.lexer.input(), i), |
1295 | 6.41M | self, |
1296 | 6.41M | ))) |
1297 | 6.41M | } |
1298 | | |
1299 | | /// Attempts to advance this cursor if the current token is a |
1300 | | /// [`Token::Float`](crate::lexer::Token) |
1301 | | /// |
1302 | | /// If the current token is `Float`, returns the float as well as a new |
1303 | | /// [`Cursor`] pointing at the rest of the tokens in the stream. Otherwise |
1304 | | /// returns `None`. |
1305 | | /// |
1306 | | /// This function will automatically skip over any comments, whitespace, or |
1307 | | /// unknown annotations. |
1308 | 691k | pub fn float(mut self) -> Result<Option<(Float<'a>, Self)>> { |
1309 | 691k | let token = match self.token()? { |
1310 | 691k | Some(token) => token, |
1311 | 0 | None => return Ok(None), |
1312 | | }; |
1313 | 691k | let f = match token.kind { |
1314 | 691k | TokenKind::Float(f) => f, |
1315 | 8 | _ => return Ok(None), |
1316 | | }; |
1317 | 691k | self.advance_past(&token); |
1318 | 691k | Ok(Some((token.float(self.parser.buf.lexer.input(), f), self))) |
1319 | 691k | } |
1320 | | |
1321 | | /// Attempts to advance this cursor if the current token is a |
1322 | | /// [`Token::String`](crate::lexer::Token) |
1323 | | /// |
1324 | | /// If the current token is `String`, returns the byte value of the string |
1325 | | /// as well as a new [`Cursor`] pointing at the rest of the tokens in the |
1326 | | /// stream. Otherwise returns `None`. |
1327 | | /// |
1328 | | /// This function will automatically skip over any comments, whitespace, or |
1329 | | /// unknown annotations. |
1330 | 206k | pub fn string(mut self) -> Result<Option<(&'a [u8], Self)>> { |
1331 | 206k | let token = match self.token()? { |
1332 | 206k | Some(token) => token, |
1333 | 6 | None => return Ok(None), |
1334 | | }; |
1335 | 206k | match token.kind { |
1336 | 206k | TokenKind::String => {} |
1337 | 5 | _ => return Ok(None), |
1338 | | } |
1339 | 206k | let string = match token.string(self.parser.buf.lexer.input()) { |
1340 | 182k | Cow::Borrowed(s) => s, |
1341 | 23.9k | Cow::Owned(s) => self.parser.buf.push_str(s), |
1342 | | }; |
1343 | 206k | self.advance_past(&token); |
1344 | 206k | Ok(Some((string, self))) |
1345 | 206k | } |
1346 | | |
1347 | | /// Attempts to advance this cursor if the current token is a |
1348 | | /// [`Token::LineComment`](crate::lexer::Token) or a |
1349 | | /// [`Token::BlockComment`](crate::lexer::Token) |
1350 | | /// |
1351 | | /// This function will only skip whitespace, no other tokens. |
1352 | 0 | pub fn comment(mut self) -> Result<Option<(&'a str, Self)>> { |
1353 | 0 | let start = self.pos.offset; |
1354 | 0 | self.pos.token = None; |
1355 | 0 | let comment = loop { |
1356 | 0 | let token = match self.parser.buf.lexer.parse(&mut self.pos.offset)? { |
1357 | 0 | Some(token) => token, |
1358 | 0 | None => return Ok(None), |
1359 | | }; |
1360 | 0 | match token.kind { |
1361 | | TokenKind::LineComment | TokenKind::BlockComment => { |
1362 | 0 | break token.src(self.parser.buf.lexer.input()); |
1363 | | } |
1364 | 0 | TokenKind::Whitespace => {} |
1365 | | _ => { |
1366 | 0 | self.pos.offset = start; |
1367 | 0 | return Ok(None); |
1368 | | } |
1369 | | } |
1370 | | }; |
1371 | 0 | Ok(Some((comment, self))) |
1372 | 0 | } |
1373 | | |
1374 | 170M | fn token(&self) -> Result<Option<Token>> { |
1375 | 170M | match self.pos.token { |
1376 | 170M | Some(token) => Ok(Some(token)), |
1377 | 51.3k | None => self.parser.buf.advance_token(self.pos.offset), |
1378 | | } |
1379 | 170M | } |
1380 | | |
1381 | 84.8M | fn advance_past(&mut self, token: &Token) { |
1382 | 84.8M | self.pos.offset = token.offset + (token.len as usize); |
1383 | 84.8M | self.pos.token = self |
1384 | 84.8M | .parser |
1385 | 84.8M | .buf |
1386 | 84.8M | .advance_token(self.pos.offset) |
1387 | 84.8M | .unwrap_or(None); |
1388 | 84.8M | } |
1389 | | } |
1390 | | |
1391 | | impl<'a> Lookahead1<'a> { |
1392 | | /// Attempts to see if `T` is the next token in the [`Parser`] this |
1393 | | /// [`Lookahead1`] references. |
1394 | | /// |
1395 | | /// For more information see [`Parser::lookahead1`] and [`Parser::peek`] |
1396 | 10.6M | pub fn peek<T: Peek>(&mut self) -> Result<bool> { |
1397 | 10.6M | Ok(if self.parser.peek::<T>()? { |
1398 | 4.42M | true |
1399 | | } else { |
1400 | 6.17M | self.attempts.push(T::display()); |
1401 | 6.17M | false |
1402 | | }) |
1403 | 10.6M | } <wast::parser::Lookahead1>::peek::<wast::kw::assert_trap> Line | Count | Source | 1396 | 7 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 7 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 7 | self.attempts.push(T::display()); | 1401 | 7 | false | 1402 | | }) | 1403 | 7 | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::export_info> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::import_info> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::processed_by> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::runtime_path> <wast::parser::Lookahead1>::peek::<wast::kw::assert_return> Line | Count | Source | 1396 | 7 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 7 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 7 | self.attempts.push(T::display()); | 1401 | 7 | false | 1402 | | }) | 1403 | 7 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_invalid> Line | Count | Source | 1396 | 10 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 10 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 10 | self.attempts.push(T::display()); | 1401 | 10 | false | 1402 | | }) | 1403 | 10 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_exception> Line | Count | Source | 1396 | 6 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 6 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 6 | self.attempts.push(T::display()); | 1401 | 6 | false | 1402 | | }) | 1403 | 6 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_malformed> Line | Count | Source | 1396 | 10 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 10 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 10 | self.attempts.push(T::display()); | 1401 | 10 | false | 1402 | | }) | 1403 | 10 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_exhaustion> Line | Count | Source | 1396 | 7 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 7 | Ok(if self.parser.peek::<T>()? { | 1398 | 1 | true | 1399 | | } else { | 1400 | 6 | self.attempts.push(T::display()); | 1401 | 6 | false | 1402 | | }) | 1403 | 7 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_suspension> Line | Count | Source | 1396 | 6 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 6 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 6 | self.attempts.push(T::display()); | 1401 | 6 | false | 1402 | | }) | 1403 | 6 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_unlinkable> Line | Count | Source | 1396 | 6 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 6 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 6 | self.attempts.push(T::display()); | 1401 | 6 | false | 1402 | | }) | 1403 | 6 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_invalid_custom> Line | Count | Source | 1396 | 10 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 10 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 10 | self.attempts.push(T::display()); | 1401 | 10 | false | 1402 | | }) | 1403 | 10 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::assert_malformed_custom> Line | Count | Source | 1396 | 10 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 10 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 10 | self.attempts.push(T::display()); | 1401 | 10 | false | 1402 | | }) | 1403 | 10 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::eq> Line | Count | Source | 1396 | 259k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 259k | Ok(if self.parser.peek::<T>()? { | 1398 | 11.6k | true | 1399 | | } else { | 1400 | 248k | self.attempts.push(T::display()); | 1401 | 248k | false | 1402 | | }) | 1403 | 259k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i8> Line | Count | Source | 1396 | 906k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 906k | Ok(if self.parser.peek::<T>()? { | 1398 | 500k | true | 1399 | | } else { | 1400 | 405k | self.attempts.push(T::display()); | 1401 | 405k | false | 1402 | | }) | 1403 | 906k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::any> Line | Count | Source | 1396 | 277k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 277k | Ok(if self.parser.peek::<T>()? { | 1398 | 17.0k | true | 1399 | | } else { | 1400 | 259k | self.attempts.push(T::display()); | 1401 | 259k | false | 1402 | | }) | 1403 | 277k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::exn> Line | Count | Source | 1396 | 311k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 311k | Ok(if self.parser.peek::<T>()? { | 1398 | 34.4k | true | 1399 | | } else { | 1400 | 277k | self.attempts.push(T::display()); | 1401 | 277k | false | 1402 | | }) | 1403 | 311k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::f32> Line | Count | Source | 1396 | 4 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 4 | Ok(if self.parser.peek::<T>()? { | 1398 | 4 | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 4 | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::f64> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::get> <wast::parser::Lookahead1>::peek::<wast::kw::i16> Line | Count | Source | 1396 | 405k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 405k | Ok(if self.parser.peek::<T>()? { | 1398 | 166k | true | 1399 | | } else { | 1400 | 239k | self.attempts.push(T::display()); | 1401 | 239k | false | 1402 | | }) | 1403 | 405k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i31> Line | Count | Source | 1396 | 234k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 234k | Ok(if self.parser.peek::<T>()? { | 1398 | 4.79k | true | 1399 | | } else { | 1400 | 229k | self.attempts.push(T::display()); | 1401 | 229k | false | 1402 | | }) | 1403 | 234k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i32> Line | Count | Source | 1396 | 28.7k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 28.7k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 28.7k | self.attempts.push(T::display()); | 1401 | 28.7k | false | 1402 | | }) | 1403 | 28.7k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i64> Line | Count | Source | 1396 | 28.7k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 28.7k | Ok(if self.parser.peek::<T>()? { | 1398 | 23.9k | true | 1399 | | } else { | 1400 | 4.81k | self.attempts.push(T::display()); | 1401 | 4.81k | false | 1402 | | }) | 1403 | 28.7k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::ref> Line | Count | Source | 1396 | 585k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 585k | Ok(if self.parser.peek::<T>()? { | 1398 | 585k | true | 1399 | | } else { | 1400 | 2 | self.attempts.push(T::display()); | 1401 | 2 | false | 1402 | | }) | 1403 | 585k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::sdk> <wast::parser::Lookahead1>::peek::<wast::kw::tag> Line | Count | Source | 1396 | 7.17k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 7.17k | Ok(if self.parser.peek::<T>()? { | 1398 | 7.17k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 7.17k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::cont> Line | Count | Source | 1396 | 277k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 277k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 277k | self.attempts.push(T::display()); | 1401 | 277k | false | 1402 | | }) | 1403 | 277k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::func> Line | Count | Source | 1396 | 937k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 937k | Ok(if self.parser.peek::<T>()? { | 1398 | 187k | true | 1399 | | } else { | 1400 | 749k | self.attempts.push(T::display()); | 1401 | 749k | false | 1402 | | }) | 1403 | 937k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::last> <wast::parser::Lookahead1>::peek::<wast::kw::none> Line | Count | Source | 1396 | 176k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 176k | Ok(if self.parser.peek::<T>()? { | 1398 | 176k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 176k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::v128> <wast::parser::Lookahead1>::peek::<wast::kw::wait> Line | Count | Source | 1396 | 6 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 6 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 6 | self.attempts.push(T::display()); | 1401 | 6 | false | 1402 | | }) | 1403 | 6 | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::after> <wast::parser::Lookahead1>::peek::<wast::kw::array> Line | Count | Source | 1396 | 516k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 516k | Ok(if self.parser.peek::<T>()? { | 1398 | 282k | true | 1399 | | } else { | 1400 | 234k | self.attempts.push(T::display()); | 1401 | 234k | false | 1402 | | }) | 1403 | 516k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::exact> Line | Count | Source | 1396 | 54.3k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 54.3k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 54.3k | self.attempts.push(T::display()); | 1401 | 54.3k | false | 1402 | | }) | 1403 | 54.3k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::f32x4> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::f64x2> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::first> <wast::parser::Lookahead1>::peek::<wast::kw::i16x8> Line | Count | Source | 1396 | 99.6k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 99.6k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 99.6k | self.attempts.push(T::display()); | 1401 | 99.6k | false | 1402 | | }) | 1403 | 99.6k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i32x4> Line | Count | Source | 1396 | 99.6k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 99.6k | Ok(if self.parser.peek::<T>()? { | 1398 | 99.6k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 99.6k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::i64x2> <wast::parser::Lookahead1>::peek::<wast::kw::i8x16> Line | Count | Source | 1396 | 99.6k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 99.6k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 99.6k | self.attempts.push(T::display()); | 1401 | 99.6k | false | 1402 | | }) | 1403 | 99.6k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::noexn> Line | Count | Source | 1396 | 176k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 176k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 176k | self.attempts.push(T::display()); | 1401 | 176k | false | 1402 | | }) | 1403 | 176k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::param> Line | Count | Source | 1396 | 837k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 837k | Ok(if self.parser.peek::<T>()? { | 1398 | 241k | true | 1399 | | } else { | 1400 | 595k | self.attempts.push(T::display()); | 1401 | 595k | false | 1402 | | }) | 1403 | 837k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::table> Line | Count | Source | 1396 | 75.1k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 75.1k | Ok(if self.parser.peek::<T>()? { | 1398 | 24.7k | true | 1399 | | } else { | 1400 | 50.4k | self.attempts.push(T::display()); | 1401 | 50.4k | false | 1402 | | }) | 1403 | 75.1k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::before> <wast::parser::Lookahead1>::peek::<wast::kw::extern> Line | Count | Source | 1396 | 325k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 325k | Ok(if self.parser.peek::<T>()? { | 1398 | 13.6k | true | 1399 | | } else { | 1400 | 311k | self.attempts.push(T::display()); | 1401 | 311k | false | 1402 | | }) | 1403 | 325k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::global> Line | Count | Source | 1396 | 42.9k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 42.9k | Ok(if self.parser.peek::<T>()? { | 1398 | 35.7k | true | 1399 | | } else { | 1400 | 7.17k | self.attempts.push(T::display()); | 1401 | 7.17k | false | 1402 | | }) | 1403 | 42.9k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::invoke> Line | Count | Source | 1396 | 9 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 9 | Ok(if self.parser.peek::<T>()? { | 1398 | 2 | true | 1399 | | } else { | 1400 | 7 | self.attempts.push(T::display()); | 1401 | 7 | false | 1402 | | }) | 1403 | 9 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::memory> Line | Count | Source | 1396 | 50.4k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 50.4k | Ok(if self.parser.peek::<T>()? { | 1398 | 7.49k | true | 1399 | | } else { | 1400 | 42.9k | self.attempts.push(T::display()); | 1401 | 42.9k | false | 1402 | | }) | 1403 | 50.4k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::module> Line | Count | Source | 1396 | 20 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 20 | Ok(if self.parser.peek::<T>()? { | 1398 | 10 | true | 1399 | | } else { | 1400 | 10 | self.attempts.push(T::display()); | 1401 | 10 | false | 1402 | | }) | 1403 | 20 | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::needed> <wast::parser::Lookahead1>::peek::<wast::kw::nocont> Line | Count | Source | 1396 | 176k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 176k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 176k | self.attempts.push(T::display()); | 1401 | 176k | false | 1402 | | }) | 1403 | 176k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::nofunc> Line | Count | Source | 1396 | 229k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 229k | Ok(if self.parser.peek::<T>()? { | 1398 | 31.8k | true | 1399 | | } else { | 1400 | 197k | self.attempts.push(T::display()); | 1401 | 197k | false | 1402 | | }) | 1403 | 229k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::result> Line | Count | Source | 1396 | 595k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 595k | Ok(if self.parser.peek::<T>()? { | 1398 | 595k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 595k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::shared> Line | Count | Source | 1396 | 14.5k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 14.5k | Ok(if self.parser.peek::<T>()? { | 1398 | 524 | true | 1399 | | } else { | 1400 | 14.0k | self.attempts.push(T::display()); | 1401 | 14.0k | false | 1402 | | }) | 1403 | 14.5k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::struct> Line | Count | Source | 1396 | 597k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 597k | Ok(if self.parser.peek::<T>()? { | 1398 | 81.3k | true | 1399 | | } else { | 1400 | 516k | self.attempts.push(T::display()); | 1401 | 516k | false | 1402 | | }) | 1403 | 597k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::thread> Line | Count | Source | 1396 | 6 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 6 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 6 | self.attempts.push(T::display()); | 1401 | 6 | false | 1402 | | }) | 1403 | 6 | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::language> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::mem_info> <wast::parser::Lookahead1>::peek::<wast::kw::noextern> Line | Count | Source | 1396 | 197k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 197k | Ok(if self.parser.peek::<T>()? { | 1398 | 21.0k | true | 1399 | | } else { | 1400 | 176k | self.attempts.push(T::display()); | 1401 | 176k | false | 1402 | | }) | 1403 | 197k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::register> Line | Count | Source | 1396 | 10 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 10 | Ok(if self.parser.peek::<T>()? { | 1398 | 1 | true | 1399 | | } else { | 1400 | 9 | self.attempts.push(T::display()); | 1401 | 9 | false | 1402 | | }) | 1403 | 10 | } |
<wast::parser::Lookahead1>::peek::<wast::kw::component> Line | Count | Source | 1396 | 10 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 10 | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 10 | self.attempts.push(T::display()); | 1401 | 10 | false | 1402 | | }) | 1403 | 10 | } |
<wast::parser::Lookahead1>::peek::<wast::token::Index> Line | Count | Source | 1396 | 1.02M | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 1.02M | Ok(if self.parser.peek::<T>()? { | 1398 | 669k | true | 1399 | | } else { | 1400 | 350k | self.attempts.push(T::display()); | 1401 | 350k | false | 1402 | | }) | 1403 | 1.02M | } |
<wast::parser::Lookahead1>::peek::<wast::token::LParen> Line | Count | Source | 1396 | 377k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 377k | Ok(if self.parser.peek::<T>()? { | 1398 | 54.3k | true | 1399 | | } else { | 1400 | 323k | self.attempts.push(T::display()); | 1401 | 323k | false | 1402 | | }) | 1403 | 377k | } |
<wast::parser::Lookahead1>::peek::<wast::core::types::AbstractHeapType> Line | Count | Source | 1396 | 296k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 296k | Ok(if self.parser.peek::<T>()? { | 1398 | 296k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 296k | } |
<wast::parser::Lookahead1>::peek::<wast::core::types::RefType> Line | Count | Source | 1396 | 14.5k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 14.5k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 14.5k | self.attempts.push(T::display()); | 1401 | 14.5k | false | 1402 | | }) | 1403 | 14.5k | } |
<wast::parser::Lookahead1>::peek::<wast::core::types::ValType> Line | Count | Source | 1396 | 239k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 239k | Ok(if self.parser.peek::<T>()? { | 1398 | 239k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 239k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::core::custom::parse_sym_flags::flag> <wast::parser::Lookahead1>::peek::<u32> Line | Count | Source | 1396 | 27.0k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 27.0k | Ok(if self.parser.peek::<T>()? { | 1398 | 12.7k | true | 1399 | | } else { | 1400 | 14.2k | self.attempts.push(T::display()); | 1401 | 14.2k | false | 1402 | | }) | 1403 | 27.0k | } |
<wast::parser::Lookahead1>::peek::<u64> Line | Count | Source | 1396 | 4.27k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 4.27k | Ok(if self.parser.peek::<T>()? { | 1398 | 4.26k | true | 1399 | | } else { | 1400 | 9 | self.attempts.push(T::display()); | 1401 | 9 | false | 1402 | | }) | 1403 | 4.27k | } |
|
1404 | | |
1405 | | /// Returns the underlying parser that this lookahead is looking at. |
1406 | 0 | pub fn parser(&self) -> Parser<'a> { |
1407 | 0 | self.parser |
1408 | 0 | } |
1409 | | |
1410 | | /// Generates an error message saying that one of the tokens passed to |
1411 | | /// [`Lookahead1::peek`] method was expected. |
1412 | | /// |
1413 | | /// Before calling this method you should call [`Lookahead1::peek`] for all |
1414 | | /// possible tokens you'd like to parse. |
1415 | 37 | pub fn error(self) -> Error { |
1416 | 37 | match self.attempts.len() { |
1417 | | 0 => { |
1418 | 0 | if self.parser.is_empty() { |
1419 | 0 | self.parser.error("unexpected end of input") |
1420 | | } else { |
1421 | 0 | self.parser.error("unexpected token") |
1422 | | } |
1423 | | } |
1424 | | 1 => { |
1425 | 0 | let message = format!("unexpected token, expected {}", self.attempts[0]); |
1426 | 0 | self.parser.error(&message) |
1427 | | } |
1428 | | 2 => { |
1429 | 2 | let message = format!( |
1430 | | "unexpected token, expected {} or {}", |
1431 | 2 | self.attempts[0], self.attempts[1] |
1432 | | ); |
1433 | 2 | self.parser.error(&message) |
1434 | | } |
1435 | | _ => { |
1436 | 35 | let join = self.attempts.join(", "); |
1437 | 35 | let message = format!("unexpected token, expected one of: {join}"); |
1438 | 35 | self.parser.error(&message) |
1439 | | } |
1440 | | } |
1441 | 37 | } |
1442 | | } |
1443 | | |
1444 | | impl<'a, T: Peek + Parse<'a>> Parse<'a> for Option<T> { |
1445 | 3.53M | fn parse(parser: Parser<'a>) -> Result<Option<T>> { |
1446 | 3.53M | if parser.peek::<T>()? { |
1447 | 852k | Ok(Some(parser.parse()?)) |
1448 | | } else { |
1449 | 2.68M | Ok(None) |
1450 | | } |
1451 | 3.53M | } <core::option::Option<wast::kw::i32> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 6 | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 6 | if parser.peek::<T>()? { | 1447 | 0 | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 6 | Ok(None) | 1450 | | } | 1451 | 6 | } |
<core::option::Option<wast::kw::i64> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 6 | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 6 | if parser.peek::<T>()? { | 1447 | 0 | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 6 | Ok(None) | 1450 | | } | 1451 | 6 | } |
<core::option::Option<wast::kw::shared> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 55.8k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 55.8k | if parser.peek::<T>()? { | 1447 | 3.09k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 52.7k | Ok(None) | 1450 | | } | 1451 | 55.8k | } |
<core::option::Option<wast::token::Id> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 2.02M | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 2.02M | if parser.peek::<T>()? { | 1447 | 11.8k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 2.00M | Ok(None) | 1450 | | } | 1451 | 2.02M | } |
<core::option::Option<wast::token::Index> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 396k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 396k | if parser.peek::<T>()? { | 1447 | 313k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 82.7k | Ok(None) | 1450 | | } | 1451 | 396k | } |
<core::option::Option<wast::core::types::FunctionType> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 206k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 206k | if parser.peek::<T>()? { | 1447 | 178k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 28.2k | Ok(None) | 1450 | | } | 1451 | 206k | } |
<core::option::Option<wast::core::types::FunctionTypeNoNames> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 577k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 577k | if parser.peek::<T>()? { | 1447 | 345k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 232k | Ok(None) | 1450 | | } | 1451 | 577k | } |
Unexecuted instantiation: <core::option::Option<wast::core::types::HeapType> as wast::parser::Parse>::parse <core::option::Option<wast::core::import::InlineImport> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 279k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 279k | if parser.peek::<T>()? { | 1447 | 0 | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 279k | Ok(None) | 1450 | | } | 1451 | 279k | } |
Unexecuted instantiation: <core::option::Option<u32> as wast::parser::Parse>::parse |
1452 | | } |