From 798c6ebf836dc4a7159c1f0f90a16b2f30655c0a Mon Sep 17 00:00:00 2001 From: Tim Vieira Date: Sat, 27 Jul 2013 10:08:21 -0400 Subject: [PATCH] fix crash report #67; color prompt #64 --- src/Dyna/Backend/Python/repl.py | 7 ++++--- src/Dyna/Backend/Python/utils.py | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Dyna/Backend/Python/repl.py b/src/Dyna/Backend/Python/repl.py index 60cfde6..2fa33a6 100644 --- a/src/Dyna/Backend/Python/repl.py +++ b/src/Dyna/Backend/Python/repl.py @@ -8,14 +8,14 @@ to help. """ import re, os, cmd, readline -from utils import ip, lexer, subst, drepr, _repr, get_module, yellow +from utils import ip, lexer, subst, drepr, _repr, get_module, yellow, \ + green, bold from stdlib import topython, todyna from errors import DynaCompilerError from config import dotdynadir from errors import show_traceback import load, post - from interpreter import Rule from contextlib import contextmanager @@ -43,7 +43,7 @@ class REPL(cmd.Cmd, object): @property def prompt(self): - return '> ' + return bold % green % '> ' def do_rules(self, _): """ @@ -263,6 +263,7 @@ class REPL(cmd.Cmd, object): print e print 'new rule(s) were not added to program.' print + return ([], {}) else: with self.error_tracker(): new_rules = self.interp.load_plan(src) diff --git a/src/Dyna/Backend/Python/utils.py b/src/Dyna/Backend/Python/utils.py index bfae7ea..1a29933 100644 --- a/src/Dyna/Backend/Python/utils.py +++ b/src/Dyna/Backend/Python/utils.py @@ -99,6 +99,7 @@ def get_module(cmd, sub): black, red, green, yellow, blue, magenta, cyan, white = \ map('\033[3%sm%%s\033[0m'.__mod__, range(8)) +bold = '\033[1m%s\033[0m' _comments = re.compile('%.*$', re.MULTILINE) -- 2.50.1