From 7be9acd0bb08901c9fdfa45b694b7d3d5a594e70 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Tue, 12 Mar 2024 21:54:28 -0700 Subject: remove a lot of stuff that was part of the shell and does not need to be part of the line input library Change-Id: Idd0435a4b29f5f525c9279e5c1d27916e6320685 --- src/path/parser.lalrpop | 92 ------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 src/path/parser.lalrpop (limited to 'src/path/parser.lalrpop') diff --git a/src/path/parser.lalrpop b/src/path/parser.lalrpop deleted file mode 100644 index c41b3fd..0000000 --- a/src/path/parser.lalrpop +++ /dev/null @@ -1,92 +0,0 @@ -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![<>], - SLASH => { - left.push(right); - left - } -} - -pub PathComponent: GenericPathComponent = { - DOT => GenericPathComponent::CurrentDirectory, - DOT_DOT => GenericPathComponent::ParentDirectory, - => - GenericPathComponent::FileOrDirectoryName(<>.to_string()) -} - -// Whitespace is not allowed. -match { - r"[^:/]+" => PATH_COMPONENT_NO_COLONS, - - r"/" => SLASH, - - ":" => COLON, - - "." => DOT, - - ".." => DOT_DOT, -} - -- cgit 1.4.1