Use colored in symbol table debug
This commit is contained in:
parent
2e42313991
commit
58251d3f28
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -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)",
|
||||
|
@ -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" }
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user