summary refs log tree commit diff
path: root/src/path/parser.lalrpop
diff options
context:
space:
mode:
Diffstat (limited to 'src/path/parser.lalrpop')
-rw-r--r--src/path/parser.lalrpop92
1 files changed, 0 insertions, 92 deletions
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<GenericPath> = {
-  => {
-    Vec::new()
-  },
-  <mut left:(<PathNoColons> COLON)*> <right:PathNoColons> => {
-    left.push(right);
-    left
-  },
-};
-
-pub PathListAllowingEmptyPaths: Vec<GenericPath> = {
-  => vec![GenericPath {
-    components: Vec::new(),
-    starts_with_slash: false,
-    ends_with_slash: false,
-  }],
-  PathNoColons => vec![<>],
-  <mut left:PathListAllowingEmptyPaths> COLON => {
-    left.push(GenericPath {
-      components: Vec::new(),
-      starts_with_slash: false,
-      ends_with_slash: false,
-    });
-    left
-  },
-  <mut left:PathListAllowingEmptyPaths> COLON <right:PathNoColons> => {
-    left.push(right);
-    left
-  },
-}
-
-pub PathNoColons: GenericPath = {
-  SLASH => GenericPath {
-    components: Vec::new(),
-    starts_with_slash: true,
-    ends_with_slash: true,
-  },
-  <PathNoColons2> => GenericPath {
-    components: <>,
-    starts_with_slash: false,
-    ends_with_slash: false,
-  },
-  <PathNoColons2> SLASH => GenericPath {
-    components: <>,
-    starts_with_slash: false,
-    ends_with_slash: true,
-  },
-  SLASH <PathNoColons2> => GenericPath {
-    components: <>,
-    starts_with_slash: true,
-    ends_with_slash: false,
-  },
-  SLASH <PathNoColons2> SLASH => GenericPath {
-    components: <>,
-    starts_with_slash: true,
-    ends_with_slash: true,
-  },
-}
-
-PathNoColons2: Vec<GenericPathComponent> = {
-  <PathComponent> => vec![<>],
-  <mut left:PathNoColons2> SLASH <right:PathComponent> => {
-    left.push(right);
-    left
-  }
-}
-
-pub PathComponent: GenericPathComponent = {
-  DOT => GenericPathComponent::CurrentDirectory,
-  DOT_DOT => GenericPathComponent::ParentDirectory,
-  <PATH_COMPONENT_NO_COLONS> =>
-    GenericPathComponent::FileOrDirectoryName(<>.to_string())
-}
-
-// Whitespace is not allowed.
-match {
-  r"[^:/]+" => PATH_COMPONENT_NO_COLONS,
-
-  r"/" => SLASH,
-
-  ":" => COLON,
-
-  "." => DOT,
-
-  ".." => DOT_DOT,
-}
-