Browse Source

chore: fix formatting

modules
Garrit Franke 3 years ago
parent
commit
40976e9dd9
  1. 6
      src/parser/node_type.rs
  2. 5
      src/parser/rules.rs

6
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<String, Option<Type>>;

5
src/parser/rules.rs

@ -151,20 +151,19 @@ impl Parser {
fn parse_import(&mut self) -> Result<String, String> {
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::<String>())
};
Ok(import_path)
}
fn parse_type(&mut self) -> Result<Type, String> {

Loading…
Cancel
Save