grammar; use crate::path::GenericPath; use crate::path::GenericPathComponent; pub PathList: Vec = { => { Vec::new() }, COLON)*> => { left.push(right); left }, }; pub PathListAllowingEmptyPaths: Vec = { => vec![GenericPath { components: Vec::new(), starts_with_slash: false, ends_with_slash: false, }], PathNoColons => vec![<>], COLON => { left.push(GenericPath { components: Vec::new(), starts_with_slash: false, ends_with_slash: false, }); left }, COLON => { left.push(right); left }, } pub PathNoColons: GenericPath = { SLASH => GenericPath { components: Vec::new(), starts_with_slash: true, ends_with_slash: true, }, => GenericPath { components: <>, starts_with_slash: false, ends_with_slash: false, }, SLASH => GenericPath { components: <>, starts_with_slash: false, ends_with_slash: true, }, SLASH => GenericPath { components: <>, starts_with_slash: true, ends_with_slash: false, }, SLASH SLASH => GenericPath { components: <>, starts_with_slash: true, ends_with_slash: true, }, } PathNoColons2: Vec = { => vec![GenericPathComponent::FileOrDirectoryName(<>.to_string())], SLASH => { left.push(GenericPathComponent::FileOrDirectoryName(right.to_string())); left } } // Whitespace is not allowed. match { r"[^z:/]+" => PATH_COMPONENT_NO_COLONS, r"/" => SLASH, ":" => COLON, }