# Path: commands/core.py
# class Resolvable(metaclass=abc.ABCMeta):
# 
#     @abc.abstractmethod
#     def resolve(self, scope):
#         pass
# 
# class Command(Resolvable):
#     pass
# 
# class EntityRef(Resolvable, metaclass=abc.ABCMeta):
# 
#     @abc.abstractmethod
#     def is_single_entity(self, scope):
#         pass
# 
#     @property
#     def ref(self):
#         from .nbt import EntityReference
#         return EntityReference(self)
# 
# class WorldPos(Resolvable):
# 
#     def __init__(self, x, y, z, block_pos=False):
#         is_anchor = self._check_coord(x, True, not block_pos)
#         was_anchor = self._check_coord(y, is_anchor, not block_pos)
#         is_anchor = self._check_coord(z, was_anchor, not block_pos)
#         if was_anchor:
#             assert is_anchor
#         self.x, self.y, self.z = x, y, z
#         self.block_pos = block_pos
# 
#     def _check_coord(self, val, allow_anchor, allow_float):
#         if isinstance(val, AnchorRelCoord):
#             assert allow_anchor
#             return True
#         if type(val) == float:
#             assert allow_float
#             return False
#         if type(val) == int:
#             return False
#         if isinstance(val, WorldRelCoord):
#             return False
#         assert False, val
# 
#     @property
#     def ref(self):
#         from .nbt import BlockReference
#         return BlockReference(self)
# 
#     def resolve(self, scope):
#         return '%s %s %s' % (self.x, self.y, self.z)


from .core import Resolvable, Command, EntityRef, WorldPos
        return Path(self.path).subpath(childpath)

class ArrayPath(SubPath):

    def __init__(self, index=None, key=None):
        super().__init__('[%d]' % index if index is not None else None, key)
        self.index = index

class StackPath(ArrayPath):
    name = 'stack'

def StackFrame(index):
    class StackFramePath(ArrayPath):
        name = 'stack[%d].stack' % (-index - 1)
    return StackFramePath

StackFrameHead = StackFrame(0)

class GlobalPath(SubPath):
    name = 'global'

    def __init__(self, name=None, key=None):
        super().__init__('.' + name if name is not None else None, key)

class NBTStorable(Resolvable):
    pass

class EntityReference(NBTStorable):

    def __init__(self, target):

# Path: commands/core.py
# class Resolvable(metaclass=abc.ABCMeta):
# 
#     @abc.abstractmethod
#     def resolve(self, scope):
#         pass
# 
# class Command(Resolvable):
#     pass
# 
# class EntityRef(Resolvable, metaclass=abc.ABCMeta):
# 
#     @abc.abstractmethod
#     def is_single_entity(self, scope):
#         pass
# 
#     @property
#     def ref(self):
#         from .nbt import EntityReference
#         return EntityReference(self)
# 
# class WorldPos(Resolvable):
# 
#     def __init__(self, x, y, z, block_pos=False):
#         is_anchor = self._check_coord(x, True, not block_pos)
#         was_anchor = self._check_coord(y, is_anchor, not block_pos)
#         is_anchor = self._check_coord(z, was_anchor, not block_pos)
#         if was_anchor:
#             assert is_anchor
#         self.x, self.y, self.z = x, y, z
#         self.block_pos = block_pos
# 
#     def _check_coord(self, val, allow_anchor, allow_float):
#         if isinstance(val, AnchorRelCoord):
#             assert allow_anchor
#             return True
#         if type(val) == float:
#             assert allow_float
#             return False
#         if type(val) == int:
#             return False
#         if isinstance(val, WorldRelCoord):
#             return False
#         assert False, val
# 
#     @property
#     def ref(self):
#         from .nbt import BlockReference
#         return BlockReference(self)
# 
#     def resolve(self, scope):
#         return '%s %s %s' % (self.x, self.y, self.z)


# Path: commands/nbt.py
from .core import Resolvable, Command, EntityRef, WorldPos

        return Path(self.path).subpath(childpath)

class ArrayPath(SubPath):

    def __init__(self, index=None, key=None):
        super().__init__('[%d]' % index if index is not None else None, key)
        self.index = index

class StackPath(ArrayPath):
    name = 'stack'

def StackFrame(index):
    class StackFramePath(ArrayPath):
        name = 'stack[%d].stack' % (-index - 1)
    return StackFramePath

StackFrameHead = StackFrame(0)

class GlobalPath(SubPath):
    name = 'global'

    def __init__(self, name=None, key=None):
        super().__init__('.' + name if name is not None else None, key)

class NBTStorable(Resolvable):
    pass

class EntityReference(NBTStorable):

    def __init__(self, target):

        assert isinstance(target, EntityRef)