rustlr 0.1.4

LR(1)/LALR(1) parser generator for rust
Documentation
//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)]
#![allow(irrefutable_let_patterns)]
extern crate rustlr;
use rustlr::{RuntimeParser,RProduction,Stateaction,decode_action};
use crate::exprtrees::*;
use crate::exprtrees::Expr::*;
use rustlr::{LBox};

const SYMBOLS:[&'static str;12] = ["E","ES","+","-","*","/","(",")",";","int","START","EOF"];

const TABLE:[u64;99] = [25770131456,4295098369,12885164032,65537,38654902272,281509336842240,281496452071424,281487862071296,281492157169664,281483567300608,562975723552768,562988608323584,562949954142209,562997198061571,562962838585344,844433520066562,844437815033858,844454994903042,844446404968450,844459289870338,844442110001154,1125912792006656,1125925676974080,1125899907629057,1125938561744896,1407387768717312,1407413538455552,1407374884405249,1407400653684736,1688888515428354,1688875630526466,1688897105362946,1688862745624578,1970350607106048,1970363491876864,1970337722138624,1970324837892097,2251838468587520,2251825583816704,2251812698849280,2251799814668289,2533300560527360,2533313445298176,2533287675559936,2533274791444481,2814788422008832,2814762652270592,2814749768220673,2814775537238016,3096233334407168,3096241924276224,3096237629177856,3096259104735232,3096246219177984,3377712605757442,3377729785626626,3377708310790146,3377716900986880,3377734080593922,3377721195692034,3659183287828480,3659204763254784,3659187582599168,3659196172599296,3659191877697536,3940658264014850,3940666854408192,3940662558982146,3940671148916738,3940679738851330,3940684033818626,4222154715627522,4222159010594818,4222133241249792,4222146125692930,4222141831118848,4222137536020480,4503633987371010,4503629692403714,4503616807501826,4503612512534530,4503621102469122,4503608217567234,4785104668917762,4785096078983170,4785091784540160,4785083194081282,4785087489048578,4785108963885058,5066588236021762,5066562466217986,5066596825956354,5066575351119874,5348041737764866,5348037442797570,5348054622666754,5348033147830274,5348058917634050,5348046032732162,];

pub fn make_parser() -> RuntimeParser<Expr,Expr>
{
 let mut parser1:RuntimeParser<Expr,Expr> = RuntimeParser::new(10,20);
 let mut rule = RProduction::<Expr,Expr>::new_skeleton("start");
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{  let mut _vflab_0=parser.stack.pop().unwrap().value;  
  if let (Val(m),)=(_vflab_0,) { Val(m)}  else {parser.bad_pattern("(Val(m),)")} };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{  let e2:Expr=parser.stack.pop().unwrap().value;  parser.stack.pop();   let e1:Expr=parser.stack.pop().unwrap().value;   Plus(parser.lb(e1),parser.lb(e2)) };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{  let e2:Expr=parser.stack.pop().unwrap().value;  parser.stack.pop();   let e1:Expr=parser.stack.pop().unwrap().value;   Minus(parser.lb(e1),parser.lb(e2)) };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{  let e2:Expr=parser.stack.pop().unwrap().value;  parser.stack.pop();   let e1:Expr=parser.stack.pop().unwrap().value;   Divide(parser.lb(e1),parser.lb(e2)) };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{  let e2:Expr=parser.stack.pop().unwrap().value;  parser.stack.pop();   let e1:Expr=parser.stack.pop().unwrap().value;   Times(parser.lb(e1),parser.lb(e2)) };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{  let e:Expr=parser.stack.pop().unwrap().value;  parser.stack.pop();   Negative(parser.lb(e)) };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{ parser.stack.pop();   let e:Expr=parser.stack.pop().unwrap().value;  parser.stack.pop();   e };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("ES");
 rule.Ruleaction = |parser|{ parser.stack.pop();   let n:Expr=parser.stack.pop().unwrap().value;   Seq(vec![parser.lb(n)]) };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("ES");
 rule.Ruleaction = |parser|{ parser.stack.pop();   let e:Expr=parser.stack.pop().unwrap().value;   let mut _vflab_0=parser.stack.pop().unwrap().value;  
  if let (Seq(mut v),)=(_vflab_0,) { 
   v.push(parser.lb(e));
   Seq(v)
 }  else {parser.bad_pattern("(Seq(mut v),)")} };
 parser1.Rules.push(rule);
 rule = RProduction::<Expr,Expr>::new_skeleton("START");
 rule.Ruleaction = |parser|{ parser.stack.pop();  return <Expr>::default();};
 parser1.Rules.push(rule);
 parser1.Errsym = "";
 parser1.resynch.insert(";");

 for i in 0..99 {
   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<Expr,Expr>)
{
}//end of load_extras: don't change this line as it affects augmentation