本文整理汇总了Python中Interpreter.Interpreter.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Interpreter.parse方法的具体用法?Python Interpreter.parse怎么用?Python Interpreter.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interpreter.Interpreter
的用法示例。
在下文中一共展示了Interpreter.parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseinfo
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import parse [as 别名]
def parseinfo(self,e):
keycode = e.GetKeyCode()
if keycode == wx.WXK_RETURN or keycode == wx.WXK_NUMPAD_ENTER or keycode == wx.WXK_TAB:
if self.editname.GetValue() == "exit" or self.editname.GetValue() == "exit;":
exit(0)
else:
z = Interpreter()
#thread.start_new_thread(z.parse(self.editname.GetValue()))
z.parse(self.editname.GetValue())
e.EventObject.Navigate()
e.Skip()
示例2: Lex
# 需要导入模块: from Interpreter import Interpreter [as 别名]
# 或者: from Interpreter.Interpreter import parse [as 别名]
# don't care about encoding right now
if ( dostdin ):
## interactive interpreter
lexer = Lex( )
parse_eval = Interpreter( lexer, debug, safe_mode,update,stacksize )
REPL( lang, lexer, parse_eval, debug )
else:
## evaluate a files sequentially
exitcode = 0
for files in fname:
## evaluate a file
lexer = Lex(files)
if ( debug ): lexer.dump_tokens()
parse_eval = Interpreter( lexer, debug, safe_mode, update, stacksize )
try:
parse_eval.parse()
except Exception as e:
print(u"parsing the code '%s' failed with exception:\n\t %s"%(files,str(e)))
if ( debug ): print("*"*60); print(str(parse_eval))
exitcode = 255
try:
env = parse_eval.evaluate()
except Exception as e:
print(u"evaluating the code '%s' failed with exception:\n\t %s"%(files,str(e)))
if debug: print("*"*60); print(str(e))
exitcode = 255
sys.exit(exitcode)
pass