diff --git a/Cargo.lock b/Cargo.lock index 9e83d9c..86000f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -728,6 +728,7 @@ dependencies = [ name = "schala-lang" version = "0.1.0" dependencies = [ + "colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/schala-lang/language/Cargo.toml b/schala-lang/language/Cargo.toml index 7632789..0b64752 100644 --- a/schala-lang/language/Cargo.toml +++ b/schala-lang/language/Cargo.toml @@ -13,6 +13,7 @@ failure = "0.1.5" ena = "0.11.0" stopwatch = "0.0.7" derivative = "1.0.3" +colored = "1.8" schala-lang-codegen = { path = "../codegen" } schala-repl = { path = "../../schala-repl" } diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index af0e29f..159685f 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -17,6 +17,7 @@ extern crate schala_repl; extern crate schala_lang_codegen; extern crate ena; extern crate derivative; +extern crate colored; macro_rules! bx { diff --git a/schala-lang/language/src/symbol_table.rs b/schala-lang/language/src/symbol_table.rs index d4d13da..8876c9a 100644 --- a/schala-lang/language/src/symbol_table.rs +++ b/schala-lang/language/src/symbol_table.rs @@ -32,13 +32,14 @@ pub struct ScopeSegment { impl fmt::Display for ScopeSegment { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use colored::*; use ScopeSegmentKind::*; let kind = match self.kind { - Function => "fn", - Type => "ty", - Terminal => "tr", + Function => "[fn]".green(), + Type => "[ty]".red(), + Terminal => "[tr]".blue(), }; - write!(f, "{}({})", self.name, kind) + write!(f, "{}{}", self.name, kind) } }