Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion parsetron/parsetron.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import copy
from collections import deque
from collections import Counter
from past.types import unicode, basestring
from past.builtins import xrange

__doc__ = \
"""
Expand Down Expand Up @@ -88,7 +90,7 @@ def __new__(typ, name, bases, dct):
return super(MetaGrammar, typ).__new__(typ, name, bases, dct)


class Grammar(object):
class Grammar(object, metaclass=MetaGrammar):
"""
Grammar user interface. Users should inherit this grammar and define a
final grammar GOAL as class variable.
Expand All @@ -114,8 +116,10 @@ class Grammar(object):
__metaclass__ = MetaGrammar

def __new__(cls):
print(cls.__dict__['_grammar_'])
return cls.__dict__['_grammar_']


@staticmethod
def test():
"""
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ tox
virtualenv
coveralls
sphinx_rtd_theme
future