Set *source* during init.

This commit is contained in:
Russ Olsen 2020-04-23 09:09:07 -04:00
parent f1bdf52b2b
commit 965f78f142

View file

@ -23,6 +23,7 @@ class Forth:
initial_defs = { initial_defs = {
'*prompt*': const_f('SallyForth>> '), '*prompt*': const_f('SallyForth>> '),
'macroexpand': w_enlist, 'macroexpand': w_enlist,
'*source*': const_f(__file__),
'true': const_f(True), 'true': const_f(True),
'false': const_f(False), 'false': const_f(False),
'nil': const_f(None), 'nil': const_f(None),
@ -149,6 +150,7 @@ class Forth:
return return
if token in self.namespace: if token in self.namespace:
# print("executing ", token)
self.namespace[token](self, 0) self.namespace[token](self, 0)
return return