#![feature(prelude_import)] #![no_std] #[prelude_import] use ::std::prelude::v1::*; #[macro_use] extern crate std as std; extern crate pm_lexer as lexer; use pomelo::pomelo; use std::collections::HashMap; pub enum JObject { JDict(HashMap), JArray(Vec), JNumber(i64), JString(String), JBool(bool), JNull, } #[automatically_derived] #[allow(unused_qualifications)] impl ::std::fmt::Debug for JObject { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { match (&*self,) { (&JObject::JDict(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JDict"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&JObject::JArray(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JArray"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&JObject::JNumber(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JNumber"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&JObject::JString(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JString"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&JObject::JBool(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JBool"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&JObject::JNull,) => { let mut debug_trait_builder = f.debug_tuple("JNull"); debug_trait_builder.finish() } } } } #[automatically_derived] #[allow(unused_qualifications)] impl ::std::clone::Clone for JObject { #[inline] fn clone(&self) -> JObject { match (&*self,) { (&JObject::JDict(ref __self_0),) => { JObject::JDict(::std::clone::Clone::clone(&(*__self_0))) } (&JObject::JArray(ref __self_0),) => { JObject::JArray(::std::clone::Clone::clone(&(*__self_0))) } (&JObject::JNumber(ref __self_0),) => { JObject::JNumber(::std::clone::Clone::clone(&(*__self_0))) } (&JObject::JString(ref __self_0),) => { JObject::JString(::std::clone::Clone::clone(&(*__self_0))) } (&JObject::JBool(ref __self_0),) => { JObject::JBool(::std::clone::Clone::clone(&(*__self_0))) } (&JObject::JNull,) => JObject::JNull, } } } impl std::str::FromStr for JObject { type Err = String; fn from_str(input: &str) -> Result { let mut p = json::Parser::new(); let tok_stream = input.parse().map_err(|_| "Lexer Error")?; lexer::parse::(tok_stream, |tk| { use proc_macro2::TokenTree; let tk = match tk { TokenTree::Punct(p) => match p.as_char() { '{' => json::Token::LBrace, '}' => json::Token::RBrace, '[' => json::Token::LBracket, ']' => json::Token::RBracket, ',' => json::Token::Comma, ':' => json::Token::Colon, c => { return Err(::alloc::fmt::format(::std::fmt::Arguments::new_v1( &["Invalid character \'", "\'"], &match (&c,) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ))); } }, TokenTree::Literal(l) => { let s = l.to_string(); if s.starts_with('"') && s.ends_with('"') { let bs = s.into_bytes(); let s = std::str::from_utf8(&bs[1..bs.len() - 1]) .unwrap() .to_string(); json::Token::JString(s) } else { let i = s.parse().map_err(|_| "Invalid integer value")?; json::Token::JNumber(i) } } TokenTree::Ident(i) => { let s = i.to_string(); if s == "true" { json::Token::JBool(true) } else if s == "false" { json::Token::JBool(false) } else if s == "null" { json::Token::JNull } else { return Err(::alloc::fmt::format(::std::fmt::Arguments::new_v1( &["Invalid token \'", "\'"], &match (&s,) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ))); } } _ => ::std::rt::begin_panic( "not yet implemented", &("examples/json.rs", 55u32, 22u32), ), }; p.parse(tk).map_err(|_| "Parser error")?; Ok(()) })?; let j = p.end_of_input().map_err(|_| "Parser error")?; Ok(j) } } mod json { #![allow(dead_code)] #![allow(unreachable_code)] #![allow(unused_variables)] #![allow(non_snake_case)] use super::JObject; use std::collections::HashMap; const YYNOCODE: i32 = 22i32; const YYWILDCARD: i8 = 0; type YYStack = std::vec::Vec; const YYSTACKLIMIT: usize = 100usize; enum YYMinorType { YY_(::core::marker::PhantomData), YY0(()), YY7((String, JObject)), YY9(Option>), YY4(JObject), YY1(i64), YY8(Option>), YY3(bool), YY2(String), YY5(Vec), YY6(HashMap), } const YYNSTATE: i32 = 25; const YYNRULE: i32 = 18; const YYERRORSYMBOL: i32 = 0; pub enum Token { JNumber(i64), JString(String), JBool(bool), JNull, LBrace, RBrace, LBracket, RBracket, Comma, Colon, } #[automatically_derived] #[allow(unused_qualifications)] impl ::std::fmt::Debug for Token { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { match (&*self,) { (&Token::JNumber(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JNumber"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&Token::JString(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JString"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&Token::JBool(ref __self_0),) => { let mut debug_trait_builder = f.debug_tuple("JBool"); let _ = debug_trait_builder.field(&&(*__self_0)); debug_trait_builder.finish() } (&Token::JNull,) => { let mut debug_trait_builder = f.debug_tuple("JNull"); debug_trait_builder.finish() } (&Token::LBrace,) => { let mut debug_trait_builder = f.debug_tuple("LBrace"); debug_trait_builder.finish() } (&Token::RBrace,) => { let mut debug_trait_builder = f.debug_tuple("RBrace"); debug_trait_builder.finish() } (&Token::LBracket,) => { let mut debug_trait_builder = f.debug_tuple("LBracket"); debug_trait_builder.finish() } (&Token::RBracket,) => { let mut debug_trait_builder = f.debug_tuple("RBracket"); debug_trait_builder.finish() } (&Token::Comma,) => { let mut debug_trait_builder = f.debug_tuple("Comma"); debug_trait_builder.finish() } (&Token::Colon,) => { let mut debug_trait_builder = f.debug_tuple("Colon"); debug_trait_builder.finish() } } } } #[inline] fn token_value(t: Token) -> (i32, YYMinorType) { match t { Token::JNumber(x) => (1i32, YYMinorType::YY1(x)), Token::JString(x) => (2i32, YYMinorType::YY2(x)), Token::JBool(x) => (3i32, YYMinorType::YY3(x)), Token::JNull => (4i32, YYMinorType::YY0(())), Token::LBrace => (5i32, YYMinorType::YY0(())), Token::RBrace => (6i32, YYMinorType::YY0(())), Token::LBracket => (7i32, YYMinorType::YY0(())), Token::RBracket => (8i32, YYMinorType::YY0(())), Token::Comma => (9i32, YYMinorType::YY0(())), Token::Colon => (10i32, YYMinorType::YY0(())), } } fn token_build(i: i32, yy: YYMinorType) -> Option { match (i, yy) { (1i32, YYMinorType::YY1(x)) => Some(Token::JNumber(x)), (2i32, YYMinorType::YY2(x)) => Some(Token::JString(x)), (3i32, YYMinorType::YY3(x)) => Some(Token::JBool(x)), (4i32, _) => Some(Token::JNull), (5i32, _) => Some(Token::LBrace), (6i32, _) => Some(Token::RBrace), (7i32, _) => Some(Token::LBracket), (8i32, _) => Some(Token::RBracket), (9i32, _) => Some(Token::Comma), (10i32, _) => Some(Token::Colon), _ => None, } } static YY_ACTION: [i32; 32usize] = [ 22, 21, 20, 19, 4, 25, 1, 14, 24, 23, 6, 12, 24, 23, 7, 44, 11, 24, 23, 9, 17, 10, 13, 24, 23, 18, 5, 8, 3, 15, 16, 2, ]; static YY_LOOKAHEAD: [i8; 32usize] = [ 1, 2, 3, 4, 5, 0, 7, 13, 14, 15, 16, 13, 14, 15, 20, 12, 13, 14, 15, 17, 18, 19, 13, 14, 15, 6, 9, 2, 10, 8, 18, 9, ]; const YY_SHIFT_USE_DFLT: i32 = -2i32; const YY_SHIFT_COUNT: i32 = 11usize as i32; const YY_SHIFT_MIN: i32 = -1i32; const YY_SHIFT_MAX: i32 = 25i32; static YY_SHIFT_OFST: [i8; 12usize] = [-1, -1, -1, -1, 25, 25, 22, 21, 18, 17, 19, 5]; const YY_REDUCE_USE_DFLT: i32 = -7i32; const YY_REDUCE_COUNT: i32 = 5usize as i32; const YY_REDUCE_MIN: i32 = -6i32; const YY_REDUCE_MAX: i32 = 12i32; static YY_REDUCE_OFST: [i8; 6usize] = [3, -6, 9, -2, 2, 12]; static YY_DEFAULT: [u8; 25usize] = [ 43, 39, 43, 43, 41, 43, 40, 43, 43, 42, 43, 43, 38, 35, 34, 33, 37, 36, 32, 31, 30, 29, 28, 27, 26, ]; static YY_FALLBACK: [i32; 0usize] = []; static YY_RULE_INFO: [i8; 18usize] = [ 12, 13, 13, 13, 13, 13, 13, 14, 15, 16, 16, 17, 17, 18, 20, 20, 19, 19, ]; struct YYStackEntry { stateno: i32, major: i32, minor: YYMinorType, } enum YYStatus { Normal, Failed, Accepted(T), } impl YYStatus { fn unwrap(self) -> T { match self { YYStatus::Accepted(t) => t, _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"accepted without data",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), } } fn is_normal(&self) -> bool { match self { YYStatus::Normal => true, _ => false, } } } pub(crate) struct Parser { error_count: u8, yystack: YYStack, extra: (), yystatus: YYStatus, } impl Parser { pub fn new() -> Self { Self::new_priv(()) } pub fn end_of_input(mut self) -> Result { self.end_of_input_priv().map(|r| r.0) } pub fn parse(&mut self, token: Token) -> Result<(), ()> { let (a, b) = token_value(token); yy_parse_token(self, a, b) } fn new_priv(extra: ()) -> Self { let mut yystack = YYStack::new(); yystack.push(YYStackEntry { stateno: 0, major: 0, minor: YYMinorType::YY0(()), }); Parser { error_count: 0, yystack, extra, yystatus: YYStatus::Normal, } } fn end_of_input_priv(mut self) -> Result<(JObject, ()), ()> { yy_parse_token(&mut self, 0, YYMinorType::YY0(()))?; Ok((self.yystatus.unwrap(), self.extra)) } } fn yy_parse_token(yy: &mut Parser, yymajor: i32, yyminor: YYMinorType) -> Result<(), ()> { if !yy.yystatus.is_normal() { { ::std::rt::begin_panic( "Cannot call parse after failure", &("examples/json.rs", 65u32, 1u32), ) }; } let res = yy_parse_token_2(yy, yymajor, yyminor); if res.is_err() { yy.yystatus = YYStatus::Failed; } res } fn yy_parse_token_2(yy: &mut Parser, yymajor: i32, yyminor: YYMinorType) -> Result<(), ()> { while yy.yystatus.is_normal() { let yyact = yy_find_shift_action(yy, yymajor); if yyact < YYNSTATE { if !(yymajor != 0) { { ::std::rt::begin_panic( "assertion failed: yymajor != 0", &("examples/json.rs", 65u32, 1u32), ) } }; yy_shift(yy, yyact, yymajor, yyminor)?; yy.error_count = yy.error_count.saturating_sub(1); break; } else if yyact < YYNSTATE + YYNRULE { yy_reduce(yy, yyact - YYNSTATE)?; } else { if !(yyact == YYNSTATE + YYNRULE) { { ::std::rt::begin_panic( "assertion failed: yyact == YYNSTATE + YYNRULE", &("examples/json.rs", 65u32, 1u32), ) } }; if YYERRORSYMBOL != 0 { if yymajor == 0 { return Err(yy_parse_failed(yy)); } while let Some(top) = yy.yystack.last() { if top.major == YYERRORSYMBOL { break; } let yyact = yy_find_reduce_action(yy, YYERRORSYMBOL); if yyact < YYNSTATE { let e = yy_syntax_error(yy, yymajor, yyminor)?; yy_shift(yy, yyact, YYERRORSYMBOL, e)?; break; } yy.yystack.pop().unwrap(); } if yy.yystack.is_empty() { return Err(yy_parse_failed(yy)); } yy.error_count = 3; break; } else { if yymajor == 0 { return Err(yy_parse_failed(yy)); } if yy.error_count == 0 { yy_syntax_error(yy, yymajor, yyminor)?; } yy.error_count = 3; break; } } } Ok(()) } fn yy_find_shift_action(yy: &mut Parser, look_ahead: i32) -> i32 { let stateno = yy.yystack.last().unwrap().stateno; if stateno > YY_SHIFT_COUNT { return YY_DEFAULT[stateno as usize] as i32; } let i = YY_SHIFT_OFST[stateno as usize] as i32; if i == YY_SHIFT_USE_DFLT { return YY_DEFAULT[stateno as usize] as i32; } if !(look_ahead != YYNOCODE) { { ::std::rt::begin_panic( "assertion failed: look_ahead != YYNOCODE", &("examples/json.rs", 65u32, 1u32), ) } }; let i = i + look_ahead; if i < 0 || i >= YY_ACTION.len() as i32 || YY_LOOKAHEAD[i as usize] as i32 != look_ahead { if look_ahead > 0 { if (look_ahead as usize) < YY_FALLBACK.len() { let fallback = YY_FALLBACK[look_ahead as usize]; if fallback != 0 { return yy_find_shift_action(yy, fallback); } } if YYWILDCARD > 0 { let j = i - look_ahead + (YYWILDCARD as i32); if j >= 0 && j < YY_ACTION.len() as i32 && YY_LOOKAHEAD[j as usize] == YYWILDCARD { return YY_ACTION[j as usize] as i32; } } } return YY_DEFAULT[stateno as usize] as i32; } else { return YY_ACTION[i as usize] as i32; } } fn yy_find_reduce_action(yy: &mut Parser, look_ahead: i32) -> i32 { let stateno = yy.yystack.last().unwrap().stateno; if YYERRORSYMBOL != 0 && stateno > YY_REDUCE_COUNT { return YY_DEFAULT[stateno as usize] as i32; } if !(stateno <= YY_REDUCE_COUNT) { { ::std::rt::begin_panic( "assertion failed: stateno <= YY_REDUCE_COUNT", &("examples/json.rs", 65u32, 1u32), ) } }; let i = YY_REDUCE_OFST[stateno as usize] as i32; if !(i != YY_REDUCE_USE_DFLT) { { ::std::rt::begin_panic( "assertion failed: i != YY_REDUCE_USE_DFLT", &("examples/json.rs", 65u32, 1u32), ) } }; if !(look_ahead != YYNOCODE) { { ::std::rt::begin_panic( "assertion failed: look_ahead != YYNOCODE", &("examples/json.rs", 65u32, 1u32), ) } }; let i = i + look_ahead; if YYERRORSYMBOL != 0 && (i < 0 || i >= YY_ACTION.len() as i32 || YY_LOOKAHEAD[i as usize] as i32 != look_ahead) { return YY_DEFAULT[stateno as usize] as i32; } if !(i >= 0 && i < YY_ACTION.len() as i32) { { ::std::rt::begin_panic( "assertion failed: i >= 0 && i < YY_ACTION.len() as i32", &("examples/json.rs", 65u32, 1u32), ) } }; if !(YY_LOOKAHEAD[i as usize] as i32 == look_ahead) { { ::std::rt::begin_panic( "assertion failed: YY_LOOKAHEAD[i as usize] as i32 == look_ahead", &("examples/json.rs", 65u32, 1u32), ) } }; return YY_ACTION[i as usize] as i32; } fn yy_shift( yy: &mut Parser, new_state: i32, yymajor: i32, yyminor: YYMinorType, ) -> Result<(), ()> { if YYSTACKLIMIT != 0 && yy.yystack.len() >= YYSTACKLIMIT { let token = token_build(yymajor, yyminor); let extra = &mut yy.extra; return Err({ Default::default() }); } yy.yystack.push(YYStackEntry { stateno: new_state, major: yymajor, minor: yyminor, }); Ok(()) } fn yy_parse_failed(yy: &mut Parser) -> () { yy.yystack.clear(); let extra = &mut yy.extra; { Default::default() } } fn yy_syntax_error_2(yy: &mut Parser, yymajor: i32, yyminor: YYMinorType) -> Result<(), ()> { let token = token_build(yymajor, yyminor); let extra = &mut yy.extra; { Err(Default::default()) } } fn yy_syntax_error( yy: &mut Parser, yymajor: i32, yyminor: YYMinorType, ) -> Result { let e = yy_syntax_error_2(yy, yymajor, yyminor)?; Ok(YYMinorType::YY0(e)) } fn yy_reduce(yy: &mut Parser, yyruleno: i32) -> Result<(), ()> { let yygotominor: YYMinorType = match (yyruleno, &mut yy.extra) { (0i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor) { (YYMinorType::YY4(J)) => J, _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (1i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor) { (YYMinorType::YY4(D)) => D, _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (2i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor) { (YYMinorType::YY4(A)) => A, _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (3i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor) { (YYMinorType::YY1(N)) => JObject::JNumber(N), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (4i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor) { (YYMinorType::YY2(S)) => JObject::JString(S), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (5i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor) { (YYMinorType::YY3(B)) => JObject::JBool(B), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (6i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor) { (_) => JObject::JNull, _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (7i32, extra) => { let yyp2 = yy.yystack.pop().unwrap(); let yyp1 = yy.yystack.pop().unwrap(); let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor, yyp1.minor, yyp2.minor) { (_, YYMinorType::YY8(D), _) => JObject::JDict(D.unwrap_or_else(HashMap::new)), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (8i32, extra) => { let yyp2 = yy.yystack.pop().unwrap(); let yyp1 = yy.yystack.pop().unwrap(); let yyp0 = yy.yystack.pop().unwrap(); let yyres: JObject = match (yyp0.minor, yyp1.minor, yyp2.minor) { (_, YYMinorType::YY9(A), _) => JObject::JArray(A.unwrap_or_else(Vec::new)), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY4(yyres) } (9i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: Vec = match (yyp0.minor) { (YYMinorType::YY4(J)) => <[_]>::into_vec(box [J]), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY5(yyres) } (10i32, extra) => { let yyp2 = yy.yystack.pop().unwrap(); let yyp1 = yy.yystack.pop().unwrap(); let yyp0 = yy.yystack.pop().unwrap(); let yyres: Vec = match (yyp0.minor, yyp1.minor, yyp2.minor) { (YYMinorType::YY5(mut A), _, YYMinorType::YY4(J)) => { A.push(J); A } _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY5(yyres) } (11i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: HashMap = match (yyp0.minor) { (YYMinorType::YY7((K, V))) => { let mut d = HashMap::new(); d.insert(K, V); d } _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY6(yyres) } (12i32, extra) => { let yyp2 = yy.yystack.pop().unwrap(); let yyp1 = yy.yystack.pop().unwrap(); let yyp0 = yy.yystack.pop().unwrap(); let yyres: HashMap = match (yyp0.minor, yyp1.minor, yyp2.minor) { (YYMinorType::YY6(mut A), _, YYMinorType::YY7((K, V))) => { A.insert(K, V); A } _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY6(yyres) } (13i32, extra) => { let yyp2 = yy.yystack.pop().unwrap(); let yyp1 = yy.yystack.pop().unwrap(); let yyp0 = yy.yystack.pop().unwrap(); let yyres: (String, JObject) = match (yyp0.minor, yyp1.minor, yyp2.minor) { (YYMinorType::YY2(K), _, YYMinorType::YY4(V)) => (K, V), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY7(yyres) } (14i32, extra) => { let yyres: Option> = match () { () => None, _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY9(yyres) } (15i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: Option> = match (yyp0.minor) { (YYMinorType::YY5(_A)) => Some(_A), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY9(yyres) } (16i32, extra) => { let yyres: Option> = match () { () => None, _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY8(yyres) } (17i32, extra) => { let yyp0 = yy.yystack.pop().unwrap(); let yyres: Option> = match (yyp0.minor) { (YYMinorType::YY6(_A)) => Some(_A), _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"impossible pattern",) { (arg0,) => { [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)] } }, ), &("examples/json.rs", 65u32, 1u32), ), }; YYMinorType::YY8(yyres) } _ => ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"no rule to apply",) { (arg0,) => [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)], }, ), &("examples/json.rs", 65u32, 1u32), ), }; let yygoto = YY_RULE_INFO[yyruleno as usize] as i32; let yyact = yy_find_reduce_action(yy, yygoto); if yyact < YYNSTATE { yy_shift(yy, yyact, yygoto, yygotominor)?; Ok(()) } else { if !(yyact == YYNSTATE + YYNRULE + 1) { { ::std::rt::begin_panic( "assertion failed: yyact == YYNSTATE + YYNRULE + 1", &("examples/json.rs", 65u32, 1u32), ) } }; if let YYMinorType::YY4(root) = yygotominor { yy.yystatus = YYStatus::Accepted(root); yy.yystack.clear(); } else { { { { ::std::rt::begin_panic_fmt( &::std::fmt::Arguments::new_v1( &["internal error: entered unreachable code: "], &match (&"unexpected root type",) { (arg0,) => [::std::fmt::ArgumentV1::new( arg0, ::std::fmt::Display::fmt, )], }, ), &("examples/json.rs", 65u32, 1u32), ) } } }; } Ok(()) } } } fn main() { let args = std::env::args().skip(1); for arg in args { { ::std::io::_print(::std::fmt::Arguments::new_v1( &["arg: \'", "\'\n"], &match (&arg,) { (arg0,) => [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Display::fmt)], }, )); }; match arg.parse() { Ok::(j) => { ::std::io::_print(::std::fmt::Arguments::new_v1_formatted( &["JSON: \'", "\'\n"], &match (&j,) { (arg0,) => [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Debug::fmt)], }, &[::std::fmt::rt::v1::Argument { position: ::std::fmt::rt::v1::Position::At(0usize), format: ::std::fmt::rt::v1::FormatSpec { fill: ' ', align: ::std::fmt::rt::v1::Alignment::Unknown, flags: 4u32, precision: ::std::fmt::rt::v1::Count::Implied, width: ::std::fmt::rt::v1::Count::Implied, }, }], )); } Err(e) => { ::std::io::_print(::std::fmt::Arguments::new_v1_formatted( &["Err: \'", "\'\n"], &match (&e,) { (arg0,) => [::std::fmt::ArgumentV1::new(arg0, ::std::fmt::Debug::fmt)], }, &[::std::fmt::rt::v1::Argument { position: ::std::fmt::rt::v1::Position::At(0usize), format: ::std::fmt::rt::v1::FormatSpec { fill: ' ', align: ::std::fmt::rt::v1::Alignment::Unknown, flags: 4u32, precision: ::std::fmt::rt::v1::Count::Implied, width: ::std::fmt::rt::v1::Count::Implied, }, }], )); } } } }