Commits

Anonymous committed 0e29a57

Incorporate latest version of rooibos.

Comments (0)

Files changed (1)

src/eightebed/rooibos.py

 
 """
 Rooibos, a parser combinator module for Python.
+
+Written by Chris Pressey of Cat's Eye Technologies.
+This work is hereby placed in the public domain.
 """
 
 import re
         has_match = True
         while has_match:
             has_match = False
+            has_ignore = True
 
-            has_ignore = True
             while has_ignore:
                 has_ignore = False
                 for pattern in self.ignoring:
                     self.text = self.text[result.end():]
                     has_match = True
                     break
+
             if has_match:
                 if meta is not None:
                     yield meta, result.group()
             yield x
 
     def __repr__(self):
-        return "PredicateSet(%s)" % repr(self._set)
+        return "PredicateSet(%r)" % self._set
 
 
 ### Productions ###
     """Container for a set of named productions.
 
     >>> g = Grammar()
-    >>> g['Expr'] = Sequence(Terminal('('),Asteration(Terminal('*')),
-    ...                      Terminal(')'))
+    >>> g['Expr'] = Sequence(
+    ...   Terminal('('),Asteration(Terminal('*')),Terminal(')'))
     >>> g.parse('Expr', Stream(['(','*','*',')']))
     ['(', ['*', '*'], ')']
-    >>> g['Expr'] = Sequence(Terminal('('),Asteration(NonTerminal('Expr')),
-    ...                      Terminal(')'))
+    >>> g['Expr'] = Sequence(
+    ...   Terminal('('),Asteration(NonTerminal('Expr')),Terminal(')'))
     >>> g.parse('Expr', Stream(['(',')']))
     ['(', [], ')']
     >>> s = Stream(['(','(',')',')'])
         elif self.parent:
             return self.parent[key]
         else:
-            raise KeyError("No production '%s' in grammar, "
-                           "and no parent grammar" % key)
+            raise KeyError("No production '%s' in grammar, and "
+                           "no parent grammar" % key)
 
     def __setitem__(self, key, value):
         self.productions[key] = value