X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/d1b1c8d9119229dbeed06cd252917e54a1cb77f6..1025235c72c31f7fa7b648c0e32ddcaa68a8f66a:/lunaix-os/scripts/build-tools/lcfg/builtins.py diff --git a/lunaix-os/scripts/build-tools/lcfg/builtins.py b/lunaix-os/scripts/build-tools/lcfg/builtins.py new file mode 100644 index 0000000..9eb616f --- /dev/null +++ b/lunaix-os/scripts/build-tools/lcfg/builtins.py @@ -0,0 +1,32 @@ +from .api import contextual, builtin +from .lcnodes import LCFuncNode, LCTermNode, LCModuleNode +from lib.utils import join_path +import os + +@contextual() +def v(env, caller, term): + node = env.lookup_node(term.__name__) + env.dependency().add(node, caller) + + return env.lookup_value(node.get_name()) + +@contextual(caller_type=[LCModuleNode]) +def include(env, caller, file): + fobj = caller.get_fo() + path = os.path.dirname(fobj.filename()) + + env.resolve_module(join_path(path, file)) + +@contextual("type", caller_type=[LCTermNode]) +def term_type(env, caller, type): + caller.set_type(type) + +@contextual("add_to_collection", caller_type=[LCFuncNode]) +def parent(env, caller, ref): + sym = env.lookup_node(ref.__name__) + + caller.set_parent(sym) + +@contextual(caller_type=[LCTermNode]) +def default(env, caller, val): + caller.set_default(val) \ No newline at end of file