#![feature(prelude_import)] #![no_std] #[prelude_import] use ::std::prelude::v1::*; #[macro_use] extern crate std as std; use pomelo::pomelo; mod parser { #![allow(dead_code)] #![allow(unreachable_code)] #![allow(unused_variables)] #![allow(non_snake_case)] type Input = (); type Error = (); type ExtraArgument = (); const YYNOCODE: i32 = 4i32; const YYWILDCARD: i8 = 0; type YYStack = std::vec::Vec; const YYSTACKLIMIT: usize = 100usize; enum YYMinorType { YY0(()), YY1(Input), } const YYNSTATE: i32 = 1; const YYNRULE: i32 = 1; const YYERRORSYMBOL: i32 = 0; pub enum Token {} #[inline] fn token_value(t: Token) -> (i32, YYMinorType) { match t {} } fn token_build(i: i32, yy: YYMinorType) -> Option { match (i, yy) { _ => None, } } static YY_ACTION: [i32; 2usize] = [3, 1]; static YY_LOOKAHEAD: [i8; 2usize] = [2, 0]; const YY_SHIFT_USE_DFLT: i32 = -1i32; const YY_SHIFT_COUNT: i32 = 0usize as i32; const YY_SHIFT_MIN: i32 = 0i32; const YY_SHIFT_MAX: i32 = 1i32; static YY_SHIFT_OFST: [i8; 1usize] = [1]; const YY_REDUCE_USE_DFLT: i32 = -3i32; const YY_REDUCE_COUNT: i32 = 0usize as i32; const YY_REDUCE_MIN: i32 = -2i32; const YY_REDUCE_MAX: i32 = 0i32; static YY_REDUCE_OFST: [i8; 1usize] = [-2]; static YY_DEFAULT: [u8; 1usize] = [2]; static YY_FALLBACK: [i32; 0usize] = []; static YY_RULE_INFO: [i8; 1usize] = [2]; 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/one.rs", 3u32, 1u32), ), } } fn is_normal(&self) -> bool { match self { YYStatus::Normal => true, _ => false, } } } pub 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<(), Error> { 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<(Input, ()), Error> { 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<(), Error> { if !yy.yystatus.is_normal() { { ::std::rt::begin_panic( "Cannot call parse after failure", &("examples/one.rs", 3u32, 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<(), Error> { 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/one.rs", 3u32, 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/one.rs", 3u32, 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/one.rs", 3u32, 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/one.rs", 3u32, 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/one.rs", 3u32, 1u32), ) } }; if !(look_ahead != YYNOCODE) { { ::std::rt::begin_panic( "assertion failed: look_ahead != YYNOCODE", &("examples/one.rs", 3u32, 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/one.rs", 3u32, 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/one.rs", 3u32, 1u32), ) } }; return YY_ACTION[i as usize] as i32; } fn yy_shift( yy: &mut Parser, new_state: i32, yymajor: i32, yyminor: YYMinorType, ) -> Result<(), Error> { 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) -> Error { yy.yystack.clear(); let extra = &mut yy.extra; { Default::default() } } fn yy_syntax_error_2(yy: &mut Parser, yymajor: i32, yyminor: YYMinorType) -> Result<(), Error> { 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<(), Error> { let yygotominor: YYMinorType = match (yyruleno, &mut yy.extra) { (0i32, extra) => { let yyres: Input = match () { () => {} _ => ::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/one.rs", 3u32, 1u32), ), }; YYMinorType::YY1(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/one.rs", 3u32, 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/one.rs", 3u32, 1u32), ) } }; if let YYMinorType::YY1(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/one.rs", 3u32, 1u32), ) } } }; } Ok(()) } } } mod parser { #![allow(dead_code)] #![allow(unreachable_code)] #![allow(unused_variables)] #![allow(non_snake_case)] type Input = (); type Error = (); type ExtraArgument = (); const YYNOCODE: i32 = 4i32; const YYWILDCARD: i8 = 0; type YYStack = std::vec::Vec; const YYSTACKLIMIT: usize = 100usize; enum YYMinorType { YY0(()), YY1(Input), } const YYNSTATE: i32 = 1; const YYNRULE: i32 = 1; const YYERRORSYMBOL: i32 = 0; pub enum Token {} #[inline] fn token_value(t: Token) -> (i32, YYMinorType) { match t {} } fn token_build(i: i32, yy: YYMinorType) -> Option { match (i, yy) { _ => None, } } static YY_ACTION: [i32; 2usize] = [3, 1]; static YY_LOOKAHEAD: [i8; 2usize] = [2, 0]; const YY_SHIFT_USE_DFLT: i32 = -1i32; const YY_SHIFT_COUNT: i32 = 0usize as i32; const YY_SHIFT_MIN: i32 = 0i32; const YY_SHIFT_MAX: i32 = 1i32; static YY_SHIFT_OFST: [i8; 1usize] = [1]; const YY_REDUCE_USE_DFLT: i32 = -3i32; const YY_REDUCE_COUNT: i32 = 0usize as i32; const YY_REDUCE_MIN: i32 = -2i32; const YY_REDUCE_MAX: i32 = 0i32; static YY_REDUCE_OFST: [i8; 1usize] = [-2]; static YY_DEFAULT: [u8; 1usize] = [2]; static YY_FALLBACK: [i32; 0usize] = []; static YY_RULE_INFO: [i8; 1usize] = [2]; 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/one.rs", 14u32, 1u32), ), } } fn is_normal(&self) -> bool { match self { YYStatus::Normal => true, _ => false, } } } pub struct Parser { error_count: u8, yystack: YYStack, extra: ExtraArgument, yystatus: YYStatus, } impl Parser { pub fn new(extra: ExtraArgument) -> Self { Self::new_priv(extra) } pub fn end_of_input(mut self) -> Result<(Input, ExtraArgument), Error> { self.end_of_input_priv() } pub fn into_extra(self) -> ExtraArgument { self.extra } pub fn extra(&self) -> &ExtraArgument { &self.extra } pub fn extra_mut(&mut self) -> &mut ExtraArgument { &mut self.extra } pub fn parse(&mut self, token: Token) -> Result<(), Error> { let (a, b) = token_value(token); yy_parse_token(self, a, b) } fn new_priv(extra: ExtraArgument) -> 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<(Input, ExtraArgument), Error> { 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<(), Error> { if !yy.yystatus.is_normal() { { ::std::rt::begin_panic( "Cannot call parse after failure", &("examples/one.rs", 14u32, 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<(), Error> { 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/one.rs", 14u32, 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/one.rs", 14u32, 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/one.rs", 14u32, 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/one.rs", 14u32, 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/one.rs", 14u32, 1u32), ) } }; if !(look_ahead != YYNOCODE) { { ::std::rt::begin_panic( "assertion failed: look_ahead != YYNOCODE", &("examples/one.rs", 14u32, 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/one.rs", 14u32, 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/one.rs", 14u32, 1u32), ) } }; return YY_ACTION[i as usize] as i32; } fn yy_shift( yy: &mut Parser, new_state: i32, yymajor: i32, yyminor: YYMinorType, ) -> Result<(), Error> { 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) -> Error { yy.yystack.clear(); let extra = &mut yy.extra; { Default::default() } } fn yy_syntax_error_2(yy: &mut Parser, yymajor: i32, yyminor: YYMinorType) -> Result<(), Error> { 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<(), Error> { let yygotominor: YYMinorType = match (yyruleno, &mut yy.extra) { (0i32, extra) => { let yyres: Input = match () { () => {} _ => ::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/one.rs", 14u32, 1u32), ), }; YYMinorType::YY1(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/one.rs", 14u32, 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/one.rs", 14u32, 1u32), ) } }; if let YYMinorType::YY1(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/one.rs", 14u32, 1u32), ) } } }; } Ok(()) } } }