]> hydra-www.ietfng.org Git - dyna2/commitdiff
fix crash report #67; color prompt #64
authorTim Vieira <tim.f.vieira@gmail.com>
Sat, 27 Jul 2013 14:08:21 +0000 (10:08 -0400)
committerTim Vieira <tim.f.vieira@gmail.com>
Sat, 27 Jul 2013 14:08:21 +0000 (10:08 -0400)
src/Dyna/Backend/Python/repl.py
src/Dyna/Backend/Python/utils.py

index 60cfde61b9c798a17cb596c9f22a11d771d045dd..2fa33a6ba1344a0c98388fa55c1bbc4541398dbb 100644 (file)
@@ -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)
index bfae7eaeb9c606052af8160d42ee0f89c6017366..1a299335bbf67d9fa51c2e094066b79f97e26519 100644 (file)
@@ -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)