本文整理汇总了Python中memory.Memory.positive_zero方法的典型用法代码示例。如果您正苦于以下问题:Python Memory.positive_zero方法的具体用法?Python Memory.positive_zero怎么用?Python Memory.positive_zero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memory.Memory
的用法示例。
在下文中一共展示了Memory.positive_zero方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: try_w_exp
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import positive_zero [as 别名]
def try_w_exp(self):
"""This function DO SELF.NEXT()"""
word = Memory.positive_zero()
value = self.try_exp()
if value is None:
return None
if self.look() == "(":
self.next()
field = self.try_f_part()
else:
# it's property of w-exp that empty f-part means not default value
# but 0:5
field = 5
self.next()
if Memory.apply_to_word(value, word, field) is None:
raise InvalidFieldSpecError(field)
while True:
if self.get() != ",":
break
self.next()
value = self.try_exp()
if value is None:
raise ExpectedExpError(self.get_all_before_this())
if self.look() == "(":
self.next()
field = self.try_f_part()
else:
field = get_codes(self.line.operation)[1]
self.next()
if Memory.apply_to_word(value, word, field) is None:
raise InvalidFieldSpecError(field)
return Memory.mix2dec(word)
示例2: try_alf_word
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import positive_zero [as 别名]
def try_alf_word(self):
if self.get() == '"':
# exactly five mix-chars in inverted or
self.next()
if self.get() == '"':
s = ""
else:
s = self.get()
if self.look() != '"':
raise UnquotedStringError(self.line.argument)
self.next()
else:
# less than six mix-chars not in inverted
s = self.line.argument.rstrip('\n\r')
self.ct = len(self.tokens) - 1
if s is None:
s = ""
s = s[:5]
while len(s) < 5:
s += " "
# now s - string with len = 5
word = Memory.positive_zero()
for i in xrange(1, 6):
word[i] = charset.ord(s[i - 1])
if word[i] is None:
raise InvalidCharError(s[i - 1])
return Memory.mix2dec(word)
示例3: write_memory
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import positive_zero [as 别名]
def write_memory(file, memory):
for i in xrange(len(memory)):
if memory[i] != Memory.positive_zero():
file.write("%04i %+2i %02i %02i %02i %02i %02i\n" \
% tuple([i] + memory[i]))