~washort/parsley/new-codegen

« back to all changes in this revision

Viewing changes to ometa/runtime.py

  • Committer: Allen Short
  • Date: 2013-02-23 06:57:10 UTC
  • Revision ID: washort42@gmail.com-20130223065710-7mzf6y572l3x0g5z
unify grammar loading

Show diffs side-by-side

added added

removed removed

Lines of Context:
770
770
    tree = False
771
771
 
772
772
    @classmethod
773
 
    def makeGrammar(cls, grammar, globals, name='Grammar', superclass=None):
 
773
    def makeGrammar(cls, grammar, name='Grammar'):
774
774
        """
775
775
        Define a new parser class with the rules in the given grammar.
776
776
 
777
777
        @param grammar: A string containing a PyMeta grammar.
778
 
        @param globals: A dict of names that should be accessible by this
779
 
        grammar.
780
778
        @param name: The name of the class to be generated.
781
779
        @param superclass: The class the generated class is a child of.
782
780
        """
796
794
        source = writePython(tree)
797
795
        if TIMING:
798
796
            print "Grammar %r generated in %g secs" % (name, time.time() - start)
799
 
        return moduleFromGrammar(source, name, superclass or OMetaBase, globals,
800
 
                                 modname, filename)
 
797
        return moduleFromGrammar(source, name, modname, filename)
801
798
 
802
799
 
803
800
    def __init__(self, grammar, *a, **kw):