# Path: py3kwarn2to3/pgen2/driver.py
# class Driver(object):
#     def __init__(self, grammar, convert=None, logger=None):
#     def parse_tokens(self, tokens, debug=False):
#     def parse_stream_raw(self, stream, debug=False):
#     def parse_stream(self, stream, debug=False):
#     def parse_file(self, filename, encoding=None, debug=False):
#     def parse_string(self, text, debug=False):
# def load_grammar(gt="Grammar.txt", gp=None,
#                  save=True, force=False, logger=None):
# def _newer(a, b):
# 
# Path: py3kwarn2to3/pgen2/literals.py
# def escape(m):
# def evalString(s):
# def test():
# 
# Path: py3kwarn2to3/pgen2/tokenize.py
# def tokenize(readline, tokeneater=printtoken):
#     """
#     The tokenize() function accepts two parameters: one representing the
#     input stream, and one providing an output mechanism for tokenize().
# 
#     The first parameter, readline, must be a callable object which provides
#     the same interface as the readline() method of built-in file objects.
#     Each call to the function should return one line of input as a string.
# 
#     The second parameter, tokeneater, must also be a callable object. It is
#     called once for each token, with five arguments, corresponding to the
#     tuples generated by generate_tokens().
#     """
#     try:
#         tokenize_loop(readline, tokeneater)
#     except StopTokenizing:
#         pass
# 
# Path: py3kwarn2to3/pgen2/grammar.py
# class Grammar(object):
#     def __init__(self):
#     def dump(self, filename):
#     def load(self, filename):
#     def copy(self):
#     def report(self):


import os
    from StringIO import StringIO
    from io import StringIO
from .pgen2 import driver, literals, token, tokenize, parse, grammar
from . import pytree
from . import pygram
            assert repeat.type == self.syms.Repeater
            children = repeat.children
            child = children[0]
            if child.type == token.STAR:
                min = 0
                max = pytree.HUGE
            elif child.type == token.PLUS:
                min = 1
                max = pytree.HUGE
            elif child.type == token.LBRACE:
                assert children[-1].type == token.RBRACE
                assert  len(children) in (3, 5)
                min = max = self.get_int(children[1])
                if len(children) == 5:
                    max = self.get_int(children[3])
            else:
                assert False
            if min != 1 or max != 1:
                pattern = pattern.optimize()
                pattern = pytree.WildcardPattern([[pattern]], min=min, max=max)

        if name is not None:
            pattern.name = name
        return pattern.optimize()

    def compile_basic(self, nodes, repeat=None):
        # Compile STRING | NAME [Details] | (...) | [...]
        assert len(nodes) >= 1
        node = nodes[0]
        if node.type == token.STRING:

# Path: py3kwarn2to3/pgen2/driver.py
# class Driver(object):
#     def __init__(self, grammar, convert=None, logger=None):
#     def parse_tokens(self, tokens, debug=False):
#     def parse_stream_raw(self, stream, debug=False):
#     def parse_stream(self, stream, debug=False):
#     def parse_file(self, filename, encoding=None, debug=False):
#     def parse_string(self, text, debug=False):
# def load_grammar(gt="Grammar.txt", gp=None,
#                  save=True, force=False, logger=None):
# def _newer(a, b):
# 
# Path: py3kwarn2to3/pgen2/literals.py
# def escape(m):
# def evalString(s):
# def test():
# 
# Path: py3kwarn2to3/pgen2/tokenize.py
# def tokenize(readline, tokeneater=printtoken):
#     """
#     The tokenize() function accepts two parameters: one representing the
#     input stream, and one providing an output mechanism for tokenize().
# 
#     The first parameter, readline, must be a callable object which provides
#     the same interface as the readline() method of built-in file objects.
#     Each call to the function should return one line of input as a string.
# 
#     The second parameter, tokeneater, must also be a callable object. It is
#     called once for each token, with five arguments, corresponding to the
#     tuples generated by generate_tokens().
#     """
#     try:
#         tokenize_loop(readline, tokeneater)
#     except StopTokenizing:
#         pass
# 
# Path: py3kwarn2to3/pgen2/grammar.py
# class Grammar(object):
#     def __init__(self):
#     def dump(self, filename):
#     def load(self, filename):
#     def copy(self):
#     def report(self):


# Path: py3kwarn2to3/patcomp.py
import os
    from StringIO import StringIO
    from io import StringIO
from .pgen2 import driver, literals, token, tokenize, parse, grammar
from . import pytree
from . import pygram

            assert repeat.type == self.syms.Repeater
            children = repeat.children
            child = children[0]
            if child.type == token.STAR:
                min = 0
                max = pytree.HUGE
            elif child.type == token.PLUS:
                min = 1
                max = pytree.HUGE
            elif child.type == token.LBRACE:
                assert children[-1].type == token.RBRACE
                assert  len(children) in (3, 5)
                min = max = self.get_int(children[1])
                if len(children) == 5:
                    max = self.get_int(children[3])
            else:
                assert False
            if min != 1 or max != 1:
                pattern = pattern.optimize()
                pattern = pytree.WildcardPattern([[pattern]], min=min, max=max)

        if name is not None:
            pattern.name = name
        return pattern.optimize()

    def compile_basic(self, nodes, repeat=None):
        # Compile STRING | NAME [Details] | (...) | [...]
        assert len(nodes) >= 1
        node = nodes[0]
        if node.type == token.STRING:

            value = unicode(literals.evalString(node.value))