/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 | 17.9k | pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> { |
122 | 17.9k | let parser = buf.parser(); |
123 | 17.9k | let result = parser.parse()?; |
124 | 13.4k | if parser.cursor().token()?.is_none() { |
125 | 13.4k | Ok(result) |
126 | | } else { |
127 | 30 | Err(parser.error("extra tokens remaining after parse")) |
128 | | } |
129 | 17.9k | } wast::parser::parse::<wast::wast::Wast> Line | Count | Source | 121 | 2.39k | pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> { | 122 | 2.39k | let parser = buf.parser(); | 123 | 2.39k | let result = parser.parse()?; | 124 | 23 | if parser.cursor().token()?.is_none() { | 125 | 8 | Ok(result) | 126 | | } else { | 127 | 15 | Err(parser.error("extra tokens remaining after parse")) | 128 | | } | 129 | 2.39k | } |
wast::parser::parse::<wast::wat::Wat> Line | Count | Source | 121 | 15.5k | pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> { | 122 | 15.5k | let parser = buf.parser(); | 123 | 15.5k | let result = parser.parse()?; | 124 | 13.4k | if parser.cursor().token()?.is_none() { | 125 | 13.4k | Ok(result) | 126 | | } else { | 127 | 15 | Err(parser.error("extra tokens remaining after parse")) | 128 | | } | 129 | 15.5k | } |
|
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 | 458k | fn parse(parser: Parser<'a>) -> Result<Self> { |
252 | 458k | Ok(Box::new(parser.parse()?)) |
253 | 458k | } <alloc::boxed::Box<wast::core::expr::BrOnCastFail> as wast::parser::Parse>::parse Line | Count | Source | 251 | 632 | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 632 | Ok(Box::new(parser.parse()?)) | 253 | 632 | } |
<alloc::boxed::Box<wast::core::expr::CallIndirect> as wast::parser::Parse>::parse Line | Count | Source | 251 | 456 | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 456 | Ok(Box::new(parser.parse()?)) | 253 | 456 | } |
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 | 454 | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 454 | Ok(Box::new(parser.parse()?)) | 253 | 454 | } |
<alloc::boxed::Box<wast::core::expr::BlockType> as wast::parser::Parse>::parse Line | Count | Source | 251 | 457k | fn parse(parser: Parser<'a>) -> Result<Self> { | 252 | 457k | Ok(Box::new(parser.parse()?)) | 253 | 457k | } |
|
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 | 7.45M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { |
282 | 7.45M | match cursor.token()? { |
283 | 7.45M | Some(token) => cursor.advance_past(&token), |
284 | 116 | None => return Ok(false), |
285 | | } |
286 | 7.45M | Self::peek(cursor) |
287 | 7.45M | } <wast::kw::definition as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 8 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 8 | match cursor.token()? { | 283 | 8 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 8 | Self::peek(cursor) | 287 | 8 | } |
<wast::kw::catch_all_ref as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 32.6k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 32.6k | match cursor.token()? { | 283 | 32.6k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 32.6k | Self::peek(cursor) | 287 | 32.6k | } |
Unexecuted instantiation: <wast::kw::on as wast::parser::Peek>::peek2 <wast::kw::mut as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 986k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 986k | match cursor.token()? { | 283 | 986k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 986k | Self::peek(cursor) | 287 | 986k | } |
<wast::kw::item as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 462k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 462k | match cursor.token()? { | 283 | 462k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 462k | Self::peek(cursor) | 287 | 462k | } |
<wast::kw::type as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 680k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 680k | match cursor.token()? { | 283 | 680k | Some(token) => cursor.advance_past(&token), | 284 | 8 | None => return Ok(false), | 285 | | } | 286 | 680k | Self::peek(cursor) | 287 | 680k | } |
<wast::kw::catch as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 161k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 161k | match cursor.token()? { | 283 | 161k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 161k | Self::peek(cursor) | 287 | 161k | } |
<wast::kw::exact as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 22.1k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 22.1k | match cursor.token()? { | 283 | 22.1k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 22.1k | Self::peek(cursor) | 287 | 22.1k | } |
<wast::kw::local as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 191k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 191k | match cursor.token()? { | 283 | 191k | Some(token) => cursor.advance_past(&token), | 284 | 2 | None => return Ok(false), | 285 | | } | 286 | 191k | Self::peek(cursor) | 287 | 191k | } |
<wast::kw::param as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 1.24M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 1.24M | match cursor.token()? { | 283 | 1.24M | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 1.24M | Self::peek(cursor) | 287 | 1.24M | } |
<wast::kw::quote as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 17 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 17 | match cursor.token()? { | 283 | 17 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 17 | Self::peek(cursor) | 287 | 17 | } |
<wast::kw::table as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 17.8k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 17.8k | match cursor.token()? { | 283 | 17.8k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 17.8k | Self::peek(cursor) | 287 | 17.8k | } |
<wast::kw::memory as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 5.82k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 5.82k | match cursor.token()? { | 283 | 5.82k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 5.82k | Self::peek(cursor) | 287 | 5.82k | } |
<wast::kw::module as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 16.6k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 16.6k | match cursor.token()? { | 283 | 15.9k | Some(token) => cursor.advance_past(&token), | 284 | 9 | None => return Ok(false), | 285 | | } | 286 | 15.9k | Self::peek(cursor) | 287 | 16.6k | } |
<wast::kw::offset as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 17.8k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 17.8k | match cursor.token()? { | 283 | 17.8k | Some(token) => cursor.advance_past(&token), | 284 | 2 | None => return Ok(false), | 285 | | } | 286 | 17.8k | Self::peek(cursor) | 287 | 17.8k | } |
<wast::kw::result as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 1.09M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 1.09M | match cursor.token()? { | 283 | 1.09M | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 1.09M | Self::peek(cursor) | 287 | 1.09M | } |
<wast::kw::shared as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 86.0k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 86.0k | match cursor.token()? { | 283 | 86.0k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 86.0k | Self::peek(cursor) | 287 | 86.0k | } |
<wast::kw::instance as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 8 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 8 | match cursor.token()? { | 283 | 8 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 8 | Self::peek(cursor) | 287 | 8 | } |
<wast::kw::pagesize as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 15.6k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 15.6k | match cursor.token()? { | 283 | 15.6k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 15.6k | Self::peek(cursor) | 287 | 15.6k | } |
<wast::kw::catch_all as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 124k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 124k | match cursor.token()? { | 283 | 124k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 124k | Self::peek(cursor) | 287 | 124k | } |
<wast::kw::catch_ref as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 124k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 124k | match cursor.token()? { | 283 | 124k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 124k | Self::peek(cursor) | 287 | 124k | } |
<wast::kw::component as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 2.21k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 2.21k | match cursor.token()? { | 283 | 2.20k | Some(token) => cursor.advance_past(&token), | 284 | 9 | None => return Ok(false), | 285 | | } | 286 | 2.20k | Self::peek(cursor) | 287 | 2.21k | } |
<wast::core::types::Type as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 527k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 527k | match cursor.token()? { | 283 | 527k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 527k | Self::peek(cursor) | 287 | 527k | } |
<wast::core::types::RefType as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 10.4k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 10.4k | match cursor.token()? { | 283 | 10.4k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 10.4k | Self::peek(cursor) | 287 | 10.4k | } |
<wast::token::Index as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 16 | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 16 | match cursor.token()? { | 283 | 16 | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 16 | Self::peek(cursor) | 287 | 16 | } |
<wast::token::LParen as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 12.4k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 12.4k | match cursor.token()? { | 283 | 12.4k | Some(token) => cursor.advance_past(&token), | 284 | 0 | None => return Ok(false), | 285 | | } | 286 | 12.4k | Self::peek(cursor) | 287 | 12.4k | } |
<wast::annotation::name as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 1.60M | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 1.60M | match cursor.token()? { | 283 | 1.60M | Some(token) => cursor.advance_past(&token), | 284 | 16 | None => return Ok(false), | 285 | | } | 286 | 1.60M | Self::peek(cursor) | 287 | 1.60M | } |
<wast::wast::WastDirectiveToken as wast::parser::Peek>::peek2 Line | Count | Source | 281 | 2.39k | fn peek2(mut cursor: Cursor<'_>) -> Result<bool> { | 282 | 2.39k | match cursor.token()? { | 283 | 1.53k | Some(token) => cursor.advance_past(&token), | 284 | 70 | None => return Ok(false), | 285 | | } | 286 | 1.53k | Self::peek(cursor) | 287 | 2.39k | } |
|
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 | 17.9k | pub fn new(input: &str) -> Result<ParseBuffer<'_>> { |
371 | 17.9k | ParseBuffer::new_with_lexer(Lexer::new(input)) |
372 | 17.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 | 17.9k | pub fn new_with_lexer(lexer: Lexer<'_>) -> Result<ParseBuffer<'_>> { |
380 | 17.9k | Ok(ParseBuffer { |
381 | 17.9k | lexer, |
382 | 17.9k | depth: Cell::new(0), |
383 | 17.9k | cur: Cell::new(Position { |
384 | 17.9k | offset: 0, |
385 | 17.9k | token: None, |
386 | 17.9k | }), |
387 | 17.9k | known_annotations: Default::default(), |
388 | 17.9k | strings: Default::default(), |
389 | 17.9k | track_instr_spans: false, |
390 | 17.9k | }) |
391 | 17.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 | 17.9k | fn parser(&self) -> Parser<'_> { |
407 | 17.9k | Parser { buf: self } |
408 | 17.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 | 26.8k | fn push_str(&self, s: Vec<u8>) -> &[u8] { |
416 | 26.8k | self.strings.alloc_slice_copy(&s) |
417 | 26.8k | } |
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 | 86.6M | fn advance_token(&self, mut pos: usize) -> Result<Option<Token>> { |
424 | 86.5M | let token = loop { |
425 | 143M | let token = match self.lexer.parse(&mut pos)? { |
426 | 143M | Some(token) => token, |
427 | 35.7k | None => return Ok(None), |
428 | | }; |
429 | 143M | match token.kind { |
430 | | // Always skip whitespace and comments. |
431 | | TokenKind::Whitespace | TokenKind::LineComment | TokenKind::BlockComment => { |
432 | 56.7M | 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 | 15.3M | if let Some(annotation) = self.lexer.annotation(pos)? { |
444 | 4.39k | let text = annotation.annotation(self.lexer.input())?; |
445 | 4.26k | match self.known_annotations.borrow().get(&text[..]) { |
446 | | Some(0) | None => { |
447 | 4.18k | self.skip_annotation(&mut pos)?; |
448 | 2.81k | continue; |
449 | | } |
450 | 85 | Some(_) => {} |
451 | | } |
452 | 15.3M | } |
453 | 15.3M | break token; |
454 | | } |
455 | 71.1M | _ => break token, |
456 | | } |
457 | | }; |
458 | 86.5M | Ok(Some(token)) |
459 | 86.6M | } |
460 | | |
461 | 4.18k | fn skip_annotation(&self, pos: &mut usize) -> Result<()> { |
462 | 4.18k | let mut depth = 1; |
463 | 4.18k | let span = Span { offset: *pos }; |
464 | | loop { |
465 | 79.7k | let token = match self.lexer.parse(pos)? { |
466 | 78.3k | Some(token) => token, |
467 | | None => { |
468 | 1.02k | break Err(Error::new(span, "unclosed annotation".to_string())); |
469 | | } |
470 | | }; |
471 | 78.3k | match token.kind { |
472 | 16.6k | TokenKind::LParen => depth += 1, |
473 | | TokenKind::RParen => { |
474 | 4.72k | depth -= 1; |
475 | 4.72k | if depth == 0 { |
476 | 2.81k | break Ok(()); |
477 | 1.91k | } |
478 | | } |
479 | 57.0k | _ => {} |
480 | | } |
481 | | } |
482 | 4.18k | } |
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 | 22.6M | pub fn is_empty(self) -> bool { |
496 | 22.6M | match self.cursor().token() { |
497 | 22.6M | Ok(Some(token)) => matches!(token.kind, TokenKind::RParen), |
498 | 35 | Ok(None) => true, |
499 | 12 | Err(_) => false, |
500 | | } |
501 | 22.6M | } |
502 | | |
503 | | #[cfg(feature = "wasm-module")] |
504 | 16.7k | pub(crate) fn has_meaningful_tokens(self) -> bool { |
505 | 17.7k | self.buf.lexer.iter(0).any(|t| match t { |
506 | 17.2k | Ok(token) => !matches!( |
507 | 17.2k | token.kind, |
508 | | TokenKind::Whitespace | TokenKind::LineComment | TokenKind::BlockComment |
509 | | ), |
510 | 527 | Err(_) => true, |
511 | 17.7k | }) |
512 | 16.7k | } |
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 | 48.5M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { |
563 | 48.5M | T::parse(self) |
564 | 48.5M | } <wast::parser::Parser>::parse::<wast::wast::Wast> Line | Count | Source | 562 | 2.39k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2.39k | T::parse(self) | 564 | 2.39k | } |
<wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::BrOnCastFail>> Line | Count | Source | 562 | 632 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 632 | T::parse(self) | 564 | 632 | } |
<wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::CallIndirect>> Line | Count | Source | 562 | 456 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 456 | T::parse(self) | 564 | 456 | } |
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 | 454 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 454 | T::parse(self) | 564 | 454 | } |
<wast::parser::Parser>::parse::<alloc::boxed::Box<wast::core::expr::BlockType>> Line | Count | Source | 562 | 457k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 457k | T::parse(self) | 564 | 457k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::kw::i32>> 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::<core::option::Option<wast::kw::i64>> 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::<core::option::Option<wast::kw::shared>> Line | Count | Source | 562 | 59.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 59.0k | T::parse(self) | 564 | 59.0k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::token::NameAnnotation>> Line | Count | Source | 562 | 1.60M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.60M | T::parse(self) | 564 | 1.60M | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::token::Id>> Line | Count | Source | 562 | 1.87M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.87M | T::parse(self) | 564 | 1.87M | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::token::Index>> Line | Count | Source | 562 | 418k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 418k | T::parse(self) | 564 | 418k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::core::types::FunctionType>> Line | Count | Source | 562 | 222k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 222k | T::parse(self) | 564 | 222k | } |
<wast::parser::Parser>::parse::<core::option::Option<wast::core::types::FunctionTypeNoNames>> Line | Count | Source | 562 | 457k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 457k | T::parse(self) | 564 | 457k | } |
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 | 286k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 286k | T::parse(self) | 564 | 286k | } |
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 | 222k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 222k | T::parse(self) | 564 | 222k | } |
<wast::parser::Parser>::parse::<wast::core::types::TypeUse<wast::core::types::FunctionTypeNoNames>> Line | Count | Source | 562 | 457k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 457k | T::parse(self) | 564 | 457k | } |
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 | 4 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4 | T::parse(self) | 564 | 4 | } |
<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 | 1.51k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.51k | T::parse(self) | 564 | 1.51k | } |
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 | 14.9k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 14.9k | T::parse(self) | 564 | 14.9k | } |
<wast::parser::Parser>::parse::<wast::kw::i8> Line | Count | Source | 562 | 499k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 499k | T::parse(self) | 564 | 499k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::on> <wast::parser::Parser>::parse::<wast::kw::any> Line | Count | Source | 562 | 5.21k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 5.21k | T::parse(self) | 564 | 5.21k | } |
<wast::parser::Parser>::parse::<wast::kw::exn> Line | Count | Source | 562 | 20.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 20.5k | T::parse(self) | 564 | 20.5k | } |
<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 | 153k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 153k | T::parse(self) | 564 | 153k | } |
<wast::parser::Parser>::parse::<wast::kw::i31> Line | Count | Source | 562 | 6.38k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 6.38k | T::parse(self) | 564 | 6.38k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::i32> <wast::parser::Parser>::parse::<wast::kw::i64> Line | Count | Source | 562 | 34.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 34.7k | T::parse(self) | 564 | 34.7k | } |
<wast::parser::Parser>::parse::<wast::kw::mut> Line | Count | Source | 562 | 664k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 664k | T::parse(self) | 564 | 664k | } |
<wast::parser::Parser>::parse::<wast::kw::rec> Line | Count | Source | 562 | 58.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 58.5k | T::parse(self) | 564 | 58.5k | } |
<wast::parser::Parser>::parse::<wast::kw::ref> Line | Count | Source | 562 | 467k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 467k | T::parse(self) | 564 | 467k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::sdk> <wast::parser::Parser>::parse::<wast::kw::sub> Line | Count | Source | 562 | 199k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 199k | T::parse(self) | 564 | 199k | } |
<wast::parser::Parser>::parse::<wast::kw::tag> Line | Count | Source | 562 | 36.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 36.6k | T::parse(self) | 564 | 36.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 | 20.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 20.0k | T::parse(self) | 564 | 20.0k | } |
<wast::parser::Parser>::parse::<wast::kw::elem> Line | Count | Source | 562 | 27.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 27.4k | T::parse(self) | 564 | 27.4k | } |
<wast::parser::Parser>::parse::<wast::kw::else> Line | Count | Source | 562 | 3.00k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3.00k | T::parse(self) | 564 | 3.00k | } |
<wast::parser::Parser>::parse::<wast::kw::func> Line | Count | Source | 562 | 370k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 370k | T::parse(self) | 564 | 370k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::item> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::last> <wast::parser::Parser>::parse::<wast::kw::none> Line | Count | Source | 562 | 398k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 398k | T::parse(self) | 564 | 398k | } |
<wast::parser::Parser>::parse::<wast::kw::null> Line | Count | Source | 562 | 460k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 460k | T::parse(self) | 564 | 460k | } |
<wast::parser::Parser>::parse::<wast::kw::then> Line | Count | Source | 562 | 31.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 31.7k | T::parse(self) | 564 | 31.7k | } |
<wast::parser::Parser>::parse::<wast::kw::type> Line | Count | Source | 562 | 811k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 811k | T::parse(self) | 564 | 811k | } |
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 | 298k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 298k | T::parse(self) | 564 | 298k | } |
<wast::parser::Parser>::parse::<wast::kw::catch> Line | Count | Source | 562 | 36.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 36.7k | T::parse(self) | 564 | 36.7k | } |
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 | 625k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 625k | T::parse(self) | 564 | 625k | } |
<wast::parser::Parser>::parse::<wast::kw::final> Line | Count | Source | 562 | 14.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 14.2k | T::parse(self) | 564 | 14.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 | 104k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 104k | T::parse(self) | 564 | 104k | } |
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 | 233k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 233k | T::parse(self) | 564 | 233k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::quote> <wast::parser::Parser>::parse::<wast::kw::start> Line | Count | Source | 562 | 748 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 748 | T::parse(self) | 564 | 748 | } |
<wast::parser::Parser>::parse::<wast::kw::table> Line | Count | Source | 562 | 51.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 51.5k | T::parse(self) | 564 | 51.5k | } |
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 | 49.3k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 49.3k | T::parse(self) | 564 | 49.3k | } |
<wast::parser::Parser>::parse::<wast::kw::extern> Line | Count | Source | 562 | 44.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 44.7k | T::parse(self) | 564 | 44.7k | } |
<wast::parser::Parser>::parse::<wast::kw::global> Line | Count | Source | 562 | 99.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 99.4k | T::parse(self) | 564 | 99.4k | } |
<wast::parser::Parser>::parse::<wast::kw::import> Line | Count | Source | 562 | 64.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 64.5k | T::parse(self) | 564 | 64.5k | } |
<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.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 36.6k | T::parse(self) | 564 | 36.6k | } |
<wast::parser::Parser>::parse::<wast::kw::module> Line | Count | Source | 562 | 13.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 13.4k | T::parse(self) | 564 | 13.4k | } |
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 | 55.9k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 55.9k | T::parse(self) | 564 | 55.9k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::kw::offset> <wast::parser::Parser>::parse::<wast::kw::result> Line | Count | Source | 562 | 466k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 466k | T::parse(self) | 564 | 466k | } |
<wast::parser::Parser>::parse::<wast::kw::shared> Line | Count | Source | 562 | 164k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 164k | T::parse(self) | 564 | 164k | } |
<wast::parser::Parser>::parse::<wast::kw::struct> Line | Count | Source | 562 | 96.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 96.0k | T::parse(self) | 564 | 96.0k | } |
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 | 4.73k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4.73k | T::parse(self) | 564 | 4.73k | } |
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 | 49.3k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 49.3k | T::parse(self) | 564 | 49.3k | } |
<wast::parser::Parser>::parse::<wast::kw::pagesize> Line | Count | Source | 562 | 15.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 15.6k | T::parse(self) | 564 | 15.6k | } |
<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 | 91.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 91.4k | T::parse(self) | 564 | 91.4k | } |
<wast::parser::Parser>::parse::<wast::kw::catch_ref> Line | Count | Source | 562 | 228 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 228 | T::parse(self) | 564 | 228 | } |
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 | 16.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 16.7k | T::parse(self) | 564 | 16.7k | } |
<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 | 19 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 19 | T::parse(self) | 564 | 19 | } |
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 | 12.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 12.8k | T::parse(self) | 564 | 12.8k | } |
<wast::parser::Parser>::parse::<wast::token::F32> Line | Count | Source | 562 | 180k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 180k | T::parse(self) | 564 | 180k | } |
<wast::parser::Parser>::parse::<wast::token::F64> Line | Count | Source | 562 | 493k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 493k | T::parse(self) | 564 | 493k | } |
<wast::parser::Parser>::parse::<wast::token::Index> Line | Count | Source | 562 | 3.81M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3.81M | T::parse(self) | 564 | 3.81M | } |
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 | 24.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 24.7k | T::parse(self) | 564 | 24.7k | } |
<wast::parser::Parser>::parse::<wast::core::tag::TagType> Line | Count | Source | 562 | 36.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 36.6k | T::parse(self) | 564 | 36.6k | } |
<wast::parser::Parser>::parse::<wast::core::expr::Expression> Line | Count | Source | 562 | 236k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 236k | T::parse(self) | 564 | 236k | } |
<wast::parser::Parser>::parse::<wast::core::expr::MemoryCopy> Line | Count | Source | 562 | 8 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 8 | T::parse(self) | 564 | 8 | } |
<wast::parser::Parser>::parse::<wast::core::expr::MemoryInit> Line | Count | Source | 562 | 12 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 12 | T::parse(self) | 564 | 12 | } |
<wast::parser::Parser>::parse::<wast::core::expr::Instruction> Line | Count | Source | 562 | 8.40M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 8.40M | T::parse(self) | 564 | 8.40M | } |
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 | 84.3k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 84.3k | T::parse(self) | 564 | 84.3k | } |
<wast::parser::Parser>::parse::<wast::core::expr::ArrayNewData> Line | Count | Source | 562 | 30 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 30 | T::parse(self) | 564 | 30 | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ArrayNewElem> <wast::parser::Parser>::parse::<wast::core::expr::BrOnCastFail> Line | Count | Source | 562 | 632 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 632 | T::parse(self) | 564 | 632 | } |
<wast::parser::Parser>::parse::<wast::core::expr::CallIndirect> Line | Count | Source | 562 | 456 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 456 | T::parse(self) | 564 | 456 | } |
<wast::parser::Parser>::parse::<wast::core::expr::I8x16Shuffle> 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::StructAccess> Line | Count | Source | 562 | 750 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 750 | T::parse(self) | 564 | 750 | } |
<wast::parser::Parser>::parse::<wast::core::expr::ArrayNewFixed> Line | Count | Source | 562 | 7.89k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 7.89k | T::parse(self) | 564 | 7.89k | } |
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 | 36.1k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 36.1k | T::parse(self) | 564 | 36.1k | } |
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 | 10.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 10.5k | T::parse(self) | 564 | 10.5k | } |
<wast::parser::Parser>::parse::<wast::core::expr::RefCast> Line | Count | Source | 562 | 2.97k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2.97k | T::parse(self) | 564 | 2.97k | } |
<wast::parser::Parser>::parse::<wast::core::expr::RefTest> Line | Count | Source | 562 | 4.82k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4.82k | T::parse(self) | 564 | 4.82k | } |
<wast::parser::Parser>::parse::<wast::core::expr::BrOnCast> Line | Count | Source | 562 | 454 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 454 | T::parse(self) | 564 | 454 | } |
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 | 27.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 27.2k | T::parse(self) | 564 | 27.2k | } |
<wast::parser::Parser>::parse::<wast::core::expr::TryTable> Line | Count | Source | 562 | 63.3k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 63.3k | T::parse(self) | 564 | 63.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ArrayCopy> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ArrayFill> Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::expr::ArrayInit> <wast::parser::Parser>::parse::<wast::core::expr::BlockType> Line | Count | Source | 562 | 457k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 457k | T::parse(self) | 564 | 457k | } |
<wast::parser::Parser>::parse::<wast::core::expr::MemoryArg> Line | Count | Source | 562 | 118k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 118k | T::parse(self) | 564 | 118k | } |
<wast::parser::Parser>::parse::<wast::core::expr::TableCopy> Line | Count | Source | 562 | 2 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 2 | T::parse(self) | 564 | 2 | } |
<wast::parser::Parser>::parse::<wast::core::expr::TableInit> Line | Count | Source | 562 | 4 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 4 | T::parse(self) | 564 | 4 | } |
<wast::parser::Parser>::parse::<wast::core::expr::V128Const> Line | Count | Source | 562 | 104k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 104k | T::parse(self) | 564 | 104k | } |
<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 | 163k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 163k | T::parse(self) | 564 | 163k | } |
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 | 27.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 27.4k | T::parse(self) | 564 | 27.4k | } |
<wast::parser::Parser>::parse::<wast::core::table::Table> Line | Count | Source | 562 | 16.7k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 16.7k | T::parse(self) | 564 | 16.7k | } |
<wast::parser::Parser>::parse::<wast::core::types::GlobalType> Line | Count | Source | 562 | 86.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 86.0k | T::parse(self) | 564 | 86.0k | } |
<wast::parser::Parser>::parse::<wast::core::types::MemoryType> Line | Count | Source | 562 | 31.1k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 31.1k | T::parse(self) | 564 | 31.1k | } |
<wast::parser::Parser>::parse::<wast::core::types::StructType> Line | Count | Source | 562 | 78.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 78.2k | T::parse(self) | 564 | 78.2k | } |
<wast::parser::Parser>::parse::<wast::core::types::StorageType> Line | Count | Source | 562 | 903k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 903k | T::parse(self) | 564 | 903k | } |
<wast::parser::Parser>::parse::<wast::core::types::FunctionType> Line | Count | Source | 562 | 318k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 318k | T::parse(self) | 564 | 318k | } |
<wast::parser::Parser>::parse::<wast::core::types::InnerTypeKind> Line | Count | Source | 562 | 502k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 502k | T::parse(self) | 564 | 502k | } |
<wast::parser::Parser>::parse::<wast::core::types::AbstractHeapType> Line | Count | Source | 562 | 653k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 653k | T::parse(self) | 564 | 653k | } |
<wast::parser::Parser>::parse::<wast::core::types::FunctionTypeNoNames> Line | Count | Source | 562 | 229k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 229k | T::parse(self) | 564 | 229k | } |
<wast::parser::Parser>::parse::<wast::core::types::Rec> Line | Count | Source | 562 | 58.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 58.5k | T::parse(self) | 564 | 58.5k | } |
<wast::parser::Parser>::parse::<wast::core::types::Type> Line | Count | Source | 562 | 502k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 502k | T::parse(self) | 564 | 502k | } |
<wast::parser::Parser>::parse::<wast::core::types::Limits> Line | Count | Source | 562 | 59.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 59.0k | T::parse(self) | 564 | 59.0k | } |
<wast::parser::Parser>::parse::<wast::core::types::RefType> Line | Count | Source | 562 | 494k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 494k | T::parse(self) | 564 | 494k | } |
<wast::parser::Parser>::parse::<wast::core::types::TypeDef> Line | Count | Source | 562 | 502k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 502k | T::parse(self) | 564 | 502k | } |
<wast::parser::Parser>::parse::<wast::core::types::ValType> Line | Count | Source | 562 | 6.91M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 6.91M | T::parse(self) | 564 | 6.91M | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::types::ContType> <wast::parser::Parser>::parse::<wast::core::types::HeapType> Line | Count | Source | 562 | 1.15M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 1.15M | T::parse(self) | 564 | 1.15M | } |
<wast::parser::Parser>::parse::<wast::core::types::ArrayType> Line | Count | Source | 562 | 277k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 277k | T::parse(self) | 564 | 277k | } |
<wast::parser::Parser>::parse::<wast::core::types::TableType> Line | Count | Source | 562 | 27.8k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 27.8k | T::parse(self) | 564 | 27.8k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<wast::core::custom::CustomPlace> <wast::parser::Parser>::parse::<wast::core::custom::RawCustomSection> 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::core::custom::CustomPlaceAnchor> <wast::parser::Parser>::parse::<wast::core::custom::Custom> 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::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 | 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::core::export::InlineExport> Line | Count | Source | 562 | 302k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 302k | T::parse(self) | 564 | 302k | } |
<wast::parser::Parser>::parse::<wast::core::export::Export> 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::core::global::Global> Line | Count | Source | 562 | 71.2k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 71.2k | T::parse(self) | 564 | 71.2k | } |
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 | 64.5k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 64.5k | T::parse(self) | 564 | 64.5k | } |
<wast::parser::Parser>::parse::<wast::core::import::ItemSig> Line | Count | Source | 562 | 64.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 64.4k | T::parse(self) | 564 | 64.4k | } |
<wast::parser::Parser>::parse::<wast::core::memory::Data> Line | Count | Source | 562 | 20.0k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 20.0k | T::parse(self) | 564 | 20.0k | } |
<wast::parser::Parser>::parse::<wast::core::memory::Memory> Line | Count | Source | 562 | 26.6k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 26.6k | T::parse(self) | 564 | 26.6k | } |
<wast::parser::Parser>::parse::<wast::core::memory::DataVal> Line | Count | Source | 562 | 19.9k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 19.9k | T::parse(self) | 564 | 19.9k | } |
<wast::parser::Parser>::parse::<wast::core::module::Module> Line | Count | Source | 562 | 13.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 13.4k | T::parse(self) | 564 | 13.4k | } |
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 | 198k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 198k | T::parse(self) | 564 | 198k | } |
<wast::parser::Parser>::parse::<&str> Line | Count | Source | 562 | 178k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 178k | T::parse(self) | 564 | 178k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<(i8, wast::token::Span)> <wast::parser::Parser>::parse::<(u8, wast::token::Span)> Line | Count | Source | 562 | 136 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 136 | T::parse(self) | 564 | 136 | } |
<wast::parser::Parser>::parse::<(i32, wast::token::Span)> Line | Count | Source | 562 | 736k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 736k | T::parse(self) | 564 | 736k | } |
<wast::parser::Parser>::parse::<(u32, wast::token::Span)> Line | Count | Source | 562 | 3.83M | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 3.83M | T::parse(self) | 564 | 3.83M | } |
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 | 883k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 883k | T::parse(self) | 564 | 883k | } |
<wast::parser::Parser>::parse::<(u64, wast::token::Span)> Line | Count | Source | 562 | 108k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 108k | T::parse(self) | 564 | 108k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<i8> <wast::parser::Parser>::parse::<u8> Line | Count | Source | 562 | 136 | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 136 | T::parse(self) | 564 | 136 | } |
<wast::parser::Parser>::parse::<i32> Line | Count | Source | 562 | 736k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 736k | T::parse(self) | 564 | 736k | } |
<wast::parser::Parser>::parse::<u32> Line | Count | Source | 562 | 23.4k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 23.4k | T::parse(self) | 564 | 23.4k | } |
Unexecuted instantiation: <wast::parser::Parser>::parse::<i16> <wast::parser::Parser>::parse::<i64> Line | Count | Source | 562 | 883k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 883k | T::parse(self) | 564 | 883k | } |
<wast::parser::Parser>::parse::<u64> Line | Count | Source | 562 | 108k | pub fn parse<T: Parse<'a>>(self) -> Result<T> { | 563 | 108k | T::parse(self) | 564 | 108k | } |
|
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 | 38.6M | pub fn peek<T: Peek>(self) -> Result<bool> { |
620 | 38.6M | T::peek(self.cursor()) |
621 | 38.6M | } <wast::parser::Parser>::peek::<wast::annotation::metadata_code_branch_hint> Line | Count | Source | 619 | 3.84M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 3.84M | T::peek(self.cursor()) | 621 | 3.84M | } |
<wast::parser::Parser>::peek::<wast::annotation::custom> Line | Count | Source | 619 | 684 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 684 | T::peek(self.cursor()) | 621 | 684 | } |
<wast::parser::Parser>::peek::<wast::annotation::dylink_0> Line | Count | Source | 619 | 669 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 669 | T::peek(self.cursor()) | 621 | 669 | } |
<wast::parser::Parser>::peek::<wast::annotation::producers> Line | Count | Source | 619 | 669 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 669 | T::peek(self.cursor()) | 621 | 669 | } |
<wast::parser::Parser>::peek::<wast::kw::descriptor> Line | Count | Source | 619 | 502k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 502k | T::peek(self.cursor()) | 621 | 502k | } |
<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 | 563k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 563k | T::peek(self.cursor()) | 621 | 563k | } |
<wast::parser::Parser>::peek::<wast::kw::i8> Line | Count | Source | 619 | 903k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 903k | T::peek(self.cursor()) | 621 | 903k | } |
<wast::parser::Parser>::peek::<wast::kw::any> Line | Count | Source | 619 | 569k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 569k | T::peek(self.cursor()) | 621 | 569k | } |
<wast::parser::Parser>::peek::<wast::kw::exn> Line | Count | Source | 619 | 589k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 589k | T::peek(self.cursor()) | 621 | 589k | } |
<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 | 403k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 403k | T::peek(self.cursor()) | 621 | 403k | } |
<wast::parser::Parser>::peek::<wast::kw::i31> Line | Count | Source | 619 | 510k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 510k | T::peek(self.cursor()) | 621 | 510k | } |
<wast::parser::Parser>::peek::<wast::kw::i32> Line | Count | Source | 619 | 114k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 114k | T::peek(self.cursor()) | 621 | 114k | } |
<wast::parser::Parser>::peek::<wast::kw::i64> Line | Count | Source | 619 | 114k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 114k | T::peek(self.cursor()) | 621 | 114k | } |
<wast::parser::Parser>::peek::<wast::kw::mut> Line | Count | Source | 619 | 78.0k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 78.0k | T::peek(self.cursor()) | 621 | 78.0k | } |
<wast::parser::Parser>::peek::<wast::kw::rec> Line | Count | Source | 619 | 510k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 510k | T::peek(self.cursor()) | 621 | 510k | } |
<wast::parser::Parser>::peek::<wast::kw::ref> Line | Count | Source | 619 | 467k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 467k | T::peek(self.cursor()) | 621 | 467k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::sdk> <wast::parser::Parser>::peek::<wast::kw::sub> Line | Count | Source | 619 | 502k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 502k | T::peek(self.cursor()) | 621 | 502k | } |
<wast::parser::Parser>::peek::<wast::kw::tag> Line | Count | Source | 619 | 37.3k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 37.3k | T::peek(self.cursor()) | 621 | 37.3k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::code> <wast::parser::Parser>::peek::<wast::kw::cont> Line | Count | Source | 619 | 569k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 569k | T::peek(self.cursor()) | 621 | 569k | } |
<wast::parser::Parser>::peek::<wast::kw::data> Line | Count | Source | 619 | 45.4k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 45.4k | T::peek(self.cursor()) | 621 | 45.4k | } |
<wast::parser::Parser>::peek::<wast::kw::elem> Line | Count | Source | 619 | 72.8k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 72.8k | T::peek(self.cursor()) | 621 | 72.8k | } |
<wast::parser::Parser>::peek::<wast::kw::func> Line | Count | Source | 619 | 1.67M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 1.67M | T::peek(self.cursor()) | 621 | 1.67M | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::last> <wast::parser::Parser>::peek::<wast::kw::none> Line | Count | Source | 619 | 398k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 398k | T::peek(self.cursor()) | 621 | 398k | } |
<wast::parser::Parser>::peek::<wast::kw::null> Line | Count | Source | 619 | 467k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 467k | T::peek(self.cursor()) | 621 | 467k | } |
<wast::parser::Parser>::peek::<wast::kw::then> Line | Count | Source | 619 | 63.9k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 63.9k | T::peek(self.cursor()) | 621 | 63.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 | 808k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 808k | T::peek(self.cursor()) | 621 | 808k | } |
<wast::parser::Parser>::peek::<wast::kw::catch> Line | Count | Source | 619 | 129k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 129k | T::peek(self.cursor()) | 621 | 129k | } |
<wast::parser::Parser>::peek::<wast::kw::exact> Line | Count | Source | 619 | 88.5k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 88.5k | T::peek(self.cursor()) | 621 | 88.5k | } |
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 | 199k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 199k | T::peek(self.cursor()) | 621 | 199k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::first> <wast::parser::Parser>::peek::<wast::kw::i16x8> Line | Count | Source | 619 | 104k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 104k | T::peek(self.cursor()) | 621 | 104k | } |
<wast::parser::Parser>::peek::<wast::kw::i32x4> Line | Count | Source | 619 | 104k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 104k | T::peek(self.cursor()) | 621 | 104k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::i64x2> <wast::parser::Parser>::peek::<wast::kw::i8x16> Line | Count | Source | 619 | 104k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 104k | T::peek(self.cursor()) | 621 | 104k | } |
<wast::parser::Parser>::peek::<wast::kw::noexn> Line | Count | Source | 619 | 398k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 398k | T::peek(self.cursor()) | 621 | 398k | } |
<wast::parser::Parser>::peek::<wast::kw::param> Line | Count | Source | 619 | 699k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 699k | T::peek(self.cursor()) | 621 | 699k | } |
<wast::parser::Parser>::peek::<wast::kw::start> Line | Count | Source | 619 | 73.6k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 73.6k | T::peek(self.cursor()) | 621 | 73.6k | } |
<wast::parser::Parser>::peek::<wast::kw::table> Line | Count | Source | 619 | 293k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 293k | T::peek(self.cursor()) | 621 | 293k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::before> <wast::parser::Parser>::peek::<wast::kw::binary> Line | Count | Source | 619 | 13.4k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 13.4k | T::peek(self.cursor()) | 621 | 13.4k | } |
<wast::parser::Parser>::peek::<wast::kw::export> Line | Count | Source | 619 | 109k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 109k | T::peek(self.cursor()) | 621 | 109k | } |
<wast::parser::Parser>::peek::<wast::kw::extern> Line | Count | Source | 619 | 634k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 634k | T::peek(self.cursor()) | 621 | 634k | } |
<wast::parser::Parser>::peek::<wast::kw::global> Line | Count | Source | 619 | 220k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 220k | T::peek(self.cursor()) | 621 | 220k | } |
<wast::parser::Parser>::peek::<wast::kw::import> Line | Count | Source | 619 | 452k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 452k | T::peek(self.cursor()) | 621 | 452k | } |
<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 | 255k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 255k | T::peek(self.cursor()) | 621 | 255k | } |
<wast::parser::Parser>::peek::<wast::kw::module> Line | Count | Source | 619 | 19 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 19 | T::peek(self.cursor()) | 621 | 19 | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::kw::needed> <wast::parser::Parser>::peek::<wast::kw::nocont> Line | Count | Source | 619 | 398k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 398k | T::peek(self.cursor()) | 621 | 398k | } |
<wast::parser::Parser>::peek::<wast::kw::nofunc> Line | Count | Source | 619 | 503k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 503k | T::peek(self.cursor()) | 621 | 503k | } |
<wast::parser::Parser>::peek::<wast::kw::offset> Line | Count | Source | 619 | 5.81k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 5.81k | T::peek(self.cursor()) | 621 | 5.81k | } |
<wast::parser::Parser>::peek::<wast::kw::result> Line | Count | Source | 619 | 466k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 466k | T::peek(self.cursor()) | 621 | 466k | } |
<wast::parser::Parser>::peek::<wast::kw::shared> Line | Count | Source | 619 | 656k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 656k | T::peek(self.cursor()) | 621 | 656k | } |
<wast::parser::Parser>::peek::<wast::kw::struct> Line | Count | Source | 619 | 904k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 904k | T::peek(self.cursor()) | 621 | 904k | } |
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 | 27.4k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 27.4k | T::peek(self.cursor()) | 621 | 27.4k | } |
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 | 447k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 447k | T::peek(self.cursor()) | 621 | 447k | } |
<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 | 93.0k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 93.0k | T::peek(self.cursor()) | 621 | 93.0k | } |
<wast::parser::Parser>::peek::<wast::kw::catch_ref> Line | Count | Source | 619 | 129k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 129k | T::peek(self.cursor()) | 621 | 129k | } |
<wast::parser::Parser>::peek::<wast::kw::component> Line | Count | Source | 619 | 18 | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 18 | T::peek(self.cursor()) | 621 | 18 | } |
<wast::parser::Parser>::peek::<wast::kw::describes> Line | Count | Source | 619 | 502k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 502k | T::peek(self.cursor()) | 621 | 502k | } |
<wast::parser::Parser>::peek::<wast::token::Id> Line | Count | Source | 619 | 6.31M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 6.31M | T::peek(self.cursor()) | 621 | 6.31M | } |
<wast::parser::Parser>::peek::<wast::token::Index> Line | Count | Source | 619 | 1.85M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 1.85M | T::peek(self.cursor()) | 621 | 1.85M | } |
<wast::parser::Parser>::peek::<wast::token::LParen> Line | Count | Source | 619 | 1.98M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 1.98M | T::peek(self.cursor()) | 621 | 1.98M | } |
<wast::parser::Parser>::peek::<wast::token::RParen> Line | Count | Source | 619 | 5.82k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 5.82k | T::peek(self.cursor()) | 621 | 5.82k | } |
<wast::parser::Parser>::peek::<wast::core::types::FunctionType> Line | Count | Source | 619 | 222k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 222k | T::peek(self.cursor()) | 621 | 222k | } |
<wast::parser::Parser>::peek::<wast::core::types::AbstractHeapType> Line | Count | Source | 619 | 565k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 565k | T::peek(self.cursor()) | 621 | 565k | } |
<wast::parser::Parser>::peek::<wast::core::types::FunctionTypeNoNames> Line | Count | Source | 619 | 457k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 457k | T::peek(self.cursor()) | 621 | 457k | } |
<wast::parser::Parser>::peek::<wast::core::types::Type> Line | Count | Source | 619 | 544k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 544k | T::peek(self.cursor()) | 621 | 544k | } |
<wast::parser::Parser>::peek::<wast::core::types::RefType> Line | Count | Source | 619 | 54.0k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 54.0k | T::peek(self.cursor()) | 621 | 54.0k | } |
<wast::parser::Parser>::peek::<wast::core::types::ValType> Line | Count | Source | 619 | 249k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 249k | T::peek(self.cursor()) | 621 | 249k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek::<wast::core::types::HeapType> <wast::parser::Parser>::peek::<wast::core::export::InlineExport> Line | Count | Source | 619 | 316k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 316k | T::peek(self.cursor()) | 621 | 316k | } |
<wast::parser::Parser>::peek::<wast::core::import::InlineImport> Line | Count | Source | 619 | 286k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 286k | T::peek(self.cursor()) | 621 | 286k | } |
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 | 20.0k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 20.0k | T::peek(self.cursor()) | 621 | 20.0k | } |
<wast::parser::Parser>::peek::<u32> Line | Count | Source | 619 | 3.88M | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 3.88M | T::peek(self.cursor()) | 621 | 3.88M | } |
<wast::parser::Parser>::peek::<u64> Line | Count | Source | 619 | 65.2k | pub fn peek<T: Peek>(self) -> Result<bool> { | 620 | 65.2k | T::peek(self.cursor()) | 621 | 65.2k | } |
|
622 | | |
623 | | /// Same as the [`Parser::peek`] method, except checks the next token, not |
624 | | /// the current token. |
625 | 7.45M | pub fn peek2<T: Peek>(self) -> Result<bool> { |
626 | 7.45M | T::peek2(self.cursor()) |
627 | 7.45M | } <wast::parser::Parser>::peek2::<wast::annotation::name> Line | Count | Source | 625 | 1.60M | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 1.60M | T::peek2(self.cursor()) | 627 | 1.60M | } |
<wast::parser::Parser>::peek2::<wast::kw::definition> Line | Count | Source | 625 | 8 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 8 | T::peek2(self.cursor()) | 627 | 8 | } |
<wast::parser::Parser>::peek2::<wast::kw::catch_all_ref> Line | Count | Source | 625 | 32.6k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 32.6k | T::peek2(self.cursor()) | 627 | 32.6k | } |
Unexecuted instantiation: <wast::parser::Parser>::peek2::<wast::kw::on> <wast::parser::Parser>::peek2::<wast::kw::mut> Line | Count | Source | 625 | 986k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 986k | T::peek2(self.cursor()) | 627 | 986k | } |
<wast::parser::Parser>::peek2::<wast::kw::item> Line | Count | Source | 625 | 462k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 462k | T::peek2(self.cursor()) | 627 | 462k | } |
<wast::parser::Parser>::peek2::<wast::kw::type> Line | Count | Source | 625 | 680k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 680k | T::peek2(self.cursor()) | 627 | 680k | } |
<wast::parser::Parser>::peek2::<wast::kw::catch> Line | Count | Source | 625 | 161k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 161k | T::peek2(self.cursor()) | 627 | 161k | } |
<wast::parser::Parser>::peek2::<wast::kw::exact> Line | Count | Source | 625 | 22.1k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 22.1k | T::peek2(self.cursor()) | 627 | 22.1k | } |
<wast::parser::Parser>::peek2::<wast::kw::local> Line | Count | Source | 625 | 191k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 191k | T::peek2(self.cursor()) | 627 | 191k | } |
<wast::parser::Parser>::peek2::<wast::kw::param> Line | Count | Source | 625 | 1.24M | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 1.24M | T::peek2(self.cursor()) | 627 | 1.24M | } |
<wast::parser::Parser>::peek2::<wast::kw::quote> Line | Count | Source | 625 | 17 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 17 | T::peek2(self.cursor()) | 627 | 17 | } |
<wast::parser::Parser>::peek2::<wast::kw::table> Line | Count | Source | 625 | 17.8k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 17.8k | T::peek2(self.cursor()) | 627 | 17.8k | } |
<wast::parser::Parser>::peek2::<wast::kw::memory> Line | Count | Source | 625 | 5.82k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 5.82k | T::peek2(self.cursor()) | 627 | 5.82k | } |
<wast::parser::Parser>::peek2::<wast::kw::module> Line | Count | Source | 625 | 16.6k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 16.6k | T::peek2(self.cursor()) | 627 | 16.6k | } |
<wast::parser::Parser>::peek2::<wast::kw::offset> Line | Count | Source | 625 | 17.8k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 17.8k | T::peek2(self.cursor()) | 627 | 17.8k | } |
<wast::parser::Parser>::peek2::<wast::kw::result> Line | Count | Source | 625 | 1.09M | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 1.09M | T::peek2(self.cursor()) | 627 | 1.09M | } |
<wast::parser::Parser>::peek2::<wast::kw::shared> Line | Count | Source | 625 | 86.0k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 86.0k | T::peek2(self.cursor()) | 627 | 86.0k | } |
<wast::parser::Parser>::peek2::<wast::kw::instance> Line | Count | Source | 625 | 8 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 8 | T::peek2(self.cursor()) | 627 | 8 | } |
<wast::parser::Parser>::peek2::<wast::kw::pagesize> Line | Count | Source | 625 | 15.6k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 15.6k | T::peek2(self.cursor()) | 627 | 15.6k | } |
<wast::parser::Parser>::peek2::<wast::kw::catch_all> Line | Count | Source | 625 | 124k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 124k | T::peek2(self.cursor()) | 627 | 124k | } |
<wast::parser::Parser>::peek2::<wast::kw::catch_ref> Line | Count | Source | 625 | 124k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 124k | T::peek2(self.cursor()) | 627 | 124k | } |
<wast::parser::Parser>::peek2::<wast::kw::component> Line | Count | Source | 625 | 2.21k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 2.21k | T::peek2(self.cursor()) | 627 | 2.21k | } |
<wast::parser::Parser>::peek2::<wast::wast::WastDirectiveToken> Line | Count | Source | 625 | 2.39k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 2.39k | T::peek2(self.cursor()) | 627 | 2.39k | } |
<wast::parser::Parser>::peek2::<wast::token::Index> Line | Count | Source | 625 | 16 | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 16 | T::peek2(self.cursor()) | 627 | 16 | } |
<wast::parser::Parser>::peek2::<wast::token::LParen> Line | Count | Source | 625 | 12.4k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 12.4k | T::peek2(self.cursor()) | 627 | 12.4k | } |
<wast::parser::Parser>::peek2::<wast::core::types::Type> Line | Count | Source | 625 | 527k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 527k | T::peek2(self.cursor()) | 627 | 527k | } |
<wast::parser::Parser>::peek2::<wast::core::types::RefType> Line | Count | Source | 625 | 10.4k | pub fn peek2<T: Peek>(self) -> Result<bool> { | 626 | 10.4k | T::peek2(self.cursor()) | 627 | 10.4k | } |
|
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.62M | pub fn lookahead1(self) -> Lookahead1<'a> { |
694 | 4.62M | Lookahead1 { |
695 | 4.62M | attempts: Vec::new(), |
696 | 4.62M | parser: self, |
697 | 4.62M | } |
698 | 4.62M | } |
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 | 4.96M | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { |
745 | 4.96M | self.buf.depth.set(self.buf.depth.get() + 1); |
746 | 4.96M | let before = self.buf.cur.get(); |
747 | 4.96M | let res = self.step(|cursor| { |
748 | 4.96M | let mut cursor = match cursor.lparen()? { |
749 | 4.96M | Some(rest) => rest, |
750 | 1.19k | None => return Err(cursor.error("expected `(`")), |
751 | | }; |
752 | 4.96M | cursor.parser.buf.cur.set(cursor.pos); |
753 | 4.96M | let result = f(cursor.parser)?; |
754 | | |
755 | | // Reset our cursor's state to whatever the current state of the |
756 | | // parser is. |
757 | 4.96M | cursor.pos = cursor.parser.buf.cur.get(); |
758 | | |
759 | 4.96M | match cursor.rparen()? { |
760 | 4.96M | Some(rest) => Ok((result, rest)), |
761 | 20 | None => Err(cursor.error("expected `)`")), |
762 | | } |
763 | 4.96M | }); <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 | 5 | let res = self.step(|cursor| { | 748 | 5 | let mut cursor = match cursor.lparen()? { | 749 | 5 | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 5 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 5 | 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 | 5 | }); |
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 | 22 | let res = self.step(|cursor| { | 748 | 22 | let mut cursor = match cursor.lparen()? { | 749 | 19 | Some(rest) => rest, | 750 | 3 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 19 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 19 | 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 | 22 | }); |
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 | 13.2k | let res = self.step(|cursor| { | 748 | 13.2k | let mut cursor = match cursor.lparen()? { | 749 | 13.2k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 13.2k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 13.2k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 13.2k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 13.2k | match cursor.rparen()? { | 760 | 13.2k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 13.2k | }); |
<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 | 201k | let res = self.step(|cursor| { | 748 | 201k | let mut cursor = match cursor.lparen()? { | 749 | 201k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 201k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 201k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 201k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 201k | match cursor.rparen()? { | 760 | 201k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 201k | }); |
<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 | 107k | let res = self.step(|cursor| { | 748 | 107k | let mut cursor = match cursor.lparen()? { | 749 | 107k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 107k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 107k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 107k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 107k | match cursor.rparen()? { | 760 | 107k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 107k | }); |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::component::Component, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#1}>::{closure#0}Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::item>::{closure#0}>::{closure#0}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 | 5.82k | let res = self.step(|cursor| { | 748 | 5.82k | let mut cursor = match cursor.lparen()? { | 749 | 5.81k | Some(rest) => rest, | 750 | 2 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 5.81k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 5.81k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 5.79k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 5.79k | match cursor.rparen()? { | 760 | 5.79k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 5.82k | }); |
<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 | 129k | let res = self.step(|cursor| { | 748 | 129k | let mut cursor = match cursor.lparen()? { | 749 | 129k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 129k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 129k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 129k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 129k | match cursor.rparen()? { | 760 | 129k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 129k | }); |
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 | 78.0k | let res = self.step(|cursor| { | 748 | 78.0k | let mut cursor = match cursor.lparen()? { | 749 | 78.0k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 78.0k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 78.0k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 78.0k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 78.0k | match cursor.rparen()? { | 760 | 78.0k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 78.0k | }); |
<wast::parser::Parser>::parens::<wast::core::types::StorageType, <wast::core::types::StructField>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 394k | let res = self.step(|cursor| { | 748 | 394k | let mut cursor = match cursor.lparen()? { | 749 | 394k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 394k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 394k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 394k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 394k | match cursor.rparen()? { | 760 | 394k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 394k | }); |
<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 | 193k | let res = self.step(|cursor| { | 748 | 193k | let mut cursor = match cursor.lparen()? { | 749 | 193k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 193k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 193k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 193k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 193k | match cursor.rparen()? { | 760 | 193k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 193k | }); |
<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 | 469k | let res = self.step(|cursor| { | 748 | 469k | let mut cursor = match cursor.lparen()? { | 749 | 469k | Some(rest) => rest, | 750 | 2 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 469k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 469k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 469k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 469k | match cursor.rparen()? { | 760 | 469k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 469k | }); |
<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 | 467k | let res = self.step(|cursor| { | 748 | 467k | let mut cursor = match cursor.lparen()? { | 749 | 467k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 467k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 467k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 467k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 467k | match cursor.rparen()? { | 760 | 467k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 467k | }); |
<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 | 502k | let res = self.step(|cursor| { | 748 | 502k | let mut cursor = match cursor.lparen()? { | 749 | 502k | Some(rest) => rest, | 750 | 5 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 502k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 502k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 502k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 502k | match cursor.rparen()? { | 760 | 502k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 502k | }); |
<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 | 88.5k | let res = self.step(|cursor| { | 748 | 88.5k | let mut cursor = match cursor.lparen()? { | 749 | 88.5k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 88.5k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 88.5k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 88.5k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 88.5k | match cursor.rparen()? { | 760 | 88.5k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 88.5k | }); |
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 | 64.4k | let res = self.step(|cursor| { | 748 | 64.4k | let mut cursor = match cursor.lparen()? { | 749 | 64.4k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 64.4k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 64.4k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 64.4k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 64.4k | match cursor.rparen()? { | 760 | 64.4k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 64.4k | }); |
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 | 545k | let res = self.step(|cursor| { | 748 | 545k | let mut cursor = match cursor.lparen()? { | 749 | 544k | Some(rest) => rest, | 750 | 1.17k | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 544k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 544k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 543k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 543k | match cursor.rparen()? { | 760 | 543k | Some(rest) => Ok((result, rest)), | 761 | 20 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 545k | }); |
<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 | 13.4k | let res = self.step(|cursor| { | 748 | 13.4k | let mut cursor = match cursor.lparen()? { | 749 | 13.4k | Some(rest) => rest, | 750 | 2 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 13.4k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 13.4k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 13.4k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 13.4k | match cursor.rparen()? { | 760 | 13.4k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 13.4k | }); |
<wast::parser::Parser>::parens::<&str, <wast::core::export::InlineExport as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 13.5k | let res = self.step(|cursor| { | 748 | 13.5k | let mut cursor = match cursor.lparen()? { | 749 | 13.5k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 13.5k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 13.5k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 13.5k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 13.5k | match cursor.rparen()? { | 760 | 13.5k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 13.5k | }); |
<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 | 35.8k | let res = self.step(|cursor| { | 748 | 35.8k | let mut cursor = match cursor.lparen()? { | 749 | 35.8k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 35.8k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 35.8k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 35.8k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 35.8k | match cursor.rparen()? { | 760 | 35.8k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 35.8k | }); |
<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 | 69.3k | let res = self.step(|cursor| { | 748 | 69.3k | let mut cursor = match cursor.lparen()? { | 749 | 69.3k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 69.3k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 69.3k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 69.3k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 69.3k | match cursor.rparen()? { | 760 | 69.3k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 69.3k | }); |
<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 | 199k | let res = self.step(|cursor| { | 748 | 199k | let mut cursor = match cursor.lparen()? { | 749 | 199k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 199k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 199k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 199k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 199k | match cursor.rparen()? { | 760 | 199k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 199k | }); |
<wast::parser::Parser>::parens::<u32, wast::core::types::page_size::{closure#0}>::{closure#0}Line | Count | Source | 747 | 15.6k | let res = self.step(|cursor| { | 748 | 15.6k | let mut cursor = match cursor.lparen()? { | 749 | 15.6k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 15.6k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 15.6k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 15.6k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 15.6k | match cursor.rparen()? { | 760 | 15.6k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 15.6k | }); |
<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 | 699k | let res = self.step(|cursor| { | 748 | 699k | let mut cursor = match cursor.lparen()? { | 749 | 699k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 699k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 699k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 699k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 699k | match cursor.rparen()? { | 760 | 699k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 699k | }); |
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 | 94 | let res = self.step(|cursor| { | 748 | 94 | let mut cursor = match cursor.lparen()? { | 749 | 94 | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 94 | cursor.parser.buf.cur.set(cursor.pos); | 753 | 94 | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 94 | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 94 | match cursor.rparen()? { | 760 | 94 | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 94 | }); |
<wast::parser::Parser>::parens::<(), <wast::core::types::StructType as wast::parser::Parse>::parse::{closure#0}>::{closure#0}Line | Count | Source | 747 | 625k | let res = self.step(|cursor| { | 748 | 625k | let mut cursor = match cursor.lparen()? { | 749 | 625k | Some(rest) => rest, | 750 | 0 | None => return Err(cursor.error("expected `(`")), | 751 | | }; | 752 | 625k | cursor.parser.buf.cur.set(cursor.pos); | 753 | 625k | let result = f(cursor.parser)?; | 754 | | | 755 | | // Reset our cursor's state to whatever the current state of the | 756 | | // parser is. | 757 | 625k | cursor.pos = cursor.parser.buf.cur.get(); | 758 | | | 759 | 625k | match cursor.rparen()? { | 760 | 625k | Some(rest) => Ok((result, rest)), | 761 | 0 | None => Err(cursor.error("expected `)`")), | 762 | | } | 763 | 625k | }); |
|
764 | 4.96M | self.buf.depth.set(self.buf.depth.get() - 1); |
765 | 4.96M | if res.is_err() { |
766 | 2.27k | self.buf.cur.set(before); |
767 | 4.96M | } |
768 | 4.96M | res |
769 | 4.96M | } <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 | 5 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 5 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 5 | let before = self.buf.cur.get(); | 747 | 5 | 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 | 5 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 5 | if res.is_err() { | 766 | 5 | self.buf.cur.set(before); | 767 | 5 | } | 768 | 5 | res | 769 | 5 | } |
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 | 22 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 22 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 22 | let before = self.buf.cur.get(); | 747 | 22 | 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 | 22 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 22 | if res.is_err() { | 766 | 20 | self.buf.cur.set(before); | 767 | 20 | } | 768 | 22 | res | 769 | 22 | } |
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 | 13.2k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 13.2k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 13.2k | let before = self.buf.cur.get(); | 747 | 13.2k | 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 | 13.2k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 13.2k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 13.2k | } | 768 | 13.2k | res | 769 | 13.2k | } |
<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 | 201k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 201k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 201k | let before = self.buf.cur.get(); | 747 | 201k | 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 | 201k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 201k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 201k | } | 768 | 201k | res | 769 | 201k | } |
<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 | 107k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 107k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 107k | let before = self.buf.cur.get(); | 747 | 107k | 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 | 107k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 107k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 107k | } | 768 | 107k | res | 769 | 107k | } |
Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::component::Component, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#1}>Unexecuted instantiation: <wast::parser::Parser>::parens::<wast::core::expr::Expression, wast::core::table::parse_expr_or_single_instr<wast::kw::item>::{closure#0}>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 | 5.82k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 5.82k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 5.82k | let before = self.buf.cur.get(); | 747 | 5.82k | 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 | 5.82k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 5.82k | if res.is_err() { | 766 | 23 | self.buf.cur.set(before); | 767 | 5.79k | } | 768 | 5.82k | res | 769 | 5.82k | } |
<wast::parser::Parser>::parens::<wast::core::expr::TryTableCatch, <wast::core::expr::TryTable as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 129k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 129k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 129k | let before = self.buf.cur.get(); | 747 | 129k | 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 | 129k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 129k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 129k | } | 768 | 129k | res | 769 | 129k | } |
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 | 78.0k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 78.0k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 78.0k | let before = self.buf.cur.get(); | 747 | 78.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 | 78.0k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 78.0k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 78.0k | } | 768 | 78.0k | res | 769 | 78.0k | } |
<wast::parser::Parser>::parens::<wast::core::types::StorageType, <wast::core::types::StructField>::parse::{closure#0}>Line | Count | Source | 744 | 394k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 394k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 394k | let before = self.buf.cur.get(); | 747 | 394k | 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 | 394k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 394k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 394k | } | 768 | 394k | res | 769 | 394k | } |
<wast::parser::Parser>::parens::<wast::core::types::StorageType, <wast::core::types::ArrayType as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 193k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 193k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 193k | let before = self.buf.cur.get(); | 747 | 193k | 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 | 193k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 193k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 193k | } | 768 | 193k | res | 769 | 193k | } |
<wast::parser::Parser>::parens::<wast::core::types::Type, <wast::core::types::Rec as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 469k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 469k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 469k | let before = self.buf.cur.get(); | 747 | 469k | 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 | 469k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 469k | if res.is_err() { | 766 | 2 | self.buf.cur.set(before); | 767 | 469k | } | 768 | 469k | res | 769 | 469k | } |
<wast::parser::Parser>::parens::<wast::core::types::RefType, <wast::core::types::RefType as wast::parser::Parse>::parse::{closure#1}>Line | Count | Source | 744 | 467k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 467k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 467k | let before = self.buf.cur.get(); | 747 | 467k | 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 | 467k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 467k | if res.is_err() { | 766 | 2 | self.buf.cur.set(before); | 767 | 467k | } | 768 | 467k | res | 769 | 467k | } |
<wast::parser::Parser>::parens::<wast::core::types::TypeDef, <wast::core::types::Type as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 502k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 502k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 502k | let before = self.buf.cur.get(); | 747 | 502k | 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 | 502k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 502k | if res.is_err() { | 766 | 20 | self.buf.cur.set(before); | 767 | 502k | } | 768 | 502k | res | 769 | 502k | } |
<wast::parser::Parser>::parens::<wast::core::types::HeapType, <wast::core::types::HeapType as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 88.5k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 88.5k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 88.5k | let before = self.buf.cur.get(); | 747 | 88.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 | 88.5k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 88.5k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 88.5k | } | 768 | 88.5k | res | 769 | 88.5k | } |
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 | 64.4k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 64.4k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 64.4k | let before = self.buf.cur.get(); | 747 | 64.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 | 64.4k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 64.4k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 64.4k | } | 768 | 64.4k | res | 769 | 64.4k | } |
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 | 545k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 545k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 545k | let before = self.buf.cur.get(); | 747 | 545k | 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 | 545k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 545k | if res.is_err() { | 766 | 2.18k | self.buf.cur.set(before); | 767 | 543k | } | 768 | 545k | res | 769 | 545k | } |
<wast::parser::Parser>::parens::<wast::core::module::Module, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}::{closure#0}>Line | Count | Source | 744 | 13.4k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 13.4k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 13.4k | let before = self.buf.cur.get(); | 747 | 13.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 | 13.4k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 13.4k | if res.is_err() { | 766 | 9 | self.buf.cur.set(before); | 767 | 13.4k | } | 768 | 13.4k | res | 769 | 13.4k | } |
<wast::parser::Parser>::parens::<&str, <wast::core::export::InlineExport as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 13.5k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 13.5k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 13.5k | let before = self.buf.cur.get(); | 747 | 13.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 | 13.5k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 13.5k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 13.5k | } | 768 | 13.5k | res | 769 | 13.5k | } |
<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 | 35.8k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 35.8k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 35.8k | let before = self.buf.cur.get(); | 747 | 35.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 | 35.8k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 35.8k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 35.8k | } | 768 | 35.8k | res | 769 | 35.8k | } |
<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 | 69.3k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 69.3k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 69.3k | let before = self.buf.cur.get(); | 747 | 69.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 | 69.3k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 69.3k | if res.is_err() { | 766 | 2 | self.buf.cur.set(before); | 767 | 69.3k | } | 768 | 69.3k | res | 769 | 69.3k | } |
<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 | 199k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 199k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 199k | let before = self.buf.cur.get(); | 747 | 199k | 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 | 199k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 199k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 199k | } | 768 | 199k | res | 769 | 199k | } |
<wast::parser::Parser>::parens::<u32, wast::core::types::page_size::{closure#0}>Line | Count | Source | 744 | 15.6k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 15.6k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 15.6k | let before = self.buf.cur.get(); | 747 | 15.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 | 15.6k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 15.6k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 15.6k | } | 768 | 15.6k | res | 769 | 15.6k | } |
<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 | 699k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 699k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 699k | let before = self.buf.cur.get(); | 747 | 699k | 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 | 699k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 699k | if res.is_err() { | 766 | 4 | self.buf.cur.set(before); | 767 | 699k | } | 768 | 699k | res | 769 | 699k | } |
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 | 94 | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 94 | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 94 | let before = self.buf.cur.get(); | 747 | 94 | 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 | 94 | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 94 | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 94 | } | 768 | 94 | res | 769 | 94 | } |
<wast::parser::Parser>::parens::<(), <wast::core::types::StructType as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 744 | 625k | pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> { | 745 | 625k | self.buf.depth.set(self.buf.depth.get() + 1); | 746 | 625k | let before = self.buf.cur.get(); | 747 | 625k | 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 | 625k | self.buf.depth.set(self.buf.depth.get() - 1); | 765 | 625k | if res.is_err() { | 766 | 0 | self.buf.cur.set(before); | 767 | 625k | } | 768 | 625k | res | 769 | 625k | } |
|
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 | 124M | fn cursor(self) -> Cursor<'a> { |
790 | 124M | Cursor { |
791 | 124M | parser: self, |
792 | 124M | pos: self.buf.cur.get(), |
793 | 124M | } |
794 | 124M | } |
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 | 47.2M | pub fn step<F, T>(self, f: F) -> Result<T> |
803 | 47.2M | where |
804 | 47.2M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, |
805 | | { |
806 | 47.2M | let (result, cursor) = f(self.cursor())?; |
807 | 47.2M | self.buf.cur.set(cursor.pos); |
808 | 47.2M | Ok(result) |
809 | 47.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 | 5 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 5 | where | 804 | 5 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 5 | let (result, cursor) = f(self.cursor())?; | 807 | 0 | self.buf.cur.set(cursor.pos); | 808 | 0 | Ok(result) | 809 | 5 | } |
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 | 22 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 22 | where | 804 | 22 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 22 | let (result, cursor) = f(self.cursor())?; | 807 | 2 | self.buf.cur.set(cursor.pos); | 808 | 2 | Ok(result) | 809 | 22 | } |
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 | 13.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 13.2k | where | 804 | 13.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 13.2k | let (result, cursor) = f(self.cursor())?; | 807 | 13.2k | self.buf.cur.set(cursor.pos); | 808 | 13.2k | Ok(result) | 809 | 13.2k | } |
<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 | 201k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 201k | where | 804 | 201k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 201k | let (result, cursor) = f(self.cursor())?; | 807 | 201k | self.buf.cur.set(cursor.pos); | 808 | 201k | Ok(result) | 809 | 201k | } |
<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 | 107k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 107k | where | 804 | 107k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 107k | let (result, cursor) = f(self.cursor())?; | 807 | 107k | self.buf.cur.set(cursor.pos); | 808 | 107k | Ok(result) | 809 | 107k | } |
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>Unexecuted instantiation: <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>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 | 5.82k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 5.82k | where | 804 | 5.82k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 5.82k | let (result, cursor) = f(self.cursor())?; | 807 | 5.79k | self.buf.cur.set(cursor.pos); | 808 | 5.79k | Ok(result) | 809 | 5.82k | } |
<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 | 129k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 129k | where | 804 | 129k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 129k | let (result, cursor) = f(self.cursor())?; | 807 | 129k | self.buf.cur.set(cursor.pos); | 808 | 129k | Ok(result) | 809 | 129k | } |
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 | 78.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 78.0k | where | 804 | 78.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 78.0k | let (result, cursor) = f(self.cursor())?; | 807 | 78.0k | self.buf.cur.set(cursor.pos); | 808 | 78.0k | Ok(result) | 809 | 78.0k | } |
<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 | 394k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 394k | where | 804 | 394k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 394k | let (result, cursor) = f(self.cursor())?; | 807 | 394k | self.buf.cur.set(cursor.pos); | 808 | 394k | Ok(result) | 809 | 394k | } |
<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 | 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::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 | 469k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 469k | where | 804 | 469k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 469k | let (result, cursor) = f(self.cursor())?; | 807 | 469k | self.buf.cur.set(cursor.pos); | 808 | 469k | Ok(result) | 809 | 469k | } |
<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 | 467k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 467k | where | 804 | 467k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 467k | let (result, cursor) = f(self.cursor())?; | 807 | 467k | self.buf.cur.set(cursor.pos); | 808 | 467k | Ok(result) | 809 | 467k | } |
<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 | 502k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 502k | where | 804 | 502k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 502k | let (result, cursor) = f(self.cursor())?; | 807 | 502k | self.buf.cur.set(cursor.pos); | 808 | 502k | Ok(result) | 809 | 502k | } |
<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 | 88.5k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 88.5k | where | 804 | 88.5k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 88.5k | let (result, cursor) = f(self.cursor())?; | 807 | 88.5k | self.buf.cur.set(cursor.pos); | 808 | 88.5k | Ok(result) | 809 | 88.5k | } |
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 | 64.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 64.4k | where | 804 | 64.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 64.4k | let (result, cursor) = f(self.cursor())?; | 807 | 64.4k | self.buf.cur.set(cursor.pos); | 808 | 64.4k | Ok(result) | 809 | 64.4k | } |
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 | 545k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 545k | where | 804 | 545k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 545k | let (result, cursor) = f(self.cursor())?; | 807 | 543k | self.buf.cur.set(cursor.pos); | 808 | 543k | Ok(result) | 809 | 545k | } |
<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 | 13.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 13.4k | where | 804 | 13.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 13.4k | let (result, cursor) = f(self.cursor())?; | 807 | 13.4k | self.buf.cur.set(cursor.pos); | 808 | 13.4k | Ok(result) | 809 | 13.4k | } |
<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 | 13.5k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 13.5k | where | 804 | 13.5k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 13.5k | let (result, cursor) = f(self.cursor())?; | 807 | 13.5k | self.buf.cur.set(cursor.pos); | 808 | 13.5k | Ok(result) | 809 | 13.5k | } |
<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 | 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 | } |
<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 | 69.3k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 69.3k | where | 804 | 69.3k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 69.3k | let (result, cursor) = f(self.cursor())?; | 807 | 69.3k | self.buf.cur.set(cursor.pos); | 808 | 69.3k | Ok(result) | 809 | 69.3k | } |
<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 | 199k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 199k | where | 804 | 199k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 199k | let (result, cursor) = f(self.cursor())?; | 807 | 199k | self.buf.cur.set(cursor.pos); | 808 | 199k | Ok(result) | 809 | 199k | } |
<wast::parser::Parser>::step::<<wast::parser::Parser>::parens<u32, wast::core::types::page_size::{closure#0}>::{closure#0}, u32>Line | Count | Source | 802 | 15.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 15.6k | where | 804 | 15.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 15.6k | let (result, cursor) = f(self.cursor())?; | 807 | 15.6k | self.buf.cur.set(cursor.pos); | 808 | 15.6k | Ok(result) | 809 | 15.6k | } |
<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 | 699k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 699k | where | 804 | 699k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 699k | let (result, cursor) = f(self.cursor())?; | 807 | 699k | self.buf.cur.set(cursor.pos); | 808 | 699k | Ok(result) | 809 | 699k | } |
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 | 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 | } |
<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 | 625k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 625k | where | 804 | 625k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 625k | let (result, cursor) = f(self.cursor())?; | 807 | 625k | self.buf.cur.set(cursor.pos); | 808 | 625k | Ok(result) | 809 | 625k | } |
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 | 12.8M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 12.8M | where | 804 | 12.8M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 12.8M | let (result, cursor) = f(self.cursor())?; | 807 | 12.8M | self.buf.cur.set(cursor.pos); | 808 | 12.8M | Ok(result) | 809 | 12.8M | } |
<wast::parser::Parser>::step::<<wast::core::expr::LoadOrStoreLane>::parse::{closure#0}, bool>Line | Count | Source | 802 | 496 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 496 | where | 804 | 496 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 496 | let (result, cursor) = f(self.cursor())?; | 807 | 496 | self.buf.cur.set(cursor.pos); | 808 | 496 | Ok(result) | 809 | 496 | } |
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 | 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 | } |
<wast::parser::Parser>::step::<<wast::annotation::custom as wast::parser::Parse>::parse::{closure#0}, wast::annotation::custom>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::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 | 736k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 736k | where | 804 | 736k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 736k | let (result, cursor) = f(self.cursor())?; | 807 | 736k | self.buf.cur.set(cursor.pos); | 808 | 736k | Ok(result) | 809 | 736k | } |
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 | 883k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 883k | where | 804 | 883k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 883k | let (result, cursor) = f(self.cursor())?; | 807 | 883k | self.buf.cur.set(cursor.pos); | 808 | 883k | Ok(result) | 809 | 883k | } |
<wast::parser::Parser>::step::<<wast::token::F32 as wast::parser::Parse>::parse::{closure#0}, wast::token::F32>Line | Count | Source | 802 | 180k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 180k | where | 804 | 180k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 180k | let (result, cursor) = f(self.cursor())?; | 807 | 180k | self.buf.cur.set(cursor.pos); | 808 | 180k | Ok(result) | 809 | 180k | } |
<wast::parser::Parser>::step::<<wast::token::F64 as wast::parser::Parse>::parse::{closure#0}, wast::token::F64>Line | Count | Source | 802 | 493k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 493k | where | 804 | 493k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 493k | let (result, cursor) = f(self.cursor())?; | 807 | 493k | self.buf.cur.set(cursor.pos); | 808 | 493k | Ok(result) | 809 | 493k | } |
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 | 36.7k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 36.7k | where | 804 | 36.7k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 36.7k | let (result, cursor) = f(self.cursor())?; | 807 | 36.7k | self.buf.cur.set(cursor.pos); | 808 | 36.7k | Ok(result) | 809 | 36.7k | } |
<wast::parser::Parser>::step::<<wast::kw::catch_ref as wast::parser::Parse>::parse::{closure#0}, wast::kw::catch_ref>Line | Count | Source | 802 | 228 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 228 | where | 804 | 228 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 228 | let (result, cursor) = f(self.cursor())?; | 807 | 228 | self.buf.cur.set(cursor.pos); | 808 | 228 | Ok(result) | 809 | 228 | } |
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 | 20.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 20.0k | where | 804 | 20.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 20.0k | let (result, cursor) = f(self.cursor())?; | 807 | 20.0k | self.buf.cur.set(cursor.pos); | 808 | 20.0k | Ok(result) | 809 | 20.0k | } |
<wast::parser::Parser>::step::<<wast::kw::declare as wast::parser::Parse>::parse::{closure#0}, wast::kw::declare>Line | Count | Source | 802 | 4.73k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 4.73k | where | 804 | 4.73k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 4.73k | let (result, cursor) = f(self.cursor())?; | 807 | 4.73k | self.buf.cur.set(cursor.pos); | 808 | 4.73k | Ok(result) | 809 | 4.73k | } |
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 | 91.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 91.4k | where | 804 | 91.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 91.4k | let (result, cursor) = f(self.cursor())?; | 807 | 91.4k | self.buf.cur.set(cursor.pos); | 808 | 91.4k | Ok(result) | 809 | 91.4k | } |
<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 | 1.51k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 1.51k | where | 804 | 1.51k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 1.51k | let (result, cursor) = f(self.cursor())?; | 807 | 1.51k | self.buf.cur.set(cursor.pos); | 808 | 1.51k | Ok(result) | 809 | 1.51k | } |
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 | 36.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 36.6k | where | 804 | 36.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 36.6k | let (result, cursor) = f(self.cursor())?; | 807 | 36.6k | self.buf.cur.set(cursor.pos); | 808 | 36.6k | Ok(result) | 809 | 36.6k | } |
<wast::parser::Parser>::step::<<wast::kw::exn as wast::parser::Parse>::parse::{closure#0}, wast::kw::exn>Line | Count | Source | 802 | 20.5k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 20.5k | where | 804 | 20.5k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 20.5k | let (result, cursor) = f(self.cursor())?; | 807 | 20.5k | self.buf.cur.set(cursor.pos); | 808 | 20.5k | Ok(result) | 809 | 20.5k | } |
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 | 12.8k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 12.8k | where | 804 | 12.8k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 12.8k | let (result, cursor) = f(self.cursor())?; | 807 | 12.8k | self.buf.cur.set(cursor.pos); | 808 | 12.8k | Ok(result) | 809 | 12.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 | 27.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 27.4k | where | 804 | 27.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 27.4k | let (result, cursor) = f(self.cursor())?; | 807 | 27.4k | self.buf.cur.set(cursor.pos); | 808 | 27.4k | Ok(result) | 809 | 27.4k | } |
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 | 49.3k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 49.3k | where | 804 | 49.3k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 49.3k | let (result, cursor) = f(self.cursor())?; | 807 | 49.3k | self.buf.cur.set(cursor.pos); | 808 | 49.3k | Ok(result) | 809 | 49.3k | } |
<wast::parser::Parser>::step::<<wast::kw::extern as wast::parser::Parse>::parse::{closure#0}, wast::kw::extern>Line | Count | Source | 802 | 44.7k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 44.7k | where | 804 | 44.7k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 44.7k | let (result, cursor) = f(self.cursor())?; | 807 | 44.7k | self.buf.cur.set(cursor.pos); | 808 | 44.7k | Ok(result) | 809 | 44.7k | } |
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 | 625k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 625k | where | 804 | 625k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 625k | let (result, cursor) = f(self.cursor())?; | 807 | 625k | self.buf.cur.set(cursor.pos); | 808 | 625k | Ok(result) | 809 | 625k | } |
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 | 14.9k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 14.9k | where | 804 | 14.9k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 14.9k | let (result, cursor) = f(self.cursor())?; | 807 | 14.9k | self.buf.cur.set(cursor.pos); | 808 | 14.9k | Ok(result) | 809 | 14.9k | } |
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 | 370k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 370k | where | 804 | 370k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 370k | let (result, cursor) = f(self.cursor())?; | 807 | 370k | self.buf.cur.set(cursor.pos); | 808 | 370k | Ok(result) | 809 | 370k | } |
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 | 6.38k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 6.38k | where | 804 | 6.38k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 6.38k | let (result, cursor) = f(self.cursor())?; | 807 | 6.38k | self.buf.cur.set(cursor.pos); | 808 | 6.38k | Ok(result) | 809 | 6.38k | } |
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 | 104k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 104k | where | 804 | 104k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 104k | let (result, cursor) = f(self.cursor())?; | 807 | 104k | self.buf.cur.set(cursor.pos); | 808 | 104k | Ok(result) | 809 | 104k | } |
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 | 99.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 99.4k | where | 804 | 99.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 99.4k | let (result, cursor) = f(self.cursor())?; | 807 | 99.4k | self.buf.cur.set(cursor.pos); | 808 | 99.4k | Ok(result) | 809 | 99.4k | } |
<wast::parser::Parser>::step::<<wast::kw::i16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i16>Line | Count | Source | 802 | 153k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 153k | where | 804 | 153k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 153k | let (result, cursor) = f(self.cursor())?; | 807 | 153k | self.buf.cur.set(cursor.pos); | 808 | 153k | Ok(result) | 809 | 153k | } |
<wast::parser::Parser>::step::<<wast::kw::i64 as wast::parser::Parse>::parse::{closure#0}, wast::kw::i64>Line | Count | Source | 802 | 34.7k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 34.7k | where | 804 | 34.7k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 34.7k | let (result, cursor) = f(self.cursor())?; | 807 | 34.7k | self.buf.cur.set(cursor.pos); | 808 | 34.7k | Ok(result) | 809 | 34.7k | } |
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 | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::item as wast::parser::Parse>::parse::{closure#0}, wast::kw::item><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 | 494k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 494k | where | 804 | 494k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 494k | let (result, cursor) = f(self.cursor())?; | 807 | 494k | self.buf.cur.set(cursor.pos); | 808 | 494k | Ok(result) | 809 | 494k | } |
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 | 499k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 499k | where | 804 | 499k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 499k | let (result, cursor) = f(self.cursor())?; | 807 | 499k | self.buf.cur.set(cursor.pos); | 808 | 499k | Ok(result) | 809 | 499k | } |
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 | 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::kw::instance as wast::parser::Parse>::parse::{closure#0}, wast::kw::instance>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::last as wast::parser::Parse>::parse::{closure#0}, wast::kw::last><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 | } |
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 | 55.9k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 55.9k | where | 804 | 55.9k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 55.9k | let (result, cursor) = f(self.cursor())?; | 807 | 55.9k | self.buf.cur.set(cursor.pos); | 808 | 55.9k | Ok(result) | 809 | 55.9k | } |
<wast::parser::Parser>::step::<<wast::kw::noextern as wast::parser::Parse>::parse::{closure#0}, wast::kw::noextern>Line | Count | Source | 802 | 49.3k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 49.3k | where | 804 | 49.3k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 49.3k | let (result, cursor) = f(self.cursor())?; | 807 | 49.3k | self.buf.cur.set(cursor.pos); | 808 | 49.3k | Ok(result) | 809 | 49.3k | } |
<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::memory as wast::parser::Parse>::parse::{closure#0}, wast::kw::memory>Line | Count | Source | 802 | 36.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 36.6k | where | 804 | 36.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 36.6k | let (result, cursor) = f(self.cursor())?; | 807 | 36.6k | self.buf.cur.set(cursor.pos); | 808 | 36.6k | Ok(result) | 809 | 36.6k | } |
<wast::parser::Parser>::step::<<wast::kw::module as wast::parser::Parse>::parse::{closure#0}, wast::kw::module>Line | Count | Source | 802 | 13.4k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 13.4k | where | 804 | 13.4k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 13.4k | let (result, cursor) = f(self.cursor())?; | 807 | 13.4k | self.buf.cur.set(cursor.pos); | 808 | 13.4k | Ok(result) | 809 | 13.4k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::modulecode as wast::parser::Parse>::parse::{closure#0}, wast::kw::modulecode>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::noexn as wast::parser::Parse>::parse::{closure#0}, wast::kw::noexn><wast::parser::Parser>::step::<<wast::kw::none as wast::parser::Parse>::parse::{closure#0}, wast::kw::none>Line | Count | Source | 802 | 398k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 398k | where | 804 | 398k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 398k | let (result, cursor) = f(self.cursor())?; | 807 | 398k | self.buf.cur.set(cursor.pos); | 808 | 398k | Ok(result) | 809 | 398k | } |
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>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::outer as wast::parser::Parse>::parse::{closure#0}, wast::kw::outer><wast::parser::Parser>::step::<<wast::kw::null as wast::parser::Parse>::parse::{closure#0}, wast::kw::null>Line | Count | Source | 802 | 460k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 460k | where | 804 | 460k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 460k | let (result, cursor) = f(self.cursor())?; | 807 | 460k | self.buf.cur.set(cursor.pos); | 808 | 460k | Ok(result) | 809 | 460k | } |
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::nullexternref as wast::parser::Parse>::parse::{closure#0}, wast::kw::nullexternref>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::else as wast::parser::Parse>::parse::{closure#0}, wast::kw::else>Line | Count | Source | 802 | 3.00k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 3.00k | where | 804 | 3.00k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 3.00k | let (result, cursor) = f(self.cursor())?; | 807 | 3.00k | self.buf.cur.set(cursor.pos); | 808 | 3.00k | Ok(result) | 809 | 3.00k | } |
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><wast::parser::Parser>::step::<<wast::kw::mut as wast::parser::Parse>::parse::{closure#0}, wast::kw::mut>Line | Count | Source | 802 | 664k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 664k | where | 804 | 664k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 664k | let (result, cursor) = f(self.cursor())?; | 807 | 664k | self.buf.cur.set(cursor.pos); | 808 | 664k | Ok(result) | 809 | 664k | } |
<wast::parser::Parser>::step::<<wast::kw::pagesize as wast::parser::Parse>::parse::{closure#0}, wast::kw::pagesize>Line | Count | Source | 802 | 15.6k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 15.6k | where | 804 | 15.6k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 15.6k | let (result, cursor) = f(self.cursor())?; | 807 | 15.6k | self.buf.cur.set(cursor.pos); | 808 | 15.6k | Ok(result) | 809 | 15.6k | } |
<wast::parser::Parser>::step::<<wast::kw::param as wast::parser::Parse>::parse::{closure#0}, wast::kw::param>Line | Count | Source | 802 | 233k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 233k | where | 804 | 233k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 233k | let (result, cursor) = f(self.cursor())?; | 807 | 233k | self.buf.cur.set(cursor.pos); | 808 | 233k | Ok(result) | 809 | 233k | } |
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::quote as wast::parser::Parse>::parse::{closure#0}, wast::kw::quote>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 | 8.40M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 8.40M | where | 804 | 8.40M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 8.40M | let (result, cursor) = f(self.cursor())?; | 807 | 8.40M | self.buf.cur.set(cursor.pos); | 808 | 8.40M | Ok(result) | 809 | 8.40M | } |
<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 | 136 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 136 | where | 804 | 136 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 136 | let (result, cursor) = f(self.cursor())?; | 807 | 128 | self.buf.cur.set(cursor.pos); | 808 | 128 | Ok(result) | 809 | 136 | } |
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 | 3.83M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 3.83M | where | 804 | 3.83M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 3.83M | let (result, cursor) = f(self.cursor())?; | 807 | 3.83M | self.buf.cur.set(cursor.pos); | 808 | 3.83M | Ok(result) | 809 | 3.83M | } |
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 | 108k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 108k | where | 804 | 108k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 108k | let (result, cursor) = f(self.cursor())?; | 807 | 108k | self.buf.cur.set(cursor.pos); | 808 | 108k | Ok(result) | 809 | 108k | } |
<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.91M | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 6.91M | where | 804 | 6.91M | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 6.91M | let (result, cursor) = f(self.cursor())?; | 807 | 6.91M | self.buf.cur.set(cursor.pos); | 808 | 6.91M | Ok(result) | 809 | 6.91M | } |
<wast::parser::Parser>::step::<<wast::kw::type as wast::parser::Parse>::parse::{closure#0}, wast::kw::type>Line | Count | Source | 802 | 811k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 811k | where | 804 | 811k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 811k | let (result, cursor) = f(self.cursor())?; | 807 | 811k | self.buf.cur.set(cursor.pos); | 808 | 811k | Ok(result) | 809 | 811k | } |
<wast::parser::Parser>::step::<<wast::kw::ref as wast::parser::Parse>::parse::{closure#0}, wast::kw::ref>Line | Count | Source | 802 | 467k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 467k | where | 804 | 467k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 467k | let (result, cursor) = f(self.cursor())?; | 807 | 467k | self.buf.cur.set(cursor.pos); | 808 | 467k | Ok(result) | 809 | 467k | } |
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::kw::resource_new as wast::parser::Parse>::parse::{closure#0}, wast::kw::resource_new>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 | 5.21k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 5.21k | where | 804 | 5.21k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 5.21k | let (result, cursor) = f(self.cursor())?; | 807 | 5.21k | self.buf.cur.set(cursor.pos); | 808 | 5.21k | Ok(result) | 809 | 5.21k | } |
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::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 | } |
<wast::parser::Parser>::step::<<wast::kw::rec as wast::parser::Parse>::parse::{closure#0}, wast::kw::rec>Line | Count | Source | 802 | 58.5k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 58.5k | where | 804 | 58.5k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 58.5k | let (result, cursor) = f(self.cursor())?; | 807 | 58.5k | self.buf.cur.set(cursor.pos); | 808 | 58.5k | Ok(result) | 809 | 58.5k | } |
Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::resource_drop as wast::parser::Parse>::parse::{closure#0}, wast::kw::resource_drop>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::sub as wast::parser::Parse>::parse::{closure#0}, wast::kw::sub>Line | Count | Source | 802 | 199k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 199k | where | 804 | 199k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 199k | let (result, cursor) = f(self.cursor())?; | 807 | 199k | self.buf.cur.set(cursor.pos); | 808 | 199k | Ok(result) | 809 | 199k | } |
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 | 14.2k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 14.2k | where | 804 | 14.2k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 14.2k | let (result, cursor) = f(self.cursor())?; | 807 | 14.2k | self.buf.cur.set(cursor.pos); | 808 | 14.2k | Ok(result) | 809 | 14.2k | } |
<wast::parser::Parser>::step::<<wast::kw::table as wast::parser::Parse>::parse::{closure#0}, wast::kw::table>Line | Count | Source | 802 | 51.5k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 51.5k | where | 804 | 51.5k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 51.5k | let (result, cursor) = f(self.cursor())?; | 807 | 51.5k | self.buf.cur.set(cursor.pos); | 808 | 51.5k | Ok(result) | 809 | 51.5k | } |
<wast::parser::Parser>::step::<<wast::kw::then as wast::parser::Parse>::parse::{closure#0}, wast::kw::then>Line | Count | Source | 802 | 31.7k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 31.7k | where | 804 | 31.7k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 31.7k | let (result, cursor) = f(self.cursor())?; | 807 | 31.7k | self.buf.cur.set(cursor.pos); | 808 | 31.7k | Ok(result) | 809 | 31.7k | } |
<wast::parser::Parser>::step::<<wast::kw::result as wast::parser::Parse>::parse::{closure#0}, wast::kw::result>Line | Count | Source | 802 | 466k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 466k | where | 804 | 466k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 466k | let (result, cursor) = f(self.cursor())?; | 807 | 466k | self.buf.cur.set(cursor.pos); | 808 | 466k | Ok(result) | 809 | 466k | } |
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 | 164k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 164k | where | 804 | 164k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 164k | let (result, cursor) = f(self.cursor())?; | 807 | 164k | self.buf.cur.set(cursor.pos); | 808 | 164k | Ok(result) | 809 | 164k | } |
<wast::parser::Parser>::step::<<wast::kw::start as wast::parser::Parse>::parse::{closure#0}, wast::kw::start>Line | Count | Source | 802 | 748 | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 748 | where | 804 | 748 | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 748 | let (result, cursor) = f(self.cursor())?; | 807 | 748 | self.buf.cur.set(cursor.pos); | 808 | 748 | Ok(result) | 809 | 748 | } |
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::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>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::u32 as wast::parser::Parse>::parse::{closure#0}, wast::kw::u32><wast::parser::Parser>::step::<<wast::core::expr::LaneArg as wast::parser::Parse>::parse::{closure#0}, u8>Line | Count | Source | 802 | 11.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 11.0k | where | 804 | 11.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 11.0k | let (result, cursor) = f(self.cursor())?; | 807 | 11.0k | self.buf.cur.set(cursor.pos); | 808 | 11.0k | Ok(result) | 809 | 11.0k | } |
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::s32 as wast::parser::Parse>::parse::{closure#0}, wast::kw::s32>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::char as wast::parser::Parse>::parse::{closure#0}, wast::kw::char>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::flags as wast::parser::Parse>::parse::{closure#0}, wast::kw::flags>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::bool_ as wast::parser::Parse>::parse::{closure#0}, wast::kw::bool_>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::tuple as wast::parser::Parse>::parse::{closure#0}, wast::kw::tuple>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::string_utf16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::string_utf16>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::canon as wast::parser::Parse>::parse::{closure#0}, wast::kw::canon>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::string_latin1_utf16 as wast::parser::Parse>::parse::{closure#0}, wast::kw::string_latin1_utf16>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::true_ as wast::parser::Parse>::parse::{closure#0}, wast::kw::true_><wast::parser::Parser>::step::<<wast::kw::struct as wast::parser::Parse>::parse::{closure#0}, wast::kw::struct>Line | Count | Source | 802 | 96.0k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 96.0k | where | 804 | 96.0k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 96.0k | let (result, cursor) = f(self.cursor())?; | 807 | 96.0k | self.buf.cur.set(cursor.pos); | 808 | 96.0k | Ok(result) | 809 | 96.0k | } |
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::with as wast::parser::Parse>::parse::{closure#0}, wast::kw::with>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::language as wast::parser::Parse>::parse::{closure#0}, wast::kw::language>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::thread as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread>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::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::needed as wast::parser::Parse>::parse::{closure#0}, wast::kw::needed>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::thread_spawn_indirect as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_spawn_indirect>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::thread_yield as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_yield>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 | 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 | } |
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::task_return as wast::parser::Parse>::parse::{closure#0}, wast::kw::task_return>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::cancellable as wast::parser::Parse>::parse::{closure#0}, wast::kw::cancellable>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_suspend_to_suspended as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_suspend_to_suspended>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_suspend_to as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_suspend_to>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_unsuspend as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_unsuspend>Unexecuted instantiation: <wast::parser::Parser>::step::<<wast::kw::thread_yield_to_suspended as wast::parser::Parse>::parse::{closure#0}, wast::kw::thread_yield_to_suspended>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 | 298k | pub fn step<F, T>(self, f: F) -> Result<T> | 803 | 298k | where | 804 | 298k | F: FnOnce(Cursor<'a>) -> Result<(T, Cursor<'a>)>, | 805 | | { | 806 | 298k | let (result, cursor) = f(self.cursor())?; | 807 | 298k | self.buf.cur.set(cursor.pos); | 808 | 298k | Ok(result) | 809 | 298k | } |
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 | 888 | pub fn error(self, msg: impl fmt::Display) -> Error { |
818 | 888 | self.error_at(self.cursor().cur_span(), msg) |
819 | 888 | } <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 | 817 | pub fn error(self, msg: impl fmt::Display) -> Error { | 818 | 817 | self.error_at(self.cursor().cur_span(), msg) | 819 | 817 | } |
|
820 | | |
821 | | /// Creates an error whose line/column information is pointing at the |
822 | | /// given span. |
823 | 2.23k | pub fn error_at(self, span: Span, msg: impl fmt::Display) -> Error { |
824 | 2.23k | Error::parse(span, self.buf.lexer.input(), msg.to_string()) |
825 | 2.23k | } <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.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 | } |
|
826 | | |
827 | | /// Returns the span of the current token |
828 | 8.41M | pub fn cur_span(&self) -> Span { |
829 | 8.41M | self.cursor().cur_span() |
830 | 8.41M | } |
831 | | |
832 | | /// Returns the span of the previous token |
833 | 90.4k | pub fn prev_span(&self) -> Span { |
834 | 90.4k | self.cursor() |
835 | 90.4k | .prev_span() |
836 | 90.4k | .unwrap_or_else(|| Span::from_offset(0)) |
837 | 90.4k | } |
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 | 162k | pub fn register_annotation<'b>(self, annotation: &'b str) -> impl Drop + 'b |
970 | 162k | where |
971 | 162k | 'a: 'b, |
972 | | { |
973 | 162k | let mut annotations = self.buf.known_annotations.borrow_mut(); |
974 | 162k | if !annotations.contains_key(annotation) { |
975 | 89.2k | annotations.insert(annotation.to_string(), 0); |
976 | 89.2k | } |
977 | 162k | *annotations.get_mut(annotation).unwrap() += 1; |
978 | | |
979 | 162k | return RemoveOnDrop(self, annotation); |
980 | | |
981 | | struct RemoveOnDrop<'a>(Parser<'a>, &'a str); |
982 | | |
983 | | impl Drop for RemoveOnDrop<'_> { |
984 | 162k | fn drop(&mut self) { |
985 | 162k | let mut annotations = self.0.buf.known_annotations.borrow_mut(); |
986 | 162k | let slot = annotations.get_mut(self.1).unwrap(); |
987 | 162k | *slot -= 1; |
988 | 162k | } |
989 | | } |
990 | 162k | } |
991 | | |
992 | | #[cfg(feature = "wasm-module")] |
993 | 716k | pub(crate) fn track_instr_spans(&self) -> bool { |
994 | 716k | self.buf.track_instr_spans |
995 | 716k | } |
996 | | |
997 | | #[cfg(feature = "wasm-module")] |
998 | 32.4k | pub(crate) fn with_standard_annotations_registered<R>( |
999 | 32.4k | self, |
1000 | 32.4k | f: impl FnOnce(Self) -> Result<R>, |
1001 | 32.4k | ) -> Result<R> { |
1002 | 32.4k | let _r = self.register_annotation("custom"); |
1003 | 32.4k | let _r = self.register_annotation("producers"); |
1004 | 32.4k | let _r = self.register_annotation("name"); |
1005 | 32.4k | let _r = self.register_annotation("dylink.0"); |
1006 | 32.4k | let _r = self.register_annotation("metadata.code.branch_hint"); |
1007 | 32.4k | f(self) |
1008 | 32.4k | } <wast::parser::Parser>::with_standard_annotations_registered::<wast::wat::Wat, <wast::wat::Wat as wast::parser::Parse>::parse::{closure#0}>Line | Count | Source | 998 | 16.6k | pub(crate) fn with_standard_annotations_registered<R>( | 999 | 16.6k | self, | 1000 | 16.6k | f: impl FnOnce(Self) -> Result<R>, | 1001 | 16.6k | ) -> Result<R> { | 1002 | 16.6k | let _r = self.register_annotation("custom"); | 1003 | 16.6k | let _r = self.register_annotation("producers"); | 1004 | 16.6k | let _r = self.register_annotation("name"); | 1005 | 16.6k | let _r = self.register_annotation("dylink.0"); | 1006 | 16.6k | let _r = self.register_annotation("metadata.code.branch_hint"); | 1007 | 16.6k | f(self) | 1008 | 16.6k | } |
<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.39k | pub(crate) fn with_standard_annotations_registered<R>( | 999 | 2.39k | self, | 1000 | 2.39k | f: impl FnOnce(Self) -> Result<R>, | 1001 | 2.39k | ) -> Result<R> { | 1002 | 2.39k | let _r = self.register_annotation("custom"); | 1003 | 2.39k | let _r = self.register_annotation("producers"); | 1004 | 2.39k | let _r = self.register_annotation("name"); | 1005 | 2.39k | let _r = self.register_annotation("dylink.0"); | 1006 | 2.39k | let _r = self.register_annotation("metadata.code.branch_hint"); | 1007 | 2.39k | f(self) | 1008 | 2.39k | } |
<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 | 13.4k | pub(crate) fn with_standard_annotations_registered<R>( | 999 | 13.4k | self, | 1000 | 13.4k | f: impl FnOnce(Self) -> Result<R>, | 1001 | 13.4k | ) -> Result<R> { | 1002 | 13.4k | let _r = self.register_annotation("custom"); | 1003 | 13.4k | let _r = self.register_annotation("producers"); | 1004 | 13.4k | let _r = self.register_annotation("name"); | 1005 | 13.4k | let _r = self.register_annotation("dylink.0"); | 1006 | 13.4k | let _r = self.register_annotation("metadata.code.branch_hint"); | 1007 | 13.4k | f(self) | 1008 | 13.4k | } |
|
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 | 25.2M | pub fn cur_span(&self) -> Span { |
1016 | 25.2M | let offset = match self.token() { |
1017 | 25.2M | Ok(Some(t)) => t.offset, |
1018 | 344 | Ok(None) => self.parser.buf.lexer.input().len(), |
1019 | 0 | Err(_) => self.pos.offset, |
1020 | | }; |
1021 | 25.2M | Span { offset } |
1022 | 25.2M | } |
1023 | | |
1024 | | /// Returns the span of the previous `Token` token. |
1025 | | /// |
1026 | | /// Does not take into account whitespace or comments. |
1027 | 90.4k | pub(crate) fn prev_span(&self) -> Option<Span> { |
1028 | | // TODO |
1029 | 90.4k | Some(Span { |
1030 | 90.4k | offset: self.pos.offset, |
1031 | 90.4k | }) |
1032 | | // let (token, _) = self.parser.buf.tokens.get(self.cur.checked_sub(1)?)?; |
1033 | | // Some(Span { |
1034 | | // offset: token.offset, |
1035 | | // }) |
1036 | 90.4k | } |
1037 | | |
1038 | | /// Same as [`Parser::error`], but works with the current token in this |
1039 | | /// [`Cursor`] instead. |
1040 | 1.34k | pub fn error(&self, msg: impl fmt::Display) -> Error { |
1041 | 1.34k | self.parser.error_at(self.cur_span(), msg) |
1042 | 1.34k | } |
1043 | | |
1044 | | /// Tests whether the next token is an lparen |
1045 | 1.99M | pub fn peek_lparen(self) -> Result<bool> { |
1046 | 739k | Ok(matches!( |
1047 | 1.99M | self.token()?, |
1048 | | Some(Token { |
1049 | | kind: TokenKind::LParen, |
1050 | | .. |
1051 | | }) |
1052 | | )) |
1053 | 1.99M | } |
1054 | | |
1055 | | /// Tests whether the next token is an rparen |
1056 | 5.82k | pub fn peek_rparen(self) -> Result<bool> { |
1057 | 5.82k | Ok(matches!( |
1058 | 5.82k | self.token()?, |
1059 | | Some(Token { |
1060 | | kind: TokenKind::RParen, |
1061 | | .. |
1062 | | }) |
1063 | | )) |
1064 | 5.82k | } |
1065 | | |
1066 | | /// Tests whether the next token is an id |
1067 | 7.13M | pub fn peek_id(self) -> Result<bool> { |
1068 | 7.12M | Ok(matches!( |
1069 | 7.13M | self.token()?, |
1070 | | Some(Token { |
1071 | | kind: TokenKind::Id, |
1072 | | .. |
1073 | | }) |
1074 | | )) |
1075 | 7.13M | } |
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 | 5.80M | pub fn peek_integer(self) -> Result<bool> { |
1101 | 897k | Ok(matches!( |
1102 | 5.80M | self.token()?, |
1103 | | Some(Token { |
1104 | | kind: TokenKind::Integer(_), |
1105 | | .. |
1106 | | }) |
1107 | | )) |
1108 | 5.80M | } |
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 | 20.0k | pub fn peek_string(self) -> Result<bool> { |
1123 | 5.82k | Ok(matches!( |
1124 | 20.0k | self.token()?, |
1125 | | Some(Token { |
1126 | | kind: TokenKind::String, |
1127 | | .. |
1128 | | }) |
1129 | | )) |
1130 | 20.0k | } |
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 | 19.1M | pub fn lparen(mut self) -> Result<Option<Self>> { |
1140 | 19.1M | let token = match self.token()? { |
1141 | 19.1M | Some(token) => token, |
1142 | 34 | None => return Ok(None), |
1143 | | }; |
1144 | 19.1M | match token.kind { |
1145 | 10.4M | TokenKind::LParen => {} |
1146 | 8.72M | _ => return Ok(None), |
1147 | | } |
1148 | 10.4M | self.advance_past(&token); |
1149 | 10.4M | Ok(Some(self)) |
1150 | 19.1M | } |
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.33M | pub fn rparen(mut self) -> Result<Option<Self>> { |
1160 | 9.33M | let token = match self.token()? { |
1161 | 9.33M | Some(token) => token, |
1162 | 20 | None => return Ok(None), |
1163 | | }; |
1164 | 9.33M | match token.kind { |
1165 | 9.33M | TokenKind::RParen => {} |
1166 | 10 | _ => return Ok(None), |
1167 | | } |
1168 | 9.33M | self.advance_past(&token); |
1169 | 9.33M | Ok(Some(self)) |
1170 | 9.33M | } |
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 | 12.8k | pub fn id(mut self) -> Result<Option<(&'a str, Self)>> { |
1182 | 12.8k | let token = match self.token()? { |
1183 | 12.8k | Some(token) => token, |
1184 | 0 | None => return Ok(None), |
1185 | | }; |
1186 | 12.8k | match token.kind { |
1187 | 12.8k | TokenKind::Id => {} |
1188 | 0 | _ => return Ok(None), |
1189 | | } |
1190 | 12.8k | self.advance_past(&token); |
1191 | 12.8k | let id = match token.id(self.parser.buf.lexer.input())? { |
1192 | 12.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 | 12.8k | Ok(Some((id, self))) |
1199 | 12.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 | 55.6M | pub fn keyword(mut self) -> Result<Option<(&'a str, Self)>> { |
1211 | 55.6M | let token = match self.token()? { |
1212 | 55.6M | Some(token) => token, |
1213 | 4.15k | None => return Ok(None), |
1214 | | }; |
1215 | 55.6M | match token.kind { |
1216 | 52.8M | TokenKind::Keyword => {} |
1217 | 2.76M | _ => return Ok(None), |
1218 | | } |
1219 | 52.8M | self.advance_past(&token); |
1220 | 52.8M | Ok(Some((token.keyword(self.parser.buf.lexer.input()), self))) |
1221 | 55.6M | } |
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 | 5.45M | pub fn annotation(mut self) -> Result<Option<(&'a str, Self)>> { |
1233 | 5.45M | let token = match self.token()? { |
1234 | 5.45M | Some(token) => token, |
1235 | 634 | None => return Ok(None), |
1236 | | }; |
1237 | 5.45M | match token.kind { |
1238 | 89 | TokenKind::Annotation => {} |
1239 | 5.45M | _ => return Ok(None), |
1240 | | } |
1241 | 89 | self.advance_past(&token); |
1242 | 89 | let annotation = match token.annotation(self.parser.buf.lexer.input())? { |
1243 | 72 | 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 | 72 | Ok(Some((annotation, self))) |
1250 | 5.45M | } |
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 | 5.57M | pub fn integer(mut self) -> Result<Option<(Integer<'a>, Self)>> { |
1284 | 5.57M | let token = match self.token()? { |
1285 | 5.57M | Some(token) => token, |
1286 | 2 | None => return Ok(None), |
1287 | | }; |
1288 | 5.57M | let i = match token.kind { |
1289 | 5.57M | TokenKind::Integer(i) => i, |
1290 | 474 | _ => return Ok(None), |
1291 | | }; |
1292 | 5.57M | self.advance_past(&token); |
1293 | 5.57M | Ok(Some(( |
1294 | 5.57M | token.integer(self.parser.buf.lexer.input(), i), |
1295 | 5.57M | self, |
1296 | 5.57M | ))) |
1297 | 5.57M | } |
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 | 673k | pub fn float(mut self) -> Result<Option<(Float<'a>, Self)>> { |
1309 | 673k | let token = match self.token()? { |
1310 | 673k | Some(token) => token, |
1311 | 0 | None => return Ok(None), |
1312 | | }; |
1313 | 673k | let f = match token.kind { |
1314 | 673k | TokenKind::Float(f) => f, |
1315 | 8 | _ => return Ok(None), |
1316 | | }; |
1317 | 673k | self.advance_past(&token); |
1318 | 673k | Ok(Some((token.float(self.parser.buf.lexer.input(), f), self))) |
1319 | 673k | } |
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 | 211k | pub fn string(mut self) -> Result<Option<(&'a [u8], Self)>> { |
1331 | 211k | let token = match self.token()? { |
1332 | 211k | Some(token) => token, |
1333 | 6 | None => return Ok(None), |
1334 | | }; |
1335 | 211k | match token.kind { |
1336 | 211k | TokenKind::String => {} |
1337 | 6 | _ => return Ok(None), |
1338 | | } |
1339 | 211k | let string = match token.string(self.parser.buf.lexer.input()) { |
1340 | 185k | Cow::Borrowed(s) => s, |
1341 | 26.8k | Cow::Owned(s) => self.parser.buf.push_str(s), |
1342 | | }; |
1343 | 211k | self.advance_past(&token); |
1344 | 211k | Ok(Some((string, self))) |
1345 | 211k | } |
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 | 166M | fn token(&self) -> Result<Option<Token>> { |
1375 | 166M | match self.pos.token { |
1376 | 166M | Some(token) => Ok(Some(token)), |
1377 | 59.7k | None => self.parser.buf.advance_token(self.pos.offset), |
1378 | | } |
1379 | 166M | } |
1380 | | |
1381 | 86.5M | fn advance_past(&mut self, token: &Token) { |
1382 | 86.5M | self.pos.offset = token.offset + (token.len as usize); |
1383 | 86.5M | self.pos.token = self |
1384 | 86.5M | .parser |
1385 | 86.5M | .buf |
1386 | 86.5M | .advance_token(self.pos.offset) |
1387 | 86.5M | .unwrap_or(None); |
1388 | 86.5M | } |
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 | 14.8M | pub fn peek<T: Peek>(&mut self) -> Result<bool> { |
1397 | 14.8M | Ok(if self.parser.peek::<T>()? { |
1398 | 4.62M | true |
1399 | | } else { |
1400 | 10.2M | self.attempts.push(T::display()); |
1401 | 10.2M | false |
1402 | | }) |
1403 | 14.8M | } <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 | 563k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 563k | Ok(if self.parser.peek::<T>()? { | 1398 | 14.9k | true | 1399 | | } else { | 1400 | 548k | self.attempts.push(T::display()); | 1401 | 548k | false | 1402 | | }) | 1403 | 563k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i8> Line | Count | Source | 1396 | 903k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 903k | Ok(if self.parser.peek::<T>()? { | 1398 | 499k | true | 1399 | | } else { | 1400 | 403k | self.attempts.push(T::display()); | 1401 | 403k | false | 1402 | | }) | 1403 | 903k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::any> Line | Count | Source | 1396 | 569k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 569k | Ok(if self.parser.peek::<T>()? { | 1398 | 5.21k | true | 1399 | | } else { | 1400 | 563k | self.attempts.push(T::display()); | 1401 | 563k | false | 1402 | | }) | 1403 | 569k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::exn> Line | Count | Source | 1396 | 589k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 589k | Ok(if self.parser.peek::<T>()? { | 1398 | 20.5k | true | 1399 | | } else { | 1400 | 569k | self.attempts.push(T::display()); | 1401 | 569k | false | 1402 | | }) | 1403 | 589k | } |
<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 | 403k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 403k | Ok(if self.parser.peek::<T>()? { | 1398 | 153k | true | 1399 | | } else { | 1400 | 249k | self.attempts.push(T::display()); | 1401 | 249k | false | 1402 | | }) | 1403 | 403k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i31> Line | Count | Source | 1396 | 510k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 510k | Ok(if self.parser.peek::<T>()? { | 1398 | 6.38k | true | 1399 | | } else { | 1400 | 503k | self.attempts.push(T::display()); | 1401 | 503k | false | 1402 | | }) | 1403 | 510k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i32> Line | Count | Source | 1396 | 29.2k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 29.2k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 29.2k | self.attempts.push(T::display()); | 1401 | 29.2k | false | 1402 | | }) | 1403 | 29.2k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i64> Line | Count | Source | 1396 | 29.2k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 29.2k | Ok(if self.parser.peek::<T>()? { | 1398 | 21.6k | true | 1399 | | } else { | 1400 | 7.55k | self.attempts.push(T::display()); | 1401 | 7.55k | false | 1402 | | }) | 1403 | 29.2k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::ref> Line | Count | Source | 1396 | 467k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 467k | Ok(if self.parser.peek::<T>()? { | 1398 | 467k | true | 1399 | | } else { | 1400 | 2 | self.attempts.push(T::display()); | 1401 | 2 | false | 1402 | | }) | 1403 | 467k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::sdk> <wast::parser::Lookahead1>::peek::<wast::kw::tag> Line | Count | Source | 1396 | 11.8k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 11.8k | Ok(if self.parser.peek::<T>()? { | 1398 | 11.8k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 11.8k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::cont> Line | Count | Source | 1396 | 569k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 569k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 569k | self.attempts.push(T::display()); | 1401 | 569k | false | 1402 | | }) | 1403 | 569k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::func> Line | Count | Source | 1396 | 1.25M | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 1.25M | Ok(if self.parser.peek::<T>()? { | 1398 | 197k | true | 1399 | | } else { | 1400 | 1.05M | self.attempts.push(T::display()); | 1401 | 1.05M | false | 1402 | | }) | 1403 | 1.25M | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::last> <wast::parser::Lookahead1>::peek::<wast::kw::none> Line | Count | Source | 1396 | 398k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 398k | Ok(if self.parser.peek::<T>()? { | 1398 | 398k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 398k | } |
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 | 808k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 808k | Ok(if self.parser.peek::<T>()? { | 1398 | 298k | true | 1399 | | } else { | 1400 | 510k | self.attempts.push(T::display()); | 1401 | 510k | false | 1402 | | }) | 1403 | 808k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::exact> Line | Count | Source | 1396 | 88.5k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 88.5k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 88.5k | self.attempts.push(T::display()); | 1401 | 88.5k | false | 1402 | | }) | 1403 | 88.5k | } |
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 | 104k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 104k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 104k | self.attempts.push(T::display()); | 1401 | 104k | false | 1402 | | }) | 1403 | 104k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::i32x4> Line | Count | Source | 1396 | 104k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 104k | Ok(if self.parser.peek::<T>()? { | 1398 | 104k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 104k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::i64x2> <wast::parser::Lookahead1>::peek::<wast::kw::i8x16> Line | Count | Source | 1396 | 104k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 104k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 104k | self.attempts.push(T::display()); | 1401 | 104k | false | 1402 | | }) | 1403 | 104k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::noexn> Line | Count | Source | 1396 | 398k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 398k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 398k | self.attempts.push(T::display()); | 1401 | 398k | false | 1402 | | }) | 1403 | 398k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::param> Line | Count | Source | 1396 | 699k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 699k | Ok(if self.parser.peek::<T>()? { | 1398 | 233k | true | 1399 | | } else { | 1400 | 466k | self.attempts.push(T::display()); | 1401 | 466k | false | 1402 | | }) | 1403 | 699k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::table> Line | Count | Source | 1396 | 69.1k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 69.1k | Ok(if self.parser.peek::<T>()? { | 1398 | 21.5k | true | 1399 | | } else { | 1400 | 47.6k | self.attempts.push(T::display()); | 1401 | 47.6k | false | 1402 | | }) | 1403 | 69.1k | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::before> <wast::parser::Lookahead1>::peek::<wast::kw::extern> Line | Count | Source | 1396 | 634k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 634k | Ok(if self.parser.peek::<T>()? { | 1398 | 44.7k | true | 1399 | | } else { | 1400 | 589k | self.attempts.push(T::display()); | 1401 | 589k | false | 1402 | | }) | 1403 | 634k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::global> Line | Count | Source | 1396 | 40.1k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 40.1k | Ok(if self.parser.peek::<T>()? { | 1398 | 28.2k | true | 1399 | | } else { | 1400 | 11.8k | self.attempts.push(T::display()); | 1401 | 11.8k | false | 1402 | | }) | 1403 | 40.1k | } |
<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 | 47.6k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 47.6k | Ok(if self.parser.peek::<T>()? { | 1398 | 7.51k | true | 1399 | | } else { | 1400 | 40.1k | self.attempts.push(T::display()); | 1401 | 40.1k | false | 1402 | | }) | 1403 | 47.6k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::module> Line | Count | Source | 1396 | 19 | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 19 | Ok(if self.parser.peek::<T>()? { | 1398 | 9 | true | 1399 | | } else { | 1400 | 10 | self.attempts.push(T::display()); | 1401 | 10 | false | 1402 | | }) | 1403 | 19 | } |
Unexecuted instantiation: <wast::parser::Lookahead1>::peek::<wast::kw::needed> <wast::parser::Lookahead1>::peek::<wast::kw::nocont> Line | Count | Source | 1396 | 398k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 398k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 398k | self.attempts.push(T::display()); | 1401 | 398k | false | 1402 | | }) | 1403 | 398k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::nofunc> Line | Count | Source | 1396 | 503k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 503k | Ok(if self.parser.peek::<T>()? { | 1398 | 55.9k | true | 1399 | | } else { | 1400 | 447k | self.attempts.push(T::display()); | 1401 | 447k | false | 1402 | | }) | 1403 | 503k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::result> Line | Count | Source | 1396 | 466k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 466k | Ok(if self.parser.peek::<T>()? { | 1398 | 466k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 466k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::shared> Line | Count | Source | 1396 | 16.7k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 16.7k | Ok(if self.parser.peek::<T>()? { | 1398 | 1.28k | true | 1399 | | } else { | 1400 | 15.4k | self.attempts.push(T::display()); | 1401 | 15.4k | false | 1402 | | }) | 1403 | 16.7k | } |
<wast::parser::Lookahead1>::peek::<wast::kw::struct> Line | Count | Source | 1396 | 904k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 904k | Ok(if self.parser.peek::<T>()? { | 1398 | 96.0k | true | 1399 | | } else { | 1400 | 808k | self.attempts.push(T::display()); | 1401 | 808k | false | 1402 | | }) | 1403 | 904k | } |
<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 | 447k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 447k | Ok(if self.parser.peek::<T>()? { | 1398 | 49.3k | true | 1399 | | } else { | 1400 | 398k | self.attempts.push(T::display()); | 1401 | 398k | false | 1402 | | }) | 1403 | 447k | } |
<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.15M | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 1.15M | Ok(if self.parser.peek::<T>()? { | 1398 | 499k | true | 1399 | | } else { | 1400 | 653k | self.attempts.push(T::display()); | 1401 | 653k | false | 1402 | | }) | 1403 | 1.15M | } |
<wast::parser::Lookahead1>::peek::<wast::token::LParen> Line | Count | Source | 1396 | 680k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 680k | Ok(if self.parser.peek::<T>()? { | 1398 | 88.5k | true | 1399 | | } else { | 1400 | 591k | self.attempts.push(T::display()); | 1401 | 591k | false | 1402 | | }) | 1403 | 680k | } |
<wast::parser::Lookahead1>::peek::<wast::core::types::AbstractHeapType> Line | Count | Source | 1396 | 565k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 565k | Ok(if self.parser.peek::<T>()? { | 1398 | 565k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 565k | } |
<wast::parser::Lookahead1>::peek::<wast::core::types::RefType> Line | Count | Source | 1396 | 16.7k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 16.7k | Ok(if self.parser.peek::<T>()? { | 1398 | 0 | true | 1399 | | } else { | 1400 | 16.7k | self.attempts.push(T::display()); | 1401 | 16.7k | false | 1402 | | }) | 1403 | 16.7k | } |
<wast::parser::Lookahead1>::peek::<wast::core::types::ValType> Line | Count | Source | 1396 | 249k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 249k | Ok(if self.parser.peek::<T>()? { | 1398 | 249k | true | 1399 | | } else { | 1400 | 0 | self.attempts.push(T::display()); | 1401 | 0 | false | 1402 | | }) | 1403 | 249k | } |
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 | 26.6k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 26.6k | Ok(if self.parser.peek::<T>()? { | 1398 | 14.1k | true | 1399 | | } else { | 1400 | 12.5k | self.attempts.push(T::display()); | 1401 | 12.5k | false | 1402 | | }) | 1403 | 26.6k | } |
<wast::parser::Lookahead1>::peek::<u64> Line | Count | Source | 1396 | 6.25k | pub fn peek<T: Peek>(&mut self) -> Result<bool> { | 1397 | 6.25k | Ok(if self.parser.peek::<T>()? { | 1398 | 6.25k | true | 1399 | | } else { | 1400 | 9 | self.attempts.push(T::display()); | 1401 | 9 | false | 1402 | | }) | 1403 | 6.25k | } |
|
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.31M | fn parse(parser: Parser<'a>) -> Result<Option<T>> { |
1446 | 3.31M | if parser.peek::<T>()? { |
1447 | 745k | Ok(Some(parser.parse()?)) |
1448 | | } else { |
1449 | 2.57M | Ok(None) |
1450 | | } |
1451 | 3.31M | } <core::option::Option<wast::kw::i32> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 5 | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 5 | if parser.peek::<T>()? { | 1447 | 0 | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 5 | Ok(None) | 1450 | | } | 1451 | 5 | } |
<core::option::Option<wast::kw::i64> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 5 | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 5 | if parser.peek::<T>()? { | 1447 | 0 | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 5 | Ok(None) | 1450 | | } | 1451 | 5 | } |
<core::option::Option<wast::kw::shared> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 59.0k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 59.0k | if parser.peek::<T>()? { | 1447 | 4.49k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 54.5k | Ok(None) | 1450 | | } | 1451 | 59.0k | } |
<core::option::Option<wast::token::Id> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 1.87M | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 1.87M | if parser.peek::<T>()? { | 1447 | 12.8k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 1.86M | Ok(None) | 1450 | | } | 1451 | 1.87M | } |
<core::option::Option<wast::token::Index> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 418k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 418k | if parser.peek::<T>()? { | 1447 | 327k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 90.3k | Ok(None) | 1450 | | } | 1451 | 418k | } |
<core::option::Option<wast::core::types::FunctionType> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 222k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 222k | if parser.peek::<T>()? { | 1447 | 170k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 51.4k | Ok(None) | 1450 | | } | 1451 | 222k | } |
<core::option::Option<wast::core::types::FunctionTypeNoNames> as wast::parser::Parse>::parse Line | Count | Source | 1445 | 457k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 457k | if parser.peek::<T>()? { | 1447 | 229k | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 228k | Ok(None) | 1450 | | } | 1451 | 457k | } |
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 | 286k | fn parse(parser: Parser<'a>) -> Result<Option<T>> { | 1446 | 286k | if parser.peek::<T>()? { | 1447 | 0 | Ok(Some(parser.parse()?)) | 1448 | | } else { | 1449 | 286k | Ok(None) | 1450 | | } | 1451 | 286k | } |
Unexecuted instantiation: <core::option::Option<u32> as wast::parser::Parse>::parse |
1452 | | } |