from thinglang.lexer.symbols.logic import LexicalEquality
from thinglang.parser.tokens import BaseToken


class Conditional(BaseToken):

    ADVANCE = False

    def __init__(self, slice):
        super(Conditional, self).__init__(slice)
        _, self.value = slice

    def describe(self):
        return 'if {}'.format(self.value)

    def evaluate(self, stack):
        return self.value.evaluate(stack)


class UnconditionalElse(BaseToken):
    pass


class ConditionalElse(Conditional):

    def __init__(self, slice):
        super(ConditionalElse, self).__init__(slice)
        _, self.conditional = slice

    def describe(self):
        return 'otherwise if {}'.format(self.value)

from thinglang.lexer.symbols.logic import LexicalEquality
from thinglang.parser.tokens import BaseToken


class Conditional(BaseToken):

    ADVANCE = False

    def __init__(self, slice):
        super(Conditional, self).__init__(slice)
        _, self.value = slice

    def describe(self):
        return 'if {}'.format(self.value)

    def evaluate(self, stack):
        return self.value.evaluate(stack)


class ElseBranchInterface(object):
    pass


class UnconditionalElse(BaseToken, ElseBranchInterface):
    pass


class ConditionalElse(Conditional, ElseBranchInterface):

    def __init__(self, slice):
        super(ConditionalElse, self).__init__(slice)
        _, self.conditional = slice

    def describe(self):
        return 'otherwise if {}'.format(self.value)

Update interface signatures for else branches
Update interface signatures for else branches

  from thinglang.lexer.symbols.logic import LexicalEquality
  from thinglang.parser.tokens import BaseToken
  
  
  class Conditional(BaseToken):
  
      ADVANCE = False
  
      def __init__(self, slice):
          super(Conditional, self).__init__(slice)
          _, self.value = slice
  
      def describe(self):
          return 'if {}'.format(self.value)
  
      def evaluate(self, stack):
          return self.value.evaluate(stack)
  
  
- class UnconditionalElse(BaseToken):
+ class ElseBranchInterface(object):
      pass
  
  
+ class UnconditionalElse(BaseToken, ElseBranchInterface):
+     pass
+ 
+ 
- class ConditionalElse(Conditional):
+ class ConditionalElse(Conditional, ElseBranchInterface):
  
      def __init__(self, slice):
          super(ConditionalElse, self).__init__(slice)
          _, self.conditional = slice
  
      def describe(self):
          return 'otherwise if {}'.format(self.value)
  
Update interface signatures for else branches
## Code Before:
from thinglang.lexer.symbols.logic import LexicalEquality
from thinglang.parser.tokens import BaseToken


class Conditional(BaseToken):

    ADVANCE = False

    def __init__(self, slice):
        super(Conditional, self).__init__(slice)
        _, self.value = slice

    def describe(self):
        return 'if {}'.format(self.value)

    def evaluate(self, stack):
        return self.value.evaluate(stack)


class UnconditionalElse(BaseToken):
    pass


class ConditionalElse(Conditional):

    def __init__(self, slice):
        super(ConditionalElse, self).__init__(slice)
        _, self.conditional = slice

    def describe(self):
        return 'otherwise if {}'.format(self.value)

## Instruction:
Update interface signatures for else branches
## Code After:
from thinglang.lexer.symbols.logic import LexicalEquality
from thinglang.parser.tokens import BaseToken


class Conditional(BaseToken):

    ADVANCE = False

    def __init__(self, slice):
        super(Conditional, self).__init__(slice)
        _, self.value = slice

    def describe(self):
        return 'if {}'.format(self.value)

    def evaluate(self, stack):
        return self.value.evaluate(stack)


class ElseBranchInterface(object):
    pass


class UnconditionalElse(BaseToken, ElseBranchInterface):
    pass


class ConditionalElse(Conditional, ElseBranchInterface):

    def __init__(self, slice):
        super(ConditionalElse, self).__init__(slice)
        _, self.conditional = slice

    def describe(self):
        return 'otherwise if {}'.format(self.value)
