//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] = [8590000129,12885229570,38655033346,4295098369,47244967938,21475164162,30065098754,281487861809154,281492156776450,281522221547522,281500746711042,281509336645634,281513631612928,281496451743746,281505041678338,562962838781952,562997198061571,562971428651008,562980018454528,562949953748993,844437815427074,844442110394370,844450700328962,844472175165442,844459290263554,844463585230850,844454995296258,844446405361666,1125904202334209,1125934266908674,1125912792072194,1125938561875970,1125908496842753,1125929971941378,1125921382006786,1407404948586498,1407422128455682,1407400653619202,1407409243553794,1407387768717314,1407392063684610,1407396358651906,1688858450264065,1688879925362690,1688875630395394,1688854155821057,1688888515297282,1688871335428098,1688862745493506,1970342017171458,1970363492007938,1970333426974721,1970329132597249,1970337722204162,1970346312138754,1970354902073346,2251812699045888,2251799814012929,2251829878718464,2251834174144512,2251821288914944,2533287675756544,2533296265625600,2533304855429120,2533274790723585,2533300560986112,2814766947827712,2814779832139776,2814762652467200,2814749767434241,2814771242336256,3096237628850178,3096254808719362,3096250513752066,3096259103686658,3096241923817474,3096246218784770,3096271988588546,3377716900462594,3377712605495298,3377734080331778,3377725490397186,3377729785364482,3377721195429890,3377746965233666,3659209056976898,3659221941878786,3659204762009602,3659191877107714,3659196172075010,3659200467042306,3659187582140418,];
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 (ref mut a,b,ref mut c):(u32,u32,u32)=parser.stack.pop().unwrap().value; parser.stack.pop(); (a+1,b,c)};
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("E");
rule.Ruleaction = |parser|{ parser.stack.pop(); let (a,b,c):(u32,u32,u32)=parser.stack.pop().unwrap().value; parser.stack.pop(); (a,b+1,c)};
parser1.Rules.push(rule);
rule = RProduction::<(u32,u32,u32),(u32,u32,u32)>::new_skeleton("E");
rule.Ruleaction = |parser|{ parser.stack.pop(); let (a,b,c):(u32,u32,u32)=parser.stack.pop().unwrap().value; parser.stack.pop(); (a,b,c+1)};
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 (p,q,r):(u32,u32,u32)=parser.stack.pop().unwrap().value; let (a,b,c):(u32,u32,u32)=parser.stack.pop().unwrap().value; (a+p,b+q,c+r)};
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