本文整理汇总了Python中env.Env.freshOld方法的典型用法代码示例。如果您正苦于以下问题:Python Env.freshOld方法的具体用法?Python Env.freshOld怎么用?Python Env.freshOld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类env.Env
的用法示例。
在下文中一共展示了Env.freshOld方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkJudge
# 需要导入模块: from env import Env [as 别名]
# 或者: from env.Env import freshOld [as 别名]
def checkJudge(self, name):
pTree = self.world.judgeTrees[name][0]
judge = JudgeDef(pTree)
judge.name = pTree.val
judge.envs = map(lambda x: self.strToSym(x, pTree.syntax), pTree.syntax.envs)
judge.args = map(lambda x: self.strToSym(x, pTree.syntax), pTree.syntax.children)
freshGen = Env()
judge.envLabels = map(lambda x: freshGen.freshOld(x), judge.envs)
judge.argLabels = map(lambda x: freshGen.freshOld(x), judge.args)
self.world.judges[pTree.val] = judge
for i in range(len(pTree.children)):
self.checkJCase(pTree.children[i], judge, i)
curIndex = len(pTree.children)
#add any other asts which hold parts of the judgement
for oTree in self.world.judgeTrees[name][1:]:
#check the shapes match (ignore any latex or label)
envs = map(lambda x: self.strToSym(x, oTree.syntax), oTree.syntax.envs)
args = map(lambda x: self.strToSym(x, oTree.syntax), oTree.syntax.children)
check = reduce(lambda x,y: x and y, map(lambda (x,y): x == y, zip(args, judge.args)), True)
check = check and reduce(lambda x,y: x and y, map(lambda (x,y): x == y, zip(envs, judge.envs)), True)
if not check:
expectStr = "; ".join(map(lambda x: x.name, judge.envs)) + " |- " + "; ".join(map(lambda x: x.name, judge.args))
foundStr = "; ".join(map(lambda x: x.name, envs)) + " |- " + "; ".join(map(lambda x: x.name, args))
self.addErr("Shape of repeated judgment does not match original judgement: found: " + foundStr + ", expected: " + expectStr, oTree)
#add any cases
for i in range(len(oTree.children)):
self.checkJCase(oTree.children[i], judge, curIndex + i)
curIndex += len(oTree.children)