use std::str::FromStr; //use crate::lexer; use crate::Expr; use crate::Span; grammar; pub Expr: Expr = { "(" )+> ")" => Expr::List(Span(l, r), elems), "{" )> <()>)*> "}" => Expr::Table(Span(l, r), elems), => x, => x, => Expr::Str(Span(l, r), x), => Expr::Number(Span(l, r), x), Comment => Expr::Comment, }; Keyword: Expr = => Expr::Keyword(Span(l, r), x.to_string()); Symbol: Expr = /.*-+][^\s{}\(\)]*"> => Expr::Symbol(Span(l, r), x.to_string()); StrLit: String = { => { x[1..x.len() - 1].to_owned() }, } Comment: () = r";[^\n\r]*"; Num: i32 = => i32::from_str(<>).unwrap(); // vim:shiftwidth=4