Example #1
0
class ZeroOrMore(ComposedDFA):
  def __init__(self, machine):
    self.machine = OneOrMore(machine)
    super(ZeroOrMore, self).__init__()

  def is_final(self):
    return len(self.lexeme) == 0 or self.machine.is_final()

  def clone(self):
    return ZeroOrMore(self.machine.clone())
Example #2
0
 def __init__(self, machine):
   self.machine = OneOrMore(machine)
   super(ZeroOrMore, self).__init__()