rustlr 0.1.2

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)]
extern crate rustlr;
use rustlr::{RuntimeParser,RProduction,Stateaction,decode_action};
use crate::exprtrees::*;
use crate::exprtrees::Expr::*;

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

const TABLE:[u64;74] = [17180065792,30064902144,262145,25769869312,8590262272,281487861612546,281479271677954,281513631416322,281496451547138,281483566645250,562975723618304,844442110197760,844433520394240,844424930590721,844454995034112,844450700001280,1125908497432576,1125912792268800,1125938561548291,1125904202399744,1407404948455424,1407383473815552,1407374884274177,1407400653422592,1407392063619072,1688888515362818,1688854155624450,1688862745559042,1688858450591746,1688871335493634,1970337722400768,1970333427564544,1970329132531712,1970346312597504,2251829878587392,2251799814537217,2251808403947520,2251816993751040,2251825583554560,2533300560265216,2533283380658176,2533291970461696,2533274791313409,2533304855298048,2814758357368832,2814779832008704,2814766947172352,2814775536975872,2814749768089601,3096237629243392,3096229039046658,3096263398785026,3096246218915842,3096233334013954,3377704015822850,3377708310790146,3377712605757442,3377738375561218,3377721195692034,3659213352140802,3659183287369730,3659187582337026,3659178992402434,3659196172271618,3940671148851202,3940658263949314,3940662559375360,3940688328720386,3940653968982018,4222133240725506,4222128945758210,4222137536086016,4222163305496578,4222146125627394,];

pub fn make_parser() -> RuntimeParser<Expr,Expr>
{
 let mut parser1:RuntimeParser<Expr,Expr> = RuntimeParser::new(8,16);
 let mut rule = RProduction::<Expr,Expr>::new_skeleton("start");
 rule = RProduction::<Expr,Expr>::new_skeleton("E");
 rule.Ruleaction = |parser|{  let n:Expr=parser.stack.pop().unwrap().value;  n};
 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(bx(e1),bx(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(bx(e1),bx(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(bx(e1),bx(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(bx(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("E");
 rule.Ruleaction = |parser|{  let n:Expr=parser.stack.pop().unwrap().value;  parser.stack.pop();   parser.report("not a valid expression"); Val(-1000) };
 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 = "ERROR";

 for i in 0..74 {
   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