From f5ec40b8fbbe7d4409d94dafcbfcdd41b8a6202b Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Fri, 25 Dec 2020 16:31:48 -0800 Subject: got the path stuff parsing just right --- src/main.rs | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index d499ad9..2a5234f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,3 @@ -pub mod error; - use error::Error; use std::io; use std::io::prelude::*; @@ -7,29 +5,17 @@ use std::io::prelude::*; #[macro_use] extern crate lalrpop_util; lalrpop_mod!(pub commandline); -lalrpop_mod!(pub path); +pub mod error; +pub mod path; pub type Result = std::result::Result; - pub enum Input { String(String), End, } -pub struct GenericPath { - absolute: bool, - directory: bool, - components: Vec, -} - -pub enum GenericPathComponent { - CurrentDirectory, - ParentDirectory, - Entry(String), -} - fn main() -> Result<()> { std::process::exit(match repl() { @@ -87,12 +73,12 @@ fn execute(input: &str) -> Result<()> { match invocation.as_slice() { ["paths", path_list, ..] => { println!("{:?}", path_list); - match path::PathListParser::new().parse(path_list) { + match path::parser::PathListParser::new().parse(path_list) { Ok(parsed_paths) => { println!("paths '{:?}'", parsed_paths); }, Err(_) => { - match path::PathListAllowingEmptyPathsParser::new() + match path::parser::PathListAllowingEmptyPathsParser::new() .parse(path_list) { Ok(parsed) => { -- cgit 1.4.1