Module refinery.lib.scripts.xlm.handlers
The handler table of the emulator: one handler per macro command the interpreter answers, drawn from the per-category registries, with the guarantee that every name it holds is a command the registry knows, and the table of the commands an expression reads by a handler of its own.
Expand source code Browse git
"""
The handler table of the emulator: one handler per macro command the interpreter answers, drawn
from the per-category registries, with the guarantee that every name it holds is a command the
registry knows, and the table of the commands an expression reads by a handler of its own.
"""
from __future__ import annotations
from refinery.lib.scripts.xlm.commands import XLM_COMMANDS
from refinery.lib.scripts.xlm.handlers.control import CONTROL_HANDLERS, EXPRESSION_HANDLERS
from refinery.lib.scripts.xlm.handlers.functions import FUNCTION_HANDLERS
from refinery.lib.scripts.xlm.handlers.lookups import LOOKUP_HANDLERS
from refinery.lib.scripts.xlm.handlers.mutate import MUTATION_HANDLERS
from refinery.lib.scripts.xlm.handlers.strings import STRING_HANDLERS
from refinery.lib.scripts.xlm.handlers.system import SYSTEM_HANDLERS
HANDLERS = {
**CONTROL_HANDLERS,
**FUNCTION_HANDLERS,
**STRING_HANDLERS,
**LOOKUP_HANDLERS,
**MUTATION_HANDLERS,
**SYSTEM_HANDLERS,
}
_UNREGISTERED = (set(HANDLERS) | set(EXPRESSION_HANDLERS)) - set(XLM_COMMANDS)
assert not _UNREGISTERED, F'handlers without a command registry entry: {sorted(_UNREGISTERED)}'
Sub-modules
refinery.lib.scripts.xlm.handlers.control-
The control-flow commands of the macro language: the jumps that move execution between cells, the branches of
IF, the blocks its one-argument form … refinery.lib.scripts.xlm.handlers.functions-
The numeric and logic commands of the macro language: the arithmetic of numbers, the truth of conditions, the counting of arguments, and the Roman …
refinery.lib.scripts.xlm.handlers.lookups-
The lookup commands of the macro language: the addresses they compose, the cells they name, and the ranges they count and search.
refinery.lib.scripts.xlm.handlers.mutate-
The mutation commands of the macro language: the formulas the program writes into cells, the names it defines, and the selection it moves through the …
refinery.lib.scripts.xlm.handlers.strings-
The text commands of the macro language: the characters, lengths, slices, and searches of the strings the macro program assembles.
refinery.lib.scripts.xlm.handlers.system-
The system commands of the macro language: the external calls the program makes, the files it opens and writes, the environment answers its questions …