diff options
| author | mryouse | 2022-07-22 01:19:22 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-22 01:19:22 +0000 |
| commit | 869e6da7796a71b7f861627e0fced2ee14da01ca (patch) | |
| tree | 65c3171cc009909a56b1be6544c5e77562cf76f0 /neb.py | |
| parent | bff7f43c039eea0b247beedcfa53598b433dbe21 (diff) | |
add support for init.neb
Diffstat (limited to 'neb.py')
| -rw-r--r-- | neb.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |
