diff --git a/src/parser/node_type.rs b/src/parser/node_type.rs index 5cb8aeb..4347ce2 100644 --- a/src/parser/node_type.rs +++ b/src/parser/node_type.rs @@ -1,3 +1,6 @@ +use crate::lexer::*; +use core::convert::TryFrom; +use std::collections::HashMap; /** * Copyright 2020 Garrit Franke * @@ -14,9 +17,6 @@ * limitations under the License. */ use std::collections::HashSet; -use crate::lexer::*; -use core::convert::TryFrom; -use std::collections::HashMap; /// Table that contains all symbol and its types pub type SymbolTable = HashMap>; diff --git a/src/parser/rules.rs b/src/parser/rules.rs index 5db1704..ecc2f99 100644 --- a/src/parser/rules.rs +++ b/src/parser/rules.rs @@ -151,20 +151,19 @@ impl Parser { fn parse_import(&mut self) -> Result { self.match_keyword(Keyword::Import)?; let import_path_token = self.match_token(TokenKind::Literal(Value::Str))?; - + // Remove leading and trailing string tokens let mut chars = import_path_token.raw.chars(); chars.next(); chars.next_back(); let import_path = if chars.as_str().ends_with(".sb") { - chars.collect() + chars.collect() } else { format!("{}.sb", chars.collect::()) }; Ok(import_path) - } fn parse_type(&mut self) -> Result {