Esempio n. 1
0
 def compile(self, source, filepath, initial_lineno=1, symtable=None):
     if symtable is None:
         symtable = SymbolTable()
     astnode = self.parse(source, initial_lineno=initial_lineno, symtable=symtable)
     ctx = CompilerContext(self, "<main>", symtable, filepath)
     with ctx.set_lineno(initial_lineno):
         astnode.compile(ctx)
     return ctx.create_bytecode([], [], None, None)
Esempio n. 2
0
 def compile(self, source, filepath, initial_lineno=1, symtable=None):
     if symtable is None:
         symtable = SymbolTable()
     astnode = self.parse(source, initial_lineno=initial_lineno, symtable=symtable)
     ctx = CompilerContext(self, "<main>", symtable, filepath)
     with ctx.set_lineno(initial_lineno):
         astnode.compile(ctx)
     return ctx.create_bytecode([], [], None, None)
Esempio n. 3
0
 def compile(self, source, filepath, initial_lineno=1, symtable=None):
     if symtable is None:
         symtable = SymbolTable()
     astnode = self.parse(
         source, initial_lineno=initial_lineno, symtable=symtable)
     ctx = CompilerContext(self, "<main>", symtable, filepath)
     with ctx.set_lineno(initial_lineno):
         try:
             astnode.compile(ctx)
         except CompilerError as e:
             raise self.error(self.w_SyntaxError, "%s" % e.msg)
     return ctx.create_bytecode(initial_lineno, [], [], None, None)