extern crate gramatica; use std::cmp::Ordering; use gramatica::{Associativity,EarleyKind,State,Parser,ParsingTablesTrait}; use std::env; use std::fs::File; use std::io::prelude::*; use std::rc::Rc; use std::collections::HashMap; use std::fmt::{self,Display,Formatter}; #[derive(Clone,Debug,PartialEq)] enum PatKind { Underscore, Ref(Rc), RefMut(Rc), Void, Tuple(Rc), Path(Rc), EnumEmpty(Rc), Enum(Rc,Rc),//name,tuple } #[derive(Clone,Debug,PartialEq)] enum TyKind { Underscore, Ref(Rc), RefMut(Rc), Void, Path(String), } #[derive(Clone,Debug,PartialEq)] enum ExprKind { Single(Rc), Member(Rc,String),//object, attribute_or_method Index(Rc,Option>),//object, index Call(Rc,Vec),//function,arguments Parentheses(Vec), Infix(Rc,Rc,Rc),//left,symbol,right Ref(Rc), RefMut(Rc), Prefix(Rc,Rc),//symbol,operand } #[derive(Clone,Debug,PartialEq)] enum StmtKind { //Let Item(Vec,Rc),//attributes, item Block(Vec,Rc),//attributes, block Expr(Vec,ExprKind),//attributes, expression Empty, } #[derive(Clone,Debug,PartialEq)] enum AttrKind { Documentation(String), Flag(String), Value(String,Rc), Sequence(String,Vec), } #[derive(Clone,Debug,PartialEq)] enum Token { DummyStart,//0 reserved for dummy start FN,//1 Mut,//2 Match,//3 If,//4 Else,//5 While,//6 Loop,//7 For,//8 In,//9 Terminal,//10 Nonterminal,//11 OuterDocComment(String),//12 LiteralIdent(String),//13 LitStr(String),//14 LitChar(char),//15 LitInteger(usize),//16 RArrow,//17 FatArrow,//18 EqualEqual,//19 LPar,//20 RPar,//21 Dot,//22 Comma,//23 Colon,//24 Underscore,//25 Ampersand,//26 NumberSign,//27 Minus,//28 Bang,//29 Semicolon,//30 LBrace,//31 RBrace,//32 LBracket,//33 RBracket,//34 Equal,//35 Star,//36 Plus,//37 //Now nonterminals WholeCrate(Vec>),//38 MaybeModItems(Vec>),//39 ModItems(Vec>),//40 ModItem(Vec,Rc),//41 Item(Rc),//42 StmtItem(Rc),//43 BlockItem(Rc),//44 ItemMacro(Rc,Option>,Rc),//45 path,id,tree PathExpr(String),//46 PathGenericArgsWithColons(String),//47 Ident(String),//48 ItemFn,//49 FnDecl,//50 FnParams,//51 MaybeParams,//52 Params,//53 Param,//54 Pat(PatKind),//55 LitOrPath(String),//56 Lit(Rc),//57 Str,//58 MaybeIdent,//59 DelimitedTokenTrees(Vec>),//60 ParensDelimitedTokenTrees(Vec>),//61 TokenTrees(Vec>),//62 TokenTree(Rc),//63 UnpairedToken(Rc),//64 InnerAttrsAndBlock,//65 MaybeStmts(Vec,Option),//66 statements, expression Stmts(Vec),//67 Stmt(StmtKind),//68 MaybeOuterAttrs(Vec),//69 OuterAttrs(Vec),//70 OuterAttr(AttrKind),//71 MetaItem(AttrKind),//72 MetaSeq(Vec),//73 RetTy,//74 Ty(TyKind),//75 TyPrim(TyKind),//76 PathGenericArgsWithoutColons(String),//77 TySum(TyKind),//78 TySumElt(TyKind),//79 PatTup(Vec>),//80 PatTupElts(Vec>),//81 NonblockExpr(ExprKind),//82 NonblockPrefixExpr(ExprKind),//83 MaybeMut(bool),//84 FullBlockExpr(Rc),//85 BlockExpr(Rc),//86 ExprMatch,//87 ExprNostruct,//88 Block(Vec,Option),//89 statements, expression NonblockPrefixExprNostruct,//90 MacroExpr,//91 MaybeExpr(Option),//92 Expr(ExprKind),//93 MaybeExprs(Vec),//94 Exprs(Vec),//95 ExprIf,//96 BlockOrIf,//97 ExprWhile,//98 ExprLoop,//99 ExprFor,//100 MatchClauses(Vec>),//101 MatchClause(Vec,Rc,Rc),//102 attributes,patterns,expression NonblockMatchClause(Vec,Rc,Rc),//103 BlockMatchClause(Vec,Rc,Rc),//104 PatsOr(Rc),//105 MaybeGuard,//106 ItemTerminal(String,Option>,Vec>),//107 id,type,items MaybeTerminalItems(Vec>),//108 TerminalItems(Vec>),//109 TerminalItem(Rc),//110 ItemNonterminal(String,Option>,Vec>),//111 id,type,clauses MaybeTySums(Vec>),//112 TySums(Vec>),//113 } impl Default for Token { fn default() -> Self { Token::DummyStart } } impl Display for PatKind { fn fmt(&self, f:&mut Formatter) -> fmt::Result { match self { &PatKind::Underscore => write!(f,"_"), &PatKind::Ref(ref kind) => write!(f,"& {}",kind), &PatKind::RefMut(ref kind) => write!(f,"&mut {}",kind), &PatKind::Void => write!(f,"()"), &PatKind::Tuple(ref token) => write!(f,"({})",token), &PatKind::Path(ref token) => write!(f,"{}",token), &PatKind::EnumEmpty(ref name) => write!(f,"{}",name), &PatKind::Enum(ref name, ref tuple) => write!(f,"{}({})",name,tuple), } } } impl Display for TyKind { fn fmt(&self, f:&mut Formatter) -> fmt::Result { match self { &TyKind::Underscore => write!(f,"_"), &TyKind::Ref(ref kind) => write!(f,"& {}",kind), &TyKind::RefMut(ref kind) => write!(f,"&mut {}",kind), &TyKind::Void => write!(f,"()"), &TyKind::Path(ref string) => write!(f,"{}",string), } } } impl Display for ExprKind { fn fmt(&self, f:&mut Formatter) -> fmt::Result { match self { &ExprKind::Single(ref token) => write!(f,"{}",token), &ExprKind::Member(ref kind, ref path) => write!(f,"{}.{}",kind,path), &ExprKind::Index(ref object, None) => write!(f,"{}[]",object), &ExprKind::Index(ref object, Some(ref index)) => write!(f,"{}[{}]",object,index), &ExprKind::Call(ref function, ref arguments) => write!(f,"{}({})",function,arguments.iter().map(|x| x.to_string() ).collect::>().join(",")), &ExprKind::Parentheses(ref list) => write!(f,"({})",list.iter().map(|x| x.to_string() ).collect::>().join(",")), &ExprKind::Infix(ref left,ref symbol,ref right) => write!(f,"{} {} {}",left,symbol,right), &ExprKind::Ref(ref expr) => write!(f,"&{}",expr), &ExprKind::RefMut(ref expr) => write!(f,"&mut {}",expr), &ExprKind::Prefix(ref symbol, ref expr) => write!(f,"{} {}",symbol,expr), } } } impl Display for StmtKind { fn fmt(&self, f:&mut Formatter) -> fmt::Result { match self { &StmtKind::Item(ref attrs, ref token) => write!(f,"{};",token), &StmtKind::Block(ref attrs, ref token) => write!(f,"{};",token), &StmtKind::Expr(ref attrs, ref token) => write!(f,"{};",token), &StmtKind::Empty => write!(f,";"), } } } impl Display for Token { fn fmt(&self, f:&mut Formatter) -> fmt::Result { match self { &Token::TySum(ref kind) => write!(f,"{}",kind), &Token::Pat(ref kind) => write!(f,"{}",kind), &Token::LitOrPath(ref string) => write!(f,"{}",string), &Token::NonblockExpr(ref expr) => write!(f,"{}",expr), &Token::PathExpr(ref string) => write!(f,"{}",string), &Token::Block(ref stmts, None) => write!(f,"{{{}}}", stmts.iter().map(|s| s.to_string() ).collect::>().join("\n") ), &Token::Block(ref stmts, Some(ref expr)) => write!(f,"{{{}; {}}}", stmts.iter().map(|s| s.to_string() ).collect::>().join("\n") , expr), &Token::Equal => write!(f," = "), &Token::Lit(ref token) => write!(f,"{}",token), &Token::LitInteger(x) => write!(f,"{}",x), &Token::Str => write!(f,"\"some Str\""), &Token::BlockExpr(ref token) => write!(f,"{}",token), &Token::ExprMatch => write!(f,"match FIXME {{ }}"), &Token::ExprIf => write!(f,"if FIXME {{ }}"), _ => panic!("panic displaying {:?}",self), //_ => Err(fmt::Error), } } } struct ParsingTables {} impl ParsingTablesTrait for ParsingTables { fn initial()->usize { 38 } fn match_some(parser: &mut Parser) -> Option<(usize,Token)> { let source=&parser.source[parser.source_index..]; match { match parser.re("fn", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::FN)), }; match { match parser.re("mut", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Mut)), }; match { match parser.re("match", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Match)), }; match { match parser.re("if", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::If)), }; match { match parser.re("else", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Else)), }; match { match parser.re("while", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::While)), }; match { match parser.re("loop", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Loop)), }; match { match parser.re("for", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::For)), }; match { match parser.re("in", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::In)), }; match { match parser.re("terminal", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Terminal)), }; match { match parser.re("nonterminal", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Nonterminal)), }; match { match parser.re("\\\\\\[^\n]*\n", source) { None => None, Some((size,string)) => Some((size,string)), } } { None => (), Some((size,result)) => return Some((size,Token::OuterDocComment(result))), }; match { match parser.re("[a-zA-Z\\x80-\\xff_][a-zA-Z0-9\\x80-\\xff_]*", source) { None => None, Some((size,string)) => Some((size,string)), } } { None => (), Some((size,result)) => return Some((size,Token::LiteralIdent(result))), }; match { let mut ret=None; let mut characters=source.chars(); if characters.next()!=Some('"') { } else { let mut size=1; let mut r=String::from("\""); loop { match characters.next() { None => break, Some('"') => { ret=Some((size+1,r+&"\"")); break; }, Some('\\') => { match characters.next() { None => break, //Some(c) => r+='\\'+c, Some(c) => { r.push('\\'); r.push(c); } }; size+=2; }, Some(c) => { //r+=&String::from(c); r.push(c); size+=1; }, }; } } ret } { None => (), Some((size,result)) => return Some((size,Token::LitStr(result))), }; match { match parser.re("'\\?.'", source) { None => None, Some((size,string)) => Some((size,string.parse::().unwrap())), } } { None => (), Some((size,result)) => return Some((size,Token::LitChar(result))), }; match { match parser.re("[0-9]+", source) { None => None, Some((size,string)) => Some((size,string.parse::().unwrap())), } } { None => (), Some((size,result)) => return Some((size,Token::LitInteger(result))), }; match { match parser.re("->", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::RArrow)), }; match { match parser.re("=>", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::FatArrow)), }; match { match parser.re("==", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::EqualEqual)), }; match { match parser.re("\\(", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::LPar)), }; match { match parser.re("\\)", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::RPar)), }; match { match parser.re("\\.", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Dot)), }; match { match parser.re(",", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Comma)), }; match { match parser.re(":", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Colon)), }; match { match parser.re("_", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Underscore)), }; match { match parser.re("&", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Ampersand)), }; match { match parser.re("#", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::NumberSign)), }; match { match parser.re("-", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Minus)), }; match { match parser.re("!", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Bang)), }; match { match parser.re(";", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Semicolon)), }; match { match parser.re("\\{", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::LBrace)), }; match { match parser.re("\\}", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::RBrace)), }; match { match parser.re("\\[", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::LBracket)), }; match { match parser.re("\\]", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::RBracket)), }; match { match parser.re("=", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Equal)), }; match { match parser.re("\\*", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Star)), }; match { match parser.re("\\+", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::Plus)), }; match { match parser.re("\\s+|\n|\\\\[^\n]*\n", source) { None => None, Some((size,_string)) => Some((size,())), } } { None => (), Some((size,_result)) => return Some((size,Token::DummyStart)), }; None } fn predict(parser:&mut Parser,index:usize,state_index:usize,token:usize) { match token { //WholeCrate 38 => { parser.sets[index].predict(State{rule: 1 ,left: 38 ,right:vec![ 39 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //MaybeModItems 39 => { parser.sets[index].predict(State{rule: 2 ,left: 39 ,right:vec![ 40 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 3 ,left: 39 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //ModItems 40 => { parser.sets[index].predict(State{rule: 4 ,left: 40 ,right:vec![ 41 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 5 ,left: 40 ,right:vec![ 40,41 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //ModItem 41 => { //parser.sets[index].predict(State{rule: 6 ,left: 41 ,right:vec![ 42 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 6 ,left: 41 ,right:vec![ 69,42 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //Item 42 => { parser.sets[index].predict(State{rule: 7 ,left: 42 ,right:vec![ 43 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 8 ,left: 42 ,right:vec![ 45 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //StmtItem 43 => { parser.sets[index].predict(State{rule: 9 ,left: 43 ,right:vec![ 44 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //BlockItem 44 => { parser.sets[index].predict(State{rule: 10 ,left: 44 ,right:vec![ 49 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 193 ,left: 44 ,right:vec![ 107 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 194 ,left: 44 ,right:vec![ 111 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //ItemMacro 45 => { parser.sets[index].predict(State{rule: 11 ,left: 45 ,right:vec![ 46,29,59,61,30 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); }, //PathExpr 46 => { parser.sets[index].predict(State{rule: 12 ,left: 46 ,right:vec![ 47 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //PathGenericArgsWithColons 47 => { parser.sets[index].predict(State{rule: 13 ,left: 47 ,right:vec![ 48 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //Ident 48 => { parser.sets[index].predict(State{rule: 14 ,left: 48 ,right:vec![ 13 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //ItemFn 49 => { parser.sets[index].predict(State{rule: 15 ,left: 49 ,right:vec![ 1,48,50,65 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); }, //FnDecl 50 => { parser.sets[index].predict(State{rule: 16 ,left: 50 ,right:vec![ 51,74 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //FnParams 51 => { parser.sets[index].predict(State{rule: 17 ,left: 51 ,right:vec![ 20,52,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //MaybeParams 52 => { parser.sets[index].predict(State{rule: 18 ,left: 52 ,right:vec![ 53 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 19 ,left: 52 ,right:vec![ 53,23 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 20 ,left: 52 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //Params 53 => { parser.sets[index].predict(State{rule: 21 ,left: 53 ,right:vec![ 54 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 22 ,left: 53 ,right:vec![ 53,23,54 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //Param 54 => { parser.sets[index].predict(State{rule: 23 ,left: 54 ,right:vec![ 55,24,78 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //Pat 55 => { parser.sets[index].predict(State{rule: 24 ,left: 55 ,right:vec![ 25 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 25 ,left: 55 ,right:vec![ 26,55 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 26 ,left: 55 ,right:vec![ 26,2,55 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 27 ,left: 55 ,right:vec![ 20,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 195 ,left: 55 ,right:vec![ 20,80,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 28 ,left: 55 ,right:vec![ 56 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 29 ,left: 55 ,right:vec![ 46,20,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 30 ,left: 55 ,right:vec![ 46,20,80,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); }, //LitOrPath 56 => { parser.sets[index].predict(State{rule: 31 ,left: 56 ,right:vec![ 46 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 32 ,left: 56 ,right:vec![ 57 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 33 ,left: 56 ,right:vec![ 28,57 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //Lit 57 => { parser.sets[index].predict(State{rule: 34 ,left: 57 ,right:vec![ 15 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 35 ,left: 57 ,right:vec![ 16 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 36 ,left: 57 ,right:vec![ 58 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //Str 58 => { parser.sets[index].predict(State{rule: 37 ,left: 58 ,right:vec![ 14 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //MaybeIdent 59 => { parser.sets[index].predict(State{rule: 38 ,left: 59 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 39 ,left: 59 ,right:vec![ 48 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //DelimitedTokenTrees 60 => { parser.sets[index].predict(State{rule: 40 ,left: 60 ,right:vec![ 61 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //ParensDelimitedTokenTrees 61 => { parser.sets[index].predict(State{rule: 41 ,left: 61 ,right:vec![ 20,62,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //TokenTrees 62 => { parser.sets[index].predict(State{rule: 42 ,left: 62 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 43 ,left: 62 ,right:vec![ 62,63 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //TokenTree 63 => { parser.sets[index].predict(State{rule: 44 ,left: 63 ,right:vec![ 60 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 45 ,left: 63 ,right:vec![ 64 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //UnpairedToken 64 => { parser.sets[index].predict(State{rule: 46 ,left: 64 ,right:vec![ 14 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 47 ,left: 64 ,right:vec![ 13 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 48 ,left: 64 ,right:vec![ 23 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //InnerAttrsAndBlock 65 => { parser.sets[index].predict(State{rule: 49 ,left: 65 ,right:vec![ 31,66,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //MaybeStmts 66 => { parser.sets[index].predict(State{rule: 50 ,left: 66 ,right:vec![ 67 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 51 ,left: 66 ,right:vec![ 67,82 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 52 ,left: 66 ,right:vec![ 82 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 53 ,left: 66 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //Stmts 67 => { parser.sets[index].predict(State{rule: 54 ,left: 67 ,right:vec![ 68 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 55 ,left: 67 ,right:vec![ 67,68 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //Stmt 68 => { //parser.sets[index].predict(State{rule: 56 ,left: 68 ,right:vec![ 69, ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 57 ,left: 68 ,right:vec![ 43 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 58 ,left: 68 ,right:vec![ 70,43 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 59 ,left: 68 ,right:vec![ 85 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 60 ,left: 68 ,right:vec![ 69,89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 61 ,left: 68 ,right:vec![ 82,30 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 62 ,left: 68 ,right:vec![ 70,82,30 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 63 ,left: 68 ,right:vec![ 30 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //MaybeOuterAttrs 69 => { parser.sets[index].predict(State{rule: 64 ,left: 69 ,right:vec![ 70 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 65 ,left: 69 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //OuterAttrs 70 => { parser.sets[index].predict(State{rule: 66 ,left: 70 ,right:vec![ 71 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 67 ,left: 70 ,right:vec![ 70,71 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //OuterAttr 71 => { parser.sets[index].predict(State{rule: 68 ,left: 71 ,right:vec![ 27,33,72,34 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 69 ,left: 71 ,right:vec![ 12 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //MetaItem 72 => { parser.sets[index].predict(State{rule: 70 ,left: 72 ,right:vec![ 48 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 71 ,left: 72 ,right:vec![ 48,35,57 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 72 ,left: 72 ,right:vec![ 48,20,73,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 73 ,left: 72 ,right:vec![ 48,20,73,23,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); }, //MetaSeq 73 => { parser.sets[index].predict(State{rule: 74 ,left: 73 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 75 ,left: 73 ,right:vec![ 72 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 76 ,left: 73 ,right:vec![ 73,23,72 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //RetTy 74 => { parser.sets[index].predict(State{rule: 77 ,left: 74 ,right:vec![ 17,75 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 78 ,left: 74 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //Ty 75 => { parser.sets[index].predict(State{rule: 79 ,left: 75 ,right:vec![ 76 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 80 ,left: 75 ,right:vec![ 20,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //TyPrim 76 => { parser.sets[index].predict(State{rule: 81 ,left: 76 ,right:vec![ 77 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 82 ,left: 76 ,right:vec![ 26,75 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 83 ,left: 76 ,right:vec![ 26,2,75 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 84 ,left: 76 ,right:vec![ 25 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //PathGenericArgsWithoutColons 77 => { parser.sets[index].predict(State{rule: 85 ,left: 77 ,right:vec![ 48 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //TySum 78 => { parser.sets[index].predict(State{rule: 86 ,left: 78 ,right:vec![ 79 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //TySumElt 79 => { parser.sets[index].predict(State{rule: 87 ,left: 79 ,right:vec![ 75 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //PatTup 80 => { parser.sets[index].predict(State{rule: 88 ,left: 80 ,right:vec![ 81 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 89 ,left: 80 ,right:vec![ 81,23 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //PatTupElts 81 => { parser.sets[index].predict(State{rule: 90 ,left: 81 ,right:vec![ 55 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 91 ,left: 81 ,right:vec![ 81,23,55 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //NonblockExpr 82 => { parser.sets[index].predict(State{rule: 92 ,left: 82 ,right:vec![ 57 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 93 ,left: 82 ,right:vec![ 46 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 94 ,left: 82 ,right:vec![ 91 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 95 ,left: 82 ,right:vec![ 82,22,47 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 96 ,left: 82 ,right:vec![ 82,33,92,34 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 97 ,left: 82 ,right:vec![ 82,20,94,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 98 ,left: 82 ,right:vec![ 20,94,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 99 ,left: 82 ,right:vec![ 82,35,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 100 ,left: 82 ,right:vec![ 82,19,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 101 ,left: 82 ,right:vec![ 82,26,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 102 ,left: 82 ,right:vec![ 82,37,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 103 ,left: 82 ,right:vec![ 82,28,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 104 ,left: 82 ,right:vec![ 82,36,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 105 ,left: 82 ,right:vec![ 83 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //NonblockPrefixExpr 83 => { parser.sets[index].predict(State{rule: 106 ,left: 83 ,right:vec![ 28,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 107 ,left: 83 ,right:vec![ 29,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 108 ,left: 83 ,right:vec![ 36,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 109 ,left: 83 ,right:vec![ 26,84,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //MaybeMut 84 => { parser.sets[index].predict(State{rule: 110 ,left: 84 ,right:vec![ 2 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 111 ,left: 84 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //FullBlockExpr 85 => { parser.sets[index].predict(State{rule: 112 ,left: 85 ,right:vec![ 86 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //BlockExpr 86 => { parser.sets[index].predict(State{rule: 113 ,left: 86 ,right:vec![ 87 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 114 ,left: 86 ,right:vec![ 96 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 115 ,left: 86 ,right:vec![ 98 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 116 ,left: 86 ,right:vec![ 99 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 117 ,left: 86 ,right:vec![ 100 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //ExprMatch 87 => { parser.sets[index].predict(State{rule: 118 ,left: 87 ,right:vec![ 3,88,31,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 119 ,left: 87 ,right:vec![ 3,88,31,101,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 120 ,left: 87 ,right:vec![ 3,88,31,101,103,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 6 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 121 ,left: 87 ,right:vec![ 3,88,31,103,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); }, //ExprNostruct 88 => { parser.sets[index].predict(State{rule: 122 ,left: 88 ,right:vec![ 57 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 123 ,left: 88 ,right:vec![ 46 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 124 ,left: 88 ,right:vec![ 91 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 125 ,left: 88 ,right:vec![ 88,22,46 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 126 ,left: 88 ,right:vec![ 88,33,92,34 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 127 ,left: 88 ,right:vec![ 88,20,94,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 128 ,left: 88 ,right:vec![ 20,94,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 129 ,left: 88 ,right:vec![ 88,35,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 130 ,left: 88 ,right:vec![ 88,19,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 131 ,left: 88 ,right:vec![ 88,26,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 132 ,left: 88 ,right:vec![ 88,37,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 133 ,left: 88 ,right:vec![ 88,28,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 134 ,left: 88 ,right:vec![ 88,36,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 135 ,left: 88 ,right:vec![ 86 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 136 ,left: 88 ,right:vec![ 89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 137 ,left: 88 ,right:vec![ 90 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //Block 89 => { parser.sets[index].predict(State{rule: 138 ,left: 89 ,right:vec![ 31,66,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //NonblockPrefixExprNostruct 90 => { parser.sets[index].predict(State{rule: 139 ,left: 90 ,right:vec![ 28,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 140 ,left: 90 ,right:vec![ 29,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 141 ,left: 90 ,right:vec![ 36,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 142 ,left: 90 ,right:vec![ 26,84,88 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //MacroExpr 91 => { parser.sets[index].predict(State{rule: 143 ,left: 91 ,right:vec![ 46,29,59,61 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); }, //MaybeExpr 92 => { parser.sets[index].predict(State{rule: 144 ,left: 92 ,right:vec![ 93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 145 ,left: 92 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //Expr 93 => { parser.sets[index].predict(State{rule: 146 ,left: 93 ,right:vec![ 57 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 147 ,left: 93 ,right:vec![ 46 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 148 ,left: 93 ,right:vec![ 91 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 149 ,left: 93 ,right:vec![ 93,22,47 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 150 ,left: 93 ,right:vec![ 93,33,92,34 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 151 ,left: 93 ,right:vec![ 93,20,94,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 4 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 152 ,left: 93 ,right:vec![ 20,94,21 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 153 ,left: 93 ,right:vec![ 93,35,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 154 ,left: 93 ,right:vec![ 93,19,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 155 ,left: 93 ,right:vec![ 93,26,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 156 ,left: 93 ,right:vec![ 93,37,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 157 ,left: 93 ,right:vec![ 93,28,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 158 ,left: 93 ,right:vec![ 93,36,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 159 ,left: 93 ,right:vec![ 86 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 160 ,left: 93 ,right:vec![ 89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 161 ,left: 93 ,right:vec![ 83 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //MaybeExprs 94 => { parser.sets[index].predict(State{rule: 162 ,left: 94 ,right:vec![ 95 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 163 ,left: 94 ,right:vec![ 95,23 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 164 ,left: 94 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //Exprs 95 => { parser.sets[index].predict(State{rule: 165 ,left: 95 ,right:vec![ 93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 166 ,left: 95 ,right:vec![ 95,23,93 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //ExprIf 96 => { parser.sets[index].predict(State{rule: 167 ,left: 96 ,right:vec![ 4,88,89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 168 ,left: 96 ,right:vec![ 4,88,89,5,97 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); }, //BlockOrIf 97 => { parser.sets[index].predict(State{rule: 169 ,left: 97 ,right:vec![ 89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 170 ,left: 97 ,right:vec![ 96 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //ExprWhile 98 => { parser.sets[index].predict(State{rule: 171 ,left: 98 ,right:vec![ 6,88,89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, //ExprLoop 99 => { parser.sets[index].predict(State{rule: 172 ,left: 99 ,right:vec![ 7,89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //ExprFor 100 => { parser.sets[index].predict(State{rule: 173 ,left: 100 ,right:vec![ 8,55,9,88,89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); }, //MatchClauses 101 => { parser.sets[index].predict(State{rule: 174 ,left: 101 ,right:vec![ 102 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 175 ,left: 101 ,right:vec![ 101,102 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //MatchClause 102 => { parser.sets[index].predict(State{rule: 176 ,left: 102 ,right:vec![ 103,23 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 177 ,left: 102 ,right:vec![ 104 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 178 ,left: 102 ,right:vec![ 104,23 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //NonblockMatchClause 103 => { parser.sets[index].predict(State{rule: 179 ,left: 103 ,right:vec![ 69,105,106,18,82 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); }, //BlockMatchClause 104 => { parser.sets[index].predict(State{rule: 180 ,left: 104 ,right:vec![ 69,105,106,18,89 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 181 ,left: 104 ,right:vec![ 69,105,106,18,86 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); }, //PatsOr 105 => { parser.sets[index].predict(State{rule: 182 ,left: 105 ,right:vec![ 55 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //MaybeGuard 106 => { parser.sets[index].predict(State{rule: 183 ,left: 106 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //ItemTerminal 107 => { parser.sets[index].predict(State{rule: 184 ,left: 107 ,right:vec![ 10,48,31,108,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 185 ,left: 107 ,right:vec![ 10,48,20,112,21,31,108,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 8 ],computed_value:Token::DummyStart}); }, //MaybeTerminalItems 108 => { parser.sets[index].predict(State{rule: 186 ,left: 108 ,right:vec![ 109 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 187 ,left: 108 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //TerminalItems 109 => { parser.sets[index].predict(State{rule: 188 ,left: 109 ,right:vec![ 110 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 189 ,left: 109 ,right:vec![ 110,109 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); }, //TerminalItem 110 => { parser.sets[index].predict(State{rule: 190 ,left: 110 ,right:vec![ 49 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); }, //ItemNonterminal 111 => { parser.sets[index].predict(State{rule: 191 ,left: 111 ,right:vec![ 11,48,31,101,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 5 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 192 ,left: 111 ,right:vec![ 11,48,20,112,21,31,101,32 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 8 ],computed_value:Token::DummyStart}); }, //MaybeTySums 112 => { parser.sets[index].predict(State{rule: 196 ,left: 112 ,right:vec![ 113 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 197 ,left: 112 ,right:vec![ 113,23 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 2 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 198 ,left: 112 ,right:vec![ ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 0 ],computed_value:Token::DummyStart}); }, //TySums 113 => { parser.sets[index].predict(State{rule: 199 ,left: 113 ,right:vec![ 78 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 1 ],computed_value:Token::DummyStart}); parser.sets[index].predict(State{rule: 200 ,left: 113 ,right:vec![ 113,23,78 ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; 3 ],computed_value:Token::DummyStart}); }, _ => panic!("nonterminal?"), } } fn compute_value(state:&mut State) { state.computed_value = match state.rule { 0 => state.values[0].clone(), //(MaybeModItems) => (),//rule1 1 => match state.values[0] { Token::MaybeModItems(ref items) => Token::WholeCrate(items.clone()), _ => panic!(""), }, //(ModItems) => (),//rule2 2 => match state.values[0] { Token::ModItems(ref items) => Token::MaybeModItems(items.clone()), _ => panic!(""), }, //() => (),//rule3 3 => Token::MaybeModItems(vec![]), //(ModItem) => (),//rule4 4 => match state.values[0] { Token::ModItem(ref outer,ref item) => Token::ModItems(vec![Rc::new(Token::ModItem(outer.clone(),item.clone()))]), _ => panic!(""), }, //(ModItems,ModItem) => (),//rule5 5 => match state.values[0] { Token::ModItems(ref items) => match state.values[1] { Token::ModItem(ref outer,ref item) => { let mut new=items.clone(); new.push(Rc::new(Token::ModItem(outer.clone(),item.clone()))); Token::ModItems(new) }, _ => panic!(""), } _ => panic!(""), }, //(MaybeOuterAttrs,Item) => (),//rule6 6 => match state.values[0] { Token::MaybeOuterAttrs(ref attrs) => match state.values[1] { Token::Item(ref item) => Token::ModItem(attrs.clone(),item.clone()), _ => panic!(""), }, _ => panic!(""), }, //(StmtItem) => (),//rule7 7 => match state.values[0] { Token::StmtItem(ref item) => Token::Item(item.clone()), _ => panic!(""), }, //(ItemMacro) => (),//rule8 8 => match state.values[0] { Token::ItemMacro(ref path,ref id,ref tree) => Token::Item(Rc::new(Token::ItemMacro(path.clone(),id.clone(),tree.clone()))), _ => panic!(""), }, //(BlockItem) => (),//rule9 9 => match state.values[0] { Token::BlockItem(ref item) => Token::StmtItem(item.clone()), _ => panic!(""), }, //(ItemFn) => (),//rule10 10 => Token::BlockItem(Rc::new(Token::ItemFn)), //(ItemTerminal) => (),//NEW rule193 193 => Token::BlockItem(Rc::new(state.values[0].clone())), //(ItemNonterminal) => (),//NEW rule194 194 => match state.values[0] { Token::ItemNonterminal(ref id, ref ty, ref clauses) => Token::BlockItem(Rc::new(Token::ItemNonterminal(id.clone(),ty.clone(),clauses.clone()))), _ => panic!(""), }, //(PathExpr,Bang,MaybeIdent,ParensDelimitedTokenTrees,Semicolon) => (),//rule11 11 => match (&state.values[0],&state.values[3]) { (&Token::PathExpr(ref s),&Token::ParensDelimitedTokenTrees(ref trees)) => Token::ItemMacro(Rc::new(Token::PathExpr(s.clone())),None,Rc::new(Token::ParensDelimitedTokenTrees(trees.clone()))), _ => panic!(""), }, //(PathGenericArgsWithColons) => (),//rule12 12 => match state.values[0] { Token::PathGenericArgsWithColons(ref s) => Token::PathExpr(s.clone()), _ => panic!(""), }, //(Ident) => (),//rule13 13 => match state.values[0] { Token::Ident(ref s) => Token::PathGenericArgsWithColons(s.clone()), _ => panic!(""), }, //(LiteralIdent) => (),//rule14 14 => match state.values[0] { Token::LiteralIdent(ref s) => Token::Ident(s.clone()), _ => panic!(""), }, //(FN,Ident,FnDecl,InnerAttrsAndBlock) => (),//rule15 15 => Token::ItemFn, //(FnParams,RetTy) => (),//rule16 16 => Token::FnDecl, //(LPar,MaybeParams,RPar) => (),//rule17 17 => Token::FnParams, //(Params) => (),//rule18 18 => Token::MaybeParams, //(Params,Comma) => (),//rule19 19 => Token::MaybeParams, //() => (),//rule20 20 => Token::MaybeParams, //(Param) => (),//rule21 21 => Token::Params, //(Params,Comma,Param) => (),//rule22 22 => Token::Params, //(Pat,Colon,TySum) => (),//rule23 23 => Token::Param, //(Underscore) => (),//rule24 24 => Token::Pat(PatKind::Underscore), //(Ampersand,Pat) => (),//rule25 25 => match state.values[1] { Token::Pat(ref kind) => Token::Pat(PatKind::Ref(Rc::new(kind.clone()))), _ => panic!(""), }, //(Ampersand,Mut,Pat) => (),//rule26 26 => match state.values[2] { Token::Pat(ref kind) => Token::Pat(PatKind::RefMut(Rc::new(kind.clone()))), _ => panic!(""), }, //(LPar,RPar) => (),//rule27 27 => Token::Pat(PatKind::Void), //(LPar,PatTup,RPar) => (),//XXX rule195 195 => Token::Pat(PatKind::Tuple(Rc::new(state.values[1].clone()))), //(LitOrPath) => (),//rule28 28 => Token::Pat(PatKind::Path(Rc::new(state.values[0].clone()))), //(PathExpr,LPar,RPar) => (),//rule29 29 => Token::Pat(PatKind::EnumEmpty(Rc::new(state.values[0].clone()))), //(PathExpr,LPar,PatTup,RPar) => (),//rule30 30 => Token::Pat(PatKind::Enum(Rc::new(state.values[0].clone()),Rc::new(state.values[2].clone()))), //(PathExpr) => (),//rule31 31 => match state.values[0] { Token::PathExpr(ref string) => Token::LitOrPath(string.clone()), _ => panic!(""), }, //(Lit) => (),//rule32 32 => Token::LitOrPath(String::from("[Lit]")), //(Minus,Lit) => (),//rule33 33 => Token::LitOrPath(String::from("[Minus,Lit]")), //(LitChar) => (),//rule34 34 => Token::Lit(Rc::new(state.values[0].clone())), //(LitInteger) => (),//rule35 35 => Token::Lit(Rc::new(state.values[0].clone())), //(Str) => (),//rule36 36 => Token::Lit(Rc::new(state.values[0].clone())), //(LitStr) => (),//rule37 37 => Token::Str, //() => (),//rule38 38 => Token::MaybeIdent, //(Ident) => (),//rule39 39 => Token::MaybeIdent, //(ParensDelimitedTokenTrees) => (),//rule40 40 => match state.values[0] { Token::ParensDelimitedTokenTrees(ref trees) => Token::DelimitedTokenTrees(trees.clone()), _ => panic!(""), }, //(LPar,TokenTrees,RPar) => (),//rule41 41 => match state.values[1] { Token::TokenTrees(ref trees) => Token::ParensDelimitedTokenTrees(trees.clone()), _ => panic!(""), }, //() => (),//rule42 42 => Token::TokenTrees(vec![]), //(TokenTrees,TokenTree) => (),//rule43 43 => match (&state.values[0],&state.values[1]) { (&Token::TokenTrees(ref trees),&Token::TokenTree(ref token)) => { let mut new=trees.clone(); new.push(token.clone()); Token::TokenTrees(new) } _ => panic!(""), }, //(DelimitedTokenTrees) => (),//rule44 44 => match state.values[0] { Token::DelimitedTokenTrees(ref trees) => Token::TokenTree(Rc::new(Token::DelimitedTokenTrees(trees.clone()))), _ => panic!(""), }, //(UnpairedToken) => (),//rule45 45 => match state.values[0] { Token::UnpairedToken(ref token) => Token::TokenTree(token.clone()), _ => panic!(""), }, //(LitStr) => (),//rule46 46 => Token::UnpairedToken(Rc::new(state.values[0].clone())), //(LiteralIdent) => (),//rule47 47 => Token::UnpairedToken(Rc::new(state.values[0].clone())), //(Comma) => (),//rule48 48 => Token::UnpairedToken(Rc::new(state.values[0].clone())), //(LBrace,MaybeStmts,RBrace) => (),//rule49 49 => Token::InnerAttrsAndBlock, //(Stmts) => (),//rule50 50 => match state.values[0] { Token::Stmts(ref list) => Token::MaybeStmts(list.clone(),None), _ => panic!(""), }, //(Stmts,NonblockExpr) => (),//rule51 51 => match (&state.values[0],&state.values[1]) { (&Token::Stmts(ref list),&Token::NonblockExpr(ref expr)) => Token::MaybeStmts(list.clone(),Some(expr.clone())), _ => panic!(""), }, //(NonblockExpr) => (),//rule52 52 => match state.values[0] { Token::NonblockExpr(ref expr) => Token::MaybeStmts(vec![],Some(expr.clone())), _ => panic!(""), }, //() => (),//rule53 53 => Token::MaybeStmts(vec![],None), //(Stmt) => (),//rule54 54 => match state.values[0] { Token::Stmt(ref stmt) => Token::Stmts(vec![stmt.clone()]), _ => panic!(""), } //(Stmts,Stmt) => (),//rule55 55 => match (&state.values[0],&state.values[1]) { (&Token::Stmts(ref stmts),&Token::Stmt(ref stmt)) => { let mut new=stmts.clone(); new.push(stmt.clone()); Token::Stmts(new) }, _ => panic!(""), }, //(MaybeOuterAttrs,Let) => (),//rule56 : FIXME Let 56 => Token::Stmt(StmtKind::Empty), //(StmtItem) => (),//rule57 57 => match state.values[0] { Token::StmtItem(ref item) => Token::Stmt(StmtKind::Item(vec![],item.clone())), _ => panic!(""), }, //(OuterAttrs,StmtItem) => (),//rule58 58 => match (&state.values[0],&state.values[1]) { (&Token::OuterAttrs(ref attrs),&Token::StmtItem(ref item)) => Token::Stmt(StmtKind::Item(attrs.clone(),item.clone())), _ => panic!(""), }, //(FullBlockExpr) => (),//rule59 59 => match state.values[0] { Token::FullBlockExpr(ref block) => Token::Stmt(StmtKind::Block(vec![],block.clone())), _ => panic!(""), }, //(MaybeOuterAttrs,Block) => (),//rule60 60 => match state.values[0] { Token::MaybeOuterAttrs(ref attrs) => Token::Stmt(StmtKind::Block(attrs.clone(),Rc::new(state.values[1].clone()))), _ => panic!(""), }, //(NonblockExpr,Semicolon) => (),//rule61 61 => match state.values[0] { Token::NonblockExpr(ref expr) => Token::Stmt(StmtKind::Expr(vec![],expr.clone())), _ => panic!(""), }, //(OuterAttrs,NonblockExpr,Semicolon) => (),//rule62 62 => match (&state.values[0],&state.values[1]) { (&Token::OuterAttrs(ref attrs),&Token::NonblockExpr(ref expr)) => Token::Stmt(StmtKind::Expr(attrs.clone(),expr.clone())), _ => panic!(""), } //(Semicolon) => (),//rule63 63 => Token::Stmt(StmtKind::Empty), //(OuterAttrs) => (),//rule64 64 => match state.values[0] { Token::OuterAttrs(ref attrs) => Token::MaybeOuterAttrs(attrs.clone()), _ => panic!(""), }, //() => (),//rule65 65 => Token::MaybeOuterAttrs(vec![]), //(OuterAttr) => (),//rule66 66 => match state.values[0] { Token::OuterAttr(ref kind) => Token::OuterAttrs(vec![kind.clone()]), _ => panic!(""), }, //(OuterAttrs,OuterAttr) => (),//rule67 67 => match (&state.values[0],&state.values[1]) { (&Token::OuterAttrs(ref attrs),&Token::OuterAttr(ref attr)) => { let mut new=attrs.clone(); new.push(attr.clone()); Token::OuterAttrs(new) } _ => panic!(""), }, //(NumberSign,LBracket,MetaItem,RBracket) => (),//rule68 68 => match state.values[2] { Token::MetaItem(ref attr) => Token::OuterAttr(attr.clone()), _ => panic!(""), }, //(OuterDocComment) => (),//rule69 69 => match state.values[0] { Token::OuterDocComment(ref string) => Token::OuterAttr(AttrKind::Documentation(string.clone())), _ => panic!(""), }, //(Ident) => (),//rule70 70 => match state.values[0] { Token::Ident(ref string) => Token::MetaItem(AttrKind::Flag(string.clone())), _ => panic!(""), }, //(Ident,Equal,Lit) => (),//rule71 71 => match (&state.values[0],&state.values[2]) { (&Token::Ident(ref string),&Token::Lit(ref lit)) => Token::MetaItem(AttrKind::Value(string.clone(),lit.clone())), _ => panic!(""), }, //(Ident,LPar,MetaSeq,RPar) => (),//rule72 72 => match (&state.values[0],&state.values[2]) { (&Token::Ident(ref string),&Token::MetaSeq(ref seq)) => Token::MetaItem(AttrKind::Sequence(string.clone(),seq.clone())), _ => panic!(""), }, //(Ident,LPar,MetaSeq,Comma,RPar) => (),//rule73 73 => match (&state.values[0],&state.values[2]) { (&Token::Ident(ref string),&Token::MetaSeq(ref seq)) => Token::MetaItem(AttrKind::Sequence(string.clone(),seq.clone())), _ => panic!(""), }, //() => (),//rule74 74 => Token::MetaSeq(vec![]), //(MetaItem) => (),//rule75 75 => match state.values[0] { Token::MetaItem(ref attr) => Token::MetaSeq(vec![attr.clone()]), _ => panic!(""), }, //(MetaSeq,Comma,MetaItem) => (),//rule76 76 => match (&state.values[0],&state.values[2]) { (&Token::MetaSeq(ref seq),&Token::MetaItem(ref attr)) => { let mut new=seq.clone(); new.push(attr.clone()); Token::MetaSeq(new) }, _ => panic!(""), }, //(RArrow,Ty) => (),//rule77 77 => Token::RetTy, //() => (), //in bison with IDENT precedence//rule78 78 => Token::RetTy, //(TyPrim) => (),//rule79 79 => match state.values[0] { Token::TyPrim(ref kind) => Token::Ty(kind.clone()), _ => panic!(""), }, //(LPar,RPar) => (),//rule80 80 => Token::Ty(TyKind::Void), //(PathGenericArgsWithoutColons) => (),//rule81 81 => match state.values[0] { Token::PathGenericArgsWithoutColons(ref string) => Token::TyPrim(TyKind::Path(string.clone())), _ => panic!(""), }, //(Ampersand,Ty) => (),//rule82 82 => match state.values[1] { Token::Ty(ref kind) => Token::TyPrim(TyKind::Ref(Rc::new(kind.clone()))), _ => panic!(""), }, //(Ampersand,Mut,Ty) => (),//rule83 83 => match state.values[2] { Token::Ty(ref kind) => Token::TyPrim(TyKind::RefMut(Rc::new(kind.clone()))), _ => panic!(""), }, //(Underscore) => (),//rule84 84 => Token::TyPrim(TyKind::Underscore), //(Ident) => (),//rule85 85 => match state.values[0] { Token::Ident(ref string) => Token::PathGenericArgsWithoutColons(string.clone()), _ => panic!(""), }, //(TySumElt) => (),//rule86 86 => match state.values[0] { Token::TySumElt(ref kind) => Token::TySum(kind.clone()), _ => panic!(""), }, //(Ty) => (),//rule87 87 => match state.values[0] { Token::Ty(ref kind) => Token::TySumElt(kind.clone()), _ => panic!(""), }, //(PatTupElts) => (),//rule88 88 => match state.values[0] { Token::PatTupElts(ref elements) => Token::PatTup(elements.clone()), _ => panic!(""), }, //(PatTupElts,Comma) => (),//rule89 89 => match state.values[0] { Token::PatTupElts(ref elements) => Token::PatTup(elements.clone()), _ => panic!(""), }, //(Pat) => (),//rule90 90 => Token::PatTupElts(vec![Rc::new(state.values[0].clone())]), //(PatTupElts,Comma,Pat) => (),//rule91 91 => match state.values[0] { Token::PatTupElts(ref elements) => { let mut new=elements.clone(); new.push(Rc::new(state.values[2].clone())); Token::PatTupElts(new) }, _ => panic!(""), }, //(Lit) => (),//rule92 92 => Token::NonblockExpr(ExprKind::Single(Rc::new(state.values[0].clone()))), //(PathExpr) => (),//rule93 93 => Token::NonblockExpr(ExprKind::Single(Rc::new(state.values[0].clone()))), //(MacroExpr) => (),//rule94 94 => Token::NonblockExpr(ExprKind::Single(Rc::new(state.values[0].clone()))), //(NonblockExpr,Dot,PathGenericArgsWithColons) => (),//rule95 95 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref kind),&Token::PathGenericArgsWithColons(ref string)) => Token::NonblockExpr(ExprKind::Member(Rc::new(kind.clone()),string.clone())), _ => panic!(""), }, //(NonblockExpr,LBracket,MaybeExpr,RBracket) => (),//rule96 96 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref kind),&Token::MaybeExpr(None)) => Token::NonblockExpr(ExprKind::Index(Rc::new(kind.clone()),None)), (&Token::NonblockExpr(ref kind),&Token::MaybeExpr(Some(ref index))) => Token::NonblockExpr(ExprKind::Index(Rc::new(kind.clone()),Some(Rc::new(index.clone())))), _ => panic!(""), }, //(NonblockExpr,LPar,MaybeExprs,RPar) => (),//rule97 97 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref kind),&Token::MaybeExprs(ref arguments)) => Token::NonblockExpr(ExprKind::Call(Rc::new(kind.clone()),arguments.clone())), _ => panic!(""), }, //(LPar,MaybeExprs,RPar) => (),//rule98 98 => match state.values[1] { Token::MaybeExprs(ref arguments) => Token::NonblockExpr(ExprKind::Parentheses(arguments.clone())), _ => panic!(""), }, //(NonblockExpr,Equal,Expr) => (),//rule99 99 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref left),&Token::Expr(ref right)) => Token::NonblockExpr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(NonblockExpr,EqualEqual,Expr) => (),//rule100 100 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref left),&Token::Expr(ref right)) => Token::NonblockExpr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(NonblockExpr,Ampersand,Expr) => (),//rule101 101 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref left),&Token::Expr(ref right)) => Token::NonblockExpr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(NonblockExpr,Plus,Expr) => (),//rule102 102 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref left),&Token::Expr(ref right)) => Token::NonblockExpr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(NonblockExpr,Minus,Expr) => (),//rule103 103 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref left),&Token::Expr(ref right)) => Token::NonblockExpr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(NonblockExpr,Star,Expr) => (),//rule104 104 => match (&state.values[0],&state.values[2]) { (&Token::NonblockExpr(ref left),&Token::Expr(ref right)) => Token::NonblockExpr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(NonblockPrefixExpr) => (),//rule105 105 => match state.values[0] { Token::NonblockPrefixExpr(ref expr) => Token::NonblockExpr(expr.clone()), _ => panic!(""), }, //(Minus,Expr) => (),//rule106 106 => match state.values[1] { Token::Expr(ref expr) => Token::NonblockPrefixExpr(ExprKind::Prefix(Rc::new(state.values[0].clone()),Rc::new(expr.clone()))), _ => panic!(""), }, //(Bang,Expr) => (),//rule107 107 => match state.values[1] { Token::Expr(ref expr) => Token::NonblockPrefixExpr(ExprKind::Prefix(Rc::new(state.values[0].clone()),Rc::new(expr.clone()))), _ => panic!(""), }, //(Star,Expr) => (),//rule108 108 => match state.values[1] { Token::Expr(ref expr) => Token::NonblockPrefixExpr(ExprKind::Prefix(Rc::new(state.values[0].clone()),Rc::new(expr.clone()))), _ => panic!(""), }, //(Ampersand,MaybeMut,Expr) => (),//rule109 109 => match (&state.values[1],&state.values[2]) { (&Token::MaybeMut(ismut),&Token::Expr(ref expr)) => if ismut {Token::NonblockPrefixExpr(ExprKind::RefMut(Rc::new(expr.clone())))} else {Token::NonblockPrefixExpr(ExprKind::Ref(Rc::new(expr.clone())))}, _ => panic!(""), }, //(Mut) => (),//rule110 110 => Token::MaybeMut(true), //() => (),//rule111 111 => Token::MaybeMut(false), //(BlockExpr) => (),//rule112 112 => match state.values[0] { Token::BlockExpr(ref block) => Token::FullBlockExpr(block.clone()), _ => panic!(""), }, //(ExprMatch) => (),//rule113 113 => Token::BlockExpr(Rc::new(state.values[0].clone())), //(ExprIf) => (),//rule114 114 => Token::BlockExpr(Rc::new(state.values[0].clone())), //(ExprWhile) => (),//rule115 115 => Token::BlockExpr(Rc::new(state.values[0].clone())), //(ExprLoop) => (),//rule116 116 => Token::BlockExpr(Rc::new(state.values[0].clone())), //(ExprFor) => (),//rule117 117 => Token::BlockExpr(Rc::new(state.values[0].clone())), //(Match,ExprNostruct,LBrace,RBrace) => (),//rule118 118 => Token::ExprMatch, //(Match,ExprNostruct,LBrace,MatchClauses,RBrace) => (),//rule119 119 => Token::ExprMatch, //(Match,ExprNostruct,LBrace,MatchClauses,NonblockMatchClause,RBrace) => (),//rule120 120 => Token::ExprMatch, //(Match,ExprNostruct,LBrace,NonblockMatchClause,RBrace) => (),//rule121 121 => Token::ExprMatch, //(Lit) => (),//rule122 122 => Token::ExprNostruct, //(PathExpr) => (),//rule123 123 => Token::ExprNostruct, //(MacroExpr) => (),//rule124 124 => Token::ExprNostruct, //(ExprNostruct,Dot,PathGenericArgsWithColons) => (),//rule125 125 => Token::ExprNostruct, //(ExprNostruct,LBracket,MaybeExpr,RBracket) => (),//rule126 126 => Token::ExprNostruct, //(ExprNostruct,LPar,MaybeExprs,RPar) => (),//rule127 127 => Token::ExprNostruct, //(LPar,MaybeExprs,RPar) => (),//rule128 128 => Token::ExprNostruct, //(ExprNostruct,Equal,ExprNostruct) => (),//rule129 129 => Token::ExprNostruct, //(ExprNostruct,EqualEqual,ExprNostruct) => (),//rule130 130 => Token::ExprNostruct, //(ExprNostruct,Ampersand,ExprNostruct) => (),//rule131 131 => Token::ExprNostruct, //(ExprNostruct,Plus,ExprNostruct) => (),//rule132 132 => Token::ExprNostruct, //(ExprNostruct,Minus,ExprNostruct) => (),//rule133 133 => Token::ExprNostruct, //(ExprNostruct,Star,ExprNostruct) => (),//rule134 134 => Token::ExprNostruct, //(BlockExpr) => (),//rule135 135 => Token::ExprNostruct, //(Block) => (),//rule136 136 => Token::ExprNostruct, //(NonblockPrefixExprNostruct) => (),//rule137 137 => Token::ExprNostruct, //(LBrace,MaybeStmts,RBrace) => (),//rule138 138 => match state.values[1] { Token::MaybeStmts(ref list, ref option) => Token::Block(list.clone(),option.clone()), _ => panic!(""), }, //(Minus,ExprNostruct) => (),//rule139 139 => Token::NonblockPrefixExprNostruct, //(Bang,ExprNostruct) => (),//rule140 140 => Token::NonblockPrefixExprNostruct, //(Star,ExprNostruct) => (),//rule141 141 => Token::NonblockPrefixExprNostruct, //(Ampersand,MaybeMut,ExprNostruct) => (),//rule142 142 => Token::NonblockPrefixExprNostruct, //(PathExpr,Bang,MaybeIdent,ParensDelimitedTokenTrees) => (),//rule143 143 => Token::MacroExpr, //(Expr) => (),//rule144 144 => match state.values[0] { Token::Expr(ref expr) => Token::MaybeExpr(Some(expr.clone())), _ => panic!(""), }, //() => (),//rule145 145 => Token::MaybeExpr(None), //(Lit) => (),//rule146 146 => Token::Expr(ExprKind::Single(Rc::new(state.values[0].clone()))), //(PathExpr) => (),//rule147 147 => Token::Expr(ExprKind::Single(Rc::new(state.values[0].clone()))), //(MacroExpr) => (),//rule148 148 => Token::Expr(ExprKind::Single(Rc::new(state.values[0].clone()))), //(Expr,Dot,PathGenericArgsWithColons) => (),//rule149 149 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref kind),&Token::PathGenericArgsWithColons(ref string)) => Token::Expr(ExprKind::Member(Rc::new(kind.clone()),string.clone())), _ => panic!(""), }, //(Expr,LBracket,MaybeExpr,RBracket) => (),//rule150 150 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref kind),&Token::MaybeExpr(None)) => Token::Expr(ExprKind::Index(Rc::new(kind.clone()),None)), (&Token::Expr(ref kind),&Token::MaybeExpr(Some(ref index))) => Token::Expr(ExprKind::Index(Rc::new(kind.clone()),Some(Rc::new(index.clone())))), _ => panic!(""), }, //(Expr,LPar,MaybeExprs,RPar) => (),//rule151 151 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref kind),&Token::MaybeExprs(ref arguments)) => Token::Expr(ExprKind::Call(Rc::new(kind.clone()),arguments.clone())), _ => panic!(""), }, //(LPar,MaybeExprs,RPar) => (),//rule152 152 => match state.values[1] { Token::MaybeExprs(ref arguments) => Token::Expr(ExprKind::Parentheses(arguments.clone())), _ => panic!(""), }, //(Expr,Equal,Expr) => (),//rule153 153 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref left),&Token::Expr(ref right)) => Token::Expr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(Expr,EqualEqual,Expr) => (),//rule154 154 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref left),&Token::Expr(ref right)) => Token::Expr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(Expr,Ampersand,Expr) => (),//rule155 155 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref left),&Token::Expr(ref right)) => Token::Expr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(Expr,Plus,Expr) => (),//rule156 156 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref left),&Token::Expr(ref right)) => Token::Expr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(Expr,Minus,Expr) => (),//rule157 157 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref left),&Token::Expr(ref right)) => Token::Expr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(Expr,Star,Expr) => (),//rule158 158 => match (&state.values[0],&state.values[2]) { (&Token::Expr(ref left),&Token::Expr(ref right)) => Token::Expr(ExprKind::Infix(Rc::new(left.clone()),Rc::new(state.values[1].clone()),Rc::new(right.clone()))), _ => panic!(""), }, //(BlockExpr) => (),//rule159 159 => match state.values[0] { Token::BlockExpr(ref block) => Token::Expr(ExprKind::Single(block.clone())), _ => panic!(""), }, //(Block) => (),//rule160 160 => Token::Expr(ExprKind::Single(Rc::new(state.values[0].clone()))), //(NonblockPrefixExpr) => (),//rule161 161 => match state.values[0] { Token::NonblockPrefixExpr(ref expr) => Token::Expr(expr.clone()), _ => panic!(""), }, //(Exprs) => (),//rule162 162 => match state.values[0] { Token::Exprs(ref list) => Token::MaybeExprs(list.clone()), _ => panic!(""), }, //(Exprs,Comma) => (),//rule163 163 => match state.values[0] { Token::Exprs(ref list) => Token::MaybeExprs(list.clone()), _ => panic!(""), }, //() => (),//rule164 164 => Token::MaybeExprs(vec![]), //(Expr) => (),//rule165 165 => match state.values[0] { Token::Expr(ref expr) => Token::Exprs(vec![expr.clone()]), _ => panic!(""), }, //(Exprs,Comma,Expr) => (),//rule166 166 => match (&state.values[0],&state.values[2]) { (&Token::Exprs(ref list),&Token::Expr(ref expr)) => { let mut new=list.clone(); new.push(expr.clone()); Token::Exprs(new) }, _ => panic!(""), }, //(If,ExprNostruct,Block) => (),//rule167 167 => Token::ExprIf, //(If,ExprNostruct,Block,Else,BlockOrIf) => (),//rule168 168 => Token::ExprIf, //(Block) => (),//rule169 169 => Token::BlockOrIf, //(ExprIf) => (),//rule170 170 => Token::BlockOrIf, //(While,ExprNostruct,Block) => (),//rule171 171 => Token::ExprWhile, //(Loop,Block) => (),//rule172 172 => Token::ExprLoop, //(For,Pat,In,ExprNostruct,Block) => (),//rule173 173 => Token::ExprFor, //(MatchClause) => (),//rule174 174 => Token::MatchClauses(vec![Rc::new(state.values[0].clone())]), //(MatchClauses,MatchClause) => (),//rule175 175 => match state.values[0] { Token::MatchClauses(ref clauses) => { let mut new=clauses.clone(); new.push(Rc::new(state.values[1].clone())); Token::MatchClauses(new) }, _ => panic!(""), }, //(NonblockMatchClause,Comma) => (),//rule176 176 => match state.values[0] { Token::NonblockMatchClause(ref attributes, ref patterns, ref expression) => Token::MatchClause(attributes.clone(),patterns.clone(),expression.clone()), _ => panic!(""), }, //(BlockMatchClause) => (),//rule177 177 => match state.values[0] { Token::BlockMatchClause(ref attributes, ref patterns, ref expression) => Token::MatchClause(attributes.clone(),patterns.clone(),expression.clone()), _ => panic!(""), }, //(BlockMatchClause,Comma) => (),//rule178 178 => match state.values[0] { Token::BlockMatchClause(ref attributes, ref patterns, ref expression) => Token::MatchClause(attributes.clone(),patterns.clone(),expression.clone()), _ => panic!(""), }, //(MaybeOuterAttrs,PatsOr,MaybeGuard,FatArrow,NonblockExpr) => (),//rule179 179 => match state.values[0] { Token::MaybeOuterAttrs(ref attributes) => Token::NonblockMatchClause(attributes.clone(),Rc::new(state.values[1].clone()),Rc::new(state.values[4].clone())), _ => panic!(""), }, //(MaybeOuterAttrs,PatsOr,MaybeGuard,FatArrow,Block) => (),//rule180 180 => match state.values[0] { Token::MaybeOuterAttrs(ref attributes) => Token::BlockMatchClause(attributes.clone(),Rc::new(state.values[1].clone()),Rc::new(state.values[4].clone())), _ => panic!(""), } //(MaybeOuterAttrs,PatsOr,MaybeGuard,FatArrow,BlockExpr) => (),//rule181 181 => match state.values[0] { Token::MaybeOuterAttrs(ref attributes) => Token::BlockMatchClause(attributes.clone(),Rc::new(state.values[1].clone()),Rc::new(state.values[4].clone())), _ => panic!(""), }, //(Pat) => (),//rule182 182 => Token::PatsOr(Rc::new(state.values[0].clone())), //() => (),//rule183 183 => Token::MaybeGuard, //(Terminal,Ident,LBrace,MaybeTerminalItems,RBrace) => (),//rule184 184 => match (&state.values[1],&state.values[3]) { (&Token::Ident(ref id),&Token::MaybeTerminalItems(ref items)) => Token::ItemTerminal(id.clone(),None,items.clone()), _ => panic!(""), } //(Terminal,Ident,LPar,Ty,RPar,LBrace,MaybeTerminalItems,RBrace) => (),//rule185 185 => match (&state.values[1],&state.values[6]) { (&Token::Ident(ref id),&Token::MaybeTerminalItems(ref items)) => Token::ItemTerminal(id.clone(),Some(Rc::new(state.values[3].clone())),items.clone()), _ => panic!(""), } //(TerminalItems) => (),//rule186 186 => match state.values[0] { Token::TerminalItems(ref items) => Token::MaybeTerminalItems(items.clone()), _ => panic!(""), }, //() => (),//rule187 187 => Token::MaybeTerminalItems(vec![]), //(TerminalItem) => (),//rule188 188 => match state.values[0] { Token::TerminalItem(ref item) => Token::TerminalItems(vec![item.clone()]), _ => panic!(""), }, //(TerminalItem,TerminalItems) => (),//rule189 189 => match (&state.values[0],&state.values[1]) { (&Token::TerminalItem(ref item),&Token::TerminalItems(ref items)) => { //Token::TerminalItems(vec![item.clone()]+items), let mut new:Vec>=vec![item.clone()]; new.extend(items.iter().map(|x|x.clone())); Token::TerminalItems(new) }, _ => panic!(""), }, //(ItemFn) => (),//rule190 190 => Token::TerminalItem(Rc::new(state.values[0].clone())), //(Nonterminal,Ident,LBrace,MatchClauses,RBrace) => (),//rule191 191 => match (&state.values[1],&state.values[3]) { (&Token::Ident(ref id),&Token::MatchClauses(ref clauses)) => Token::ItemNonterminal(id.clone(),None,clauses.clone()), _ => panic!(""), }, //(Nonterminal,Ident,LPar,Ty,RPar,LBrace,MatchClauses,RBrace) => (),//rule192 192 => match (&state.values[1],&state.values[6]) { (&Token::Ident(ref id),&Token::MatchClauses(ref clauses)) => Token::ItemNonterminal(id.clone(),Some(Rc::new(state.values[3].clone())),clauses.clone()), _ => panic!(""), }, //(TySums) => (),//rule196 196 => match state.values[0] { Token::TySums(ref types) => Token::MaybeTySums(types.clone()), _ => panic!(""), }, //(TySums,Comma) => (),//rule197 197 => match state.values[0] { Token::TySums(ref types) => Token::MaybeTySums(types.clone()), _ => panic!(""), }, //() => (),//rule198 198 => Token::MaybeTySums(vec![]), //(TySum) => (),//rule199 199 => Token::TySums(vec![Rc::new(state.values[0].clone())]), //(TySums,Comma,TySum) => (),//rule200 200 => match state.values[0] { Token::TySums(ref types) => { let mut new=types.clone(); new.push(Rc::new(state.values[2].clone())); Token::TySums(new) }, _ => panic!(""), }, _ => panic!("Not a rule"), } } fn table_terminal(token_index:usize)->bool { match token_index { 1 ... 37 => true, 0| 38 ... 113 => false, _ => panic!("table_terminal"), } } fn table_priority(a:usize, b:usize) -> Option { match (a,b) { _ => None, } } fn table_associativity(rule:usize) -> Option { match rule { _ => None } } fn to_usize(token:&Token) -> usize { match token { &Token::DummyStart => 0, &Token::FN => 1, &Token::Mut => 2, &Token::Match => 3, &Token::If => 4, &Token::Else => 5, &Token::While => 6, &Token::Loop => 7, &Token::For => 8, &Token::In => 9, &Token::Terminal => 10, &Token::Nonterminal => 11, &Token::OuterDocComment(_) => 12, &Token::LiteralIdent(_) => 13, &Token::LitStr(_) => 14, &Token::LitChar(_) => 15, &Token::LitInteger(_) => 16, &Token::RArrow => 17, &Token::FatArrow => 18, &Token::EqualEqual => 19, &Token::LPar => 20, &Token::RPar => 21, &Token::Dot => 22, &Token::Comma => 23, &Token::Colon => 24, &Token::Underscore => 25, &Token::Ampersand => 26, &Token::NumberSign => 27, &Token::Minus => 28, &Token::Bang => 29, &Token::Semicolon => 30, &Token::LBrace => 31, &Token::RBrace => 32, &Token::LBracket => 33, &Token::RBracket => 34, &Token::Equal => 35, &Token::Star => 36, &Token::Plus => 37, //Now nonterminals, &Token::WholeCrate(_) => 38, &Token::MaybeModItems(_) => 39, &Token::ModItems(_) => 40, &Token::ModItem(_,_) => 41, &Token::Item(_) => 42, &Token::StmtItem(_) => 43, &Token::BlockItem(_) => 44, &Token::ItemMacro(_,_,_) => 45, &Token::PathExpr(_) => 46, &Token::PathGenericArgsWithColons(_) => 47, &Token::Ident(_) => 48, &Token::ItemFn => 49, &Token::FnDecl => 50, &Token::FnParams => 51, &Token::MaybeParams => 52, &Token::Params => 53, &Token::Param => 54, &Token::Pat(_) => 55, &Token::LitOrPath(_) => 56, &Token::Lit(_) => 57, &Token::Str => 58, &Token::MaybeIdent => 59, &Token::DelimitedTokenTrees(_) => 60, &Token::ParensDelimitedTokenTrees(_) => 61, &Token::TokenTrees(_) => 62, &Token::TokenTree(_) => 63, &Token::UnpairedToken(_) => 64, &Token::InnerAttrsAndBlock => 65, &Token::MaybeStmts(_,_) => 66, &Token::Stmts(_) => 67, &Token::Stmt(_) => 68, &Token::MaybeOuterAttrs(_) => 69, &Token::OuterAttrs(_) => 70, &Token::OuterAttr(_) => 71, &Token::MetaItem(_) => 72, &Token::MetaSeq(_) => 73, &Token::RetTy => 74, &Token::Ty(_) => 75, &Token::TyPrim(_) => 76, &Token::PathGenericArgsWithoutColons(_) => 77, &Token::TySum(_) => 78, &Token::TySumElt(_) => 79, &Token::PatTup(_) => 80, &Token::PatTupElts(_) => 81, &Token::NonblockExpr(_) => 82, &Token::NonblockPrefixExpr(_) => 83, &Token::MaybeMut(_) => 84, &Token::FullBlockExpr(_) => 85, &Token::BlockExpr(_) => 86, &Token::ExprMatch => 87, &Token::ExprNostruct => 88, &Token::Block(_,_) => 89, &Token::NonblockPrefixExprNostruct => 90, &Token::MacroExpr => 91, &Token::MaybeExpr(_) => 92, &Token::Expr(_) => 93, &Token::MaybeExprs(_) => 94, &Token::Exprs(_) => 95, &Token::ExprIf => 96, &Token::BlockOrIf => 97, &Token::ExprWhile => 98, &Token::ExprLoop => 99, &Token::ExprFor => 100, &Token::MatchClauses(_) => 101, &Token::MatchClause(_,_,_) => 102, &Token::NonblockMatchClause(_,_,_) => 103, &Token::BlockMatchClause(_,_,_) => 104, &Token::PatsOr(_) => 105, &Token::MaybeGuard => 106, &Token::ItemTerminal(_,_,_) => 107, &Token::MaybeTerminalItems(_) => 108, &Token::TerminalItems(_) => 109, &Token::TerminalItem(_) => 110, &Token::ItemNonterminal(_,_,_) => 111, &Token::MaybeTySums(_) => 112, &Token::TySums(_) => 113, } } } #[derive(Debug)] struct Rule { //left //right: Vec, patterns: Vec>,//[Pat(Path(LitOrPath("NoSpace")))] , Pat(Enum(PathExpr("MaybeModItems"), PatTup([Pat(Path(LitOrPath("items")))]))) expression: Rc,//NonblockExpr priority: Option, } #[derive(Debug)] struct TokenInfo { id: String, type_arguments: Vec>, is_terminal: bool, re: Option, fn_match: Option>, rules: Vec, } struct Compiler<'a> { source: &'a Token, token_info: Vec, first_nonterminal: Option, token_name_to_index: HashMap, ordering: HashMap<(String,String),Ordering>, } impl<'a> Compiler<'a> { fn process_token(&mut self,token:&Token) { println!(">>process_token {:?}",token); match token { &Token::WholeCrate(ref items) => { for item in items { self.process_token(item); } }, &Token::ModItem(ref attributes,ref item) => { self.process_token(item); }, &Token::ItemMacro(ref path, ref id, ref tree) => { println!("Got macro {:?} with data {:?}",path,tree); match (path.as_ref(),tree.as_ref()) { (&Token::PathExpr(ref s),&Token::ParensDelimitedTokenTrees(ref data)) => { if s=="re_terminal" { //match (data[0].as_ref(),data[1].as_ref(),data[2].as_ref()) //{ // (&Token::LiteralIdent(ref id),&Token::Comma,&Token::LitStr(ref re)) => // { // if id!="_" // { // self.token_info.push(TokenInfo{ // id:id.clone(), // type_string:String::from("()"), // is_terminal: true, // re:Some(re[1..re.len()-1].to_string()), // }); // } // }, // _ => println!("incorrect data in re_terminal"), //}; let mut comma_index=0; while comma_index { if id!="_" { self.token_info.push(TokenInfo{ id:id.clone(), //type_string:String::from("()"), type_arguments: vec![], is_terminal: true, re:Some(re[1..re.len()-1].to_string()), fn_match: None, rules: vec![], }); } }, _ => println!("incorrect data in re_terminal"), } } else { println!("incorrect data in re_terminal"); } } else if s=="ordering" { let mut order=vec![]; for elem in data { match elem.as_ref() { &Token::LiteralIdent(ref id) => order.push(id.clone()), &Token::Comma => (), _ => panic!("incorrect token in ordering! {:?}",elem), }; } for i in 0..order.len() { for j in 0..order.len() { self.ordering.insert((order[i].clone(),order[j].clone()),i.cmp(&j)); } } } }, _ => println!("ignoring macro"), }; }, &Token::ItemTerminal(ref id, ref ty, ref items) => { let type_arguments= match ty { &None => vec![], &Some(ref mts) => match mts.as_ref() { &Token::MaybeTySums(ref types) => types.clone(), _ => panic!(""), } }; self.token_info.push(TokenInfo{ id:id.clone(), //type_string:String::from("()"), type_arguments, is_terminal: true, re: None, fn_match: None,//FIXME rules: vec![], }); }, &Token::ItemNonterminal(ref id, ref ty, ref clauses) => { if let None=self.first_nonterminal { self.first_nonterminal=Some(self.token_info.len()); } let mut rules=vec![]; for clause in clauses { println!("Found clause {:?}",clause); if let &Token::MatchClause(ref attributes,ref patterns,ref expression)=clause.as_ref() { let mut rule_patterns : Vec>=vec![]; //if let &Token::PatsOr(&Token::Pat(&PatKind::Tuple(&Token::PatTup(ref pats))))=patterns.as_ref() if let &Token::PatsOr(ref patsor_pat)=patterns.as_ref() { if let &Token::Pat(PatKind::Tuple(ref tuple))=patsor_pat.as_ref() { if let &Token::PatTup(ref pats)=tuple.as_ref() { for pat in pats { rule_patterns.push(pat.clone()); } } } } let mut priority=None; for attr in attributes { if let &AttrKind::Sequence(ref attr_name, ref seq)=attr { if attr_name=="priority" { if seq.len()!=1 { panic!("there must be exactly one priority flag ({:?})",attr); } if let AttrKind::Flag(ref p_flag)=seq[0] { priority=Some(p_flag.clone()); } else { panic!("I do not understand this priority {:?}",attr); } } } } rules.push(Rule{ //right: vec![], patterns: rule_patterns, expression: expression.clone(), priority, }); } } let type_arguments= match ty { &None => vec![], &Some(ref mts) => match mts.as_ref() { &Token::MaybeTySums(ref types) => types.clone(), _ => panic!(""), } }; self.token_info.push(TokenInfo{ id:id.clone(), //type_string:String::from("()"), type_arguments, is_terminal: false, re: None, fn_match: None, rules, }); }, _ => (), }; } fn compile(&mut self) { self.process_token(self.source); for (i,token) in self.token_info.iter().enumerate() { println!("token {}={:?}",i+1,token); self.token_name_to_index.insert(token.id.clone(),i+1); } println!("first non-terminal={:?}",self.first_nonterminal); println!("--------------------------------------"); println!("enum Token{{DummyStart,"); for token in self.token_info.iter() { if token.type_arguments.len()>0 { print!("{}({}),",token.id,token.type_arguments.iter().map(|t|format!("{}",t)).collect::>().join(",")); } else { print!("{},",token.id); } } println!("}}\nimpl Default for Token {{ fn default()->Self{{Token::DummyStart}} }}"); println!("struct ParsingTables {{ }}"); println!("impl ParsingTablesTrait for ParsingTables {{"); println!("fn initial()->usize {{ {} }}",self.first_nonterminal.unwrap()+1); println!("fn match_some(parser: &mut Parser) -> Option<(usize,Token)> {{ let source=&parser.source[parser.source_index..];"); for token in self.token_info.iter() { if token.is_terminal { if let Some(ref sre)=token.re { //println!("PUT HERE THE MATCH WITH {} re={},",token.id,sre); println!("match {{ match parser.re(\"{}\",source) {{ None => None, Some((size,_string)) => Some((size,())) }} }}",sre); println!("{{ None => (), Some((size,_result)) => return Some((size,Token::{})), }};",token.id); } else { println!("PUT HERE THE MATCH WITH {},",token.id); } } } println!("None }}//match_some");//match_some println!("fn predict(parser:&mut Parser,index:usize,state_index:usize,token:usize) {{ match token {{"); let mut irule=1; for (i,token) in self.token_info.iter().enumerate() { if !token.is_terminal { println!("{} => {{",i+1); //println!("PRINT THE RULES OF TOKEN {}",token.id); for rule in token.rules.iter() { println!("parser.sets[index].predict(State{{rule: {} ,left: {} ,right:vec![ {} ],position:0,original_set:index,kind:EarleyKind::Predict(state_index),values:vec![Token::DummyStart; {} ],computed_value:Token::DummyStart}});",irule,i+1,rule.patterns.iter().map(|p|match p.as_ref() { &Token::Pat(PatKind::Path(ref path)) => match path.as_ref() { &Token::LitOrPath(ref string) => self.token_name_to_index.get(string).expect(&format!("string {} not found in map",string)).to_string(), _ => panic!(""), }, &Token::Pat(PatKind::Enum(ref name, _ )) => match name.as_ref() { &Token::PathExpr(ref string) => self.token_name_to_index.get(string).expect(&format!("string {} not found in map",string)).to_string(), _ => panic!(""), }, _ => panic!("received {:?}",p), }).collect::>().join(","),rule.patterns.len()); irule+=1; } println!("}}"); } } println!("_ => panic!(\"\"), }} }}//predict"); println!("fn compute_value(state:&mut State) {{ state.computed_value = match state.rule {{ 0 => state.values[0].clone(),"); //println!("GO THROUGH THE RULES"); let mut irule=1; for token in self.token_info.iter() { for rule in token.rules.iter() { println!("{} => match ({}) {{",irule,(0..rule.patterns.len()).map(|i| format!("&state.values[{}]",i) ).collect::>().join(",")); let pattern_string=rule.patterns.iter().map(|p|match p.as_ref() { &Token::Pat(PatKind::Path(ref path)) => match path.as_ref() { &Token::LitOrPath(ref string) => format!("&Token::{}",string), _ => panic!(""), }, &Token::Pat(PatKind::Enum(ref name, ref tuple)) => match (name.as_ref(),tuple.as_ref()) { (&Token::PathExpr(ref string),&Token::PatTup(ref v)) => format!("&Token::{}({})",string,v.iter().map(|x| format!("{}",x) ).collect::>().join(",")), _ => panic!("name={:?} tuple={:?}",name,tuple), }, _ => panic!("received {:?}",p), }).collect::>().join(","); if token.type_arguments.len()==0 { println!("({}) => Token::{},",pattern_string,token.id); } else { println!("({}) => Token::{}({}),",pattern_string,token.id,rule.expression); // We may need to do unpacking if >=2 // https://stackoverflow.com/questions/39878382/unpacking-tuples-into-arguments // https://github.com/rust-lang/rust/issues/17274 } println!("_ => panic!(\"\"), }},"); irule+=1; } } println!("_ => panic(\"\"), }} }}//compute_value"); println!("fn table_terminal(token_index:usize)->bool {{ match token_index {{"); println!("{} => true,",self.token_info.iter().enumerate().filter_map(|(i,t)|if t.is_terminal {Some((i+1).to_string())} else {None}).collect::>().join("|")); println!("0|{} => false,",self.token_info.iter().enumerate().filter_map(|(i,t)|if !t.is_terminal {Some((i+1).to_string())} else {None}).collect::>().join("|")); println!("_ => panic!(\"table_terminal\"), }} }}//table_terminal"); println!("fn table_priority(a:usize, b:usize) -> Option {{ match (a,b) {{"); //println!("HERE THE PRIORITIES"); let mut irule=1; for ltoken in self.token_info.iter() { for lrule in ltoken.rules.iter() { if let Some(ref lorder)=lrule.priority { let mut jrule=1; for rtoken in self.token_info.iter() { for rrule in rtoken.rules.iter() { if let Some(ref rorder)=rrule.priority { //(6,6) => Some(Ordering::Equal), println!("({},{}) => Some(Ordering::{:?}),",irule,jrule,self.ordering.get(&(lorder.clone(),rorder.clone())).expect("what?")); } jrule+=1; } } } irule+=1; } } println!("_ => None, }} }}//table_priority"); println!("fn table_associativity(rule:usize) -> Option {{ match rule {{"); println!("_ => None, }} }}//table_associativity"); println!("fn to_usize(token:&Token) -> usize {{ match token {{ &Token::DummyStart => 0,"); for (i,token) in self.token_info.iter().enumerate() { if token.type_arguments.len()==0 { println!("&Token::{} => {},",token.id,i+1); } else { println!("&Token::{}({}) => {},",token.id,(0..token.type_arguments.len()).map(|_|String::from("_")).collect::>().join(","),i+1); } } println!("}} }}//to_usize"); println!("}}//impl");//impl } } fn main() { let args: Vec = env::args().collect(); //println!("{:?}", args); if args.len()!=2 { println!("Use:\n\t{} filename",args[0]); return; } let mut f = File::open(&args[1]).expect("file cannot be opened"); let mut contents = String::new(); f.read_to_string(&mut contents).expect("something went wrong reading the file"); //println!("With text:\n{}", contents); match Parser::::parse(&contents,None) { Err(x) => println!("error parsing: {:?}",x), Ok(x) => { //println!("parsed correctly: {:?}",x); let mut compiler=Compiler{ source: &x, token_info: vec![], first_nonterminal: None, token_name_to_index: HashMap::new(), ordering: HashMap::new(), }; compiler.compile(); }, }; }