Initial Commit
Working base grammar, visitor, client, context. Good test coverage for grammar constructs.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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'] = []
|
||||
Reference in New Issue
Block a user