use std::str::FromStr; use ast::{self, WithLocation}; grammar; pub Program: ast::Program = { Expression => ast::Program(<>), }; Expression: Box> = { Num => Box::new(<>.map(|v| ast::Expression::Number(v))), }; Num: WithLocation = > => e.map(|v| u64::from_str(v).unwrap()); Spanned: WithLocation = { => WithLocation::new(v, l, r) };