예제 #1
0
    def __init__(self, debug=False, optimize=True, outputdir=None,
                 rewrite_tables=False):
        if debug:
            # Turn off optimization and caching to help debugging
            optimize = False
            outputdir = None
        if outputdir:
            # Need outputdir in path because lex imports the cached lex table
            # as a Python module
            sys.path.append(outputdir)

            if rewrite_tables:
                tablefile_root = os.path.join(outputdir, LEXTAB)
                # Also remove the .pyc/.pyo files, or they'll be used even if
                # the .py file doesn't exist.
                for ext in ('.py', '.pyc', '.pyo'):
                    try:
                        os.unlink(tablefile_root + ext)
                    except OSError:
                        pass

            lextab = LEXTAB
        else:
            lextab = None

        IDLLexer.__init__(self)
        # Optimized mode substantially decreases startup time (by disabling
        # error checking), and also allows use of Python's optimized mode.
        # See: Optimized Mode
        # http://www.dabeaz.com/ply/ply.html#ply_nn15
        self._lexobj = lex.lex(object=self,
                               debug=debug,
                               optimize=optimize,
                               lextab=lextab,
                               outputdir=outputdir)
예제 #2
0
    def __init__(self, debug=False, optimize=True, outputdir=None,
                 rewrite_tables=False):
        if debug:
            # Turn off optimization and caching to help debugging
            optimize = False
            outputdir = None
        if outputdir:
            # Need outputdir in path because lex imports the cached lex table
            # as a Python module
            sys.path.append(outputdir)

            if rewrite_tables:
                tablefile_root = os.path.join(outputdir, LEXTAB)
                # Also remove the .pyc/.pyo files, or they'll be used even if
                # the .py file doesn't exist.
                for ext in ('.py', '.pyc', '.pyo'):
                    try:
                        os.unlink(tablefile_root + ext)
                    except OSError:
                        pass

            lextab = LEXTAB
        else:
            lextab = None

        IDLLexer.__init__(self)
        # Optimized mode substantially decreases startup time (by disabling
        # error checking), and also allows use of Python's optimized mode.
        # See: Optimized Mode
        # http://www.dabeaz.com/ply/ply.html#ply_nn15
        self._lexobj = lex.lex(object=self,
                               debug=debug,
                               optimize=optimize,
                               lextab=lextab,
                               outputdir=outputdir)
    def __init__(self, debug=False, optimize=True, outputdir=None):
        if debug:
            # Turn off optimization and caching to help debugging
            optimize = False
            outputdir = None
        if outputdir:
            # Need outputdir in path because lex imports the cached lex table
            # as a Python module
            sys.path.append(outputdir)

        IDLLexer.__init__(self)
        # Overrides to parent class
        self._RemoveTokens(REMOVE_TOKENS)
        # Optimized mode substantially decreases startup time (by disabling
        # error checking), and also allows use of Python's optimized mode.
        # See: Optimized Mode
        # http://www.dabeaz.com/ply/ply.html#ply_nn15
        self._lexobj = lex.lex(object=self,
                               debug=debug,
                               optimize=optimize,
                               outputdir=outputdir)
예제 #4
0
    def __init__(self, debug=False, optimize=True, outputdir=None):
        if debug:
            # Turn off optimization and caching to help debugging
            optimize = False
            outputdir = None
        if outputdir:
            # Need outputdir in path because lex imports the cached lex table
            # as a Python module
            sys.path.append(outputdir)

        IDLLexer.__init__(self)
        # Overrides to parent class
        self._RemoveTokens(REMOVE_TOKENS)
        # Optimized mode substantially decreases startup time (by disabling
        # error checking), and also allows use of Python's optimized mode.
        # See: Optimized Mode
        # http://www.dabeaz.com/ply/ply.html#ply_nn15
        self._lexobj = lex.lex(object=self,
                               debug=debug,
                               optimize=optimize,
                               outputdir=outputdir)
예제 #5
0
 def __init__(self):
     IDLLexer.__init__(self)
     self._RemoveTokens(REMOVE_TOKENS)
예제 #6
0
 def __init__(self):
     IDLLexer.__init__(self)
     self._RemoveTokens(REMOVE_TOKENS)