Use colored in symbol table debug

This commit is contained in:
greg 2019-09-25 02:28:24 -07:00
parent 2e42313991
commit 58251d3f28
4 changed files with 8 additions and 4 deletions

1
Cargo.lock generated
View File

@ -728,6 +728,7 @@ dependencies = [
name = "schala-lang" name = "schala-lang"
version = "0.1.0" version = "0.1.0"
dependencies = [ 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)", "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)", "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)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -13,6 +13,7 @@ failure = "0.1.5"
ena = "0.11.0" ena = "0.11.0"
stopwatch = "0.0.7" stopwatch = "0.0.7"
derivative = "1.0.3" derivative = "1.0.3"
colored = "1.8"
schala-lang-codegen = { path = "../codegen" } schala-lang-codegen = { path = "../codegen" }
schala-repl = { path = "../../schala-repl" } schala-repl = { path = "../../schala-repl" }

View File

@ -17,6 +17,7 @@ extern crate schala_repl;
extern crate schala_lang_codegen; extern crate schala_lang_codegen;
extern crate ena; extern crate ena;
extern crate derivative; extern crate derivative;
extern crate colored;
macro_rules! bx { macro_rules! bx {

View File

@ -32,13 +32,14 @@ pub struct ScopeSegment {
impl fmt::Display for ScopeSegment { impl fmt::Display for ScopeSegment {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use colored::*;
use ScopeSegmentKind::*; use ScopeSegmentKind::*;
let kind = match self.kind { let kind = match self.kind {
Function => "fn", Function => "[fn]".green(),
Type => "ty", Type => "[ty]".red(),
Terminal => "tr", Terminal => "[tr]".blue(),
}; };
write!(f, "{}({})", self.name, kind) write!(f, "{}{}", self.name, kind)
} }
} }