from collections import defaultdict
from argparse import ArgumentParser
+from hashlib import sha1
+
import debug
from chart import Chart, Term, _repr
from defn import aggregator
raises ``DynaCompilerError``
"""
+ x = sha1()
+ x.update(self.parser_state)
+ x.update(code)
+
+ dyna = dotdynadir / 'tmp' / ('%s.dyna' % x.hexdigest())
+
+ # make necessary directories
+ dyna.dirname().mkdir_p()
- dyna = dotdynadir / 'tmp.dyna'
out = '%s.plan.py' % dyna
with file(dyna, 'wb') as f:
with file(hist, 'wb') as f:
f.write('')
readline.read_history_file(hist)
- self.do_trace('off')
self.lineno = 0
@property
def do_ip(self, _):
ip()
- def do_trace(self, args):
- if args == 'on':
- self.interp.trace = sys.stdout
- elif args == 'off':
- self.interp.trace = file(os.devnull, 'w')
- else:
- print 'Did not understand argument %r please use (on or off).' % args
-
def do_debug(self, line):
- with file(dotdynadir / 'tmp.dyna', 'wb') as f:
+ with file(dotdynadir / 'repl-debug-line.dyna', 'wb') as f:
f.write(line)
debug.main(f.name)
:- :- =============
a := 1
-:- AggregatorConflict: Aggregator conflict 'a/0' was '+=' trying to set to '|='.
+:- DynaCompilerError:
+FATAL: Encountered error in input program:
+ Conflicting aggregators; rule /home/timv/.dyna/tmp/966093dc38b755a6f17b02774b5c656931163a3a.dyna:5:1-/home/timv/.dyna/tmp/966093dc38b755a6f17b02774b5c656931163a3a.dyna:5:3
+ uses '|=' for a/0 but I had been lead to expect '+='.
+
> new rule(s) were not added to program.
:- exit
:- =============
a := 2
-:- 0:
- 1: a += 1.
+:- 0: a += 1.
+ 1: b += 1.
2: a += 1.
:-
Charts