Load defs from files into dictionary.

This commit is contained in:
Simon Forman
2021-11-24 22:01:09 -08:00
parent 31cd926ab4
commit aa0b01fdcc
2 changed files with 14 additions and 2 deletions
+8
View File
@@ -323,6 +323,14 @@ class Def(DefinitionWrapper):
self.__doc__ = expression_to_string(body)
self._compiled = None
@classmethod
def load_definitions(class_, stream, dictionary):
for line in stream:
if line.lstrip().startswith('#'):
continue
name, body = text_to_expression(line)
inscribe(class_(name, body), dictionary)
def _text_to_defs(text):
return (