// Generated by rust-peg. Do not edit.
pub mod peg {
#[allow(unused_imports)]
use super::*;
type Input = FlatTokenStream;
type PositionRepr = ::PositionRepr;
struct ParseState<'input> {
_phantom: ::std::marker::PhantomData<&'input ()>,
primary_cache: ::std::collections::HashMap>,
}
impl<'input> ParseState<'input> {
fn new() -> ParseState<'input> {
ParseState {
_phantom: ::std::marker::PhantomData,
primary_cache: ::std::collections::HashMap::new(),
}
}
}
use crate::ast::Expr::*;
use crate::ast::*;
use crate::tokens::FlatTokenStream;
use proc_macro2::{Delimiter, Ident, Literal, TokenStream};
pub fn peg_grammar<'input>(
__input: &'input Input,
) -> ::std::result::Result> {
#![allow(non_snake_case, unused)]
let mut __err_state = ::peg::error::ErrorState::new(::peg::Parse::start(__input));
let mut __state = ParseState::new();
match __parse_peg_grammar(
__input,
&mut __state,
&mut __err_state,
::peg::Parse::start(__input),
) {
::peg::RuleResult::Matched(__pos, __value) => {
if __pos == __input.len() {
return Ok(__value);
} else {
__err_state.mark_failure(__pos, "EOF");
}
}
_ => (),
}
__state = ParseState::new();
__err_state.reparse_for_error();
match __parse_peg_grammar(
__input,
&mut __state,
&mut __err_state,
::peg::Parse::start(__input),
) {
::peg::RuleResult::Matched(__pos, __value) => {
if __pos == __input.len() {
panic!(
"Parser is nondeterministic: succeeded when reparsing for error position"
);
} else {
__err_state.mark_failure(__pos, "EOF");
}
}
_ => (),
}
Err(__err_state.into_parse_error(__input))
}
fn __parse_peg_grammar<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult {
#![allow(non_snake_case, unused)]
{
let __seq_res = __parse_rust_doc_comment(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, doc) => {
let __seq_res = __parse_rust_visibility(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, visibility) => {
let __seq_res = match ::peg::ParseLiteral::parse_string_literal(
__input, __pos, "grammar",
) {
::peg::RuleResult::Matched(__pos, __val) => {
::peg::RuleResult::Matched(__pos, __val)
}
::peg::RuleResult::Failed => {
__err_state.mark_failure(__pos, "\"grammar\"")
}
};
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 = __parse_grammar_args(
__input,
__state,
__err_state,
__pos,
);
match __seq_res {
::peg::RuleResult::Matched(__pos, args) => {
let __seq_res = match :: peg :: ParseLiteral :: parse_string_literal ( __input , __pos , "for" ) { :: peg :: RuleResult :: Matched ( __pos , __val ) => :: peg :: RuleResult :: Matched ( __pos , __val ) , :: peg :: RuleResult :: Failed => __err_state . mark_failure ( __pos , "\"for\"" ) } ;
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
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,
) => {
let __seq_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 , "\"{\"" ) } ;
match __seq_res { :: peg :: RuleResult :: Matched ( __pos , _ ) => { { 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 ) => { { let __seq_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 , "\"}\"" ) } ; match __seq_res { :: peg :: RuleResult :: Matched ( __pos , _ ) => { :: peg :: RuleResult :: Matched ( __pos , { Grammar { doc , visibility , name , args , input_type , items } } ) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
}
fn __parse_grammar_args<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult> {
#![allow(non_snake_case, unused)]
{
let __seq_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, "\"(\""),
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
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, "\",\"")
}
};
match __sep_res {
::peg::RuleResult::Matched(__newpos, _) => __newpos,
::peg::RuleResult::Failed => break,
}
};
let __step_res = {
let __seq_res = __parse_IDENT(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, i) => {
let __seq_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, "\":\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
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, {
(i, t)
})
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::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;
}
}
}
::peg::RuleResult::Matched(__repeat_pos, __repeat_value)
};
match __seq_res {
::peg::RuleResult::Matched(__pos, args) => {
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::Matched(__newpos, _) => {
::peg::RuleResult::Matched(__newpos, ())
}
::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
let __seq_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, "\")\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
::peg::RuleResult::Matched(__pos, { args })
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
}
fn __parse_peg_rule<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult {
#![allow(non_snake_case, unused)]
{
let __seq_res = __parse_rust_doc_comment(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, doc) => {
let __seq_res = __parse_cacheflag(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, cached) => {
let __seq_res =
__parse_rust_visibility(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, visibility) => {
let __seq_res = match ::peg::ParseLiteral::parse_string_literal(
__input, __pos, "rule",
) {
::peg::RuleResult::Matched(__pos, __val) => {
::peg::RuleResult::Matched(__pos, __val)
}
::peg::RuleResult::Failed => {
__err_state.mark_failure(__pos, "\"rule\"")
}
};
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 __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 = 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 , "\"(\"" ) } ;
match __seq_res {
::peg::RuleResult::Matched(
__pos,
_,
) => {
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 , "\",\"" ) } ;
match __sep_res { :: peg :: RuleResult :: Matched ( __newpos , _ ) => { __newpos } , :: peg :: RuleResult :: Failed => break , }
};
let __step_res =
__parse_rule_param(
__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 , params ) => { { let __seq_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 , "\")\"" ) } ; match __seq_res { :: peg :: RuleResult :: Matched ( __pos , _ ) => { { let __seq_res = match { let __seq_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 , "\"->\"" ) } ; match __seq_res { :: peg :: RuleResult :: Matched ( __pos , _ ) => { { 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 => :: 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 , ret_type ) => { { let __seq_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 , "\"=\"" ) } ; match __seq_res { :: peg :: RuleResult :: Matched ( __pos , _ ) => { { 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 :: 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 { doc , name , ty_params , params , expr , ret_type , visibility , cached } } ) } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , } } } :: peg :: RuleResult :: Failed => :: peg :: RuleResult :: Failed , }
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
}
fn __parse_cacheflag<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult {
#![allow(non_snake_case, unused)]
{
let __choice_res = {
let __seq_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, "\"#\""),
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
let __seq_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, "\"[\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
let __seq_res = match ::peg::ParseLiteral::parse_string_literal(
__input, __pos, "cache",
) {
::peg::RuleResult::Matched(__pos, __val) => {
::peg::RuleResult::Matched(__pos, __val)
}
::peg::RuleResult::Failed => {
__err_state.mark_failure(__pos, "\"cache\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
let __seq_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, "\"]\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
::peg::RuleResult::Matched(__pos, { true })
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::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 => ::peg::RuleResult::Matched(__pos, { false }),
}
}
}
fn __parse_rust_ty_params<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult> {
#![allow(non_snake_case, unused)]
{
let __seq_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, "\"<\""),
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
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, "\",\"")
}
};
match __sep_res {
::peg::RuleResult::Matched(__newpos, _) => __newpos,
::peg::RuleResult::Failed => break,
}
};
let __step_res = {
let str_start = __pos;
match {
let __choice_res =
match __parse_IDENT(__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_LIFETIME(
__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 __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, __repeat_value)
} else {
::peg::RuleResult::Failed
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, p) => {
let __seq_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, "\">\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
::peg::RuleResult::Matched(__pos, { p })
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
}
fn __parse_rule_param<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult {
#![allow(non_snake_case, unused)]
{
let __seq_res = __parse_IDENT(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, name) => {
let __seq_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, "\":\""),
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
let __seq_res = {
let __choice_res = {
let __seq_res = match ::peg::ParseLiteral::parse_string_literal(
__input, __pos, "rule",
) {
::peg::RuleResult::Matched(__pos, __val) => {
::peg::RuleResult::Matched(__pos, __val)
}
::peg::RuleResult::Failed => {
__err_state.mark_failure(__pos, "\"rule\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
let __seq_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, "\"<\"")
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, _) => {
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, r) => {
let __seq_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 , "\">\"" ) } ;
match __seq_res {
::peg::RuleResult::Matched(
__pos,
_,
) => ::peg::RuleResult::Matched(
__pos,
{ RuleParamTy::Rule(r) },
),
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => {
::peg::RuleResult::Failed
}
}
}
::peg::RuleResult::Failed => {
::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 __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, {
RuleParamTy::Rust(t)
})
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
}
};
match __seq_res {
::peg::RuleResult::Matched(__pos, ty) => {
::peg::RuleResult::Matched(__pos, { RuleParam { name, ty } })
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
}
fn __parse_item<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult- {
#![allow(non_snake_case, unused)]
{
let __choice_res = {
let __seq_res = __parse_rust_use(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, u) => {
::peg::RuleResult::Matched(__pos, { Item::Use(u) })
}
::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 = __parse_peg_rule(__input, __state, __err_state, __pos);
match __seq_res {
::peg::RuleResult::Matched(__pos, r) => {
::peg::RuleResult::Matched(__pos, { Item::Rule(r) })
}
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
}
}
}
}
}
fn __parse_rust_doc_comment<'input>(
__input: &'input Input,
__state: &mut ParseState<'input>,
__err_state: &mut ::peg::error::ErrorState,
__pos: usize,
) -> ::peg::RuleResult