本文整理汇总了Python中Interpreter.Interpreter.start方法的典型用法代码示例。如果您正苦于以下问题:Python Interpreter.start方法的具体用法?Python Interpreter.start怎么用?Python Interpreter.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interpreter.Interpreter
的用法示例。
在下文中一共展示了Interpreter.start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import start [as 别名]
def parse(self):
instructions = self._program()
# do not print any output if error occurs
if self.total_error_flag == 0:
if self.print_symbol_table == 0:
self.observer.print_output()
elif self.print_symbol_table == 1:
self.visitor.visitScope(self.program_scope)
self.visitor.end()
elif self.print_symbol_table == 2:
currinstruction = instructions
self.visitor.start()
# while(currinstruction is not None):
currinstruction.visit(self.visitor)
# currinstruction = currinstruction._next
elif self.print_symbol_table == 3:
environment = self.program_scope.make_environment()
stack = []
currinstruction = instructions
# while curr is not None:
# self.interpret(curr, environment, stack)
# curr = curr._next
# v = InterpreterVisitor(environment)
# v.start()
# currinstruction.int_visit(v)
v = Interpreter(currinstruction, environment)
v.start()
示例2: create_dev
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import start [as 别名]
def create_dev(ip):
dev = Router(ip, username, password, cmd_file, rdeb)
if dev.err:
print "Skipping device %s\n" %ip
return
#all input values are correct
#create Interpreter
i = Interpreter(dev, ideb, ideb)
i.start()
if ideb:
#print last debug info
print "Oper_st: %s" %i.oper_st
print "Data_st: %s" %i.data_st
print "Env: %s" %i.env
示例3: len
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import start [as 别名]
#strip leading spaces
cmd = self.cmds.pop(0)
cmd = cmd.lstrip()
#skip comments
while cmd.startswith('#'):
if len(self.cmds) == 0:
print "Done with device \n"
return False
cmd = self.cmds.pop(0).lstrip()
return cmd
#end of Dummy class
#instantiate Dummy
r = Dummy()
#instantiate Interpreter and set debug
i = Interpreter(r, debug = True, verb = verbose)
i.start()
print "Oper_st: %s" %i.oper_st
print "Data_st: %s" %i.data_st
#print env after last command if required
if verbose: print "Env: %s" %i.env
#work is done end
sys.exit()
else : #wrong command
print "Usage: Rtrcfg -d =>for Router debug or Rtrcfg -d|-dd cmd_file =>for Interpreter debug"; sys.exit()
#list with device ips
ip_list = []
#get ips
ip_file = raw_input("Enter IP file or an IP: ")