Commits

Anonymous committed 972b1a7

how_many() bug: reduce requirements

Comments (0)

Files changed (1)

pypeg2/__init__.py

     if grammar is None:
         return 0
 
+    elif type(grammar) == int:
+        return grammar
+
     elif _issubclass(grammar, Symbol) or isinstance(grammar, (RegEx, _RegEx)):
         return 1
 
 
     else:
         raise GrammarTypeError("grammar contains an illegal type: "
-                + type(grammar).__name__)
+                + type(grammar).__name__ + ": " + repr(grammar))
 
 
 def parse(text, thing, filename=None, whitespace=whitespace, comment=None):