From 0940e1f0bf8b9e499717b02cefe8c59601c21673 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Mon, 14 Dec 2020 20:14:11 -0800 Subject: path lists parse okay now --- src/path.lalrpop | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/path.lalrpop (limited to 'src/path.lalrpop') diff --git a/src/path.lalrpop b/src/path.lalrpop new file mode 100644 index 0000000..099b217 --- /dev/null +++ b/src/path.lalrpop @@ -0,0 +1,38 @@ +grammar; + +pub PathList: Vec<&'input str> = { + => { + Vec::new() + }, + COLON)*> => { + left.push(right); + left + }, +}; + +pub PathListAllowingEmptyPaths: Vec<&'input str> = { + => vec![""], + Path => vec![<>], + COLON => { + left.push(""); + left + }, + COLON => { + left.push(right); + left + }, +} + +pub Path: &'input str = { + , +} + +// Whitespace is not allowed. +match { + r"[^z:/]+" => PATH_COMPONENT, + + r"/" => SLASH, + + ":" => COLON, +} + -- cgit 1.4.1