示例#1
0
    def __call__(self, ast, M):
        self.emit('BEGIN '+self.__name__, ast, M)

        for P in self.passes:
            try:
                ast = P(ast, M)
            except:
                print
                print "ERROR during compilation in", P.__name__
                print S._indent(ast_to_string(ast))
                raise

            self.emit(P.__name__, ast, M)

        self.emit('END '+self.__name__, ast, M)
        return ast
示例#2
0
    def __call__(self, ast, M):
        self.emit('BEGIN ' + self.__name__, ast, M)

        for P in self.passes:
            try:
                ast = P(ast, M)
            except Exception as e:
                if isinstance(e, NotImplementedError):
                    raise e
                if not M.silence:
                    print
                    print "ERROR during compilation in", P.__name__
                    print S._indent(ast_to_string(ast))
                raise

            self.emit(P.__name__, ast, M)

        self.emit('END ' + self.__name__, ast, M)
        return ast
示例#3
0
    def __call__(self, ast, M):
        self.emit('BEGIN '+self.__name__, ast, M)

        for P in self.passes:
            try:
                ast = P(ast, M)
            except Exception as e:
                if isinstance(e, NotImplementedError):
                    raise e
                if not M.silence:
                    print
                    print "ERROR during compilation in", P.__name__
                    print S._indent(ast_to_string(ast))
                raise

            self.emit(P.__name__, ast, M)

        self.emit('END '+self.__name__, ast, M)
        return ast
示例#4
0
 def __str__(self):
     body = _indent(strlist(self.parameters[1], sep='\n', form=str))
     return 'while %s:\n%s' % (self.parameters[0], body)