From: Tim Vieira Date: Sat, 27 Jul 2013 14:08:21 +0000 (-0400) Subject: fix crash report #67; color prompt #64 X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=798c6ebf836dc4a7159c1f0f90a16b2f30655c0a;p=dyna2 fix crash report #67; color prompt #64 --- 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)