# Path: esc/commands.py
# class EscBuiltin(EscCommand):
#     r"""
#     Mock class for built-in commands. Built-in :class:`EscCommand`\ s do not
#     actually get run and do anything -- they are special-cased because they
#     need access to internals normal commands cannot access. However, it's
#     still useful to have classes for them as stand-ins for things like
#     retrieving help.
# 
#     Unlike the other :class:`EscCommand`\ s, each :class:`EscBuiltin` has its
#     own subclass rather than its own instance, as they each need special
#     behaviors. The subclasses are defined in the
#     :mod:`builtin_stubs <esc.builtin_stubs>` module.
# 
#     Subclasses should override the docstring
#     and the :meth:`simulated_result` method.
# 
#     Subclasses should also define :attr:`key <esc.commands.EscCommand.key>`
#     and :attr:`description <esc.commands.EscCommand.description>`
#     as class variables. They'll be shadowed by instance variables once we
#     instantiate the class, but the values will be the same. That sounds dumb,
#     but it makes sense for all other classes in the hierarchy and doesn't
#     hurt us here. We don't want to define them in the ``__init__`` of each
#     subclass because then we have to instantiate every class to match on them
#     by key (see the reflective search in ``esc.helpme``).
#     """
#     def __init__(self):
#         super().__init__(self.key, self.description)
#         self.is_menu = False
# 
#     def execute(self, access_key, ss, registry):  # pylint: disable=useless-return
#         "Executing a builtin does nothing."
# 
#     def simulated_result(self, ss, registry):
#         "Reimplemented by each subclass."
#         raise NotImplementedError
# 
#     def test(self):
#         "Testing a builtin with esc's function test feature does nothing."
# 
#     @property
#     def signature_info(self):
#         "Constant string that describes the built-in as a built-in."
#         type_ = f"    Type: Built-in (performs special esc actions)"
#         return (type_,)


from .commands import EscBuiltin
    Remove an existing register from your registers list and destroy its value.
    """
    key = "X"
    description = "delete register"

    def simulated_result(self, ss, registry):
        if registry:
            return ("A register of your choice would be deleted.",)
        else:
            return ("You wouldn't be able to do anything useful.",
                    "(You don't have any registers to delete.)")


class Undo(EscBuiltin):
    """
    Undo the last change made to your stack. Registers are unaffected. (This
    is a feature, not a bug: a common esc workflow is to reach an answer,
    then realize you need to go back and do something else with those same
    numbers. Registers allow you to hold onto your answer while you do so.)
    """
    key = "u"
    description = "undo"

    def simulated_result(self, ss, registry):
        # Unfortunately, it's hard to imagine getting the necessary information
        # here to update dynamically on whether it's possible.
        return ("The last change made to your stack (if any)",
                "would be undone.",)



# Path: esc/commands.py
# class EscBuiltin(EscCommand):
#     r"""
#     Mock class for built-in commands. Built-in :class:`EscCommand`\ s do not
#     actually get run and do anything -- they are special-cased because they
#     need access to internals normal commands cannot access. However, it's
#     still useful to have classes for them as stand-ins for things like
#     retrieving help.
# 
#     Unlike the other :class:`EscCommand`\ s, each :class:`EscBuiltin` has its
#     own subclass rather than its own instance, as they each need special
#     behaviors. The subclasses are defined in the
#     :mod:`builtin_stubs <esc.builtin_stubs>` module.
# 
#     Subclasses should override the docstring
#     and the :meth:`simulated_result` method.
# 
#     Subclasses should also define :attr:`key <esc.commands.EscCommand.key>`
#     and :attr:`description <esc.commands.EscCommand.description>`
#     as class variables. They'll be shadowed by instance variables once we
#     instantiate the class, but the values will be the same. That sounds dumb,
#     but it makes sense for all other classes in the hierarchy and doesn't
#     hurt us here. We don't want to define them in the ``__init__`` of each
#     subclass because then we have to instantiate every class to match on them
#     by key (see the reflective search in ``esc.helpme``).
#     """
#     def __init__(self):
#         super().__init__(self.key, self.description)
#         self.is_menu = False
# 
#     def execute(self, access_key, ss, registry):  # pylint: disable=useless-return
#         "Executing a builtin does nothing."
# 
#     def simulated_result(self, ss, registry):
#         "Reimplemented by each subclass."
#         raise NotImplementedError
# 
#     def test(self):
#         "Testing a builtin with esc's function test feature does nothing."
# 
#     @property
#     def signature_info(self):
#         "Constant string that describes the built-in as a built-in."
#         type_ = f"    Type: Built-in (performs special esc actions)"
#         return (type_,)


# Path: esc/builtin_stubs.py
from .commands import EscBuiltin

    Remove an existing register from your registers list and destroy its value.
    """
    key = "X"
    description = "delete register"

    def simulated_result(self, ss, registry):
        if registry:
            return ("A register of your choice would be deleted.",)
        else:
            return ("You wouldn't be able to do anything useful.",
                    "(You don't have any registers to delete.)")


class Undo(EscBuiltin):
    """
    Undo the last change made to your stack. Registers are unaffected. (This
    is a feature, not a bug: a common esc workflow is to reach an answer,
    then realize you need to go back and do something else with those same
    numbers. Registers allow you to hold onto your answer while you do so.)
    """
    key = "u"
    description = "undo"

    def simulated_result(self, ss, registry):
        # Unfortunately, it's hard to imagine getting the necessary information
        # here to update dynamically on whether it's possible.
        return ("The last change made to your stack (if any)",
                "would be undone.",)



class Redo(EscBuiltin):