From a5b633a98d3d22fb7303af75898752308bef0d51 Mon Sep 17 00:00:00 2001 From: Natapat Samutpong Date: Fri, 11 Feb 2022 17:38:36 +0700 Subject: [PATCH] refactor: remove unused --- src/util.rs | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/util.rs diff --git a/src/util.rs b/src/util.rs deleted file mode 100644 index 5ff3433..0000000 --- a/src/util.rs +++ /dev/null @@ -1,49 +0,0 @@ -use crate::token::Expr::{self, List}; - -pub fn cover_paren(s: String) -> String { - format!("({})", s) -} - -pub fn unescape(s: String) -> String { - let mut result = String::new(); - let mut i = 0; - while i < s.len() { - if s.chars().nth(i).unwrap() == '\\' { - match s.chars().nth(i + 1).unwrap() { - 'n' => result.push('\n'), - 't' => result.push('\t'), - 'r' => result.push('\r'), - '\\' => result.push('\\'), - '"' => result.push('"'), - _ => result.push(s.chars().nth(i + 1).unwrap()), - } - i += 2; - } else { - result.push(s.chars().nth(i).unwrap()); - i += 1; - } - } - result -} - -pub fn unwrap_list_nest(ast: Expr) -> Vec { - let mut result: Vec = Vec::new(); - - match ast.clone() { - List(l, _) => { - for expr in l.iter() { - - result.push(expr.clone()); - - } - } - _ => { - // This probably will not happen because everything is wrapped - // in list. So it would be impossible that the ast is not a list. - eprintln!("Possibly a bug in the compiler, you shouln't get this messages."); - dbg!(ast); - } - }; - - result -} \ No newline at end of file