diff --git a/peg-macros/grammar.rs b/peg-macros/grammar.rs index f7debea..9b3fe83 100644 --- a/peg-macros/grammar.rs +++ b/peg-macros/grammar.rs @@ -113,7 +113,7 @@ pub mod peg { __err_state, __pos, ); - 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 , } + 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 = Default :: default () ; let mut __repeat_count = 0usize ; 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 ; core :: iter :: Extend :: extend (& mut __repeat_value , Some (__value)) ; } , :: peg :: RuleResult :: Failed => { break ; } } __repeat_count += 1 ; } :: 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 , } } ::peg::RuleResult::Failed => { ::peg::RuleResult::Failed @@ -147,10 +147,11 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -191,14 +192,15 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) } else { ::peg::RuleResult::Failed @@ -258,10 +260,11 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -337,12 +340,13 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) }; @@ -772,10 +776,11 @@ pub mod peg { let __seq_res = match { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -832,14 +837,15 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) } else { ::peg::RuleResult::Failed @@ -943,6 +949,7 @@ pub mod peg { let str_start = __pos; match { let mut __repeat_pos = __pos; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; let __step_res = match ::peg::ParseLiteral::parse_string_literal( @@ -1005,6 +1012,7 @@ pub mod peg { break; } } + __repeat_count += 1; } ::peg::RuleResult::Matched(__repeat_pos, ()) } { @@ -1118,7 +1126,7 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __value) } ::peg::RuleResult::Failed => { - 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 } } ; + 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_count = 0usize ; loop { let __pos = __repeat_pos ; let __pos = if __repeat_count == 0 { __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 ; } , :: peg :: RuleResult :: Failed => { break ; } } __repeat_count += 1 ; } if __repeat_count >= 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 } } ; 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 , ()) } , } } } } @@ -1198,10 +1206,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, _) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -1230,14 +1238,14 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, ()) } else { ::peg::RuleResult::Failed @@ -1359,10 +1367,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = @@ -1404,14 +1412,14 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, ()) } else { ::peg::RuleResult::Failed @@ -1441,10 +1449,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __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 } } ; @@ -1475,14 +1483,14 @@ pub mod peg { __value, ) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, ()) } else { ::peg::RuleResult::Failed @@ -1515,11 +1523,11 @@ pub mod peg { let __seq_res = match { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value - .is_empty() + let __pos = if __repeat_count + == 0 { __pos } else { @@ -1527,9 +1535,10 @@ pub mod peg { match __sep_res { :: peg :: RuleResult :: Matched (__newpos , _) => { __newpos } , :: peg :: RuleResult :: Failed => break , } }; 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 , } ; - match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; __repeat_value . push (__value) ; } , :: peg :: RuleResult :: Failed => { break ; } } + match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; } , :: peg :: RuleResult :: Failed => { break ; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched( __repeat_pos, (), @@ -1656,10 +1665,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, _) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -1693,7 +1702,7 @@ pub mod peg { match __seq_res { ::peg::RuleResult::Matched(__pos, _) => { let __seq_res = { - let __choice_res = 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 = { let __choice_res = match __parse_LIFETIME (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: 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 = match __parse_rust_type (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: 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 = match __parse_BRACE_GROUP (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => match __parse_LITERAL (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: 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 , _) => { 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 } } ; + let __choice_res = match :: peg :: ParseLiteral :: parse_string_literal (__input , __pos , "<") { :: peg :: RuleResult :: Matched (__pos , __val) => { { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_count = 0usize ; loop { let __pos = __repeat_pos ; let __pos = if __repeat_count == 0 { __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 __choice_res = match __parse_LIFETIME (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: 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 = match __parse_rust_type (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: 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 = match __parse_BRACE_GROUP (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => match __parse_LITERAL (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } } } } } ; match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; } , :: peg :: RuleResult :: Failed => { break ; } } __repeat_count += 1 ; } if __repeat_count >= 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 , _) => { 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 } } ; match __choice_res { ::peg::RuleResult::Matched( __pos, @@ -1752,14 +1761,14 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, ()) } else { ::peg::RuleResult::Failed @@ -1787,10 +1796,11 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -1836,14 +1846,15 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) } else { ::peg::RuleResult::Failed @@ -1903,10 +1914,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -1943,11 +1954,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() - { + let __pos = if __repeat_count == 0 { __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 } } ; @@ -1984,14 +1994,14 @@ pub mod peg { __value, ) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched( __repeat_pos, (), @@ -2101,11 +2111,11 @@ pub mod peg { ) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value - .is_empty() + let __pos = if __repeat_count + == 0 { __pos } else { @@ -2116,9 +2126,10 @@ pub mod peg { let __choice_res = match __parse_LIFETIME (__input , __state , __err_state , __pos) { :: peg :: RuleResult :: Matched (pos , _) => :: peg :: RuleResult :: Matched (pos , ()) , :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } ; match __choice_res { :: peg :: RuleResult :: Matched (__pos , __value) => :: peg :: RuleResult :: Matched (__pos , __value) , :: peg :: RuleResult :: Failed => { 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 , _) => { { 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 => :: peg :: RuleResult :: Failed , } } } }; - match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; __repeat_value . push (__value) ; } , :: peg :: RuleResult :: Failed => { break ; } } + match __step_res { :: peg :: RuleResult :: Matched (__newpos , __value) => { __repeat_pos = __newpos ; } , :: peg :: RuleResult :: Failed => { break ; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched( __repeat_pos, (), @@ -2160,12 +2171,12 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } ::peg::RuleResult::Matched(__repeat_pos, ()) }; @@ -2224,10 +2235,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = @@ -2261,14 +2272,14 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, ()) } else { ::peg::RuleResult::Failed @@ -2318,10 +2329,10 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = @@ -2398,14 +2409,14 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, ()) } else { ::peg::RuleResult::Failed @@ -2463,10 +2474,11 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, sp) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __pos } else { let __sep_res = match ::peg::ParseLiteral::parse_string_literal( @@ -2489,14 +2501,15 @@ pub mod peg { match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) } else { ::peg::RuleResult::Failed @@ -2506,6 +2519,7 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, s) => ::peg::RuleResult::Matched( __pos, (|| { + let s: Vec<_> = s; if s.len() == 1 { s.into_iter().next().unwrap() } else { @@ -2533,19 +2547,21 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, sp) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; let __step_res = __parse_labeled(__input, __state, __err_state, __pos); match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) }; @@ -3183,10 +3199,11 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, __val) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; - let __pos = if __repeat_value.is_empty() { + let __pos = if __repeat_count == 0 { __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 } } ; @@ -3210,12 +3227,16 @@ pub mod peg { __value, ) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend( + &mut __repeat_value, + Some(__value), + ); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } ::peg::RuleResult::Matched( __repeat_pos, @@ -3382,7 +3403,7 @@ pub mod peg { __err_state, __pos, ); - match __seq_res { :: peg :: RuleResult :: Matched (__pos , name) => { 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 , 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 , } + match __seq_res { :: peg :: RuleResult :: Matched (__pos , name) => { 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 = Default :: default () ; let mut __repeat_count = 0usize ; loop { let __pos = __repeat_pos ; let __pos = if __repeat_count == 0 { __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 ; core :: iter :: Extend :: extend (& mut __repeat_value , Some (__value)) ; } , :: peg :: RuleResult :: Failed => { break ; } } __repeat_count += 1 ; } :: 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 , 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 , } } ::peg::RuleResult::Failed => { ::peg::RuleResult::Failed @@ -3500,21 +3521,21 @@ pub mod peg { let str_start = __pos; match { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; let __step_res = __input.eat_until(__pos, ','); match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, ()) } else { ::peg::RuleResult::Failed @@ -3547,21 +3568,23 @@ pub mod peg { { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; let __step_res = __parse_precedence_op(__input, __state, __err_state, __pos); match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } - if __repeat_value.len() >= 1 { + if __repeat_count >= 1 { ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) } else { ::peg::RuleResult::Failed @@ -3591,19 +3614,21 @@ pub mod peg { ::peg::RuleResult::Matched(__pos, span) => { let __seq_res = { let mut __repeat_pos = __pos; - let mut __repeat_value = vec![]; + let mut __repeat_value = Default::default(); + let mut __repeat_count = 0usize; loop { let __pos = __repeat_pos; let __step_res = __parse_labeled(__input, __state, __err_state, __pos); match __step_res { ::peg::RuleResult::Matched(__newpos, __value) => { __repeat_pos = __newpos; - __repeat_value.push(__value); + core::iter::Extend::extend(&mut __repeat_value, Some(__value)); } ::peg::RuleResult::Failed => { break; } } + __repeat_count += 1; } ::peg::RuleResult::Matched(__repeat_pos, __repeat_value) }; diff --git a/peg-macros/grammar.rustpeg b/peg-macros/grammar.rustpeg index 7fdafdb..72fded5 100644 --- a/peg-macros/grammar.rustpeg +++ b/peg-macros/grammar.rustpeg @@ -83,6 +83,7 @@ rule rust_generic_param() rule expression() -> SpannedExpr = choice() rule choice() -> SpannedExpr = sp:sp() s:sequence() ++ "/" { + let s: Vec<_> = s; if s.len() == 1 { s.into_iter().next().unwrap() } else {