summary refs log tree commit diff
path: root/src/path
diff options
context:
space:
mode:
Diffstat (limited to 'src/path')
-rw-r--r--src/path/parser.lalrpop18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/path/parser.lalrpop b/src/path/parser.lalrpop
index 0b3be9a..3547444 100644
--- a/src/path/parser.lalrpop
+++ b/src/path/parser.lalrpop
@@ -63,14 +63,20 @@ pub PathNoColons: GenericPath = {
 }
 
 PathNoColons2: Vec<GenericPathComponent> = {
-  <PATH_COMPONENT_NO_COLONS> =>
-      vec![GenericPathComponent::FileOrDirectoryName(<>.to_string())],
-  <mut left:PathNoColons2> SLASH <right:PATH_COMPONENT_NO_COLONS> => {
-    left.push(GenericPathComponent::FileOrDirectoryName(right.to_string()));
+  <PathComponent> => vec![<>],
+  <mut left:PathNoColons2> SLASH <right:PathComponent> => {
+    left.push(right);
     left
   }
 }
 
+PathComponent: GenericPathComponent = {
+  DOT => GenericPathComponent::CurrentDirectory,
+  DOT_DOT => GenericPathComponent::ParentDirectory,
+  <PATH_COMPONENT_NO_COLONS> =>
+    GenericPathComponent::FileOrDirectoryName(<>.to_string())
+}
+
 // Whitespace is not allowed.
 match {
   r"[^z:/]+" => PATH_COMPONENT_NO_COLONS,
@@ -78,5 +84,9 @@ match {
   r"/" => SLASH,
 
   ":" => COLON,
+
+  "." => DOT,
+
+  ".." => DOT_DOT,
 }