//Parser generated by rustlr
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(unused_parens)]
#![allow(unused_mut)]
#![allow(unused_imports)]
#![allow(unused_assignments)]
extern crate rustlr;
use rustlr::{RuntimeParser,RProduction,Stateaction,decode_action};
use rustlr::charlexer;
//anything on a ! line is injected verbatim into the generated parser
fn main() {
let argv:Vec<String> = std::env::args().collect(); // command-line args
let input = &argv[1];
let mut parser1 = make_parser();
let mut lexer1 = charlexer::make(input.as_str(),true);
lexer1.modify = |c| { match c { //modify char to grammar terminal names
'{' => String::from("LBRACE"),
'}' => String::from("RBRACE"),
_ if c.is_whitespace() => String::from("Whitespace"),
_ => c.to_string(),
}};
let result = parser1.parse(&mut lexer1);
if !parser1.error_occurred() {
println!("parsed successfully with result {:?}",&result);
}
else {println!("parsing failed; partial result is {:?}",&result);}
}//main
const SYMBOLS:[&'static str;12] = ["E","S","WS","(",")","[","]","LBRACE","RBRACE","Whitespace","START","EOF"];
const TABLE:[u64;92] = [38655033346,30065098754,12885229570,47244967938,8590000129,21475164162,4295098369,281522221547522,281500746711042,281505041678338,281509336645634,281513631612928,281492156776450,281496451743746,281487861809154,562997198061571,562949953683457,562971428651008,562962838650880,562980018651136,844437815427074,844446405361666,844463585230850,844450700328962,844454995296258,844459290263554,844472175165442,844442110394370,1125921381941250,1125917086973954,1125934266843138,1125912792006658,1125947151745026,1125925676908546,1125929971875842,1407404948652034,1407383473553409,1407396358717442,1407413538586626,1407379179044865,1407387768782850,1407392063750146,1688858450264065,1688875630395394,1688871335428098,1688854155821057,1688862745493506,1688879925362690,1688888515297282,1970346312138754,1970333426974721,1970329132597249,1970337722204162,1970363492007938,1970359197040642,1970354902073346,2251812698914816,2251829878915072,2251821288914944,2251799813947393,2251816994275328,2533287675625472,2533274790658049,2533300560986112,2533304855625728,2533296265625600,2814749767368705,2814779832336384,2814771242336256,2814762652336128,2814784127696896,3096271988457474,3096254808588290,3096259103555586,3096237628719106,3096250513620994,3096246218653698,3096241923686402,3377716900462594,3377734080331778,3377725490397186,3377746965233666,3377712605495298,3377721195429890,3377729785364482,3659196172206082,3659191877238786,3659204762140674,3659200467173378,3659209057107970,3659187582271490,3659221942009858,];
pub fn make_parser() -> RuntimeParser<(u32,u32,u32),(u32,u32,u32)>
{
let mut parser1:RuntimeParser<(u32,u32,u32),(u32,u32,u32)> = RuntimeParser::new(8,14);
let mut rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("start");
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("E");
rule.Ruleaction = |parser|{ parser.stack.pop(); let mut _vflab_1=parser.stack.pop().unwrap().value; parser.stack.pop(); if let ((a,b,c),)=(_vflab_1,) { (a+1,b,c)} else {return <(u32,u32,u32)>::default();} };
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("E");
rule.Ruleaction = |parser|{ parser.stack.pop(); let mut _vflab_1=parser.stack.pop().unwrap().value; parser.stack.pop(); if let ((a,b,c),)=(_vflab_1,) { (a,b+1,c)} else {return <(u32,u32,u32)>::default();} };
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("E");
rule.Ruleaction = |parser|{ parser.stack.pop(); let mut _vflab_1=parser.stack.pop().unwrap().value; parser.stack.pop(); if let ((a,b,c),)=(_vflab_1,) { (a,b,c+1)} else {return <(u32,u32,u32)>::default();} };
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("S");
rule.Ruleaction = |parser|{ parser.stack.pop(); (0,0,0) };
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("S");
rule.Ruleaction = |parser|{ let mut _vflab_1=parser.stack.pop().unwrap().value; let mut _vflab_0=parser.stack.pop().unwrap().value; if let ((p,q,r),(a,b,c),)=(_vflab_1,_vflab_0,) { (a+p,b+q,c+r)} else {return <(u32,u32,u32)>::default();} };
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("WS");
rule.Ruleaction = |parser|{ return <(u32,u32,u32)>::default();};
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("WS");
rule.Ruleaction = |parser|{ parser.stack.pop(); parser.stack.pop(); return <(u32,u32,u32)>::default();};
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("START");
rule.Ruleaction = |parser|{ parser.stack.pop(); return <(u32,u32,u32)>::default();};
parser1.Rules.push(rule);
parser1.Errsym = "";
parser1.resynch.insert("Whitespace");
for i in 0..92 {
let symi = ((TABLE[i] & 0x0000ffff00000000) >> 32) as usize;
let sti = ((TABLE[i] & 0xffff000000000000) >> 48) as usize;
parser1.RSM[sti].insert(SYMBOLS[symi],decode_action(TABLE[i]));
}
for s in SYMBOLS { parser1.Symset.insert(s); }
load_extras(&mut parser1);
return parser1;
} //make_parser
fn load_extras(parser:&mut RuntimeParser<(u32,u32,u32),(u32,u32,u32)>)
{
}//end of load_extras: don't change this line as it affects augmentation