From f37ab80163c3f8ed44b72e9a4cc3694e90182a44 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 23 Jan 2017 19:51:27 -0800 Subject: [PATCH] Fix tests --- src/language.rs | 2 ++ src/schala_lang/parser.rs | 11 +++++++---- src/schala_lang/tokenizer.rs | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/language.rs b/src/language.rs index 9f2cdbc..92148e6 100644 --- a/src/language.rs +++ b/src/language.rs @@ -1,5 +1,6 @@ use std::fmt::Debug; +#[derive(Debug)] pub struct TokenError { pub msg: String, } @@ -10,6 +11,7 @@ impl TokenError { } } +#[derive(Debug)] pub struct ParseError { pub msg: String, } diff --git a/src/schala_lang/parser.rs b/src/schala_lang/parser.rs index 7935200..789c782 100644 --- a/src/schala_lang/parser.rs +++ b/src/schala_lang/parser.rs @@ -1,6 +1,9 @@ -use std::fmt; + use schala_lang::tokenizer::{Token, Kw, OpTok}; use schala_lang::tokenizer::Token::*; +use language::ProgrammingLanguage; + +use std::fmt; use std::collections::VecDeque; use std::rc::Rc; use std::convert::From; @@ -551,7 +554,7 @@ pub fn parse(tokens: &[Token], _parsed_tree: &[Statement]) -> ParseResult { #[cfg(test)] mod tests { - use tokenizer; + use schala_lang::tokenizer; use super::*; use super::Statement::*; use super::Expression::*; @@ -610,7 +613,7 @@ mod tests { #[test] fn lambda_parse_test() { - use tokenizer; + use schala_lang::tokenizer; let t1 = "(fn(x) { x + 2 })"; let tokens1 = tokenizer::tokenize(t1).unwrap(); match parse(&tokens1, &[]).unwrap()[..] { @@ -624,7 +627,7 @@ mod tests { #[test] fn conditional_parse_test() { - use tokenizer; + use schala_lang::tokenizer; let t1 = "if null { 20 } else { 40 }"; let tokens = tokenizer::tokenize(t1).unwrap(); match parse(&tokens, &[]).unwrap()[..] { diff --git a/src/schala_lang/tokenizer.rs b/src/schala_lang/tokenizer.rs index a1a9235..d775c95 100644 --- a/src/schala_lang/tokenizer.rs +++ b/src/schala_lang/tokenizer.rs @@ -5,7 +5,7 @@ use std::str::Chars; use self::itertools::Itertools; use std::rc::Rc; -use language::TokenError; +use language::{TokenError, ProgrammingLanguage}; #[derive(Debug, Clone, PartialEq)] pub enum Token {