1pub mod peg {
3 #[allow(unused_imports)]
4 use super::*;
5 type Input = FlatTokenStream;
6 type PositionRepr = <Input as ::peg::Parse>::PositionRepr;
7 #[allow(unused_parens)]
8 struct ParseState<'input> {
9 _phantom: ::core::marker::PhantomData<(&'input ())>,
10 primary_cache: ::std::collections::HashMap<usize, ::peg::RuleResult<SpannedExpr>>,
11 }
12 impl<'input> ParseState<'input> {
13 fn new() -> ParseState<'input> {
14 ParseState {
15 _phantom: ::core::marker::PhantomData,
16 primary_cache: ::std::collections::HashMap::new(),
17 }
18 }
19 }
20 use crate::ast::Expr::*;
21 use crate::ast::*;
22 use crate::tokens::FlatTokenStream;
23 use proc_macro2::{Delimiter, Group, Ident, Literal, Span, TokenStream};
24 pub fn peg_grammar<'input>(
25 __input: &'input Input,
26 ) -> ::core::result::Result<Grammar, ::peg::error::ParseError<PositionRepr>> {
27 #![allow(non_snake_case, unused)]
28 let mut __err_state = ::peg::error::ErrorState::new(::peg::Parse::start(__input));
29 let mut __state = ParseState::new();
30 match __parse_peg_grammar(
31 __input,
32 &mut __state,
33 &mut __err_state,
34 ::peg::Parse::start(__input),
35 ) {
36 ::peg::RuleResult::Matched(__pos, __value) => {
37 if ::peg::Parse::is_eof(__input, __pos) {
38 return Ok(__value);
39 } else {
40 __err_state.mark_failure(__pos, "EOF");
41 }
42 }
43 _ => (),
44 }
45 __state = ParseState::new();
46 __err_state.reparse_for_error();
47 match __parse_peg_grammar(
48 __input,
49 &mut __state,
50 &mut __err_state,
51 ::peg::Parse::start(__input),
52 ) {
53 ::peg::RuleResult::Matched(__pos, __value) => {
54 if ::peg::Parse::is_eof(__input, __pos) {
55 panic!(
56 "Parser is nondeterministic: succeeded when reparsing for error position"
57 );
58 return Ok(__value);
59 } else {
60 __err_state.mark_failure(__pos, "EOF");
61 }
62 }
63 _ => (),
64 }
65 Err(__err_state.into_parse_error(__input))
66 }
67 fn __parse_peg_grammar<'input>(
68 __input: &'input Input,
69 __state: &mut ParseState<'input>,
70 __err_state: &mut ::peg::error::ErrorState,
71 __pos: usize,
72 ) -> ::peg::RuleResult<Grammar> {
73 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
74 {
75 let __seq_res = __parse_rust_doc_comment(__input, __state, __err_state, __pos);
76 match __seq_res {
77 ::peg::RuleResult::Matched(__pos, doc) => {
78 let __seq_res = __parse_rust_visibility(__input, __state, __err_state, __pos);
79 match __seq_res {
80 ::peg::RuleResult::Matched(__pos, visibility) => {
81 match ::peg::ParseLiteral::parse_string_literal(
82 __input, __pos, "grammar",
83 ) {
84 ::peg::RuleResult::Matched(__pos, __val) => {
85 let __seq_res =
86 __parse_IDENT(__input, __state, __err_state, __pos);
87 match __seq_res {
88 ::peg::RuleResult::Matched(__pos, name) => {
89 let __seq_res = match __parse_rust_lifetime_params(
90 __input,
91 __state,
92 __err_state,
93 __pos,
94 ) {
95 ::peg::RuleResult::Matched(__newpos, __value) => {
96 ::peg::RuleResult::Matched(
97 __newpos,
98 Some(__value),
99 )
100 }
101 ::peg::RuleResult::Failed => {
102 ::peg::RuleResult::Matched(__pos, None)
103 }
104 };
105 match __seq_res {
106 ::peg::RuleResult::Matched(
107 __pos,
108 lifetime_params,
109 ) => {
110 let __seq_res = __parse_grammar_args(
111 __input,
112 __state,
113 __err_state,
114 __pos,
115 );
116 match __seq_res { :: peg :: RuleResult :: Matched (__pos , args) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "for") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = { let str_start = __pos ; match match __parse_rust_type (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , :: peg :: ParseSlice :: parse_slice (__input , str_start , __newpos)) } , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , input_type) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "{") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! () ; loop { let __pos = __repeat_pos ; let __step_res = __parse_item (__input , __state , __err_state , __pos) ; match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; __repeat_value . push (__value) ; } , :: peg :: RuleResult :: Failed => { break ; } } } :: peg :: RuleResult :: Matched (__repeat_pos , __repeat_value) } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , items) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "}") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { Grammar { doc , visibility , name , lifetime_params , args , input_type , items } }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"}\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"{\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"for\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
117 }
118 ::peg::RuleResult::Failed => {
119 ::peg::RuleResult::Failed
120 }
121 }
122 }
123 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
124 }
125 }
126 ::peg::RuleResult::Failed => {
127 __err_state.mark_failure(__pos, "\"grammar\"");
128 ::peg::RuleResult::Failed
129 }
130 }
131 }
132 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
133 }
134 }
135 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
136 }
137 }
138 }
139 fn __parse_rust_lifetime_params<'input>(
140 __input: &'input Input,
141 __state: &mut ParseState<'input>,
142 __err_state: &mut ::peg::error::ErrorState,
143 __pos: usize,
144 ) -> ::peg::RuleResult<Vec<TokenStream>> {
145 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
146 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "<") {
147 ::peg::RuleResult::Matched(__pos, __val) => {
148 let __seq_res = {
149 let mut __repeat_pos = __pos;
150 let mut __repeat_value = vec![];
151 loop {
152 let __pos = __repeat_pos;
153 let __pos = if __repeat_value.is_empty() {
154 __pos
155 } else {
156 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
157 __input, __pos, ",",
158 ) {
159 ::peg::RuleResult::Matched(__pos, __val) => {
160 ::peg::RuleResult::Matched(__pos, __val)
161 }
162 ::peg::RuleResult::Failed => {
163 __err_state.mark_failure(__pos, "\",\"");
164 ::peg::RuleResult::Failed
165 }
166 };
167 match __sep_res {
168 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
169 ::peg::RuleResult::Failed => break,
170 }
171 };
172 let __step_res = {
173 let str_start = __pos;
174 match match __parse_LIFETIME(__input, __state, __err_state, __pos) {
175 ::peg::RuleResult::Matched(pos, _) => {
176 ::peg::RuleResult::Matched(pos, ())
177 }
178 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
179 } {
180 ::peg::RuleResult::Matched(__newpos, _) => {
181 ::peg::RuleResult::Matched(
182 __newpos,
183 ::peg::ParseSlice::parse_slice(
184 __input, str_start, __newpos,
185 ),
186 )
187 }
188 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
189 }
190 };
191 match __step_res {
192 ::peg::RuleResult::Matched(__newpos, __value) => {
193 __repeat_pos = __newpos;
194 __repeat_value.push(__value);
195 }
196 ::peg::RuleResult::Failed => {
197 break;
198 }
199 }
200 }
201 if __repeat_value.len() >= 1 {
202 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
203 } else {
204 ::peg::RuleResult::Failed
205 }
206 };
207 match __seq_res {
208 ::peg::RuleResult::Matched(__pos, p) => {
209 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
210 __input, __pos, ",",
211 ) {
212 ::peg::RuleResult::Matched(__pos, __val) => {
213 ::peg::RuleResult::Matched(__pos, __val)
214 }
215 ::peg::RuleResult::Failed => {
216 __err_state.mark_failure(__pos, "\",\"");
217 ::peg::RuleResult::Failed
218 }
219 } {
220 ::peg::RuleResult::Matched(__newpos, _) => {
221 ::peg::RuleResult::Matched(__newpos, ())
222 }
223 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
224 };
225 match __seq_res {
226 ::peg::RuleResult::Matched(__pos, _) => {
227 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ">")
228 {
229 ::peg::RuleResult::Matched(__pos, __val) => {
230 ::peg::RuleResult::Matched(__pos, (|| p)())
231 }
232 ::peg::RuleResult::Failed => {
233 __err_state.mark_failure(__pos, "\">\"");
234 ::peg::RuleResult::Failed
235 }
236 }
237 }
238 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
239 }
240 }
241 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
242 }
243 }
244 ::peg::RuleResult::Failed => {
245 __err_state.mark_failure(__pos, "\"<\"");
246 ::peg::RuleResult::Failed
247 }
248 }
249 }
250 fn __parse_grammar_args<'input>(
251 __input: &'input Input,
252 __state: &mut ParseState<'input>,
253 __err_state: &mut ::peg::error::ErrorState,
254 __pos: usize,
255 ) -> ::peg::RuleResult<Vec<(Ident, TokenStream)>> {
256 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
257 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "(") {
258 ::peg::RuleResult::Matched(__pos, __val) => {
259 let __seq_res = {
260 let mut __repeat_pos = __pos;
261 let mut __repeat_value = vec![];
262 loop {
263 let __pos = __repeat_pos;
264 let __pos = if __repeat_value.is_empty() {
265 __pos
266 } else {
267 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
268 __input, __pos, ",",
269 ) {
270 ::peg::RuleResult::Matched(__pos, __val) => {
271 ::peg::RuleResult::Matched(__pos, __val)
272 }
273 ::peg::RuleResult::Failed => {
274 __err_state.mark_failure(__pos, "\",\"");
275 ::peg::RuleResult::Failed
276 }
277 };
278 match __sep_res {
279 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
280 ::peg::RuleResult::Failed => break,
281 }
282 };
283 let __step_res = {
284 let __seq_res = __parse_IDENT(__input, __state, __err_state, __pos);
285 match __seq_res {
286 ::peg::RuleResult::Matched(__pos, i) => {
287 match ::peg::ParseLiteral::parse_string_literal(
288 __input, __pos, ":",
289 ) {
290 ::peg::RuleResult::Matched(__pos, __val) => {
291 let __seq_res = {
292 let str_start = __pos;
293 match match __parse_rust_type(
294 __input,
295 __state,
296 __err_state,
297 __pos,
298 ) {
299 ::peg::RuleResult::Matched(pos, _) => {
300 ::peg::RuleResult::Matched(pos, ())
301 }
302 ::peg::RuleResult::Failed => {
303 ::peg::RuleResult::Failed
304 }
305 } {
306 ::peg::RuleResult::Matched(__newpos, _) => {
307 ::peg::RuleResult::Matched(
308 __newpos,
309 ::peg::ParseSlice::parse_slice(
310 __input, str_start, __newpos,
311 ),
312 )
313 }
314 ::peg::RuleResult::Failed => {
315 ::peg::RuleResult::Failed
316 }
317 }
318 };
319 match __seq_res {
320 ::peg::RuleResult::Matched(__pos, t) => {
321 ::peg::RuleResult::Matched(__pos, (|| (i, t))())
322 }
323 ::peg::RuleResult::Failed => {
324 ::peg::RuleResult::Failed
325 }
326 }
327 }
328 ::peg::RuleResult::Failed => {
329 __err_state.mark_failure(__pos, "\":\"");
330 ::peg::RuleResult::Failed
331 }
332 }
333 }
334 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
335 }
336 };
337 match __step_res {
338 ::peg::RuleResult::Matched(__newpos, __value) => {
339 __repeat_pos = __newpos;
340 __repeat_value.push(__value);
341 }
342 ::peg::RuleResult::Failed => {
343 break;
344 }
345 }
346 }
347 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
348 };
349 match __seq_res {
350 ::peg::RuleResult::Matched(__pos, args) => {
351 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
352 __input, __pos, ",",
353 ) {
354 ::peg::RuleResult::Matched(__pos, __val) => {
355 ::peg::RuleResult::Matched(__pos, __val)
356 }
357 ::peg::RuleResult::Failed => {
358 __err_state.mark_failure(__pos, "\",\"");
359 ::peg::RuleResult::Failed
360 }
361 } {
362 ::peg::RuleResult::Matched(__newpos, _) => {
363 ::peg::RuleResult::Matched(__newpos, ())
364 }
365 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
366 };
367 match __seq_res {
368 ::peg::RuleResult::Matched(__pos, _) => {
369 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ")")
370 {
371 ::peg::RuleResult::Matched(__pos, __val) => {
372 ::peg::RuleResult::Matched(__pos, (|| args)())
373 }
374 ::peg::RuleResult::Failed => {
375 __err_state.mark_failure(__pos, "\")\"");
376 ::peg::RuleResult::Failed
377 }
378 }
379 }
380 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
381 }
382 }
383 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
384 }
385 }
386 ::peg::RuleResult::Failed => {
387 __err_state.mark_failure(__pos, "\"(\"");
388 ::peg::RuleResult::Failed
389 }
390 }
391 }
392 fn __parse_peg_rule<'input>(
393 __input: &'input Input,
394 __state: &mut ParseState<'input>,
395 __err_state: &mut ::peg::error::ErrorState,
396 __pos: usize,
397 ) -> ::peg::RuleResult<Rule> {
398 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
399 {
400 let __seq_res = __parse_rust_doc_comment(__input, __state, __err_state, __pos);
401 match __seq_res {
402 ::peg::RuleResult::Matched(__pos, doc) => {
403 let __seq_res = __parse_cacheflag(__input, __state, __err_state, __pos);
404 match __seq_res {
405 ::peg::RuleResult::Matched(__pos, cache) => {
406 let __seq_res =
407 __parse_no_eof_flag(__input, __state, __err_state, __pos);
408 match __seq_res {
409 ::peg::RuleResult::Matched(__pos, no_eof) => {
410 let __seq_res = __parse_rust_visibility(
411 __input,
412 __state,
413 __err_state,
414 __pos,
415 );
416 match __seq_res {
417 ::peg::RuleResult::Matched(__pos, visibility) => {
418 let __seq_res =
419 __parse_sp(__input, __state, __err_state, __pos);
420 match __seq_res {
421 ::peg::RuleResult::Matched(__pos, span) => {
422 match ::peg::ParseLiteral::parse_string_literal(
423 __input, __pos, "rule",
424 ) {
425 ::peg::RuleResult::Matched(
426 __pos,
427 __val,
428 ) => {
429 let __seq_res = {
430 let __choice_res = {
431 let __seq_res = {
432 __err_state
433 .suppress_fail += 1;
434 let __assert_res = {
435 let __choice_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "_") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"_\"") ; :: peg :: RuleResult :: Failed } } ;
436 match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => { let __choice_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "__") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"__\"") ; :: peg :: RuleResult :: Failed } } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "___") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"___\"") ; :: peg :: RuleResult :: Failed } } } } }
437 };
438 __err_state
439 .suppress_fail -= 1;
440 match __assert_res { :: peg :: RuleResult :: Matched (_ , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
441 };
442 match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { { let __seq_res = __parse_IDENT (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , name) => { { let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "(") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ")") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\")\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"(\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , (|| { (name , None , Vec :: new ()) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
443 };
444 match __choice_res {
445 ::peg::RuleResult::Matched(
446 __pos,
447 __value,
448 ) => {
449 ::peg::RuleResult::Matched(
450 __pos, __value,
451 )
452 }
453 ::peg::RuleResult::Failed => {
454 let __seq_res =
455 __parse_IDENT(
456 __input,
457 __state,
458 __err_state,
459 __pos,
460 );
461 match __seq_res { :: peg :: RuleResult :: Matched (__pos , name) => { { let __seq_res = match __parse_rust_ty_params (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (__newpos , __value) => { :: peg :: RuleResult :: Matched (__newpos , Some (__value)) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , None) } , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , ty_params) => { { let __seq_res = __parse_rule_params (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , params) => { :: peg :: RuleResult :: Matched (__pos , (|| { (name , ty_params , params) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
462 }
463 }
464 };
465 match __seq_res {
466 ::peg::RuleResult::Matched(
467 __pos,
468 header,
469 ) => {
470 let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "->") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = { let str_start = __pos ; match match __parse_rust_type (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , :: peg :: ParseSlice :: parse_slice (__input , str_start , __newpos)) } , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , t) => { :: peg :: RuleResult :: Matched (__pos , (|| { t }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"->\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , __value) => { :: peg :: RuleResult :: Matched (__newpos , Some (__value)) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , None) } , } ;
471 match __seq_res { :: peg :: RuleResult :: Matched (__pos , ret_type) => { { let __seq_res = match { let str_start = __pos ; match match __parse_rust_where_clause (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , :: peg :: ParseSlice :: parse_slice (__input , str_start , __newpos)) } , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } { :: peg :: RuleResult :: Matched (__newpos , __value) => { :: peg :: RuleResult :: Matched (__newpos , Some (__value)) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , None) } , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , where_clause) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "=") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_expression (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , expr) => { { let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ";") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\";\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , (|| { Rule { span , doc , name : header . 0 , ty_params : header . 1 , params : header . 2 , expr , ret_type , where_clause , visibility , no_eof , cache } }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"=\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
472 }
473 ::peg::RuleResult::Failed => {
474 ::peg::RuleResult::Failed
475 }
476 }
477 }
478 ::peg::RuleResult::Failed => {
479 __err_state
480 .mark_failure(__pos, "\"rule\"");
481 ::peg::RuleResult::Failed
482 }
483 }
484 }
485 ::peg::RuleResult::Failed => {
486 ::peg::RuleResult::Failed
487 }
488 }
489 }
490 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
491 }
492 }
493 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
494 }
495 }
496 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
497 }
498 }
499 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
500 }
501 }
502 }
503 fn __parse_cacheflag<'input>(
504 __input: &'input Input,
505 __state: &mut ParseState<'input>,
506 __err_state: &mut ::peg::error::ErrorState,
507 __pos: usize,
508 ) -> ::peg::RuleResult<Option<Cache>> {
509 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
510 {
511 let __choice_res = match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "#")
512 {
513 ::peg::RuleResult::Matched(__pos, __val) => {
514 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "[") {
515 ::peg::RuleResult::Matched(__pos, __val) => {
516 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "cache")
517 {
518 ::peg::RuleResult::Matched(__pos, __val) => {
519 match ::peg::ParseLiteral::parse_string_literal(
520 __input, __pos, "]",
521 ) {
522 ::peg::RuleResult::Matched(__pos, __val) => {
523 ::peg::RuleResult::Matched(
524 __pos,
525 (|| Some(Cache::Simple))(),
526 )
527 }
528 ::peg::RuleResult::Failed => {
529 __err_state.mark_failure(__pos, "\"]\"");
530 ::peg::RuleResult::Failed
531 }
532 }
533 }
534 ::peg::RuleResult::Failed => {
535 __err_state.mark_failure(__pos, "\"cache\"");
536 ::peg::RuleResult::Failed
537 }
538 }
539 }
540 ::peg::RuleResult::Failed => {
541 __err_state.mark_failure(__pos, "\"[\"");
542 ::peg::RuleResult::Failed
543 }
544 }
545 }
546 ::peg::RuleResult::Failed => {
547 __err_state.mark_failure(__pos, "\"#\"");
548 ::peg::RuleResult::Failed
549 }
550 };
551 match __choice_res {
552 ::peg::RuleResult::Matched(__pos, __value) => {
553 ::peg::RuleResult::Matched(__pos, __value)
554 }
555 ::peg::RuleResult::Failed => {
556 let __choice_res =
557 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "#") {
558 ::peg::RuleResult::Matched(__pos, __val) => {
559 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "[")
560 {
561 ::peg::RuleResult::Matched(__pos, __val) => {
562 match ::peg::ParseLiteral::parse_string_literal(
563 __input,
564 __pos,
565 "cache_left_rec",
566 ) {
567 ::peg::RuleResult::Matched(__pos, __val) => {
568 match ::peg::ParseLiteral::parse_string_literal(
569 __input, __pos, "]",
570 ) {
571 ::peg::RuleResult::Matched(__pos, __val) => {
572 ::peg::RuleResult::Matched(
573 __pos,
574 (|| Some(Cache::Recursive))(),
575 )
576 }
577 ::peg::RuleResult::Failed => {
578 __err_state.mark_failure(__pos, "\"]\"");
579 ::peg::RuleResult::Failed
580 }
581 }
582 }
583 ::peg::RuleResult::Failed => {
584 __err_state
585 .mark_failure(__pos, "\"cache_left_rec\"");
586 ::peg::RuleResult::Failed
587 }
588 }
589 }
590 ::peg::RuleResult::Failed => {
591 __err_state.mark_failure(__pos, "\"[\"");
592 ::peg::RuleResult::Failed
593 }
594 }
595 }
596 ::peg::RuleResult::Failed => {
597 __err_state.mark_failure(__pos, "\"#\"");
598 ::peg::RuleResult::Failed
599 }
600 };
601 match __choice_res {
602 ::peg::RuleResult::Matched(__pos, __value) => {
603 ::peg::RuleResult::Matched(__pos, __value)
604 }
605 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, (|| None)()),
606 }
607 }
608 }
609 }
610 }
611 fn __parse_no_eof_flag<'input>(
612 __input: &'input Input,
613 __state: &mut ParseState<'input>,
614 __err_state: &mut ::peg::error::ErrorState,
615 __pos: usize,
616 ) -> ::peg::RuleResult<bool> {
617 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
618 {
619 let __choice_res = match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "#")
620 {
621 ::peg::RuleResult::Matched(__pos, __val) => {
622 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "[") {
623 ::peg::RuleResult::Matched(__pos, __val) => {
624 match ::peg::ParseLiteral::parse_string_literal(
625 __input, __pos, "no_eof",
626 ) {
627 ::peg::RuleResult::Matched(__pos, __val) => {
628 match ::peg::ParseLiteral::parse_string_literal(
629 __input, __pos, "]",
630 ) {
631 ::peg::RuleResult::Matched(__pos, __val) => {
632 ::peg::RuleResult::Matched(__pos, (|| true)())
633 }
634 ::peg::RuleResult::Failed => {
635 __err_state.mark_failure(__pos, "\"]\"");
636 ::peg::RuleResult::Failed
637 }
638 }
639 }
640 ::peg::RuleResult::Failed => {
641 __err_state.mark_failure(__pos, "\"no_eof\"");
642 ::peg::RuleResult::Failed
643 }
644 }
645 }
646 ::peg::RuleResult::Failed => {
647 __err_state.mark_failure(__pos, "\"[\"");
648 ::peg::RuleResult::Failed
649 }
650 }
651 }
652 ::peg::RuleResult::Failed => {
653 __err_state.mark_failure(__pos, "\"#\"");
654 ::peg::RuleResult::Failed
655 }
656 };
657 match __choice_res {
658 ::peg::RuleResult::Matched(__pos, __value) => {
659 ::peg::RuleResult::Matched(__pos, __value)
660 }
661 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, (|| false)()),
662 }
663 }
664 }
665 fn __parse_rule_param_ty<'input>(
666 __input: &'input Input,
667 __state: &mut ParseState<'input>,
668 __err_state: &mut ::peg::error::ErrorState,
669 __pos: usize,
670 ) -> ::peg::RuleResult<RuleParamTy> {
671 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
672 {
673 let __choice_res =
674 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "rule") {
675 ::peg::RuleResult::Matched(__pos, __val) => {
676 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "<") {
677 ::peg::RuleResult::Matched(__pos, __val) => {
678 let __seq_res = {
679 let str_start = __pos;
680 match match __parse_rust_type(
681 __input,
682 __state,
683 __err_state,
684 __pos,
685 ) {
686 ::peg::RuleResult::Matched(pos, _) => {
687 ::peg::RuleResult::Matched(pos, ())
688 }
689 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
690 } {
691 ::peg::RuleResult::Matched(__newpos, _) => {
692 ::peg::RuleResult::Matched(
693 __newpos,
694 ::peg::ParseSlice::parse_slice(
695 __input, str_start, __newpos,
696 ),
697 )
698 }
699 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
700 }
701 };
702 match __seq_res {
703 ::peg::RuleResult::Matched(__pos, r) => {
704 match ::peg::ParseLiteral::parse_string_literal(
705 __input, __pos, ">",
706 ) {
707 ::peg::RuleResult::Matched(__pos, __val) => {
708 ::peg::RuleResult::Matched(
709 __pos,
710 (|| RuleParamTy::Rule(r))(),
711 )
712 }
713 ::peg::RuleResult::Failed => {
714 __err_state.mark_failure(__pos, "\">\"");
715 ::peg::RuleResult::Failed
716 }
717 }
718 }
719 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
720 }
721 }
722 ::peg::RuleResult::Failed => {
723 __err_state.mark_failure(__pos, "\"<\"");
724 ::peg::RuleResult::Failed
725 }
726 }
727 }
728 ::peg::RuleResult::Failed => {
729 __err_state.mark_failure(__pos, "\"rule\"");
730 ::peg::RuleResult::Failed
731 }
732 };
733 match __choice_res {
734 ::peg::RuleResult::Matched(__pos, __value) => {
735 ::peg::RuleResult::Matched(__pos, __value)
736 }
737 ::peg::RuleResult::Failed => {
738 let __seq_res = {
739 let str_start = __pos;
740 match match __parse_rust_type(__input, __state, __err_state, __pos) {
741 ::peg::RuleResult::Matched(pos, _) => {
742 ::peg::RuleResult::Matched(pos, ())
743 }
744 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
745 } {
746 ::peg::RuleResult::Matched(__newpos, _) => ::peg::RuleResult::Matched(
747 __newpos,
748 ::peg::ParseSlice::parse_slice(__input, str_start, __newpos),
749 ),
750 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
751 }
752 };
753 match __seq_res {
754 ::peg::RuleResult::Matched(__pos, t) => {
755 ::peg::RuleResult::Matched(__pos, (|| RuleParamTy::Rust(t))())
756 }
757 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
758 }
759 }
760 }
761 }
762 }
763 fn __parse_rule_params<'input>(
764 __input: &'input Input,
765 __state: &mut ParseState<'input>,
766 __err_state: &mut ::peg::error::ErrorState,
767 __pos: usize,
768 ) -> ::peg::RuleResult<Vec<RuleParam>> {
769 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
770 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "(") {
771 ::peg::RuleResult::Matched(__pos, __val) => {
772 let __seq_res = match {
773 let __seq_res = {
774 let mut __repeat_pos = __pos;
775 let mut __repeat_value = vec![];
776 loop {
777 let __pos = __repeat_pos;
778 let __pos = if __repeat_value.is_empty() {
779 __pos
780 } else {
781 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
782 __input, __pos, ",",
783 ) {
784 ::peg::RuleResult::Matched(__pos, __val) => {
785 ::peg::RuleResult::Matched(__pos, __val)
786 }
787 ::peg::RuleResult::Failed => {
788 __err_state.mark_failure(__pos, "\",\"");
789 ::peg::RuleResult::Failed
790 }
791 };
792 match __sep_res {
793 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
794 ::peg::RuleResult::Failed => break,
795 }
796 };
797 let __step_res = {
798 let __seq_res = __parse_IDENT(__input, __state, __err_state, __pos);
799 match __seq_res {
800 ::peg::RuleResult::Matched(__pos, name) => {
801 match ::peg::ParseLiteral::parse_string_literal(
802 __input, __pos, ":",
803 ) {
804 ::peg::RuleResult::Matched(__pos, __val) => {
805 let __seq_res = __parse_rule_param_ty(
806 __input,
807 __state,
808 __err_state,
809 __pos,
810 );
811 match __seq_res {
812 ::peg::RuleResult::Matched(__pos, ty) => {
813 ::peg::RuleResult::Matched(
814 __pos,
815 (|| RuleParam { name, ty })(),
816 )
817 }
818 ::peg::RuleResult::Failed => {
819 ::peg::RuleResult::Failed
820 }
821 }
822 }
823 ::peg::RuleResult::Failed => {
824 __err_state.mark_failure(__pos, "\":\"");
825 ::peg::RuleResult::Failed
826 }
827 }
828 }
829 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
830 }
831 };
832 match __step_res {
833 ::peg::RuleResult::Matched(__newpos, __value) => {
834 __repeat_pos = __newpos;
835 __repeat_value.push(__value);
836 }
837 ::peg::RuleResult::Failed => {
838 break;
839 }
840 }
841 }
842 if __repeat_value.len() >= 1 {
843 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
844 } else {
845 ::peg::RuleResult::Failed
846 }
847 };
848 match __seq_res {
849 ::peg::RuleResult::Matched(__pos, x) => {
850 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
851 __input, __pos, ",",
852 ) {
853 ::peg::RuleResult::Matched(__pos, __val) => {
854 ::peg::RuleResult::Matched(__pos, __val)
855 }
856 ::peg::RuleResult::Failed => {
857 __err_state.mark_failure(__pos, "\",\"");
858 ::peg::RuleResult::Failed
859 }
860 } {
861 ::peg::RuleResult::Matched(__newpos, _) => {
862 ::peg::RuleResult::Matched(__newpos, ())
863 }
864 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
865 };
866 match __seq_res {
867 ::peg::RuleResult::Matched(__pos, _) => {
868 ::peg::RuleResult::Matched(__pos, (|| x)())
869 }
870 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
871 }
872 }
873 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
874 }
875 } {
876 ::peg::RuleResult::Matched(__newpos, __value) => {
877 ::peg::RuleResult::Matched(__newpos, Some(__value))
878 }
879 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, None),
880 };
881 match __seq_res {
882 ::peg::RuleResult::Matched(__pos, params) => {
883 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ")") {
884 ::peg::RuleResult::Matched(__pos, __val) => {
885 ::peg::RuleResult::Matched(__pos, (|| params.unwrap_or_default())())
886 }
887 ::peg::RuleResult::Failed => {
888 __err_state.mark_failure(__pos, "\")\"");
889 ::peg::RuleResult::Failed
890 }
891 }
892 }
893 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
894 }
895 }
896 ::peg::RuleResult::Failed => {
897 __err_state.mark_failure(__pos, "\"(\"");
898 ::peg::RuleResult::Failed
899 }
900 }
901 }
902 fn __parse_item<'input>(
903 __input: &'input Input,
904 __state: &mut ParseState<'input>,
905 __err_state: &mut ::peg::error::ErrorState,
906 __pos: usize,
907 ) -> ::peg::RuleResult<Item> {
908 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
909 {
910 let __choice_res = {
911 let __seq_res = __parse_rust_use(__input, __state, __err_state, __pos);
912 match __seq_res {
913 ::peg::RuleResult::Matched(__pos, u) => {
914 ::peg::RuleResult::Matched(__pos, (|| Item::Use(u))())
915 }
916 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
917 }
918 };
919 match __choice_res {
920 ::peg::RuleResult::Matched(__pos, __value) => {
921 ::peg::RuleResult::Matched(__pos, __value)
922 }
923 ::peg::RuleResult::Failed => {
924 let __seq_res = __parse_peg_rule(__input, __state, __err_state, __pos);
925 match __seq_res {
926 ::peg::RuleResult::Matched(__pos, r) => {
927 ::peg::RuleResult::Matched(__pos, (|| Item::Rule(r))())
928 }
929 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
930 }
931 }
932 }
933 }
934 }
935 fn __parse_rust_doc_comment<'input>(
936 __input: &'input Input,
937 __state: &mut ParseState<'input>,
938 __err_state: &mut ::peg::error::ErrorState,
939 __pos: usize,
940 ) -> ::peg::RuleResult<Option<TokenStream>> {
941 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
942 match {
943 let str_start = __pos;
944 match {
945 let mut __repeat_pos = __pos;
946 loop {
947 let __pos = __repeat_pos;
948 let __step_res = match ::peg::ParseLiteral::parse_string_literal(
949 __input, __pos, "#",
950 ) {
951 ::peg::RuleResult::Matched(__pos, __val) => {
952 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "[") {
953 ::peg::RuleResult::Matched(__pos, __val) => {
954 match ::peg::ParseLiteral::parse_string_literal(
955 __input, __pos, "doc",
956 ) {
957 ::peg::RuleResult::Matched(__pos, __val) => {
958 match ::peg::ParseLiteral::parse_string_literal(
959 __input, __pos, "=",
960 ) {
961 ::peg::RuleResult::Matched(__pos, __val) => {
962 let __seq_res = match __parse_LITERAL(
963 __input,
964 __state,
965 __err_state,
966 __pos,
967 ) {
968 ::peg::RuleResult::Matched(pos, _) => {
969 ::peg::RuleResult::Matched(pos, ())
970 }
971 ::peg::RuleResult::Failed => {
972 ::peg::RuleResult::Failed
973 }
974 };
975 match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "]") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"]\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
976 }
977 ::peg::RuleResult::Failed => {
978 __err_state.mark_failure(__pos, "\"=\"");
979 ::peg::RuleResult::Failed
980 }
981 }
982 }
983 ::peg::RuleResult::Failed => {
984 __err_state.mark_failure(__pos, "\"doc\"");
985 ::peg::RuleResult::Failed
986 }
987 }
988 }
989 ::peg::RuleResult::Failed => {
990 __err_state.mark_failure(__pos, "\"[\"");
991 ::peg::RuleResult::Failed
992 }
993 }
994 }
995 ::peg::RuleResult::Failed => {
996 __err_state.mark_failure(__pos, "\"#\"");
997 ::peg::RuleResult::Failed
998 }
999 };
1000 match __step_res {
1001 ::peg::RuleResult::Matched(__newpos, __value) => {
1002 __repeat_pos = __newpos;
1003 }
1004 ::peg::RuleResult::Failed => {
1005 break;
1006 }
1007 }
1008 }
1009 ::peg::RuleResult::Matched(__repeat_pos, ())
1010 } {
1011 ::peg::RuleResult::Matched(__newpos, _) => ::peg::RuleResult::Matched(
1012 __newpos,
1013 ::peg::ParseSlice::parse_slice(__input, str_start, __newpos),
1014 ),
1015 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1016 }
1017 } {
1018 ::peg::RuleResult::Matched(__newpos, __value) => {
1019 ::peg::RuleResult::Matched(__newpos, Some(__value))
1020 }
1021 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, None),
1022 }
1023 }
1024 fn __parse_rust_visibility<'input>(
1025 __input: &'input Input,
1026 __state: &mut ParseState<'input>,
1027 __err_state: &mut ::peg::error::ErrorState,
1028 __pos: usize,
1029 ) -> ::peg::RuleResult<Option<TokenStream>> {
1030 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
1031 match {
1032 let str_start = __pos;
1033 match match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "pub") {
1034 ::peg::RuleResult::Matched(__pos, __val) => {
1035 let __seq_res =
1036 match match __parse_PAREN_GROUP(__input, __state, __err_state, __pos) {
1037 ::peg::RuleResult::Matched(pos, _) => {
1038 ::peg::RuleResult::Matched(pos, ())
1039 }
1040 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1041 } {
1042 ::peg::RuleResult::Matched(__newpos, _) => {
1043 ::peg::RuleResult::Matched(__newpos, ())
1044 }
1045 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
1046 };
1047 match __seq_res {
1048 ::peg::RuleResult::Matched(__pos, _) => {
1049 ::peg::RuleResult::Matched(__pos, ())
1050 }
1051 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1052 }
1053 }
1054 ::peg::RuleResult::Failed => {
1055 __err_state.mark_failure(__pos, "\"pub\"");
1056 ::peg::RuleResult::Failed
1057 }
1058 } {
1059 ::peg::RuleResult::Matched(__newpos, _) => ::peg::RuleResult::Matched(
1060 __newpos,
1061 ::peg::ParseSlice::parse_slice(__input, str_start, __newpos),
1062 ),
1063 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1064 }
1065 } {
1066 ::peg::RuleResult::Matched(__newpos, __value) => {
1067 ::peg::RuleResult::Matched(__newpos, Some(__value))
1068 }
1069 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, None),
1070 }
1071 }
1072 fn __parse_rust_use<'input>(
1073 __input: &'input Input,
1074 __state: &mut ParseState<'input>,
1075 __err_state: &mut ::peg::error::ErrorState,
1076 __pos: usize,
1077 ) -> ::peg::RuleResult<TokenStream> {
1078 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
1079 {
1080 let __seq_res = {
1081 let str_start = __pos;
1082 match match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "use") {
1083 ::peg::RuleResult::Matched(__pos, __val) => {
1084 let __seq_res =
1085 match __parse_rust_path(__input, __state, __err_state, __pos) {
1086 ::peg::RuleResult::Matched(pos, _) => {
1087 ::peg::RuleResult::Matched(pos, ())
1088 }
1089 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1090 };
1091 match __seq_res {
1092 ::peg::RuleResult::Matched(__pos, _) => {
1093 let __seq_res = {
1094 let __choice_res =
1095 match ::peg::ParseLiteral::parse_string_literal(
1096 __input, __pos, "::",
1097 ) {
1098 ::peg::RuleResult::Matched(__pos, __val) => {
1099 match ::peg::ParseLiteral::parse_string_literal(
1100 __input, __pos, "*",
1101 ) {
1102 ::peg::RuleResult::Matched(__pos, __val) => {
1103 ::peg::RuleResult::Matched(__pos, ())
1104 }
1105 ::peg::RuleResult::Failed => {
1106 __err_state.mark_failure(__pos, "\"*\"");
1107 ::peg::RuleResult::Failed
1108 }
1109 }
1110 }
1111 ::peg::RuleResult::Failed => {
1112 __err_state.mark_failure(__pos, "\"::\"");
1113 ::peg::RuleResult::Failed
1114 }
1115 };
1116 match __choice_res {
1117 ::peg::RuleResult::Matched(__pos, __value) => {
1118 ::peg::RuleResult::Matched(__pos, __value)
1119 }
1120 ::peg::RuleResult::Failed => {
1121 let __choice_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "::") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "{") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! () ; loop { let __pos = __repeat_pos ; let __pos = if __repeat_value . is_empty () { __pos } else { let __sep_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ",") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\",\"") ; :: peg :: RuleResult :: Failed } } ; match __sep_res { :: peg :: RuleResult :: Matched (__newpos , _) => { __newpos } , :: peg :: RuleResult :: Failed => break , } } ; let __step_res = { let __seq_res = match __parse_IDENT (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { { let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "as") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = match __parse_IDENT (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"as\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } ; match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; __repeat_value . push (__value) ; } , :: peg :: RuleResult :: Failed => { break ; } } } if __repeat_value . len () >= 1 { :: peg :: RuleResult :: Matched (__repeat_pos , ()) } else { :: peg :: RuleResult :: Failed } } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { { let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ",") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\",\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "}") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"}\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"{\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"::\"") ; :: peg :: RuleResult :: Failed } } ;
1122 match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "as") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = match __parse_IDENT (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"as\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } }
1123 }
1124 }
1125 };
1126 match __seq_res {
1127 ::peg::RuleResult::Matched(__pos, _) => {
1128 match ::peg::ParseLiteral::parse_string_literal(
1129 __input, __pos, ";",
1130 ) {
1131 ::peg::RuleResult::Matched(__pos, __val) => {
1132 ::peg::RuleResult::Matched(__pos, ())
1133 }
1134 ::peg::RuleResult::Failed => {
1135 __err_state.mark_failure(__pos, "\";\"");
1136 ::peg::RuleResult::Failed
1137 }
1138 }
1139 }
1140 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1141 }
1142 }
1143 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1144 }
1145 }
1146 ::peg::RuleResult::Failed => {
1147 __err_state.mark_failure(__pos, "\"use\"");
1148 ::peg::RuleResult::Failed
1149 }
1150 } {
1151 ::peg::RuleResult::Matched(__newpos, _) => ::peg::RuleResult::Matched(
1152 __newpos,
1153 ::peg::ParseSlice::parse_slice(__input, str_start, __newpos),
1154 ),
1155 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1156 }
1157 };
1158 match __seq_res {
1159 ::peg::RuleResult::Matched(__pos, v) => {
1160 ::peg::RuleResult::Matched(__pos, (|| v.to_owned())())
1161 }
1162 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1163 }
1164 }
1165 }
1166 fn __parse_rust_path<'input>(
1167 __input: &'input Input,
1168 __state: &mut ParseState<'input>,
1169 __err_state: &mut ::peg::error::ErrorState,
1170 __pos: usize,
1171 ) -> ::peg::RuleResult<()> {
1172 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
1173 {
1174 let __seq_res =
1175 match match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "crate") {
1176 ::peg::RuleResult::Matched(__pos, __val) => {
1177 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "::") {
1178 ::peg::RuleResult::Matched(__pos, __val) => {
1179 ::peg::RuleResult::Matched(__pos, ())
1180 }
1181 ::peg::RuleResult::Failed => {
1182 __err_state.mark_failure(__pos, "\"::\"");
1183 ::peg::RuleResult::Failed
1184 }
1185 }
1186 }
1187 ::peg::RuleResult::Failed => {
1188 __err_state.mark_failure(__pos, "\"crate\"");
1189 ::peg::RuleResult::Failed
1190 }
1191 } {
1192 ::peg::RuleResult::Matched(__newpos, _) => {
1193 ::peg::RuleResult::Matched(__newpos, ())
1194 }
1195 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
1196 };
1197 match __seq_res {
1198 ::peg::RuleResult::Matched(__pos, _) => {
1199 let __seq_res = {
1200 let mut __repeat_pos = __pos;
1201 let mut __repeat_value = vec![];
1202 loop {
1203 let __pos = __repeat_pos;
1204 let __pos = if __repeat_value.is_empty() {
1205 __pos
1206 } else {
1207 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
1208 __input, __pos, "::",
1209 ) {
1210 ::peg::RuleResult::Matched(__pos, __val) => {
1211 ::peg::RuleResult::Matched(__pos, __val)
1212 }
1213 ::peg::RuleResult::Failed => {
1214 __err_state.mark_failure(__pos, "\"::\"");
1215 ::peg::RuleResult::Failed
1216 }
1217 };
1218 match __sep_res {
1219 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
1220 ::peg::RuleResult::Failed => break,
1221 }
1222 };
1223 let __step_res =
1224 match __parse_IDENT(__input, __state, __err_state, __pos) {
1225 ::peg::RuleResult::Matched(pos, _) => {
1226 ::peg::RuleResult::Matched(pos, ())
1227 }
1228 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1229 };
1230 match __step_res {
1231 ::peg::RuleResult::Matched(__newpos, __value) => {
1232 __repeat_pos = __newpos;
1233 __repeat_value.push(__value);
1234 }
1235 ::peg::RuleResult::Failed => {
1236 break;
1237 }
1238 }
1239 }
1240 if __repeat_value.len() >= 1 {
1241 ::peg::RuleResult::Matched(__repeat_pos, ())
1242 } else {
1243 ::peg::RuleResult::Failed
1244 }
1245 };
1246 match __seq_res {
1247 ::peg::RuleResult::Matched(__pos, _) => {
1248 ::peg::RuleResult::Matched(__pos, ())
1249 }
1250 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1251 }
1252 }
1253 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1254 }
1255 }
1256 }
1257 fn __parse_rust_type<'input>(
1258 __input: &'input Input,
1259 __state: &mut ParseState<'input>,
1260 __err_state: &mut ::peg::error::ErrorState,
1261 __pos: usize,
1262 ) -> ::peg::RuleResult<()> {
1263 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
1264 {
1265 let __choice_res = match __parse_BRACKET_GROUP(__input, __state, __err_state, __pos) {
1266 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
1267 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1268 };
1269 match __choice_res {
1270 ::peg::RuleResult::Matched(__pos, __value) => {
1271 ::peg::RuleResult::Matched(__pos, __value)
1272 }
1273 ::peg::RuleResult::Failed => {
1274 let __choice_res =
1275 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "&") {
1276 ::peg::RuleResult::Matched(__pos, __val) => {
1277 let __seq_res = match match __parse_LIFETIME(
1278 __input,
1279 __state,
1280 __err_state,
1281 __pos,
1282 ) {
1283 ::peg::RuleResult::Matched(pos, _) => {
1284 ::peg::RuleResult::Matched(pos, ())
1285 }
1286 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1287 } {
1288 ::peg::RuleResult::Matched(__newpos, _) => {
1289 ::peg::RuleResult::Matched(__newpos, ())
1290 }
1291 ::peg::RuleResult::Failed => {
1292 ::peg::RuleResult::Matched(__pos, ())
1293 }
1294 };
1295 match __seq_res {
1296 ::peg::RuleResult::Matched(__pos, _) => {
1297 let __seq_res =
1298 match match ::peg::ParseLiteral::parse_string_literal(
1299 __input, __pos, "mut",
1300 ) {
1301 ::peg::RuleResult::Matched(__pos, __val) => {
1302 ::peg::RuleResult::Matched(__pos, __val)
1303 }
1304 ::peg::RuleResult::Failed => {
1305 __err_state.mark_failure(__pos, "\"mut\"");
1306 ::peg::RuleResult::Failed
1307 }
1308 } {
1309 ::peg::RuleResult::Matched(__newpos, _) => {
1310 ::peg::RuleResult::Matched(__newpos, ())
1311 }
1312 ::peg::RuleResult::Failed => {
1313 ::peg::RuleResult::Matched(__pos, ())
1314 }
1315 };
1316 match __seq_res {
1317 ::peg::RuleResult::Matched(__pos, _) => {
1318 let __seq_res = match __parse_rust_type(
1319 __input,
1320 __state,
1321 __err_state,
1322 __pos,
1323 ) {
1324 ::peg::RuleResult::Matched(pos, _) => {
1325 ::peg::RuleResult::Matched(pos, ())
1326 }
1327 ::peg::RuleResult::Failed => {
1328 ::peg::RuleResult::Failed
1329 }
1330 };
1331 match __seq_res {
1332 ::peg::RuleResult::Matched(__pos, _) => {
1333 ::peg::RuleResult::Matched(__pos, ())
1334 }
1335 ::peg::RuleResult::Failed => {
1336 ::peg::RuleResult::Failed
1337 }
1338 }
1339 }
1340 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1341 }
1342 }
1343 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1344 }
1345 }
1346 ::peg::RuleResult::Failed => {
1347 __err_state.mark_failure(__pos, "\"&\"");
1348 ::peg::RuleResult::Failed
1349 }
1350 };
1351 match __choice_res {
1352 ::peg::RuleResult::Matched(__pos, __value) => {
1353 ::peg::RuleResult::Matched(__pos, __value)
1354 }
1355 ::peg::RuleResult::Failed => {
1356 let __choice_res = match ::peg::ParseLiteral::parse_string_literal(
1357 __input, __pos, "dyn",
1358 ) {
1359 ::peg::RuleResult::Matched(__pos, __val) => {
1360 let __seq_res = {
1361 let mut __repeat_pos = __pos;
1362 let mut __repeat_value = vec![];
1363 loop {
1364 let __pos = __repeat_pos;
1365 let __pos = if __repeat_value.is_empty() {
1366 __pos
1367 } else {
1368 let __sep_res =
1369 match ::peg::ParseLiteral::parse_string_literal(
1370 __input, __pos, "+",
1371 ) {
1372 ::peg::RuleResult::Matched(
1373 __pos,
1374 __val,
1375 ) => {
1376 ::peg::RuleResult::Matched(__pos, __val)
1377 }
1378 ::peg::RuleResult::Failed => {
1379 __err_state
1380 .mark_failure(__pos, "\"+\"");
1381 ::peg::RuleResult::Failed
1382 }
1383 };
1384 match __sep_res {
1385 ::peg::RuleResult::Matched(__newpos, _) => {
1386 __newpos
1387 }
1388 ::peg::RuleResult::Failed => break,
1389 }
1390 };
1391 let __step_res = match __parse_rust_ty_param_bound(
1392 __input,
1393 __state,
1394 __err_state,
1395 __pos,
1396 ) {
1397 ::peg::RuleResult::Matched(pos, _) => {
1398 ::peg::RuleResult::Matched(pos, ())
1399 }
1400 ::peg::RuleResult::Failed => {
1401 ::peg::RuleResult::Failed
1402 }
1403 };
1404 match __step_res {
1405 ::peg::RuleResult::Matched(__newpos, __value) => {
1406 __repeat_pos = __newpos;
1407 __repeat_value.push(__value);
1408 }
1409 ::peg::RuleResult::Failed => {
1410 break;
1411 }
1412 }
1413 }
1414 if __repeat_value.len() >= 1 {
1415 ::peg::RuleResult::Matched(__repeat_pos, ())
1416 } else {
1417 ::peg::RuleResult::Failed
1418 }
1419 };
1420 match __seq_res {
1421 ::peg::RuleResult::Matched(__pos, _) => {
1422 ::peg::RuleResult::Matched(__pos, ())
1423 }
1424 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1425 }
1426 }
1427 ::peg::RuleResult::Failed => {
1428 __err_state.mark_failure(__pos, "\"dyn\"");
1429 ::peg::RuleResult::Failed
1430 }
1431 };
1432 match __choice_res {
1433 ::peg::RuleResult::Matched(__pos, __value) => {
1434 ::peg::RuleResult::Matched(__pos, __value)
1435 }
1436 ::peg::RuleResult::Failed => {
1437 let __choice_res =
1438 match ::peg::ParseLiteral::parse_string_literal(
1439 __input, __pos, "impl",
1440 ) {
1441 ::peg::RuleResult::Matched(__pos, __val) => {
1442 let __seq_res = {
1443 let mut __repeat_pos = __pos;
1444 let mut __repeat_value = vec![];
1445 loop {
1446 let __pos = __repeat_pos;
1447 let __pos = if __repeat_value.is_empty() {
1448 __pos
1449 } else {
1450 let __sep_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "+") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"+\"") ; :: peg :: RuleResult :: Failed } } ;
1451 match __sep_res {
1452 ::peg::RuleResult::Matched(
1453 __newpos,
1454 _,
1455 ) => __newpos,
1456 ::peg::RuleResult::Failed => break,
1457 }
1458 };
1459 let __step_res =
1460 match __parse_rust_ty_param_bound(
1461 __input,
1462 __state,
1463 __err_state,
1464 __pos,
1465 ) {
1466 ::peg::RuleResult::Matched(
1467 pos,
1468 _,
1469 ) => ::peg::RuleResult::Matched(
1470 pos,
1471 (),
1472 ),
1473 ::peg::RuleResult::Failed => {
1474 ::peg::RuleResult::Failed
1475 }
1476 };
1477 match __step_res {
1478 ::peg::RuleResult::Matched(
1479 __newpos,
1480 __value,
1481 ) => {
1482 __repeat_pos = __newpos;
1483 __repeat_value.push(__value);
1484 }
1485 ::peg::RuleResult::Failed => {
1486 break;
1487 }
1488 }
1489 }
1490 if __repeat_value.len() >= 1 {
1491 ::peg::RuleResult::Matched(__repeat_pos, ())
1492 } else {
1493 ::peg::RuleResult::Failed
1494 }
1495 };
1496 match __seq_res {
1497 ::peg::RuleResult::Matched(__pos, _) => {
1498 ::peg::RuleResult::Matched(__pos, ())
1499 }
1500 ::peg::RuleResult::Failed => {
1501 ::peg::RuleResult::Failed
1502 }
1503 }
1504 }
1505 ::peg::RuleResult::Failed => {
1506 __err_state.mark_failure(__pos, "\"impl\"");
1507 ::peg::RuleResult::Failed
1508 }
1509 };
1510 match __choice_res {
1511 ::peg::RuleResult::Matched(__pos, __value) => {
1512 ::peg::RuleResult::Matched(__pos, __value)
1513 }
1514 ::peg::RuleResult::Failed => {
1515 let __choice_res =
1516 match ::peg::ParseLiteral::parse_string_literal(
1517 __input, __pos, "(",
1518 ) {
1519 ::peg::RuleResult::Matched(__pos, __val) => {
1520 let __seq_res = match {
1521 let __seq_res = {
1522 let mut __repeat_pos = __pos;
1523 let mut __repeat_value = vec![];
1524 loop {
1525 let __pos = __repeat_pos;
1526 let __pos = if __repeat_value
1527 .is_empty()
1528 {
1529 __pos
1530 } else {
1531 let __sep_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ",") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\",\"") ; :: peg :: RuleResult :: Failed } } ;
1532 match __sep_res { :: peg :: RuleResult :: Matched (__newpos , _) => { __newpos } , :: peg :: RuleResult :: Failed => break , }
1533 };
1534 let __step_res = match __parse_rust_type (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ;
1535 match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; __repeat_value . push (__value) ; } , :: peg :: RuleResult :: Failed => { break ; } }
1536 }
1537 if __repeat_value.len() >= 1 {
1538 ::peg::RuleResult::Matched(
1539 __repeat_pos,
1540 (),
1541 )
1542 } else {
1543 ::peg::RuleResult::Failed
1544 }
1545 };
1546 match __seq_res {
1547 ::peg::RuleResult::Matched(
1548 __pos,
1549 _,
1550 ) => {
1551 let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ",") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\",\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ;
1552 match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
1553 }
1554 ::peg::RuleResult::Failed => {
1555 ::peg::RuleResult::Failed
1556 }
1557 }
1558 } {
1559 ::peg::RuleResult::Matched(
1560 __newpos,
1561 _,
1562 ) => ::peg::RuleResult::Matched(
1563 __newpos,
1564 (),
1565 ),
1566 ::peg::RuleResult::Failed => {
1567 ::peg::RuleResult::Matched(
1568 __pos,
1569 (),
1570 )
1571 }
1572 };
1573 match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ")") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\")\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
1574 }
1575 ::peg::RuleResult::Failed => {
1576 __err_state.mark_failure(__pos, "\"(\"");
1577 ::peg::RuleResult::Failed
1578 }
1579 };
1580 match __choice_res {
1581 ::peg::RuleResult::Matched(__pos, __value) => {
1582 ::peg::RuleResult::Matched(__pos, __value)
1583 }
1584 ::peg::RuleResult::Failed => {
1585 let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "<") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = match __parse_rust_type (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { { let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "as") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = match __parse_rust_ty_path (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"as\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ">") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\">\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"<\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ;
1586 match __seq_res {
1587 ::peg::RuleResult::Matched(__pos, _) => {
1588 let __seq_res =
1589 match __parse_rust_ty_path(
1590 __input,
1591 __state,
1592 __err_state,
1593 __pos,
1594 ) {
1595 ::peg::RuleResult::Matched(
1596 pos,
1597 _,
1598 ) => {
1599 ::peg::RuleResult::Matched(
1600 pos,
1601 (),
1602 )
1603 }
1604 ::peg::RuleResult::Failed => {
1605 ::peg::RuleResult::Failed
1606 }
1607 };
1608 match __seq_res {
1609 ::peg::RuleResult::Matched(
1610 __pos,
1611 _,
1612 ) => ::peg::RuleResult::Matched(
1613 __pos,
1614 (),
1615 ),
1616 ::peg::RuleResult::Failed => {
1617 ::peg::RuleResult::Failed
1618 }
1619 }
1620 }
1621 ::peg::RuleResult::Failed => {
1622 ::peg::RuleResult::Failed
1623 }
1624 }
1625 }
1626 }
1627 }
1628 }
1629 }
1630 }
1631 }
1632 }
1633 }
1634 }
1635 }
1636 }
1637 fn __parse_rust_ty_path<'input>(
1638 __input: &'input Input,
1639 __state: &mut ParseState<'input>,
1640 __err_state: &mut ::peg::error::ErrorState,
1641 __pos: usize,
1642 ) -> ::peg::RuleResult<()> {
1643 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
1644 {
1645 let __seq_res =
1646 match match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "::") {
1647 ::peg::RuleResult::Matched(__pos, __val) => {
1648 ::peg::RuleResult::Matched(__pos, __val)
1649 }
1650 ::peg::RuleResult::Failed => {
1651 __err_state.mark_failure(__pos, "\"::\"");
1652 ::peg::RuleResult::Failed
1653 }
1654 } {
1655 ::peg::RuleResult::Matched(__newpos, _) => {
1656 ::peg::RuleResult::Matched(__newpos, ())
1657 }
1658 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
1659 };
1660 match __seq_res {
1661 ::peg::RuleResult::Matched(__pos, _) => {
1662 let __seq_res = {
1663 let mut __repeat_pos = __pos;
1664 let mut __repeat_value = vec![];
1665 loop {
1666 let __pos = __repeat_pos;
1667 let __pos = if __repeat_value.is_empty() {
1668 __pos
1669 } else {
1670 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
1671 __input, __pos, "::",
1672 ) {
1673 ::peg::RuleResult::Matched(__pos, __val) => {
1674 ::peg::RuleResult::Matched(__pos, __val)
1675 }
1676 ::peg::RuleResult::Failed => {
1677 __err_state.mark_failure(__pos, "\"::\"");
1678 ::peg::RuleResult::Failed
1679 }
1680 };
1681 match __sep_res {
1682 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
1683 ::peg::RuleResult::Failed => break,
1684 }
1685 };
1686 let __step_res = {
1687 let __seq_res =
1688 match __parse_IDENT(__input, __state, __err_state, __pos) {
1689 ::peg::RuleResult::Matched(pos, _) => {
1690 ::peg::RuleResult::Matched(pos, ())
1691 }
1692 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1693 };
1694 match __seq_res {
1695 ::peg::RuleResult::Matched(__pos, _) => {
1696 let __seq_res = match {
1697 let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "::") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"::\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ;
1698 match __seq_res {
1699 ::peg::RuleResult::Matched(__pos, _) => {
1700 let __seq_res = {
1701 let __choice_res =
1702 match __parse_rust_generic_args(
1703 __input,
1704 __state,
1705 __err_state,
1706 __pos,
1707 ) {
1708 ::peg::RuleResult::Matched(
1709 pos,
1710 _,
1711 ) => ::peg::RuleResult::Matched(
1712 pos,
1713 (),
1714 ),
1715 ::peg::RuleResult::Failed => {
1716 ::peg::RuleResult::Failed
1717 }
1718 };
1719 match __choice_res {
1720 ::peg::RuleResult::Matched(
1721 __pos,
1722 __value,
1723 ) => ::peg::RuleResult::Matched(
1724 __pos, __value,
1725 ),
1726 ::peg::RuleResult::Failed => {
1727 let __seq_res = match __parse_PAREN_GROUP (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ;
1728 match __seq_res {
1729 ::peg::RuleResult::Matched(
1730 __pos,
1731 _,
1732 ) => {
1733 let __seq_res = match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "->") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = match __parse_rust_type (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"->\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , ()) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , ()) } , } ;
1734 match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
1735 }
1736 ::peg::RuleResult::Failed => {
1737 ::peg::RuleResult::Failed
1738 }
1739 }
1740 }
1741 }
1742 };
1743 match __seq_res {
1744 ::peg::RuleResult::Matched(__pos, _) => {
1745 ::peg::RuleResult::Matched(__pos, ())
1746 }
1747 ::peg::RuleResult::Failed => {
1748 ::peg::RuleResult::Failed
1749 }
1750 }
1751 }
1752 ::peg::RuleResult::Failed => {
1753 ::peg::RuleResult::Failed
1754 }
1755 }
1756 } {
1757 ::peg::RuleResult::Matched(__newpos, _) => {
1758 ::peg::RuleResult::Matched(__newpos, ())
1759 }
1760 ::peg::RuleResult::Failed => {
1761 ::peg::RuleResult::Matched(__pos, ())
1762 }
1763 };
1764 match __seq_res {
1765 ::peg::RuleResult::Matched(__pos, _) => {
1766 ::peg::RuleResult::Matched(__pos, ())
1767 }
1768 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1769 }
1770 }
1771 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1772 }
1773 };
1774 match __step_res {
1775 ::peg::RuleResult::Matched(__newpos, __value) => {
1776 __repeat_pos = __newpos;
1777 __repeat_value.push(__value);
1778 }
1779 ::peg::RuleResult::Failed => {
1780 break;
1781 }
1782 }
1783 }
1784 if __repeat_value.len() >= 1 {
1785 ::peg::RuleResult::Matched(__repeat_pos, ())
1786 } else {
1787 ::peg::RuleResult::Failed
1788 }
1789 };
1790 match __seq_res {
1791 ::peg::RuleResult::Matched(__pos, _) => {
1792 ::peg::RuleResult::Matched(__pos, ())
1793 }
1794 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1795 }
1796 }
1797 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1798 }
1799 }
1800 }
1801 fn __parse_rust_ty_params<'input>(
1802 __input: &'input Input,
1803 __state: &mut ParseState<'input>,
1804 __err_state: &mut ::peg::error::ErrorState,
1805 __pos: usize,
1806 ) -> ::peg::RuleResult<Vec<TokenStream>> {
1807 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
1808 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "<") {
1809 ::peg::RuleResult::Matched(__pos, __val) => {
1810 let __seq_res = {
1811 let mut __repeat_pos = __pos;
1812 let mut __repeat_value = vec![];
1813 loop {
1814 let __pos = __repeat_pos;
1815 let __pos = if __repeat_value.is_empty() {
1816 __pos
1817 } else {
1818 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
1819 __input, __pos, ",",
1820 ) {
1821 ::peg::RuleResult::Matched(__pos, __val) => {
1822 ::peg::RuleResult::Matched(__pos, __val)
1823 }
1824 ::peg::RuleResult::Failed => {
1825 __err_state.mark_failure(__pos, "\",\"");
1826 ::peg::RuleResult::Failed
1827 }
1828 };
1829 match __sep_res {
1830 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
1831 ::peg::RuleResult::Failed => break,
1832 }
1833 };
1834 let __step_res = {
1835 let str_start = __pos;
1836 match match __parse_rust_generic_param(
1837 __input,
1838 __state,
1839 __err_state,
1840 __pos,
1841 ) {
1842 ::peg::RuleResult::Matched(pos, _) => {
1843 ::peg::RuleResult::Matched(pos, ())
1844 }
1845 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1846 } {
1847 ::peg::RuleResult::Matched(__newpos, _) => {
1848 ::peg::RuleResult::Matched(
1849 __newpos,
1850 ::peg::ParseSlice::parse_slice(
1851 __input, str_start, __newpos,
1852 ),
1853 )
1854 }
1855 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1856 }
1857 };
1858 match __step_res {
1859 ::peg::RuleResult::Matched(__newpos, __value) => {
1860 __repeat_pos = __newpos;
1861 __repeat_value.push(__value);
1862 }
1863 ::peg::RuleResult::Failed => {
1864 break;
1865 }
1866 }
1867 }
1868 if __repeat_value.len() >= 1 {
1869 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
1870 } else {
1871 ::peg::RuleResult::Failed
1872 }
1873 };
1874 match __seq_res {
1875 ::peg::RuleResult::Matched(__pos, p) => {
1876 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
1877 __input, __pos, ",",
1878 ) {
1879 ::peg::RuleResult::Matched(__pos, __val) => {
1880 ::peg::RuleResult::Matched(__pos, __val)
1881 }
1882 ::peg::RuleResult::Failed => {
1883 __err_state.mark_failure(__pos, "\",\"");
1884 ::peg::RuleResult::Failed
1885 }
1886 } {
1887 ::peg::RuleResult::Matched(__newpos, _) => {
1888 ::peg::RuleResult::Matched(__newpos, ())
1889 }
1890 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
1891 };
1892 match __seq_res {
1893 ::peg::RuleResult::Matched(__pos, _) => {
1894 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ">")
1895 {
1896 ::peg::RuleResult::Matched(__pos, __val) => {
1897 ::peg::RuleResult::Matched(__pos, (|| p)())
1898 }
1899 ::peg::RuleResult::Failed => {
1900 __err_state.mark_failure(__pos, "\">\"");
1901 ::peg::RuleResult::Failed
1902 }
1903 }
1904 }
1905 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1906 }
1907 }
1908 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1909 }
1910 }
1911 ::peg::RuleResult::Failed => {
1912 __err_state.mark_failure(__pos, "\"<\"");
1913 ::peg::RuleResult::Failed
1914 }
1915 }
1916 }
1917 fn __parse_rust_where_clause<'input>(
1918 __input: &'input Input,
1919 __state: &mut ParseState<'input>,
1920 __err_state: &mut ::peg::error::ErrorState,
1921 __pos: usize,
1922 ) -> ::peg::RuleResult<()> {
1923 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
1924 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "where") {
1925 ::peg::RuleResult::Matched(__pos, __val) => {
1926 let __seq_res = {
1927 let mut __repeat_pos = __pos;
1928 let mut __repeat_value = vec![];
1929 loop {
1930 let __pos = __repeat_pos;
1931 let __pos = if __repeat_value.is_empty() {
1932 __pos
1933 } else {
1934 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
1935 __input, __pos, ",",
1936 ) {
1937 ::peg::RuleResult::Matched(__pos, __val) => {
1938 ::peg::RuleResult::Matched(__pos, __val)
1939 }
1940 ::peg::RuleResult::Failed => {
1941 __err_state.mark_failure(__pos, "\",\"");
1942 ::peg::RuleResult::Failed
1943 }
1944 };
1945 match __sep_res {
1946 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
1947 ::peg::RuleResult::Failed => break,
1948 }
1949 };
1950 let __step_res = {
1951 let __choice_res = {
1952 let __seq_res =
1953 match __parse_LIFETIME(__input, __state, __err_state, __pos) {
1954 ::peg::RuleResult::Matched(pos, _) => {
1955 ::peg::RuleResult::Matched(pos, ())
1956 }
1957 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1958 };
1959 match __seq_res {
1960 ::peg::RuleResult::Matched(__pos, _) => {
1961 let __seq_res =
1962 match match ::peg::ParseLiteral::parse_string_literal(
1963 __input, __pos, ":",
1964 ) {
1965 ::peg::RuleResult::Matched(__pos, __val) => {
1966 let __seq_res = {
1967 let mut __repeat_pos = __pos;
1968 let mut __repeat_value = vec![];
1969 loop {
1970 let __pos = __repeat_pos;
1971 let __pos = if __repeat_value.is_empty()
1972 {
1973 __pos
1974 } else {
1975 let __sep_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "+") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"+\"") ; :: peg :: RuleResult :: Failed } } ;
1976 match __sep_res {
1977 ::peg::RuleResult::Matched(
1978 __newpos,
1979 _,
1980 ) => __newpos,
1981 ::peg::RuleResult::Failed => {
1982 break
1983 }
1984 }
1985 };
1986 let __step_res = match __parse_LIFETIME(
1987 __input,
1988 __state,
1989 __err_state,
1990 __pos,
1991 ) {
1992 ::peg::RuleResult::Matched(
1993 pos,
1994 _,
1995 ) => ::peg::RuleResult::Matched(
1996 pos,
1997 (),
1998 ),
1999 ::peg::RuleResult::Failed => {
2000 ::peg::RuleResult::Failed
2001 }
2002 };
2003 match __step_res {
2004 ::peg::RuleResult::Matched(
2005 __newpos,
2006 __value,
2007 ) => {
2008 __repeat_pos = __newpos;
2009 __repeat_value.push(__value);
2010 }
2011 ::peg::RuleResult::Failed => {
2012 break;
2013 }
2014 }
2015 }
2016 if __repeat_value.len() >= 1 {
2017 ::peg::RuleResult::Matched(
2018 __repeat_pos,
2019 (),
2020 )
2021 } else {
2022 ::peg::RuleResult::Failed
2023 }
2024 };
2025 match __seq_res {
2026 ::peg::RuleResult::Matched(__pos, _) => {
2027 ::peg::RuleResult::Matched(__pos, ())
2028 }
2029 ::peg::RuleResult::Failed => {
2030 ::peg::RuleResult::Failed
2031 }
2032 }
2033 }
2034 ::peg::RuleResult::Failed => {
2035 __err_state.mark_failure(__pos, "\":\"");
2036 ::peg::RuleResult::Failed
2037 }
2038 } {
2039 ::peg::RuleResult::Matched(__newpos, _) => {
2040 ::peg::RuleResult::Matched(__newpos, ())
2041 }
2042 ::peg::RuleResult::Failed => {
2043 ::peg::RuleResult::Matched(__pos, ())
2044 }
2045 };
2046 match __seq_res {
2047 ::peg::RuleResult::Matched(__pos, _) => {
2048 ::peg::RuleResult::Matched(__pos, ())
2049 }
2050 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2051 }
2052 }
2053 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2054 }
2055 };
2056 match __choice_res {
2057 ::peg::RuleResult::Matched(__pos, __value) => {
2058 ::peg::RuleResult::Matched(__pos, __value)
2059 }
2060 ::peg::RuleResult::Failed => {
2061 let __seq_res = match match __parse_rust_for_lifetimes(
2062 __input,
2063 __state,
2064 __err_state,
2065 __pos,
2066 ) {
2067 ::peg::RuleResult::Matched(pos, _) => {
2068 ::peg::RuleResult::Matched(pos, ())
2069 }
2070 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2071 } {
2072 ::peg::RuleResult::Matched(__newpos, _) => {
2073 ::peg::RuleResult::Matched(__newpos, ())
2074 }
2075 ::peg::RuleResult::Failed => {
2076 ::peg::RuleResult::Matched(__pos, ())
2077 }
2078 };
2079 match __seq_res {
2080 ::peg::RuleResult::Matched(__pos, _) => {
2081 let __seq_res = match __parse_rust_type(
2082 __input,
2083 __state,
2084 __err_state,
2085 __pos,
2086 ) {
2087 ::peg::RuleResult::Matched(pos, _) => {
2088 ::peg::RuleResult::Matched(pos, ())
2089 }
2090 ::peg::RuleResult::Failed => {
2091 ::peg::RuleResult::Failed
2092 }
2093 };
2094 match __seq_res {
2095 ::peg::RuleResult::Matched(__pos, _) => {
2096 match ::peg::ParseLiteral::parse_string_literal(
2097 __input, __pos, ":",
2098 ) {
2099 ::peg::RuleResult::Matched(
2100 __pos,
2101 __val,
2102 ) => {
2103 let __seq_res = {
2104 let mut __repeat_pos = __pos;
2105 let mut __repeat_value = vec![];
2106 loop {
2107 let __pos = __repeat_pos;
2108 let __pos = if __repeat_value
2109 .is_empty()
2110 {
2111 __pos
2112 } else {
2113 let __sep_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "+") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"+\"") ; :: peg :: RuleResult :: Failed } } ;
2114 match __sep_res { :: peg :: RuleResult :: Matched (__newpos , _) => { __newpos } , :: peg :: RuleResult :: Failed => break , }
2115 };
2116 let __step_res = match __parse_rust_ty_param_bound (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ;
2117 match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; __repeat_value . push (__value) ; } , :: peg :: RuleResult :: Failed => { break ; } }
2118 }
2119 if __repeat_value.len() >= 1 {
2120 ::peg::RuleResult::Matched(
2121 __repeat_pos,
2122 (),
2123 )
2124 } else {
2125 ::peg::RuleResult::Failed
2126 }
2127 };
2128 match __seq_res {
2129 ::peg::RuleResult::Matched(
2130 __pos,
2131 _,
2132 ) => ::peg::RuleResult::Matched(
2133 __pos,
2134 (),
2135 ),
2136 ::peg::RuleResult::Failed => {
2137 ::peg::RuleResult::Failed
2138 }
2139 }
2140 }
2141 ::peg::RuleResult::Failed => {
2142 __err_state
2143 .mark_failure(__pos, "\":\"");
2144 ::peg::RuleResult::Failed
2145 }
2146 }
2147 }
2148 ::peg::RuleResult::Failed => {
2149 ::peg::RuleResult::Failed
2150 }
2151 }
2152 }
2153 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2154 }
2155 }
2156 }
2157 };
2158 match __step_res {
2159 ::peg::RuleResult::Matched(__newpos, __value) => {
2160 __repeat_pos = __newpos;
2161 __repeat_value.push(__value);
2162 }
2163 ::peg::RuleResult::Failed => {
2164 break;
2165 }
2166 }
2167 }
2168 ::peg::RuleResult::Matched(__repeat_pos, ())
2169 };
2170 match __seq_res {
2171 ::peg::RuleResult::Matched(__pos, _) => {
2172 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
2173 __input, __pos, ",",
2174 ) {
2175 ::peg::RuleResult::Matched(__pos, __val) => {
2176 ::peg::RuleResult::Matched(__pos, __val)
2177 }
2178 ::peg::RuleResult::Failed => {
2179 __err_state.mark_failure(__pos, "\",\"");
2180 ::peg::RuleResult::Failed
2181 }
2182 } {
2183 ::peg::RuleResult::Matched(__newpos, _) => {
2184 ::peg::RuleResult::Matched(__newpos, ())
2185 }
2186 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
2187 };
2188 match __seq_res {
2189 ::peg::RuleResult::Matched(__pos, _) => {
2190 ::peg::RuleResult::Matched(__pos, ())
2191 }
2192 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2193 }
2194 }
2195 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2196 }
2197 }
2198 ::peg::RuleResult::Failed => {
2199 __err_state.mark_failure(__pos, "\"where\"");
2200 ::peg::RuleResult::Failed
2201 }
2202 }
2203 }
2204 fn __parse_rust_generic_param<'input>(
2205 __input: &'input Input,
2206 __state: &mut ParseState<'input>,
2207 __err_state: &mut ::peg::error::ErrorState,
2208 __pos: usize,
2209 ) -> ::peg::RuleResult<()> {
2210 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2211 {
2212 let __choice_res = {
2213 let __seq_res = match __parse_LIFETIME(__input, __state, __err_state, __pos) {
2214 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
2215 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2216 };
2217 match __seq_res {
2218 ::peg::RuleResult::Matched(__pos, _) => {
2219 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
2220 __input, __pos, ":",
2221 ) {
2222 ::peg::RuleResult::Matched(__pos, __val) => {
2223 let __seq_res = {
2224 let mut __repeat_pos = __pos;
2225 let mut __repeat_value = vec![];
2226 loop {
2227 let __pos = __repeat_pos;
2228 let __pos = if __repeat_value.is_empty() {
2229 __pos
2230 } else {
2231 let __sep_res =
2232 match ::peg::ParseLiteral::parse_string_literal(
2233 __input, __pos, "+",
2234 ) {
2235 ::peg::RuleResult::Matched(__pos, __val) => {
2236 ::peg::RuleResult::Matched(__pos, __val)
2237 }
2238 ::peg::RuleResult::Failed => {
2239 __err_state.mark_failure(__pos, "\"+\"");
2240 ::peg::RuleResult::Failed
2241 }
2242 };
2243 match __sep_res {
2244 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
2245 ::peg::RuleResult::Failed => break,
2246 }
2247 };
2248 let __step_res = match __parse_LIFETIME(
2249 __input,
2250 __state,
2251 __err_state,
2252 __pos,
2253 ) {
2254 ::peg::RuleResult::Matched(pos, _) => {
2255 ::peg::RuleResult::Matched(pos, ())
2256 }
2257 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2258 };
2259 match __step_res {
2260 ::peg::RuleResult::Matched(__newpos, __value) => {
2261 __repeat_pos = __newpos;
2262 __repeat_value.push(__value);
2263 }
2264 ::peg::RuleResult::Failed => {
2265 break;
2266 }
2267 }
2268 }
2269 if __repeat_value.len() >= 1 {
2270 ::peg::RuleResult::Matched(__repeat_pos, ())
2271 } else {
2272 ::peg::RuleResult::Failed
2273 }
2274 };
2275 match __seq_res {
2276 ::peg::RuleResult::Matched(__pos, _) => {
2277 ::peg::RuleResult::Matched(__pos, ())
2278 }
2279 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2280 }
2281 }
2282 ::peg::RuleResult::Failed => {
2283 __err_state.mark_failure(__pos, "\":\"");
2284 ::peg::RuleResult::Failed
2285 }
2286 } {
2287 ::peg::RuleResult::Matched(__newpos, _) => {
2288 ::peg::RuleResult::Matched(__newpos, ())
2289 }
2290 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
2291 };
2292 match __seq_res {
2293 ::peg::RuleResult::Matched(__pos, _) => {
2294 ::peg::RuleResult::Matched(__pos, ())
2295 }
2296 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2297 }
2298 }
2299 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2300 }
2301 };
2302 match __choice_res {
2303 ::peg::RuleResult::Matched(__pos, __value) => {
2304 ::peg::RuleResult::Matched(__pos, __value)
2305 }
2306 ::peg::RuleResult::Failed => {
2307 let __seq_res = match __parse_IDENT(__input, __state, __err_state, __pos) {
2308 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
2309 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2310 };
2311 match __seq_res {
2312 ::peg::RuleResult::Matched(__pos, _) => {
2313 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
2314 __input, __pos, ":",
2315 ) {
2316 ::peg::RuleResult::Matched(__pos, __val) => {
2317 let __seq_res = {
2318 let mut __repeat_pos = __pos;
2319 let mut __repeat_value = vec![];
2320 loop {
2321 let __pos = __repeat_pos;
2322 let __pos = if __repeat_value.is_empty() {
2323 __pos
2324 } else {
2325 let __sep_res =
2326 match ::peg::ParseLiteral::parse_string_literal(
2327 __input, __pos, "+",
2328 ) {
2329 ::peg::RuleResult::Matched(
2330 __pos,
2331 __val,
2332 ) => {
2333 ::peg::RuleResult::Matched(__pos, __val)
2334 }
2335 ::peg::RuleResult::Failed => {
2336 __err_state
2337 .mark_failure(__pos, "\"+\"");
2338 ::peg::RuleResult::Failed
2339 }
2340 };
2341 match __sep_res {
2342 ::peg::RuleResult::Matched(__newpos, _) => {
2343 __newpos
2344 }
2345 ::peg::RuleResult::Failed => break,
2346 }
2347 };
2348 let __step_res = match __parse_rust_ty_param_bound(
2349 __input,
2350 __state,
2351 __err_state,
2352 __pos,
2353 ) {
2354 ::peg::RuleResult::Matched(pos, _) => {
2355 ::peg::RuleResult::Matched(pos, ())
2356 }
2357 ::peg::RuleResult::Failed => {
2358 ::peg::RuleResult::Failed
2359 }
2360 };
2361 match __step_res {
2362 ::peg::RuleResult::Matched(__newpos, __value) => {
2363 __repeat_pos = __newpos;
2364 __repeat_value.push(__value);
2365 }
2366 ::peg::RuleResult::Failed => {
2367 break;
2368 }
2369 }
2370 }
2371 if __repeat_value.len() >= 1 {
2372 ::peg::RuleResult::Matched(__repeat_pos, ())
2373 } else {
2374 ::peg::RuleResult::Failed
2375 }
2376 };
2377 match __seq_res {
2378 ::peg::RuleResult::Matched(__pos, _) => {
2379 ::peg::RuleResult::Matched(__pos, ())
2380 }
2381 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2382 }
2383 }
2384 ::peg::RuleResult::Failed => {
2385 __err_state.mark_failure(__pos, "\":\"");
2386 ::peg::RuleResult::Failed
2387 }
2388 } {
2389 ::peg::RuleResult::Matched(__newpos, _) => {
2390 ::peg::RuleResult::Matched(__newpos, ())
2391 }
2392 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
2393 };
2394 match __seq_res {
2395 ::peg::RuleResult::Matched(__pos, _) => {
2396 ::peg::RuleResult::Matched(__pos, ())
2397 }
2398 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2399 }
2400 }
2401 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2402 }
2403 }
2404 }
2405 }
2406 }
2407 fn __parse_rust_for_lifetimes<'input>(
2408 __input: &'input Input,
2409 __state: &mut ParseState<'input>,
2410 __err_state: &mut ::peg::error::ErrorState,
2411 __pos: usize,
2412 ) -> ::peg::RuleResult<()> {
2413 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2414 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "for") {
2415 ::peg::RuleResult::Matched(__pos, __val) => {
2416 let __seq_res = match __parse_rust_ty_params(__input, __state, __err_state, __pos) {
2417 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
2418 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2419 };
2420 match __seq_res {
2421 ::peg::RuleResult::Matched(__pos, _) => ::peg::RuleResult::Matched(__pos, ()),
2422 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2423 }
2424 }
2425 ::peg::RuleResult::Failed => {
2426 __err_state.mark_failure(__pos, "\"for\"");
2427 ::peg::RuleResult::Failed
2428 }
2429 }
2430 }
2431 fn __parse_rust_ty_param_bound<'input>(
2432 __input: &'input Input,
2433 __state: &mut ParseState<'input>,
2434 __err_state: &mut ::peg::error::ErrorState,
2435 __pos: usize,
2436 ) -> ::peg::RuleResult<()> {
2437 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2438 {
2439 let __choice_res = match __parse_LIFETIME(__input, __state, __err_state, __pos) {
2440 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
2441 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2442 };
2443 match __choice_res {
2444 ::peg::RuleResult::Matched(__pos, __value) => {
2445 ::peg::RuleResult::Matched(__pos, __value)
2446 }
2447 ::peg::RuleResult::Failed => {
2448 let __choice_res = {
2449 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
2450 __input, __pos, "?",
2451 ) {
2452 ::peg::RuleResult::Matched(__pos, __val) => {
2453 ::peg::RuleResult::Matched(__pos, __val)
2454 }
2455 ::peg::RuleResult::Failed => {
2456 __err_state.mark_failure(__pos, "\"?\"");
2457 ::peg::RuleResult::Failed
2458 }
2459 } {
2460 ::peg::RuleResult::Matched(__newpos, _) => {
2461 ::peg::RuleResult::Matched(__newpos, ())
2462 }
2463 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
2464 };
2465 match __seq_res {
2466 ::peg::RuleResult::Matched(__pos, _) => {
2467 let __seq_res = match match __parse_rust_for_lifetimes(
2468 __input,
2469 __state,
2470 __err_state,
2471 __pos,
2472 ) {
2473 ::peg::RuleResult::Matched(pos, _) => {
2474 ::peg::RuleResult::Matched(pos, ())
2475 }
2476 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2477 } {
2478 ::peg::RuleResult::Matched(__newpos, _) => {
2479 ::peg::RuleResult::Matched(__newpos, ())
2480 }
2481 ::peg::RuleResult::Failed => {
2482 ::peg::RuleResult::Matched(__pos, ())
2483 }
2484 };
2485 match __seq_res {
2486 ::peg::RuleResult::Matched(__pos, _) => {
2487 let __seq_res = match __parse_rust_ty_path(
2488 __input,
2489 __state,
2490 __err_state,
2491 __pos,
2492 ) {
2493 ::peg::RuleResult::Matched(pos, _) => {
2494 ::peg::RuleResult::Matched(pos, ())
2495 }
2496 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2497 };
2498 match __seq_res {
2499 ::peg::RuleResult::Matched(__pos, _) => {
2500 ::peg::RuleResult::Matched(__pos, ())
2501 }
2502 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2503 }
2504 }
2505 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2506 }
2507 }
2508 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2509 }
2510 };
2511 match __choice_res {
2512 ::peg::RuleResult::Matched(__pos, __value) => {
2513 ::peg::RuleResult::Matched(__pos, __value)
2514 }
2515 ::peg::RuleResult::Failed => {
2516 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "(") {
2517 ::peg::RuleResult::Matched(__pos, __val) => {
2518 let __seq_res =
2519 match match ::peg::ParseLiteral::parse_string_literal(
2520 __input, __pos, "?",
2521 ) {
2522 ::peg::RuleResult::Matched(__pos, __val) => {
2523 ::peg::RuleResult::Matched(__pos, __val)
2524 }
2525 ::peg::RuleResult::Failed => {
2526 __err_state.mark_failure(__pos, "\"?\"");
2527 ::peg::RuleResult::Failed
2528 }
2529 } {
2530 ::peg::RuleResult::Matched(__newpos, _) => {
2531 ::peg::RuleResult::Matched(__newpos, ())
2532 }
2533 ::peg::RuleResult::Failed => {
2534 ::peg::RuleResult::Matched(__pos, ())
2535 }
2536 };
2537 match __seq_res {
2538 ::peg::RuleResult::Matched(__pos, _) => {
2539 let __seq_res = match match __parse_rust_for_lifetimes(
2540 __input,
2541 __state,
2542 __err_state,
2543 __pos,
2544 ) {
2545 ::peg::RuleResult::Matched(pos, _) => {
2546 ::peg::RuleResult::Matched(pos, ())
2547 }
2548 ::peg::RuleResult::Failed => {
2549 ::peg::RuleResult::Failed
2550 }
2551 } {
2552 ::peg::RuleResult::Matched(__newpos, _) => {
2553 ::peg::RuleResult::Matched(__newpos, ())
2554 }
2555 ::peg::RuleResult::Failed => {
2556 ::peg::RuleResult::Matched(__pos, ())
2557 }
2558 };
2559 match __seq_res {
2560 ::peg::RuleResult::Matched(__pos, _) => {
2561 let __seq_res = match __parse_rust_ty_path(
2562 __input,
2563 __state,
2564 __err_state,
2565 __pos,
2566 ) {
2567 ::peg::RuleResult::Matched(pos, _) => {
2568 ::peg::RuleResult::Matched(pos, ())
2569 }
2570 ::peg::RuleResult::Failed => {
2571 ::peg::RuleResult::Failed
2572 }
2573 };
2574 match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ")") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\")\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
2575 }
2576 ::peg::RuleResult::Failed => {
2577 ::peg::RuleResult::Failed
2578 }
2579 }
2580 }
2581 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2582 }
2583 }
2584 ::peg::RuleResult::Failed => {
2585 __err_state.mark_failure(__pos, "\"(\"");
2586 ::peg::RuleResult::Failed
2587 }
2588 }
2589 }
2590 }
2591 }
2592 }
2593 }
2594 }
2595 fn __parse_rust_generic_args<'input>(
2596 __input: &'input Input,
2597 __state: &mut ParseState<'input>,
2598 __err_state: &mut ::peg::error::ErrorState,
2599 __pos: usize,
2600 ) -> ::peg::RuleResult<()> {
2601 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2602 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "<") {
2603 ::peg::RuleResult::Matched(__pos, __val) => {
2604 let __seq_res = {
2605 let mut __repeat_pos = __pos;
2606 let mut __repeat_value = vec![];
2607 loop {
2608 let __pos = __repeat_pos;
2609 let __pos = if __repeat_value.is_empty() {
2610 __pos
2611 } else {
2612 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
2613 __input, __pos, ",",
2614 ) {
2615 ::peg::RuleResult::Matched(__pos, __val) => {
2616 ::peg::RuleResult::Matched(__pos, __val)
2617 }
2618 ::peg::RuleResult::Failed => {
2619 __err_state.mark_failure(__pos, "\",\"");
2620 ::peg::RuleResult::Failed
2621 }
2622 };
2623 match __sep_res {
2624 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
2625 ::peg::RuleResult::Failed => break,
2626 }
2627 };
2628 let __step_res = {
2629 let __choice_res =
2630 match __parse_LIFETIME(__input, __state, __err_state, __pos) {
2631 ::peg::RuleResult::Matched(pos, _) => {
2632 ::peg::RuleResult::Matched(pos, ())
2633 }
2634 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2635 };
2636 match __choice_res {
2637 ::peg::RuleResult::Matched(__pos, __value) => {
2638 ::peg::RuleResult::Matched(__pos, __value)
2639 }
2640 ::peg::RuleResult::Failed => {
2641 let __choice_res = match __parse_rust_type(
2642 __input,
2643 __state,
2644 __err_state,
2645 __pos,
2646 ) {
2647 ::peg::RuleResult::Matched(pos, _) => {
2648 ::peg::RuleResult::Matched(pos, ())
2649 }
2650 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2651 };
2652 match __choice_res {
2653 ::peg::RuleResult::Matched(__pos, __value) => {
2654 ::peg::RuleResult::Matched(__pos, __value)
2655 }
2656 ::peg::RuleResult::Failed => {
2657 let __choice_res = match __parse_BRACE_GROUP(
2658 __input,
2659 __state,
2660 __err_state,
2661 __pos,
2662 ) {
2663 ::peg::RuleResult::Matched(pos, _) => {
2664 ::peg::RuleResult::Matched(pos, ())
2665 }
2666 ::peg::RuleResult::Failed => {
2667 ::peg::RuleResult::Failed
2668 }
2669 };
2670 match __choice_res {
2671 ::peg::RuleResult::Matched(__pos, __value) => {
2672 ::peg::RuleResult::Matched(__pos, __value)
2673 }
2674 ::peg::RuleResult::Failed => match __parse_LITERAL(
2675 __input,
2676 __state,
2677 __err_state,
2678 __pos,
2679 ) {
2680 ::peg::RuleResult::Matched(pos, _) => {
2681 ::peg::RuleResult::Matched(pos, ())
2682 }
2683 ::peg::RuleResult::Failed => {
2684 ::peg::RuleResult::Failed
2685 }
2686 },
2687 }
2688 }
2689 }
2690 }
2691 }
2692 };
2693 match __step_res {
2694 ::peg::RuleResult::Matched(__newpos, __value) => {
2695 __repeat_pos = __newpos;
2696 __repeat_value.push(__value);
2697 }
2698 ::peg::RuleResult::Failed => {
2699 break;
2700 }
2701 }
2702 }
2703 if __repeat_value.len() >= 1 {
2704 ::peg::RuleResult::Matched(__repeat_pos, ())
2705 } else {
2706 ::peg::RuleResult::Failed
2707 }
2708 };
2709 match __seq_res {
2710 ::peg::RuleResult::Matched(__pos, _) => {
2711 let __seq_res = match match ::peg::ParseLiteral::parse_string_literal(
2712 __input, __pos, ",",
2713 ) {
2714 ::peg::RuleResult::Matched(__pos, __val) => {
2715 ::peg::RuleResult::Matched(__pos, __val)
2716 }
2717 ::peg::RuleResult::Failed => {
2718 __err_state.mark_failure(__pos, "\",\"");
2719 ::peg::RuleResult::Failed
2720 }
2721 } {
2722 ::peg::RuleResult::Matched(__newpos, _) => {
2723 ::peg::RuleResult::Matched(__newpos, ())
2724 }
2725 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
2726 };
2727 match __seq_res {
2728 ::peg::RuleResult::Matched(__pos, _) => {
2729 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ">")
2730 {
2731 ::peg::RuleResult::Matched(__pos, __val) => {
2732 ::peg::RuleResult::Matched(__pos, ())
2733 }
2734 ::peg::RuleResult::Failed => {
2735 __err_state.mark_failure(__pos, "\">\"");
2736 ::peg::RuleResult::Failed
2737 }
2738 }
2739 }
2740 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2741 }
2742 }
2743 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2744 }
2745 }
2746 ::peg::RuleResult::Failed => {
2747 __err_state.mark_failure(__pos, "\"<\"");
2748 ::peg::RuleResult::Failed
2749 }
2750 }
2751 }
2752 fn __parse_expression<'input>(
2753 __input: &'input Input,
2754 __state: &mut ParseState<'input>,
2755 __err_state: &mut ::peg::error::ErrorState,
2756 __pos: usize,
2757 ) -> ::peg::RuleResult<SpannedExpr> {
2758 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2759 __parse_choice(__input, __state, __err_state, __pos)
2760 }
2761 fn __parse_choice<'input>(
2762 __input: &'input Input,
2763 __state: &mut ParseState<'input>,
2764 __err_state: &mut ::peg::error::ErrorState,
2765 __pos: usize,
2766 ) -> ::peg::RuleResult<SpannedExpr> {
2767 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2768 {
2769 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
2770 match __seq_res {
2771 ::peg::RuleResult::Matched(__pos, sp) => {
2772 let __seq_res = {
2773 let mut __repeat_pos = __pos;
2774 let mut __repeat_value = vec![];
2775 loop {
2776 let __pos = __repeat_pos;
2777 let __pos = if __repeat_value.is_empty() {
2778 __pos
2779 } else {
2780 let __sep_res = match ::peg::ParseLiteral::parse_string_literal(
2781 __input, __pos, "/",
2782 ) {
2783 ::peg::RuleResult::Matched(__pos, __val) => {
2784 ::peg::RuleResult::Matched(__pos, __val)
2785 }
2786 ::peg::RuleResult::Failed => {
2787 __err_state.mark_failure(__pos, "\"/\"");
2788 ::peg::RuleResult::Failed
2789 }
2790 };
2791 match __sep_res {
2792 ::peg::RuleResult::Matched(__newpos, _) => __newpos,
2793 ::peg::RuleResult::Failed => break,
2794 }
2795 };
2796 let __step_res = __parse_sequence(__input, __state, __err_state, __pos);
2797 match __step_res {
2798 ::peg::RuleResult::Matched(__newpos, __value) => {
2799 __repeat_pos = __newpos;
2800 __repeat_value.push(__value);
2801 }
2802 ::peg::RuleResult::Failed => {
2803 break;
2804 }
2805 }
2806 }
2807 if __repeat_value.len() >= 1 {
2808 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
2809 } else {
2810 ::peg::RuleResult::Failed
2811 }
2812 };
2813 match __seq_res {
2814 ::peg::RuleResult::Matched(__pos, s) => ::peg::RuleResult::Matched(
2815 __pos,
2816 (|| {
2817 if s.len() == 1 {
2818 s.into_iter().next().unwrap()
2819 } else {
2820 ChoiceExpr(s).at(sp)
2821 }
2822 })(),
2823 ),
2824 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2825 }
2826 }
2827 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2828 }
2829 }
2830 }
2831 fn __parse_sequence<'input>(
2832 __input: &'input Input,
2833 __state: &mut ParseState<'input>,
2834 __err_state: &mut ::peg::error::ErrorState,
2835 __pos: usize,
2836 ) -> ::peg::RuleResult<SpannedExpr> {
2837 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2838 {
2839 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
2840 match __seq_res {
2841 ::peg::RuleResult::Matched(__pos, sp) => {
2842 let __seq_res = {
2843 let mut __repeat_pos = __pos;
2844 let mut __repeat_value = vec![];
2845 loop {
2846 let __pos = __repeat_pos;
2847 let __step_res = __parse_labeled(__input, __state, __err_state, __pos);
2848 match __step_res {
2849 ::peg::RuleResult::Matched(__newpos, __value) => {
2850 __repeat_pos = __newpos;
2851 __repeat_value.push(__value);
2852 }
2853 ::peg::RuleResult::Failed => {
2854 break;
2855 }
2856 }
2857 }
2858 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
2859 };
2860 match __seq_res {
2861 ::peg::RuleResult::Matched(__pos, elements) => {
2862 let __seq_res =
2863 match __parse_BRACE_GROUP(__input, __state, __err_state, __pos) {
2864 ::peg::RuleResult::Matched(__newpos, __value) => {
2865 ::peg::RuleResult::Matched(__newpos, Some(__value))
2866 }
2867 ::peg::RuleResult::Failed => {
2868 ::peg::RuleResult::Matched(__pos, None)
2869 }
2870 };
2871 match __seq_res {
2872 ::peg::RuleResult::Matched(__pos, code) => {
2873 ::peg::RuleResult::Matched(
2874 __pos,
2875 (|| {
2876 if let Some(code) = code {
2877 ActionExpr(elements, Some(code)).at(sp)
2878 } else if elements.len() != 1 {
2879 ActionExpr(elements, None).at(sp)
2880 } else {
2881 elements.into_iter().next().unwrap().expr
2882 }
2883 })(),
2884 )
2885 }
2886 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2887 }
2888 }
2889 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2890 }
2891 }
2892 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2893 }
2894 }
2895 }
2896 fn __parse_labeled<'input>(
2897 __input: &'input Input,
2898 __state: &mut ParseState<'input>,
2899 __err_state: &mut ::peg::error::ErrorState,
2900 __pos: usize,
2901 ) -> ::peg::RuleResult<TaggedExpr> {
2902 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2903 {
2904 let __seq_res = match {
2905 let __seq_res = __parse_IDENT(__input, __state, __err_state, __pos);
2906 match __seq_res {
2907 ::peg::RuleResult::Matched(__pos, l) => {
2908 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ":") {
2909 ::peg::RuleResult::Matched(__pos, __val) => {
2910 ::peg::RuleResult::Matched(__pos, (|| l)())
2911 }
2912 ::peg::RuleResult::Failed => {
2913 __err_state.mark_failure(__pos, "\":\"");
2914 ::peg::RuleResult::Failed
2915 }
2916 }
2917 }
2918 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2919 }
2920 } {
2921 ::peg::RuleResult::Matched(__newpos, __value) => {
2922 ::peg::RuleResult::Matched(__newpos, Some(__value))
2923 }
2924 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, None),
2925 };
2926 match __seq_res {
2927 ::peg::RuleResult::Matched(__pos, label) => {
2928 let __seq_res = __parse_suffixed(__input, __state, __err_state, __pos);
2929 match __seq_res {
2930 ::peg::RuleResult::Matched(__pos, expression) => {
2931 ::peg::RuleResult::Matched(
2932 __pos,
2933 (|| TaggedExpr {
2934 name: label,
2935 expr: expression,
2936 })(),
2937 )
2938 }
2939 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2940 }
2941 }
2942 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2943 }
2944 }
2945 }
2946 fn __parse_suffixed<'input>(
2947 __input: &'input Input,
2948 __state: &mut ParseState<'input>,
2949 __err_state: &mut ::peg::error::ErrorState,
2950 __pos: usize,
2951 ) -> ::peg::RuleResult<SpannedExpr> {
2952 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
2953 {
2954 let __choice_res = {
2955 let __seq_res = __parse_prefixed(__input, __state, __err_state, __pos);
2956 match __seq_res {
2957 ::peg::RuleResult::Matched(__pos, e) => {
2958 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
2959 match __seq_res {
2960 ::peg::RuleResult::Matched(__pos, sp) => {
2961 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "?")
2962 {
2963 ::peg::RuleResult::Matched(__pos, __val) => {
2964 ::peg::RuleResult::Matched(
2965 __pos,
2966 (|| OptionalExpr(Box::new(e)).at(sp))(),
2967 )
2968 }
2969 ::peg::RuleResult::Failed => {
2970 __err_state.mark_failure(__pos, "\"?\"");
2971 ::peg::RuleResult::Failed
2972 }
2973 }
2974 }
2975 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2976 }
2977 }
2978 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
2979 }
2980 };
2981 match __choice_res {
2982 ::peg::RuleResult::Matched(__pos, __value) => {
2983 ::peg::RuleResult::Matched(__pos, __value)
2984 }
2985 ::peg::RuleResult::Failed => {
2986 let __choice_res = {
2987 let __seq_res = __parse_prefixed(__input, __state, __err_state, __pos);
2988 match __seq_res {
2989 ::peg::RuleResult::Matched(__pos, e) => {
2990 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
2991 match __seq_res {
2992 ::peg::RuleResult::Matched(__pos, sp) => {
2993 match ::peg::ParseLiteral::parse_string_literal(
2994 __input, __pos, "**",
2995 ) {
2996 ::peg::RuleResult::Matched(__pos, __val) => {
2997 let __seq_res = __parse_repeatcount(
2998 __input,
2999 __state,
3000 __err_state,
3001 __pos,
3002 );
3003 match __seq_res {
3004 ::peg::RuleResult::Matched(__pos, count) => {
3005 let __seq_res = __parse_primary(
3006 __input,
3007 __state,
3008 __err_state,
3009 __pos,
3010 );
3011 match __seq_res {
3012 ::peg::RuleResult::Matched(
3013 __pos,
3014 sep,
3015 ) => ::peg::RuleResult::Matched(
3016 __pos,
3017 (|| {
3018 Repeat {
3019 inner: Box::new(e),
3020 bound: count,
3021 sep: Some(Box::new(sep)),
3022 }
3023 .at(sp)
3024 })(
3025 ),
3026 ),
3027 ::peg::RuleResult::Failed => {
3028 ::peg::RuleResult::Failed
3029 }
3030 }
3031 }
3032 ::peg::RuleResult::Failed => {
3033 ::peg::RuleResult::Failed
3034 }
3035 }
3036 }
3037 ::peg::RuleResult::Failed => {
3038 __err_state.mark_failure(__pos, "\"**\"");
3039 ::peg::RuleResult::Failed
3040 }
3041 }
3042 }
3043 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3044 }
3045 }
3046 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3047 }
3048 };
3049 match __choice_res {
3050 ::peg::RuleResult::Matched(__pos, __value) => {
3051 ::peg::RuleResult::Matched(__pos, __value)
3052 }
3053 ::peg::RuleResult::Failed => {
3054 let __choice_res = {
3055 let __seq_res =
3056 __parse_prefixed(__input, __state, __err_state, __pos);
3057 match __seq_res {
3058 ::peg::RuleResult::Matched(__pos, e) => {
3059 let __seq_res =
3060 __parse_sp(__input, __state, __err_state, __pos);
3061 match __seq_res {
3062 ::peg::RuleResult::Matched(__pos, sp) => {
3063 match ::peg::ParseLiteral::parse_string_literal(
3064 __input, __pos, "++",
3065 ) {
3066 ::peg::RuleResult::Matched(__pos, __val) => {
3067 let __seq_res = __parse_primary(
3068 __input,
3069 __state,
3070 __err_state,
3071 __pos,
3072 );
3073 match __seq_res {
3074 ::peg::RuleResult::Matched(
3075 __pos,
3076 sep,
3077 ) => ::peg::RuleResult::Matched(
3078 __pos,
3079 (|| {
3080 Repeat {
3081 inner: Box::new(e),
3082 bound: BoundedRepeat::Plus,
3083 sep: Some(Box::new(sep)),
3084 }
3085 .at(sp)
3086 })(
3087 ),
3088 ),
3089 ::peg::RuleResult::Failed => {
3090 ::peg::RuleResult::Failed
3091 }
3092 }
3093 }
3094 ::peg::RuleResult::Failed => {
3095 __err_state.mark_failure(__pos, "\"++\"");
3096 ::peg::RuleResult::Failed
3097 }
3098 }
3099 }
3100 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3101 }
3102 }
3103 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3104 }
3105 };
3106 match __choice_res {
3107 ::peg::RuleResult::Matched(__pos, __value) => {
3108 ::peg::RuleResult::Matched(__pos, __value)
3109 }
3110 ::peg::RuleResult::Failed => {
3111 let __choice_res = {
3112 let __seq_res =
3113 __parse_prefixed(__input, __state, __err_state, __pos);
3114 match __seq_res {
3115 ::peg::RuleResult::Matched(__pos, e) => {
3116 let __seq_res = __parse_sp(
3117 __input,
3118 __state,
3119 __err_state,
3120 __pos,
3121 );
3122 match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "*") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_repeatcount (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , count) => { :: peg :: RuleResult :: Matched (__pos , (|| { Repeat { inner : Box :: new (e) , bound : count , sep : None } . at (sp) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"*\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3123 }
3124 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3125 }
3126 };
3127 match __choice_res {
3128 ::peg::RuleResult::Matched(__pos, __value) => {
3129 ::peg::RuleResult::Matched(__pos, __value)
3130 }
3131 ::peg::RuleResult::Failed => {
3132 let __choice_res = {
3133 let __seq_res = __parse_prefixed(
3134 __input,
3135 __state,
3136 __err_state,
3137 __pos,
3138 );
3139 match __seq_res {
3140 ::peg::RuleResult::Matched(__pos, e) => {
3141 let __seq_res = __parse_sp(
3142 __input,
3143 __state,
3144 __err_state,
3145 __pos,
3146 );
3147 match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "+") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { Repeat { inner : Box :: new (e) , bound : BoundedRepeat :: Plus , sep : None } . at (sp) }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"+\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3148 }
3149 ::peg::RuleResult::Failed => {
3150 ::peg::RuleResult::Failed
3151 }
3152 }
3153 };
3154 match __choice_res {
3155 ::peg::RuleResult::Matched(__pos, __value) => {
3156 ::peg::RuleResult::Matched(__pos, __value)
3157 }
3158 ::peg::RuleResult::Failed => __parse_prefixed(
3159 __input,
3160 __state,
3161 __err_state,
3162 __pos,
3163 ),
3164 }
3165 }
3166 }
3167 }
3168 }
3169 }
3170 }
3171 }
3172 }
3173 }
3174 }
3175 fn __parse_repeatcount<'input>(
3176 __input: &'input Input,
3177 __state: &mut ParseState<'input>,
3178 __err_state: &mut ::peg::error::ErrorState,
3179 __pos: usize,
3180 ) -> ::peg::RuleResult<BoundedRepeat> {
3181 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3182 {
3183 let __choice_res = match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "<")
3184 {
3185 ::peg::RuleResult::Matched(__pos, __val) => {
3186 let __seq_res = __parse_repeatnum(__input, __state, __err_state, __pos);
3187 match __seq_res {
3188 ::peg::RuleResult::Matched(__pos, n) => {
3189 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ">") {
3190 ::peg::RuleResult::Matched(__pos, __val) => {
3191 ::peg::RuleResult::Matched(
3192 __pos,
3193 (|| BoundedRepeat::Exact(n))(),
3194 )
3195 }
3196 ::peg::RuleResult::Failed => {
3197 __err_state.mark_failure(__pos, "\">\"");
3198 ::peg::RuleResult::Failed
3199 }
3200 }
3201 }
3202 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3203 }
3204 }
3205 ::peg::RuleResult::Failed => {
3206 __err_state.mark_failure(__pos, "\"<\"");
3207 ::peg::RuleResult::Failed
3208 }
3209 };
3210 match __choice_res {
3211 ::peg::RuleResult::Matched(__pos, __value) => {
3212 ::peg::RuleResult::Matched(__pos, __value)
3213 }
3214 ::peg::RuleResult::Failed => {
3215 let __choice_res = match ::peg::ParseLiteral::parse_string_literal(
3216 __input, __pos, "<",
3217 ) {
3218 ::peg::RuleResult::Matched(__pos, __val) => {
3219 let __seq_res =
3220 match __parse_repeatnum(__input, __state, __err_state, __pos) {
3221 ::peg::RuleResult::Matched(__newpos, __value) => {
3222 ::peg::RuleResult::Matched(__newpos, Some(__value))
3223 }
3224 ::peg::RuleResult::Failed => {
3225 ::peg::RuleResult::Matched(__pos, None)
3226 }
3227 };
3228 match __seq_res {
3229 ::peg::RuleResult::Matched(__pos, min) => {
3230 match ::peg::ParseLiteral::parse_string_literal(
3231 __input, __pos, ",",
3232 ) {
3233 ::peg::RuleResult::Matched(__pos, __val) => {
3234 let __seq_res = match __parse_repeatnum(
3235 __input,
3236 __state,
3237 __err_state,
3238 __pos,
3239 ) {
3240 ::peg::RuleResult::Matched(__newpos, __value) => {
3241 ::peg::RuleResult::Matched(
3242 __newpos,
3243 Some(__value),
3244 )
3245 }
3246 ::peg::RuleResult::Failed => {
3247 ::peg::RuleResult::Matched(__pos, None)
3248 }
3249 };
3250 match __seq_res {
3251 ::peg::RuleResult::Matched(__pos, max) => {
3252 match ::peg::ParseLiteral::parse_string_literal(
3253 __input, __pos, ">",
3254 ) {
3255 ::peg::RuleResult::Matched(
3256 __pos,
3257 __val,
3258 ) => ::peg::RuleResult::Matched(
3259 __pos,
3260 (|| BoundedRepeat::Both(min, max))(),
3261 ),
3262 ::peg::RuleResult::Failed => {
3263 __err_state
3264 .mark_failure(__pos, "\">\"");
3265 ::peg::RuleResult::Failed
3266 }
3267 }
3268 }
3269 ::peg::RuleResult::Failed => {
3270 ::peg::RuleResult::Failed
3271 }
3272 }
3273 }
3274 ::peg::RuleResult::Failed => {
3275 __err_state.mark_failure(__pos, "\",\"");
3276 ::peg::RuleResult::Failed
3277 }
3278 }
3279 }
3280 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3281 }
3282 }
3283 ::peg::RuleResult::Failed => {
3284 __err_state.mark_failure(__pos, "\"<\"");
3285 ::peg::RuleResult::Failed
3286 }
3287 };
3288 match __choice_res {
3289 ::peg::RuleResult::Matched(__pos, __value) => {
3290 ::peg::RuleResult::Matched(__pos, __value)
3291 }
3292 ::peg::RuleResult::Failed => {
3293 ::peg::RuleResult::Matched(__pos, (|| BoundedRepeat::None)())
3294 }
3295 }
3296 }
3297 }
3298 }
3299 }
3300 fn __parse_repeatnum<'input>(
3301 __input: &'input Input,
3302 __state: &mut ParseState<'input>,
3303 __err_state: &mut ::peg::error::ErrorState,
3304 __pos: usize,
3305 ) -> ::peg::RuleResult<TokenStream> {
3306 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3307 {
3308 let str_start = __pos;
3309 match {
3310 let __choice_res = match __parse_INTEGER(__input, __state, __err_state, __pos) {
3311 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
3312 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3313 };
3314 match __choice_res {
3315 ::peg::RuleResult::Matched(__pos, __value) => {
3316 ::peg::RuleResult::Matched(__pos, __value)
3317 }
3318 ::peg::RuleResult::Failed => {
3319 match __parse_BRACE_GROUP(__input, __state, __err_state, __pos) {
3320 ::peg::RuleResult::Matched(pos, _) => {
3321 ::peg::RuleResult::Matched(pos, ())
3322 }
3323 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3324 }
3325 }
3326 }
3327 } {
3328 ::peg::RuleResult::Matched(__newpos, _) => ::peg::RuleResult::Matched(
3329 __newpos,
3330 ::peg::ParseSlice::parse_slice(__input, str_start, __newpos),
3331 ),
3332 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3333 }
3334 }
3335 }
3336 fn __parse_prefixed<'input>(
3337 __input: &'input Input,
3338 __state: &mut ParseState<'input>,
3339 __err_state: &mut ::peg::error::ErrorState,
3340 __pos: usize,
3341 ) -> ::peg::RuleResult<SpannedExpr> {
3342 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3343 {
3344 let __choice_res = {
3345 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
3346 match __seq_res {
3347 ::peg::RuleResult::Matched(__pos, sp) => {
3348 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "$") {
3349 ::peg::RuleResult::Matched(__pos, __val) => {
3350 let __seq_res =
3351 __parse_primary(__input, __state, __err_state, __pos);
3352 match __seq_res {
3353 ::peg::RuleResult::Matched(__pos, expression) => {
3354 ::peg::RuleResult::Matched(
3355 __pos,
3356 (|| MatchStrExpr(Box::new(expression)).at(sp))(),
3357 )
3358 }
3359 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3360 }
3361 }
3362 ::peg::RuleResult::Failed => {
3363 __err_state.mark_failure(__pos, "\"$\"");
3364 ::peg::RuleResult::Failed
3365 }
3366 }
3367 }
3368 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3369 }
3370 };
3371 match __choice_res {
3372 ::peg::RuleResult::Matched(__pos, __value) => {
3373 ::peg::RuleResult::Matched(__pos, __value)
3374 }
3375 ::peg::RuleResult::Failed => {
3376 let __choice_res = {
3377 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
3378 match __seq_res {
3379 ::peg::RuleResult::Matched(__pos, sp) => {
3380 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "&")
3381 {
3382 ::peg::RuleResult::Matched(__pos, __val) => {
3383 let __seq_res =
3384 __parse_primary(__input, __state, __err_state, __pos);
3385 match __seq_res {
3386 ::peg::RuleResult::Matched(__pos, expression) => {
3387 ::peg::RuleResult::Matched(
3388 __pos,
3389 (|| PosAssertExpr(Box::new(expression)).at(sp))(
3390 ),
3391 )
3392 }
3393 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3394 }
3395 }
3396 ::peg::RuleResult::Failed => {
3397 __err_state.mark_failure(__pos, "\"&\"");
3398 ::peg::RuleResult::Failed
3399 }
3400 }
3401 }
3402 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3403 }
3404 };
3405 match __choice_res {
3406 ::peg::RuleResult::Matched(__pos, __value) => {
3407 ::peg::RuleResult::Matched(__pos, __value)
3408 }
3409 ::peg::RuleResult::Failed => {
3410 let __choice_res = {
3411 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
3412 match __seq_res {
3413 ::peg::RuleResult::Matched(__pos, sp) => {
3414 match ::peg::ParseLiteral::parse_string_literal(
3415 __input, __pos, "!",
3416 ) {
3417 ::peg::RuleResult::Matched(__pos, __val) => {
3418 let __seq_res = __parse_primary(
3419 __input,
3420 __state,
3421 __err_state,
3422 __pos,
3423 );
3424 match __seq_res {
3425 ::peg::RuleResult::Matched(
3426 __pos,
3427 expression,
3428 ) => ::peg::RuleResult::Matched(
3429 __pos,
3430 (|| {
3431 NegAssertExpr(Box::new(expression))
3432 .at(sp)
3433 })(
3434 ),
3435 ),
3436 ::peg::RuleResult::Failed => {
3437 ::peg::RuleResult::Failed
3438 }
3439 }
3440 }
3441 ::peg::RuleResult::Failed => {
3442 __err_state.mark_failure(__pos, "\"!\"");
3443 ::peg::RuleResult::Failed
3444 }
3445 }
3446 }
3447 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3448 }
3449 };
3450 match __choice_res {
3451 ::peg::RuleResult::Matched(__pos, __value) => {
3452 ::peg::RuleResult::Matched(__pos, __value)
3453 }
3454 ::peg::RuleResult::Failed => {
3455 __parse_primary(__input, __state, __err_state, __pos)
3456 }
3457 }
3458 }
3459 }
3460 }
3461 }
3462 }
3463 }
3464 fn __parse_primary<'input>(
3465 __input: &'input Input,
3466 __state: &mut ParseState<'input>,
3467 __err_state: &mut ::peg::error::ErrorState,
3468 __pos: usize,
3469 ) -> ::peg::RuleResult<SpannedExpr> {
3470 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3471 if let Some(entry) = __state.primary_cache.get(&__pos) {
3472 return entry.clone();
3473 }
3474 let __rule_result = {
3475 let __choice_res = {
3476 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
3477 match __seq_res {
3478 ::peg::RuleResult::Matched(__pos, sp) => {
3479 match ::peg::ParseLiteral::parse_string_literal(
3480 __input,
3481 __pos,
3482 "precedence",
3483 ) {
3484 ::peg::RuleResult::Matched(__pos, __val) => {
3485 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "!")
3486 {
3487 ::peg::RuleResult::Matched(__pos, __val) => {
3488 match ::peg::ParseLiteral::parse_string_literal(
3489 __input, __pos, "{",
3490 ) {
3491 ::peg::RuleResult::Matched(__pos, __val) => {
3492 let __seq_res = {
3493 let mut __repeat_pos = __pos;
3494 let mut __repeat_value = vec![];
3495 loop {
3496 let __pos = __repeat_pos;
3497 let __pos = if __repeat_value.is_empty() {
3498 __pos
3499 } else {
3500 let __sep_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "--") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"--\"") ; :: peg :: RuleResult :: Failed } } ;
3501 match __sep_res {
3502 ::peg::RuleResult::Matched(
3503 __newpos,
3504 _,
3505 ) => __newpos,
3506 ::peg::RuleResult::Failed => break,
3507 }
3508 };
3509 let __step_res = __parse_precedence_level(
3510 __input,
3511 __state,
3512 __err_state,
3513 __pos,
3514 );
3515 match __step_res {
3516 ::peg::RuleResult::Matched(
3517 __newpos,
3518 __value,
3519 ) => {
3520 __repeat_pos = __newpos;
3521 __repeat_value.push(__value);
3522 }
3523 ::peg::RuleResult::Failed => {
3524 break;
3525 }
3526 }
3527 }
3528 ::peg::RuleResult::Matched(
3529 __repeat_pos,
3530 __repeat_value,
3531 )
3532 };
3533 match __seq_res { :: peg :: RuleResult :: Matched (__pos , levels) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "}") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { PrecedenceExpr { levels : levels } . at (sp) }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"}\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3534 }
3535 ::peg::RuleResult::Failed => {
3536 __err_state.mark_failure(__pos, "\"{\"");
3537 ::peg::RuleResult::Failed
3538 }
3539 }
3540 }
3541 ::peg::RuleResult::Failed => {
3542 __err_state.mark_failure(__pos, "\"!\"");
3543 ::peg::RuleResult::Failed
3544 }
3545 }
3546 }
3547 ::peg::RuleResult::Failed => {
3548 __err_state.mark_failure(__pos, "\"precedence\"");
3549 ::peg::RuleResult::Failed
3550 }
3551 }
3552 }
3553 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3554 }
3555 };
3556 match __choice_res {
3557 ::peg::RuleResult::Matched(__pos, __value) => {
3558 ::peg::RuleResult::Matched(__pos, __value)
3559 }
3560 ::peg::RuleResult::Failed => {
3561 let __choice_res = {
3562 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
3563 match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "position") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "!") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "(") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ")") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { PositionExpr . at (sp) }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\")\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"(\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"!\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"position\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3564 };
3565 match __choice_res {
3566 ::peg::RuleResult::Matched(__pos, __value) => {
3567 ::peg::RuleResult::Matched(__pos, __value)
3568 }
3569 ::peg::RuleResult::Failed => {
3570 let __choice_res = {
3571 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
3572 match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "quiet") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "!") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "{") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_expression (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , e) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "}") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { QuietExpr (Box :: new (e)) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"}\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"{\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"!\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"quiet\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3573 };
3574 match __choice_res {
3575 ::peg::RuleResult::Matched(__pos, __value) => {
3576 ::peg::RuleResult::Matched(__pos, __value)
3577 }
3578 ::peg::RuleResult::Failed => {
3579 let __choice_res = {
3580 let __seq_res =
3581 __parse_sp(__input, __state, __err_state, __pos);
3582 match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "expected") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "!") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_PAREN_GROUP (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , s) => { :: peg :: RuleResult :: Matched (__pos , (|| { FailExpr (s) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"!\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"expected\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3583 };
3584 match __choice_res {
3585 ::peg::RuleResult::Matched(__pos, __value) => {
3586 ::peg::RuleResult::Matched(__pos, __value)
3587 }
3588 ::peg::RuleResult::Failed => {
3589 let __choice_res = {
3590 let __seq_res = {
3591 __err_state.suppress_fail += 1;
3592 let __assert_res = {
3593 let __choice_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "_") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"_\"") ; :: peg :: RuleResult :: Failed } } ;
3594 match __choice_res {
3595 ::peg::RuleResult::Matched(
3596 __pos,
3597 __value,
3598 ) => ::peg::RuleResult::Matched(
3599 __pos, __value,
3600 ),
3601 ::peg::RuleResult::Failed => {
3602 let __choice_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "__") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"__\"") ; :: peg :: RuleResult :: Failed } } ;
3603 match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "___") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"___\"") ; :: peg :: RuleResult :: Failed } } }
3604 }
3605 }
3606 };
3607 __err_state.suppress_fail -= 1;
3608 match __assert_res {
3609 ::peg::RuleResult::Matched(_, __value) => {
3610 ::peg::RuleResult::Matched(
3611 __pos, __value,
3612 )
3613 }
3614 ::peg::RuleResult::Failed => {
3615 ::peg::RuleResult::Failed
3616 }
3617 }
3618 };
3619 match __seq_res {
3620 ::peg::RuleResult::Matched(__pos, _) => {
3621 let __seq_res = __parse_sp(
3622 __input,
3623 __state,
3624 __err_state,
3625 __pos,
3626 );
3627 match __seq_res {
3628 ::peg::RuleResult::Matched(
3629 __pos,
3630 sp,
3631 ) => {
3632 let __seq_res = __parse_IDENT(
3633 __input,
3634 __state,
3635 __err_state,
3636 __pos,
3637 );
3638 match __seq_res {
3639 ::peg::RuleResult::Matched(
3640 __pos,
3641 name,
3642 ) => {
3643 ::peg::RuleResult::Matched(
3644 __pos,
3645 (|| {
3646 RuleExpr(
3647 name,
3648 None,
3649 Vec::new(),
3650 )
3651 .at(sp)
3652 })(
3653 ),
3654 )
3655 }
3656 ::peg::RuleResult::Failed => {
3657 ::peg::RuleResult::Failed
3658 }
3659 }
3660 }
3661 ::peg::RuleResult::Failed => {
3662 ::peg::RuleResult::Failed
3663 }
3664 }
3665 }
3666 ::peg::RuleResult::Failed => {
3667 ::peg::RuleResult::Failed
3668 }
3669 }
3670 };
3671 match __choice_res {
3672 ::peg::RuleResult::Matched(__pos, __value) => {
3673 ::peg::RuleResult::Matched(__pos, __value)
3674 }
3675 ::peg::RuleResult::Failed => {
3676 let __choice_res = {
3677 let __seq_res = __parse_sp(
3678 __input,
3679 __state,
3680 __err_state,
3681 __pos,
3682 );
3683 match __seq_res {
3684 ::peg::RuleResult::Matched(
3685 __pos,
3686 sp,
3687 ) => {
3688 let __seq_res = __parse_IDENT(
3689 __input,
3690 __state,
3691 __err_state,
3692 __pos,
3693 );
3694 match __seq_res {
3695 ::peg::RuleResult::Matched(
3696 __pos,
3697 name,
3698 ) => {
3699 let __seq_res = match { let str_start = __pos ; match match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "::") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = match __parse_rust_generic_args (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , _) => { :: peg :: RuleResult :: Matched (__pos , ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"::\"") ; :: peg :: RuleResult :: Failed } } { :: peg :: RuleResult :: Matched (__newpos , _) => { :: peg :: RuleResult :: Matched (__newpos , :: peg :: ParseSlice :: parse_slice (__input , str_start , __newpos)) } , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } { :: peg :: RuleResult :: Matched (__newpos , __value) => { :: peg :: RuleResult :: Matched (__newpos , Some (__value)) } , :: peg :: RuleResult :: Failed => { :: peg :: RuleResult :: Matched (__pos , None) } , } ;
3700 match __seq_res { :: peg :: RuleResult :: Matched (__pos , generics) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "(") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! () ; loop { let __pos = __repeat_pos ; let __pos = if __repeat_value . is_empty () { __pos } else { let __sep_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ",") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , __val) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\",\"") ; :: peg :: RuleResult :: Failed } } ; match __sep_res { :: peg :: RuleResult :: Matched (__newpos , _) => { __newpos } , :: peg :: RuleResult :: Failed => break , } } ; let __step_res = __parse_rule_arg (__input , __state , __err_state , __pos) ; match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; __repeat_value . push (__value) ; } , :: peg :: RuleResult :: Failed => { break ; } } } :: peg :: RuleResult :: Matched (__repeat_pos , __repeat_value) } ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , args) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ")") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { RuleExpr (name , generics , args) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\")\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"(\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3701 }
3702 ::peg::RuleResult::Failed => {
3703 ::peg::RuleResult::Failed
3704 }
3705 }
3706 }
3707 ::peg::RuleResult::Failed => {
3708 ::peg::RuleResult::Failed
3709 }
3710 }
3711 };
3712 match __choice_res {
3713 ::peg::RuleResult::Matched(
3714 __pos,
3715 __value,
3716 ) => ::peg::RuleResult::Matched(
3717 __pos, __value,
3718 ),
3719 ::peg::RuleResult::Failed => {
3720 let __choice_res = {
3721 let __seq_res = __parse_sp(
3722 __input,
3723 __state,
3724 __err_state,
3725 __pos,
3726 );
3727 match __seq_res {
3728 ::peg::RuleResult::Matched(
3729 __pos,
3730 sp,
3731 ) => {
3732 let __seq_res =
3733 __parse_LITERAL(
3734 __input,
3735 __state,
3736 __err_state,
3737 __pos,
3738 );
3739 match __seq_res { :: peg :: RuleResult :: Matched (__pos , l) => { :: peg :: RuleResult :: Matched (__pos , (|| { LiteralExpr (l) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3740 }
3741 ::peg::RuleResult::Failed => {
3742 ::peg::RuleResult::Failed
3743 }
3744 }
3745 };
3746 match __choice_res {
3747 ::peg::RuleResult::Matched(
3748 __pos,
3749 __value,
3750 ) => ::peg::RuleResult::Matched(
3751 __pos, __value,
3752 ),
3753 ::peg::RuleResult::Failed => {
3754 let __choice_res = {
3755 let __seq_res = __parse_sp(
3756 __input,
3757 __state,
3758 __err_state,
3759 __pos,
3760 );
3761 match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { { let __seq_res = __parse_BRACKET_GROUP (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , p) => { :: peg :: RuleResult :: Matched (__pos , (|| { PatternExpr (p) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
3762 };
3763 match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => { let __choice_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "(") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_sp (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "@") { :: peg :: RuleResult :: Matched (__pos , __val) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ")") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { MarkerExpr (true) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\")\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"@\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"(\"") ; :: peg :: RuleResult :: Failed } } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => { let __choice_res = { let __seq_res = __parse_sp (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "@") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { MarkerExpr (false) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"@\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => { let __choice_res = { let __seq_res = __parse_sp (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "##") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_IDENT (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , method) => { { let __seq_res = __parse_PAREN_GROUP (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , args) => { :: peg :: RuleResult :: Matched (__pos , (|| { MethodExpr (method , args . stream ()) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"##\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => { let __choice_res = { let __seq_res = __parse_sp (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , sp) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "#") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_BRACE_GROUP (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , code) => { :: peg :: RuleResult :: Matched (__pos , (|| { CustomExpr (code) . at (sp) }) ()) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"#\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "(") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = __parse_expression (__input , __state , __err_state , __pos) ; match __seq_res { :: peg :: RuleResult :: Matched (__pos , expression) => { match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , ")") { :: peg :: RuleResult :: Matched (__pos , __val) => { :: peg :: RuleResult :: Matched (__pos , (|| { expression }) ()) } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\")\"") ; :: peg :: RuleResult :: Failed } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => { __err_state . mark_failure (__pos , "\"(\"") ; :: peg :: RuleResult :: Failed } } } } } } } } } } }
3764 }
3765 }
3766 }
3767 }
3768 }
3769 }
3770 }
3771 }
3772 }
3773 }
3774 }
3775 }
3776 }
3777 }
3778 };
3779 __state.primary_cache.insert(__pos, __rule_result.clone());
3780 __rule_result
3781 }
3782 fn __parse_rule_arg<'input>(
3783 __input: &'input Input,
3784 __state: &mut ParseState<'input>,
3785 __err_state: &mut ::peg::error::ErrorState,
3786 __pos: usize,
3787 ) -> ::peg::RuleResult<RuleArg> {
3788 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3789 {
3790 let __choice_res = match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "<")
3791 {
3792 ::peg::RuleResult::Matched(__pos, __val) => {
3793 let __seq_res = __parse_expression(__input, __state, __err_state, __pos);
3794 match __seq_res {
3795 ::peg::RuleResult::Matched(__pos, e) => {
3796 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, ">") {
3797 ::peg::RuleResult::Matched(__pos, __val) => {
3798 ::peg::RuleResult::Matched(__pos, (|| RuleArg::Peg(e))())
3799 }
3800 ::peg::RuleResult::Failed => {
3801 __err_state.mark_failure(__pos, "\">\"");
3802 ::peg::RuleResult::Failed
3803 }
3804 }
3805 }
3806 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3807 }
3808 }
3809 ::peg::RuleResult::Failed => {
3810 __err_state.mark_failure(__pos, "\"<\"");
3811 ::peg::RuleResult::Failed
3812 }
3813 };
3814 match __choice_res {
3815 ::peg::RuleResult::Matched(__pos, __value) => {
3816 ::peg::RuleResult::Matched(__pos, __value)
3817 }
3818 ::peg::RuleResult::Failed => {
3819 let __seq_res = {
3820 let str_start = __pos;
3821 match {
3822 let mut __repeat_pos = __pos;
3823 let mut __repeat_value = vec![];
3824 loop {
3825 let __pos = __repeat_pos;
3826 let __step_res = ::peg::call_custom_closure(
3827 (|input, pos| input.eat_until(pos, ',')),
3828 __input,
3829 __pos,
3830 );
3831 match __step_res {
3832 ::peg::RuleResult::Matched(__newpos, __value) => {
3833 __repeat_pos = __newpos;
3834 __repeat_value.push(__value);
3835 }
3836 ::peg::RuleResult::Failed => {
3837 break;
3838 }
3839 }
3840 }
3841 if __repeat_value.len() >= 1 {
3842 ::peg::RuleResult::Matched(__repeat_pos, ())
3843 } else {
3844 ::peg::RuleResult::Failed
3845 }
3846 } {
3847 ::peg::RuleResult::Matched(__newpos, _) => ::peg::RuleResult::Matched(
3848 __newpos,
3849 ::peg::ParseSlice::parse_slice(__input, str_start, __newpos),
3850 ),
3851 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3852 }
3853 };
3854 match __seq_res {
3855 ::peg::RuleResult::Matched(__pos, tt) => {
3856 ::peg::RuleResult::Matched(__pos, (|| RuleArg::Rust(tt))())
3857 }
3858 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3859 }
3860 }
3861 }
3862 }
3863 }
3864 fn __parse_precedence_level<'input>(
3865 __input: &'input Input,
3866 __state: &mut ParseState<'input>,
3867 __err_state: &mut ::peg::error::ErrorState,
3868 __pos: usize,
3869 ) -> ::peg::RuleResult<PrecedenceLevel> {
3870 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3871 {
3872 let __seq_res = {
3873 let mut __repeat_pos = __pos;
3874 let mut __repeat_value = vec![];
3875 loop {
3876 let __pos = __repeat_pos;
3877 let __step_res = __parse_precedence_op(__input, __state, __err_state, __pos);
3878 match __step_res {
3879 ::peg::RuleResult::Matched(__newpos, __value) => {
3880 __repeat_pos = __newpos;
3881 __repeat_value.push(__value);
3882 }
3883 ::peg::RuleResult::Failed => {
3884 break;
3885 }
3886 }
3887 }
3888 if __repeat_value.len() >= 1 {
3889 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
3890 } else {
3891 ::peg::RuleResult::Failed
3892 }
3893 };
3894 match __seq_res {
3895 ::peg::RuleResult::Matched(__pos, operators) => ::peg::RuleResult::Matched(
3896 __pos,
3897 (|| PrecedenceLevel {
3898 operators: operators,
3899 })(),
3900 ),
3901 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3902 }
3903 }
3904 }
3905 fn __parse_precedence_op<'input>(
3906 __input: &'input Input,
3907 __state: &mut ParseState<'input>,
3908 __err_state: &mut ::peg::error::ErrorState,
3909 __pos: usize,
3910 ) -> ::peg::RuleResult<PrecedenceOperator> {
3911 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3912 {
3913 let __seq_res = __parse_sp(__input, __state, __err_state, __pos);
3914 match __seq_res {
3915 ::peg::RuleResult::Matched(__pos, span) => {
3916 let __seq_res = {
3917 let mut __repeat_pos = __pos;
3918 let mut __repeat_value = vec![];
3919 loop {
3920 let __pos = __repeat_pos;
3921 let __step_res = __parse_labeled(__input, __state, __err_state, __pos);
3922 match __step_res {
3923 ::peg::RuleResult::Matched(__newpos, __value) => {
3924 __repeat_pos = __newpos;
3925 __repeat_value.push(__value);
3926 }
3927 ::peg::RuleResult::Failed => {
3928 break;
3929 }
3930 }
3931 }
3932 ::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
3933 };
3934 match __seq_res {
3935 ::peg::RuleResult::Matched(__pos, elements) => {
3936 let __seq_res =
3937 __parse_BRACE_GROUP(__input, __state, __err_state, __pos);
3938 match __seq_res {
3939 ::peg::RuleResult::Matched(__pos, action) => {
3940 ::peg::RuleResult::Matched(
3941 __pos,
3942 (|| PrecedenceOperator {
3943 span,
3944 elements,
3945 action,
3946 })(),
3947 )
3948 }
3949 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3950 }
3951 }
3952 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3953 }
3954 }
3955 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
3956 }
3957 }
3958 }
3959 fn __parse_sp<'input>(
3960 __input: &'input Input,
3961 __state: &mut ParseState<'input>,
3962 __err_state: &mut ::peg::error::ErrorState,
3963 __pos: usize,
3964 ) -> ::peg::RuleResult<Span> {
3965 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3966 ::peg::call_custom_closure((|input, pos| input.next_span(pos)), __input, __pos)
3967 }
3968 fn __parse_KEYWORD<'input>(
3969 __input: &'input Input,
3970 __state: &mut ParseState<'input>,
3971 __err_state: &mut ::peg::error::ErrorState,
3972 __pos: usize,
3973 ) -> ::peg::RuleResult<()> {
3974 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
3975 {
3976 let __choice_res =
3977 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "pub") {
3978 ::peg::RuleResult::Matched(__pos, __val) => {
3979 ::peg::RuleResult::Matched(__pos, __val)
3980 }
3981 ::peg::RuleResult::Failed => {
3982 __err_state.mark_failure(__pos, "\"pub\"");
3983 ::peg::RuleResult::Failed
3984 }
3985 };
3986 match __choice_res {
3987 ::peg::RuleResult::Matched(__pos, __value) => {
3988 ::peg::RuleResult::Matched(__pos, __value)
3989 }
3990 ::peg::RuleResult::Failed => {
3991 let __choice_res =
3992 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "rule") {
3993 ::peg::RuleResult::Matched(__pos, __val) => {
3994 ::peg::RuleResult::Matched(__pos, __val)
3995 }
3996 ::peg::RuleResult::Failed => {
3997 __err_state.mark_failure(__pos, "\"rule\"");
3998 ::peg::RuleResult::Failed
3999 }
4000 };
4001 match __choice_res {
4002 ::peg::RuleResult::Matched(__pos, __value) => {
4003 ::peg::RuleResult::Matched(__pos, __value)
4004 }
4005 ::peg::RuleResult::Failed => {
4006 let __choice_res = match ::peg::ParseLiteral::parse_string_literal(
4007 __input, __pos, "use",
4008 ) {
4009 ::peg::RuleResult::Matched(__pos, __val) => {
4010 ::peg::RuleResult::Matched(__pos, __val)
4011 }
4012 ::peg::RuleResult::Failed => {
4013 __err_state.mark_failure(__pos, "\"use\"");
4014 ::peg::RuleResult::Failed
4015 }
4016 };
4017 match __choice_res {
4018 ::peg::RuleResult::Matched(__pos, __value) => {
4019 ::peg::RuleResult::Matched(__pos, __value)
4020 }
4021 ::peg::RuleResult::Failed => {
4022 let __choice_res =
4023 match ::peg::ParseLiteral::parse_string_literal(
4024 __input, __pos, "type",
4025 ) {
4026 ::peg::RuleResult::Matched(__pos, __val) => {
4027 ::peg::RuleResult::Matched(__pos, __val)
4028 }
4029 ::peg::RuleResult::Failed => {
4030 __err_state.mark_failure(__pos, "\"type\"");
4031 ::peg::RuleResult::Failed
4032 }
4033 };
4034 match __choice_res {
4035 ::peg::RuleResult::Matched(__pos, __value) => {
4036 ::peg::RuleResult::Matched(__pos, __value)
4037 }
4038 ::peg::RuleResult::Failed => {
4039 match ::peg::ParseLiteral::parse_string_literal(
4040 __input, __pos, "where",
4041 ) {
4042 ::peg::RuleResult::Matched(__pos, __val) => {
4043 ::peg::RuleResult::Matched(__pos, __val)
4044 }
4045 ::peg::RuleResult::Failed => {
4046 __err_state.mark_failure(__pos, "\"where\"");
4047 ::peg::RuleResult::Failed
4048 }
4049 }
4050 }
4051 }
4052 }
4053 }
4054 }
4055 }
4056 }
4057 }
4058 }
4059 }
4060 fn __parse_IDENT<'input>(
4061 __input: &'input Input,
4062 __state: &mut ParseState<'input>,
4063 __err_state: &mut ::peg::error::ErrorState,
4064 __pos: usize,
4065 ) -> ::peg::RuleResult<Ident> {
4066 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
4067 {
4068 let __seq_res = {
4069 __err_state.suppress_fail += 1;
4070 let __assert_res = match __parse_KEYWORD(__input, __state, __err_state, __pos) {
4071 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
4072 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
4073 };
4074 __err_state.suppress_fail -= 1;
4075 match __assert_res {
4076 ::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
4077 ::peg::RuleResult::Matched(..) => ::peg::RuleResult::Failed,
4078 }
4079 };
4080 match __seq_res {
4081 ::peg::RuleResult::Matched(__pos, _) => {
4082 let __seq_res =
4083 ::peg::call_custom_closure((|input, pos| input.ident(pos)), __input, __pos);
4084 match __seq_res {
4085 ::peg::RuleResult::Matched(__pos, i) => {
4086 ::peg::RuleResult::Matched(__pos, (|| i)())
4087 }
4088 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
4089 }
4090 }
4091 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
4092 }
4093 }
4094 }
4095 fn __parse_LITERAL<'input>(
4096 __input: &'input Input,
4097 __state: &mut ParseState<'input>,
4098 __err_state: &mut ::peg::error::ErrorState,
4099 __pos: usize,
4100 ) -> ::peg::RuleResult<Literal> {
4101 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
4102 ::peg::call_custom_closure((|input, pos| input.literal(pos)), __input, __pos)
4103 }
4104 fn __parse_PAREN_GROUP<'input>(
4105 __input: &'input Input,
4106 __state: &mut ParseState<'input>,
4107 __err_state: &mut ::peg::error::ErrorState,
4108 __pos: usize,
4109 ) -> ::peg::RuleResult<Group> {
4110 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
4111 ::peg::call_custom_closure(
4112 (|input, pos| input.group(pos, Delimiter::Parenthesis)),
4113 __input,
4114 __pos,
4115 )
4116 }
4117 fn __parse_BRACE_GROUP<'input>(
4118 __input: &'input Input,
4119 __state: &mut ParseState<'input>,
4120 __err_state: &mut ::peg::error::ErrorState,
4121 __pos: usize,
4122 ) -> ::peg::RuleResult<Group> {
4123 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
4124 ::peg::call_custom_closure(
4125 (|input, pos| input.group(pos, Delimiter::Brace)),
4126 __input,
4127 __pos,
4128 )
4129 }
4130 fn __parse_BRACKET_GROUP<'input>(
4131 __input: &'input Input,
4132 __state: &mut ParseState<'input>,
4133 __err_state: &mut ::peg::error::ErrorState,
4134 __pos: usize,
4135 ) -> ::peg::RuleResult<Group> {
4136 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
4137 ::peg::call_custom_closure(
4138 (|input, pos| input.group(pos, Delimiter::Bracket)),
4139 __input,
4140 __pos,
4141 )
4142 }
4143 fn __parse_LIFETIME<'input>(
4144 __input: &'input Input,
4145 __state: &mut ParseState<'input>,
4146 __err_state: &mut ::peg::error::ErrorState,
4147 __pos: usize,
4148 ) -> ::peg::RuleResult<()> {
4149 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
4150 match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "'") {
4151 ::peg::RuleResult::Matched(__pos, __val) => {
4152 let __seq_res = match __parse_IDENT(__input, __state, __err_state, __pos) {
4153 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
4154 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
4155 };
4156 match __seq_res {
4157 ::peg::RuleResult::Matched(__pos, _) => ::peg::RuleResult::Matched(__pos, ()),
4158 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
4159 }
4160 }
4161 ::peg::RuleResult::Failed => {
4162 __err_state.mark_failure(__pos, "\"'\"");
4163 ::peg::RuleResult::Failed
4164 }
4165 }
4166 }
4167 fn __parse_INTEGER<'input>(
4168 __input: &'input Input,
4169 __state: &mut ParseState<'input>,
4170 __err_state: &mut ::peg::error::ErrorState,
4171 __pos: usize,
4172 ) -> ::peg::RuleResult<()> {
4173 #![allow(non_snake_case, unused, clippy::redundant_closure_call)]
4174 match __parse_LITERAL(__input, __state, __err_state, __pos) {
4175 ::peg::RuleResult::Matched(pos, _) => ::peg::RuleResult::Matched(pos, ()),
4176 ::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
4177 }
4178 }
4179}