From 869e6da7796a71b7f861627e0fced2ee14da01ca Mon Sep 17 00:00:00 2001 From: mryouse Date: Fri, 22 Jul 2022 01:19:22 +0000 Subject: add support for init.neb --- neb.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'neb.py') diff --git a/neb.py b/neb.py index cd60cb8..d9b40ae 100644 --- a/neb.py +++ b/neb.py @@ -3,6 +3,7 @@ from neb import lex, parse, interpret, NebPanic, Environment, MultiFunction, Bui from neb.std import * import sys import readline +from pathlib import Path class NebCompleter: @@ -90,6 +91,19 @@ def repl(): readline.set_completer(cmp.complete) readline.set_completer_delims(" ()") + initfil = Path("~/.local/share/neb/init.neb").expanduser() + if initfil.exists(): + try: + lexed = lex(f'(use "{initfil}")') + parsed = parse(lexed) + ev = interpret(parsed, env) + except NebPanic as ne: + print(f"panic! {ne}") + return + except Exception as e: + print(f"exception! {type(e)} {e}") + return + print("### neb :)(:") print("version: < 0") idx = 1 -- cgit v1.2.3