// vim: ft=rust use ast::*; use path_lexer::{self, PathToken}; use std::borrow::Cow; grammar<'input>(); pub Path: PathSpec<'input> = { "/" => PathSpec { steps: vec![], }, => PathSpec { steps: steps, }, }; Step: PathStep<'input> = "/" => PathStep { parts: parts, }; Part: PathPart<'input> = { "{" "}" => PathPart::Variable(variable), => PathPart::Segment(segment), }; extern { type Location = usize; type Error = path_lexer::Error; enum PathToken<'input> { "/" => PathToken::Slash, "{" => PathToken::LeftCurly, "}" => PathToken::RightCurly, ident => PathToken::Identifier(>), segment => PathToken::Segment(), } }