Files
lilac-customcmd-plugin/customcmd/context.py
T
conatum 19da69b3e8 Initial Commit
Working base grammar, visitor, client, context.
Good test coverage for grammar constructs.
2026-05-30 04:57:04 +10:00

25 lines
693 B
Python

from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from .terms import ExecutorTerm
class ExecContext:
"""
Base context class that carries the instantiation state.
This is passed to all CommandTerms upon execution.
"""
def __init__(self, *, alias: str, args: list[str], content: str, **kwargs):
self.alias = alias
self.args = args
self.content = content
# Dictionary of local variables for the command context.
# Useful if the Terms need to share state
self.scope: dict[str, Any] = {}
# Stack of terms that are *currently* executing with this context.
self.termstack: list['ExecutorTerm'] = []